Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-Native - KeyboardAvoidingView - Error

I use the keyboardAvoidingView, to display inputs and used next focus. But, when i click in first input ( print label 1623 - Acidez ), this is hidden. How make show this?

enter image description here enter image description here

<ReactNative.View key={this.state.selectedTabIndex}>
                <ReactNative.ScrollView style={{ height: this.props.styles.height - 40 }}>

                    <ReactNative.KeyboardAvoidingView
                        keyboardVerticalOffset={0}

                        behavior="position"
                        contentContainerStyle={{ paddingTop: this.state.size }}
                    >
                        {this.tabs[this.state.selectedTabIndex].render()}
                    </ReactNative.KeyboardAvoidingView>

                </ReactNative.ScrollView>
            </ReactNative.View>
like image 695
Débora Gonçalves Avatar asked Jan 21 '26 11:01

Débora Gonçalves


1 Answers

keyboardVerticalOffset should be the distance between the top of the screen and the top of the KeyboardAvoidingView. If you're using flex, that number is going to be different depending on the size of the device you're viewing the app on.

The simplest approach I have found is to simply wrap the whole page with KeyboardAvoidingView. By making it your top-level wrapper, you will never have to worry about the keyboardVerticalOffset.

Experiment with the three behavior options from there until you get something that works.

like image 91
T. Dayya Avatar answered Jan 24 '26 00:01

T. Dayya