react-navigation

React navigation 5 hide tab bar from stack navigator

风流意气都作罢 提交于 2020-05-30 07:26:06
问题 I wanted to know how to hide the bottom tab bar from a specific screen inside my stack navigator that is nested on a material bottom tab bar This is my code for my stack navigator import React from 'react'; import { createStackNavigator } from '@react-navigation/stack'; import PondScreen from '../screens/PondScreen/PondScreen'; import PondDetailScreen from '../screens/PondScreen/PondDetailScreen'; const Stack = createStackNavigator(); export function PondStack() { return ( <Stack.Navigator

Passing props from a root component through a BottomTabNavigator

孤人 提交于 2020-05-30 06:24:22
问题 My app root component looks like this: export default class App extends React.Component { render() { <RootTabs doThings={this.doThings} /> } } The RootTabs component is created by createBottomTabNavigator from react-navigation: const RootTabs = createBottomTabNavigator({ Movies: { screen: Movies }, Actors: ... // etc }) My problem is, I would like to transmit data (as a prop if possible) from the root component ( App ) to the Movies component, but Movies do not receive the doThings prop. How

Deep Linking with react-navigation does not work

六眼飞鱼酱① 提交于 2020-05-29 08:38:52
问题 Actually, I'm developing an app on react-native 0.58 with react-navigation 3.1.5, and I can't make my app run properly. This is my code: app-navigation.js const MainStack = createBottomTabNavigator({ Home: { screen: Home }, Pets: { screen: Pets, path: 'spidersecurity://terque/pets' }, Notifications: { screen: UserNotifications }, UpdateUser: { screen: UpdateUser }, }); const AppStack = createStackNavigator({ MainStack: { screen: MainStack, path: '' }, PetStack: { screen: PetStack } }); const

React Native two drawers on one screen

耗尽温柔 提交于 2020-05-28 05:31:46
问题 I have an app that needs to be able to use two drawer navigators, one on the left and on on the right side of the header. I am at the point where I can get both drawers to open with the slide gesture, however I need to be able to open it programmatically. I have found the navigation.openDrawer() function only works with one of the drawers and not the other because it is only able to use one of the navigation props (whichever comes first) from my drawer navigators. Below are my rendering

Hide TabBar item in TabNavigator

生来就可爱ヽ(ⅴ<●) 提交于 2020-05-28 04:15:05
问题 How is it possible to hide certain TabBar item from TabNavigator. Is there a certain TabBarOptions option, which has visible key(true/false) like this? const Tabs = TabNavigator({ Home: { screen: Home }, Profile: { screen: Thanks, tabBarOptions: { visible: false }, }, More: { screen: More }, }) 回答1: There is not 'visible' option for hide specific item from TabNavigator. You need to create a Stacknavigator and a Tabnavigator. In the Stacknavigator you will add yours 'invisible' tabbar items

Pass Props StackNavigator

心不动则不痛 提交于 2020-05-26 10:51:06
问题 i try to pass props on stacknavigator, here my code const MainCart = StackNavigator({ Cart: { screen: CartScreen }, Checkout: { screen: COScreen } /* how to pass 'myprops' in this area? */ }); export default class ReactNative_RefreshControl extends Component { constructor(props) { super(props) } render() { console.log('ReactNative_RefreshControl this.props.myparam : ' + this.props.myparam); return <MainCart myprops = { this.props.myparam } />; //https://reactnavigation.org/docs/navigators

how to get current routeName in react-navigation-drawer Drawer compoenent?

a 夏天 提交于 2020-05-21 07:35:47
问题 I have created my App Navigator component with these libraries react-navigation react-navigation-stack react-navigation-drawer and drawer is nested inside main stack. Drawer stack const DrawerMenu = createDrawerNavigator( { Home: { screen: Home }, MyAccount: { screen: MyAccount } }, { overlayColor: "rgba(0, 0, 0, 0.7)", gestureEnabled: false, initialRouteName: "Home", contentComponent: Drawer, drawerWidth: styles.drawerWidth } ); const DrawerAppContainer = createAppContainer(DrawerMenu); Main

React-navigation v5 : Pass function as parameter to be used in headerRight button

依然范特西╮ 提交于 2020-05-20 10:52:06
问题 I ham trying to call function on headerRight button click on screen. I am passing func as param in useEffect as shown below. useEffect(() => { navigation.setParams({ _confirmClick: confirmNotification }) }, [navigation]) useLayoutEffect(() => { navigation.setOptions({ headerRight: () => ( <TouchableOpacity onPress={() => params._confirmClick('New') } style={[theme.marginRight15]}> <View style={[styles.sendNotificationButton, { backgroundColor: notification ? theme.colors

React-navigation v5 : Pass function as parameter to be used in headerRight button

╄→尐↘猪︶ㄣ 提交于 2020-05-20 10:51:09
问题 I ham trying to call function on headerRight button click on screen. I am passing func as param in useEffect as shown below. useEffect(() => { navigation.setParams({ _confirmClick: confirmNotification }) }, [navigation]) useLayoutEffect(() => { navigation.setOptions({ headerRight: () => ( <TouchableOpacity onPress={() => params._confirmClick('New') } style={[theme.marginRight15]}> <View style={[styles.sendNotificationButton, { backgroundColor: notification ? theme.colors

How to pass current state of App to Tab Navigation Screen

冷暖自知 提交于 2020-05-17 07:49:13
问题 If I'm using React Navigation v5, what is the best way to pass the current state of a parent component (in my case, the main App) down through a Tab and Stack navigator to a screen that I'd like to use the current state in? Following the documentation, I have created a stack navigator for each tab that holds the respective screens. App.js contains a state that needs to be used for a few things. Most importantly, it will provide badge count on the Tab navigator, as well as be a source of