react-navigation

Add custom icon to drawer navigation

三世轮回 提交于 2020-02-22 07:41:46
问题 I am trying to add custom icon to my CustomDrawerComponent, but nothing happen... App.js : const navigationOptions = { headerTintColor: colors.white, }; const drawerNavigationOption = ({ navigation }) => ({ ...navigationOptions, headerLeft: ( <TouchableOpacity onPress={() => navigation.toggleDrawer()}> <View> <Icon name="menu" size={24} color={colors.white} /> </View> </TouchableOpacity> ), }); const MapsStackNavigator = createStackNavigator({ MapsNavigator: { screen: MapsScreen,

How to add extra item at the bottom of the drawer navigation manually (like logout button)?

杀马特。学长 韩版系。学妹 提交于 2020-02-20 07:48:27
问题 I want to add logout button to the bottom of the drawer navigation in my RN app. I am trying to use contentComponent the following way: const DrawerWithLogoutButton = (props) => ( <ScrollView> <SafeAreaView style={styles.container} forceInset={{ top: 'always', horizontal: 'never' }}> <DrawerItems {...props} /> </SafeAreaView> <Button style={styles.logoutButton} title="Logout" onPress={() => props.navigation.navigate('Login') }/> </ScrollView> ); export default Home = createDrawerNavigator({ /

react-navigation, how to close the drawer menu when clicking on the overlay?

允我心安 提交于 2020-02-05 04:22:40
问题 I am running the react-native-paper example app on the web. For this, I have replaced in the render: <PaperProvider theme={theme}> <SafeAreaProvider> <PreferencesContext.Provider value={preferences}> <React.Fragment> <NavigationNativeContainer initialState={initialState} onStateChange={state => AsyncStorage.setItem(PERSISTENCE_KEY, JSON.stringify(state)) } > - {Platform.OS === 'web' ? ( - <App /> - ) : ( <Drawer.Navigator drawerContent={() => <DrawerContent />}> <Drawer.Screen name="Home"

React Navigation params doesn't reset

让人想犯罪 __ 提交于 2020-02-04 08:46:35
问题 I'm having trouble with resetting the navigation params to null in React Native. MainTab -- Home (stack) -- Misc (stack) -- Tips (stack) On the Home tab, I have a button to go to Misc, but I want to route to the Tips tab on route to Misc. Routing should look like - (Home -> Tips -> Misc) That button returns the following with params - this.props.navigation.navigate('Tips', {backRoute: 'Home', routeImGoingNext: 'Misc'}); When these params are passed, I render a back button and a skip button on

React Navigation params doesn't reset

生来就可爱ヽ(ⅴ<●) 提交于 2020-02-04 08:46:29
问题 I'm having trouble with resetting the navigation params to null in React Native. MainTab -- Home (stack) -- Misc (stack) -- Tips (stack) On the Home tab, I have a button to go to Misc, but I want to route to the Tips tab on route to Misc. Routing should look like - (Home -> Tips -> Misc) That button returns the following with params - this.props.navigation.navigate('Tips', {backRoute: 'Home', routeImGoingNext: 'Misc'}); When these params are passed, I render a back button and a skip button on

difference between html tag “/href” and navlink or Link

回眸只為那壹抹淺笑 提交于 2020-02-04 05:08:34
问题 what is the difference between html tag "/href" and navlink provided by react-router to navigate the page? I can use both in order to navigate page to the different URL, so why there was need of introducing Navlink or Link? 回答1: The href attribute would trigger a page refresh which would reset the application states. However the link and navlink of react-router doesn't trigger a page refresh. Since React is used to create single page applications most of the time make sure you choose Link or

React Navigation - How to pass data across different screens in TabNavigator?

*爱你&永不变心* 提交于 2020-01-30 06:19:27
问题 I have a TabNavigator, and in each tab is a StackNavigator. Inside the StackNavigator, I have screens. The screens in each Tab do not call each other directly; the TabNavigator handles the screen changes when a tab is pressed. In the first tab, if the user clicks a button, some data is created. If the user then navigates to the second Tab, I would like to pass this data to the screen in the second Tab. Here is a demo of the code: import React from 'react'; import { Button, Text, View } from

React Native Navigation from Child Components

核能气质少年 提交于 2020-01-25 07:04:45
问题 I'm trying to implement a simple navigation between screens, but getting this error: Undefined is not an object 'this.props.navigate' AppNavigator.js let AppNavigator = createStackNavigator({ Signup: { screen: SignupScreen, navigationOptions: { header: null } }, Login: { screen: LoginScreen, navigationOptions: { header: null } }, },{ initialRouteName: "Signup" }); SignupScreen.js <View> <SignupForm/> </View> SignupForm.js const { navigate } = this.props.navigation; <Text onPress={() =>

Issue with Navigation in React Native - Organizing properly

天涯浪子 提交于 2020-01-24 21:05:39
问题 Am trying to start playing with React Native now. And I come from web development field. Since start, am trying to organize my folder structure so that it would be easy for me to understand and make modifications later. Right now the folder structure is as follows: /screens HomeScreen.js ProfileScreen.js /navigation MainNavigation.js App.js ... etc Am using Expo CLI as this is my first time working on React Native. /navigation/MainNavigation.js import React from 'react'; import {

Issue with Navigation in React Native - Organizing properly

左心房为你撑大大i 提交于 2020-01-24 21:04:23
问题 Am trying to start playing with React Native now. And I come from web development field. Since start, am trying to organize my folder structure so that it would be easy for me to understand and make modifications later. Right now the folder structure is as follows: /screens HomeScreen.js ProfileScreen.js /navigation MainNavigation.js App.js ... etc Am using Expo CLI as this is my first time working on React Native. /navigation/MainNavigation.js import React from 'react'; import {