简体   繁体   中英

ReactNative TextInput in Android is not editable

Below is the simple code I have.

 change(text) { this.setState({text}); } render() { return ( <View style={styles.container}> <Text style={styles.welcome}> Welcome, what is your name? </Text> <TextInput style={{height: 40, width: 200}} onChangeText={this.change.bind(this)} value={this.state.text} /> </View> ); } 

It works as expected in iOS. In Android, it shows the Text and TextInput field. However anything I type in TextInput does not show up.

I have two questions basically.

First one is, what might be going wrong here?

Second and more important question is, how do I debug a problem like this? I used ReactNative debugger and put a breakpoint in change function, it doesn't get called.

I also checked the generated native code in anticipation to debug using Android Studio. Didn't see anything in the code there where I can possibly put a breakpoint.

If in case it helps someone - here is what I found.

I was running Android emulator with API level 25 (Nougat). When I switched to API level 23 (Marshmallow) it started working.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM