import React, { Component } from 'react'; import { StyleSheet, View, Text, TextInput, Button, TouchableOpacity, Dimensions, Image } from 'react-native'; import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'; import Picker from 'react-native-picker'; import styles from './styles'; class Settings extends Component { static navigationOptions = ({ navigation }) => ({ headerLeft: ( { navigation.goBack(); }} > ), headerTitle: navigation.state.params && navigation.state.params.getHeaderTitle && navigation.state.params.getHeaderTitle(navigation), headerRight: navigation.state.params && navigation.state.params.getHeaderRight && navigation.state.params.getHeaderRight(navigation) }); componentDidMount() { const { navigation } = this.props; const headerRight = ( 儲存 ); const headerTitle = ( 指標設定 ); navigation.setParams({ getHeaderRight: () => headerRight }); navigation.setParams({ getHeaderTitle: () => headerTitle }); } constructor(props) { super(props); this.state = { textValue: '163' }; this.onChange = this.onChange.bind(this); } onChange(a) { const { textValue } = this.state; const { navigation } = this.props; this.setState({textValue: a}); if (a != '163') { const headerTitle = 指標設定 ; const headerRight = ( this.saveData()}> 儲存 ); navigation.setParams({ getHeaderTitle: () => headerTitle }); navigation.setParams({ getHeaderRight: () => headerRight }); } } render() { const { textValue } = this.state; return ( { this.scroll = scroll; }} scrollEnabled> 身體測量 身高 this.onChange(a)} underlineColorAndroid="transparent" autoCapitalize="none" autoCorrect={false} blurOnSubmit clearButtonMode="while-editing" returnKeyType="done" value={textValue} keyboardType="numeric" /> 公分 體重 公斤 標準值 舒張壓 - mmHg 收縮壓 - mmHg 心率 - bpm 目標 每日步數 上床時間 23:00 ) } }; export default Settings; //