react-navigation

How to make “Go back to initial Screen when a BottomTabNavigator's is pressed”

时间秒杀一切 提交于 2019-12-11 17:26:37
问题 when i click an a bottom navigation tab i want the screen to go Back to the initial screen of that bottom tab for exemple when i navigate to RouteToProfile then i press search(BottomTabNavigator) and goes back to home i still find the screen of the RouteToprofile ps : i'm using react navigation 3.0.0 -Home | mainScreen Subrouts RouteToProfile .... -Search | mainScreen another page .... import React from "react"; import Ionicons from "react-native-vector-icons/Ionicons"; import {

how to open drawer without navigating to the screen from one of the tabs of tabnavigator?

自作多情 提交于 2019-12-11 17:18:13
问题 I am trying to open up the drawer from one my tab called profile as shown in below. When I click on the profile tab it opens up the HomeScreen from ProfileNavigator. Which is right, but I wanna prevent that and only open the drawer with out a default navigation. How do I do it? Also ProfileNavigator is preventing to open my next tab which is Home, any idea why? But I am able to tab of Histroy screen then can come back to Home screen. const ProfileNavigator = createDrawerNavigator({ Home: {

React-Native DrawerNavigator Menu on both sides

谁都会走 提交于 2019-12-11 16:48:41
问题 I have a react native app with a DrawerNavigator. For the menu I have my own component. That works great. Now I want to add a second side menu on the right side. Is it possible to have two DrawerNavigator like in the Slack App? This solution is not working for me: https://snack.expo.io/ry7lYempe because I don't want to have a TabController as parent. Both Drawer should be accessible in all screens. My code looks like this: import React from 'react' import reducer from './src/reducers' import

React Navigation Make Component Keep Re-rendering When Navigate to Other Screen On the Same StackNavigator

半世苍凉 提交于 2019-12-11 16:38:31
问题 I am using react-native with react-navigation@1.5.11. Environment: OS: macOS High Sierra 10.13.1 Node: 8.9.2 Yarn: 1.5.1 npm: 5.8.0 Watchman: 4.9.0 Xcode: Xcode 9.1 Build version 9B55 Android Studio: 3.1 AI-173.4720617 Packages: (wanted => installed) react: 16.3.1 => 16.3.1 react-native: 0.55.2 => 0.55.2 I am using StackNavigator and TabNavigator and my router setup like below: const BillStack = StackNavigator({ Bill: { screen: Bill }, CompletedBill: { screen: CompletedBill } }, { headerMode:

instance member is not accessible

一笑奈何 提交于 2019-12-11 16:34:12
问题 How can I access class functions from inside stack navigator header? Is this possible? What I'm trying to achieve is to call a function when I press the stack navigator header title. class Dashboard extends React.Component { static navigationOptions = ({ navigation }) => { return { headerTitle: ( <View style={header.addressView}> <Text style={header.titleAddress} onPress={() => { this._show().bind(this); }}> /> </View> ), }; }; _show(){ this.setState({ visibleModal: 1 }) } constructor(props)

How to hide the header of `createBottomTabNavigator` who is not allowing the headers of all classes implemented using `navigationOptions`

╄→гoц情女王★ 提交于 2019-12-11 15:52:05
问题 All classes of my React Native code have their own header implemented using navigationOptions and I've created the bottomTabNavigator that has its own header overwriting the existing header and their functionality. How to hide the bottomTabNavigator header while own headers of classes work properly and accordingly? I've used header: null and navigationOptions: { header: null, } in the stack of bottomTabNavigator and also header: { visible: false, } but it didn't work, as header is still

componentDidMount is not working when redirect to a screen

若如初见. 提交于 2019-12-11 15:48:58
问题 I am having componentDidMount to list set of files(images) in a screen A, from this screen A I am having another screen B link where I can see detailed view of a file and there I have an option to delete a document. When screen A is called using <TouchableOpacity style={Styles.HomeButton} onPress={ () => this.props.navigation.navigate('Gallery')}> <Text style={Styles.HomeButtonText}>View Photos</Text> </TouchableOpacity> componentDidMount working fine, But when I delete a file (i am using

Undefined function onClick in contentComponent

喜欢而已 提交于 2019-12-11 15:38:48
问题 Im trying to access a function inside a button on contentComponent that is inside a createDrawerNavigator. The problem is that the 'props' passed to the contentComponent does not have the function that im trying to access and i keep getting 'undefined'. Here's the code: const MainDrawer = createDrawerNavigator( { Home: { screen: HomeScreen, }, }, { contentComponent: (props) => ( <View style={{ flex: 1 }}> <SafeAreaView forceInset={{ top: 'always', horizontal: 'never' }}> <DrawerItems {..

React Navigation: How to go back to a screen in another stack from a stack

☆樱花仙子☆ 提交于 2019-12-11 15:16:54
问题 I'm using react-navigation v2 in React Native and was stucked whenever I wanna go back to a route in the root navigator. I've the following route stack: const HomeStack = createStackNavigator( { Home: Home, CreateInvoice: CreateInvoiceScreen, InvoiceSummary: InvoiceSummaryScreen, PinEntry: PinEntryScreen }, { navigationOptions: { header: null } } ); const CustomersStack = createStackNavigator( { Customers: CustomersScreen, Details: CustomerDetailsScreen }, { navigationOptions: { header: null

How can I hide the bottom tab bar on a specific screen (react-navigation 3.x)

微笑、不失礼 提交于 2019-12-11 15:04:51
问题 I used the createBottomTabNavigator, but I can't hide the bottom app bar on a specific screen const StackHome = createStackNavigator( { Home: Home, Autor: Autor, Publicacion: Publicacion, Comentarios: { screen: Comentarios, navigationOptions:{ // this should do the work, but it doesn't tabBarVisible: false } } } ); 回答1: Finally I got a solution that works, the component would be like this import { createStackNavigator } from "react-navigation"; import Home from "./Home"; import Autor from ".