在發送提取請求並保存狀態數據並顯示保存在inputText中的值後,我無法再編輯它。否則,它在我的輸入清晰時起作用。設置狀態[react-native]後無法編輯inputText
下面是代碼:
第一步我取submiting爲textInput後所需的數據上input.js
<TextInput
style={[ style.itemInfoMajor, global.alignRight ]}
onFocus={ onFocus }
onChangeText={ this._onChange }
onSubmitEditing={() => this._onSubmit(network) }
value={ value }
returnKeyType="done"
enablesReturnKeyAutomatically={ true }
clearButtonMode="always"
placeholder={ network }
placeholderTextColor="rgba(255, 255, 255, 0.25)"
autoCorrect={ false }
autoCapitalize="none"
clearTextOnFocus={ true }
/>
在list.js
我找回後加載的應用程序數據。
它那裏有我設置的狀態誰得到了inputText
componentWillMount() {
this._loadInitialState().done();
},
async _loadInitialState() {
try {
const value = await Storage.get('userData');
if (value !== null) {
this.setState({
data: value,
});
}
}
}
的價值和它的下面,我通過了國家的輸入組件
<Input
onFocus={ this._handleFocus.bind(this, item) }
value={ value }
ref={ item }
key={ i }
network={ item }
/>
我加入少許視頻現場觀看問題:https://vid.me/8L9k 源代碼在這裏:https://github.com/statiks/statiks-react-native/blob/master/sources/input/index.js
如何編輯此輸入值?在getInitialState
是的。你是對的。還有一些問題,然後我看到了。 –
完整的代碼在這裏:https://github.com/statiks/statiks-react-native/blob/master/sources/input/index.js你也可以構建projet。無論如何,我無法訪問'input.js'組件的'getInitialState'上的'this.props.value'。 – jbr
是的,您可能需要在父項的狀態中將'value'的值設置爲空字符串,直到數據準備就緒 –