Skip to content

Commit 6fbf6dd

Browse files
Add note how to use KeyboardAvoidingView with tab and stack navigator
Details are described here: react-navigation/react-navigation#11244
1 parent b8090e3 commit 6fbf6dd

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

versioned_docs/version-6.x/tab-based-navigation.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,25 @@ For example, React Navigation's tab navigator takes care of handling the Android
237237
## A tab navigator contains a stack and you want to hide the tab bar on specific screens
238238

239239
[See the documentation here](hiding-tabbar-in-screens.md)
240+
241+
## A tab navigator contains a stack and you want to use KeyboardAvoidingView to prevent hidden TextInput
242+
243+
Make sure you to wrap KeyboardAvoidingView around the main tab navigator
244+
245+
```js
246+
function TabNavigator() {
247+
return (
248+
<KeyboardAvoidingView
249+
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
250+
style={{ flex: 1 }}>
251+
<Tab.Navigator
252+
screenOptions={{
253+
tabBarHideOnKeyboard: true,
254+
headerShown: false,
255+
}}>
256+
<Tab.Screen name="Tab" component={StackContainer} />
257+
</Tab.Navigator>
258+
</KeyboardAvoidingView>
259+
);
260+
}
261+
```

0 commit comments

Comments
 (0)