react-navigation

how to display headers in react navigation with TabNavigation

心不动则不痛 提交于 2019-12-05 09:14:15
问题 I noticed that views in StackNavigation show the header title but if I set those same screens in a TabNavigation it doesn't show a header. It only shows a header if I wrap a StackNavigation either around each tab, or wrap the TabNavigation nested inside a StackNavigation. Why don't screens in TabNavigation show a header - is that expected behavior? If so, is it better to have a StackNavigation in each tab, or one big StackNavigation around the TabNavigation? // tabs navigation doesn't show a

The best way to create a scrollable tab in the middle of the screen?

落花浮王杯 提交于 2019-12-05 09:13:59
The mobile app of Twitter has a scrollable tab in the middle of the screen when you are on your profile. The top half of the screen displaying your profile info etc doesn't change when you click on the scrollable tabs mid screen : "Tweets & replies", "Media" etc. I am wondering how one would create this? Having half the screen stay the same and then having tabs which change mid screen... At the moment I have react navigation tabs as my main navigation - so on one of these tabs (the profile tab) I want to create the same concept as the picture.. Late answer but (for anyone else and future

React navigation tabBarVisible: false not working for StackNavigator inside TabNavigator

本秂侑毒 提交于 2019-12-05 09:11:43
I am totally confused to achieve something like below, this is working fine but can't hide tab bar for EditPage and PageTwo Login SignUp TabNavigator(TabNavigator) FirstTab SecondTab(StackNavigator) ListPage EditPage ThirdTab(StackNavigator) PageOne PageTwo Settings Below is my configuration for it. import { createStackNavigator, createSwitchNavigator, createBottomTabNavigator } from 'react-navigation'; //Other required imports here const SignedOut = createStackNavigator({ Signup: { screen : Signup}, Login: { screen : Login} }); const SignedIn = createBottomTabNavigator({ Dashboard: { screen:

Add an overlay to a react-navigation navigator

谁都会走 提交于 2019-12-05 08:15:10
I'm trying to add an overlay (e.g. to display error popups/toasters/debug buttons etc) to a react-navigation navigator. However I have a problem: When I put the react navigator in a view , with the overlay on top, the react navigator either doesn't appear or is distorted in some way. import React, { Component } from 'react'; import { Text, View } from 'react-native'; import { StackNavigator } from 'react-navigation'; class HomeScreen extends React.Component { static navigationOptions = { title: 'Welcome', }; render() { return <Text>Hello, Navigation!</Text>; } } const SimpleApp =

React Native - Identify the active screen. Drawer navigator

試著忘記壹切 提交于 2019-12-05 04:58:38
问题 I am using stack navigator inside the drawer navigator. What I want to do is, I need to know the activeItem (the active screen), so as to display it as active. StackNavigator const stackNav = StackNavigator({ homeComponent: { screen: HomeScreen }, serviceScreen: { screen: ServiceScreen }, serviceDetailScreen: { screen: ServiceDetailScreen }, selectVehicleScreen: { screen: SelectVehileScreen }, addEditVehicle: { screen: AddVehicle }, dateTimeScreen: { screen: DateTimeScreen }, reviewScreen: {

React navigation didfocus event listener works differently between class component and functional component

余生颓废 提交于 2019-12-05 04:27:46
When I transition to this screen, it will do some API calls to fetch the latest data. But it seems not trigger the didFocus event to fire the api calls when I transition from another navigation stack with hooks version while it works well with class version. How do I make hooks version have the same behavior as class version? What's the difference between this two version? class component version class someScreen extends Component { componentDidMount() { const { navigation, } = this.props; this.navFocusListener = navigation.addListener('didFocus', () => { // do some API calls here console.log(

React native router flux: TypeError: undefined is not a function (evaluating 'addListener')

情到浓时终转凉″ 提交于 2019-12-05 03:04:06
问题 Im working on a react native app using this principal dependencies: react native react native router flux react thunk expo I was working using this package.json: "dependencies": { "expo": "23.0.4", "humps": "^2.0.0", "install": "^0.10.1", "lodash": "^4.17.4", "native-base": "^2.3.5", "react": "16.0.0", "react-native": "0.50.4", "react-native-extend-indicator": "^0.1.2", "react-native-keyboard-aware-scroll-view": "^0.4.2", "react-native-maps": "^0.19.0", "react-native-maps-directions": "^1.3.0

In react-navigation, how do I get the dimensions of the visible area between the header and TabBar?

人盡茶涼 提交于 2019-12-04 21:35:07
问题 const viewableWindowHeight = Dimensions.get('window').height - Header.HEIGHT - ??? How do I get the TabBar height? What if the iPhone is X? How can I take that into account? 回答1: Solution 1 If you want to calculate viewable window height directly, then you can use the onLayout callback, for eg, on tab navigation each page, render() { return ( <View style={{ flex: 1}} onLayout={(event) => { var {x, y, width, height} = event.nativeEvent.layout; this.viewableWindowHeight=height; // use height as

React native push notification data showing undefined

与世无争的帅哥 提交于 2019-12-04 21:23:45
I am using push notification in my react native project and from the push notification i am getting id but first 2 times it's showing me "undefined" so my another navigator call and condition failed. I created new stacknavigator for my push notification but with booking id my condition every time failed. componentWillUnmount() { this.createNotificationListeners(); } This is my push notification function: async createNotificationListeners() { const channel = new firebase.notifications.Android.Channel( 'appname', 'appname', firebase.notifications.Android.Importance.Max ).setDescription('my

React Navigation: Scroll to top if tab is the same as active tab

最后都变了- 提交于 2019-12-04 17:03:21
I have a tab-based app. If I'm currently on the first tab, scrolled all the way down, and I click the tab again, I want it to scroll to the top. Is this possible? I know I should have a scroll view with a reference and then use this._scrollView.scrollTo(0) , but how can I detect when the user taps the tabbar and decide whether it is the same tab? You can create your tab navigator as follow: const TabNav = TabNavigator({ // config }, { navigationOptions: ({ navigation }) => ({ tabBarOnPress: (scene, jumpToIndex) => { // Called when tab is press }, }), }); In order to scroll to top, you can