react-navigation-v5

How to add a line at top of the bottom tab when the current tab is active in react navigation 5

≡放荡痞女 提交于 2021-01-29 10:02:30
问题 I want to add the line at the top of the bottom tabs, how to add this? like this issue https://github.com/react-navigation/react-navigation/issues/8957 React navigation versions: "@react-navigation/bottom-tabs": "^5.9.2", "@react-navigation/native": "^5.7.6", "@react-navigation/stack": "^5.9.3", "react": "16.13.1", "react-native": "0.63.3", 回答1: You can use a custom button like below const CustomTabButton = (props) => ( <TouchableOpacity {...props} style={ props.accessibilityState.selected ?

Initial route params in React Navigation v5?

笑着哭i 提交于 2021-01-27 06:38:29
问题 React Navigation v3 was featuring an initialRouteParams property to pass initial values to this.navigation.props . Is there a way to set initial route params to be accessed via route.params in the React Navigation v5? function MainScreen({route, navigation}) { return ( // how to pass default values to route in here? // route.params.userParam ? ... ); } 回答1: It could be accomplished by passing initialParams to the Stack.Screen : <Stack.Screen name="Main" component={MainScreen} initialParams={{

React Navigation 5 Hide Drawer Item

匆匆过客 提交于 2021-01-21 07:36:32
问题 I am trying to hide the ability to press one of my routes in the drawer navigator as it is another navigator and the default location in the app. I want the drawer to simply be used for navigating to extraneous routes that don't fit well into user flow elsewhere. Before React Navigation 5 I was able to achieve this by simply setting drawerLabel: () => null . However now with the changes I cannot figure out how to hide this in the same manner. Below is my current navigator code: const

React Navigation + TypeScript Error: Type 'EventStackParams' does not satisfy the constraint 'Record<string, object | undefined>'

倾然丶 夕夏残阳落幕 提交于 2021-01-05 08:53:19
问题 I'm adding TypeScript to my React Native/React Navigation 5 Navigator, but having an issue with Adding EventStackParams to the createStackNavigator() . I've looked through the React Native 5 Docs, StackOverflow, and GitHub, but no luck. What am I doing wrong? Below is my error and the code Error: Type 'EventStackParams' does not satisfy the constraint 'Record<string, object | undefined>'. Index signature is missing in type 'EventStackParams'.ts(2344) Navigation.tsx: // Imports: TypeScript

How to implement drawer navigator in each tab?

大城市里の小女人 提交于 2020-12-15 03:36:54
问题 I want to have drawer navigation in each tab and I followed this approach, but it doesn't work when I switch back to the previous tab (maybe some navigation tree issue). As you can see above, the drawer works fine for the first time in each tab, but when I go back to any already navigated tab and try to open the drawer, the drawer doesn't open for that tab but opens up for the just previous tab. I think there's some navigation issue. HomeBottomTab.js Here, I created a Bottom Tab Navigator and