I am developing a Facebook type application where i have a problem in my comments.js. In this file i have ScrollView and View wrape in a KeyboardAwareScrollView.When i click a button it's focus on TextInput correctly.The problem is only the keyboard is open and the child component inside the KeyboardAwareScrollView is not scrolled to the last TextInputs where they can focused.
What i do i can wrape the ScrollView and View into into one View but did't any help.Then i apply multiple way's i think there is issue in my code.
This question is ask multiple time i read these
1.React-Native button press after textInput in Keyboard aware scroll view
2.React Native KeyboardAwareScrollView doesn't work
3.Automatically scroll the view up when keyboard is shown in react-native
4.How to make your React Native app respond gracefully when the keyboard pops up
but didn't meet my condition.
Here is my code
<KeyboardAwareScrollView style={{flex:1}} resetScrollToCoords={{ x:0, y: 0 }}> <ScrollView contentContainerStyle={styles.scrollViewStyle} keyboardShouldPersistTaps='always'> <Image/> <List/> </ScrollView> <View style={{ flexDirection: 'row', height: 50 }} > <Image style={{ height: 40, width: 40, marginLeft: 20 }} source={require('../../assets/plus.png')} /> <View style={{ flex: 1, marginLeft: 20 }}> <TextInput autoGrow='true' ref='myInput' underlineColorAndroid='transparent' placeholder='Type here to translate!' onChangeText={text => this.setState({ text })} > {this.state.text} </TextInput> </View> <TouchableOpacity onPress={() => { this.CommentsApi() }}> <Image/> </TouchableOpacity> </View> </KeyboardAwareScrollView>