react-navigation

How can we center title of react-navigation header?

a 夏天 提交于 2019-12-03 15:46:54
问题 React-navigation docs are still young, and reading through the issues is not working quite much for me (changes on each version) does anyone have a working method to center title in Android using react-navigation in React Native? 回答1: Use headerTitleStyle: static navigationOptions = { headerTitleStyle: { alignSelf: 'center' }, title: 'Center Title', } Modified 2019/03/12: In year of 2018, after react-navigation v2 release (7 Apr 2018), for some reason alignSelf was not working anymore. Here

undefined is not an object (evaluating route.routeName)

感情迁移 提交于 2019-12-03 14:04:48
问题 when update the expo from (16.0.0) to (24.0.0) and react navigation from (git+https://github.com/react-community/react-navigation.git) to (^1.0.0-beta.21) version, this error occured 回答1: Finally found out how to solve this, its an undocumented DrawerNavigatorConfig: drawerOpenRoute: 'DrawerOpen', drawerCloseRoute: 'DrawerClose', drawerToggleRoute: 'DrawerToggle' Look here: https://github.com/react-community/react-navigation/issues/3148#issuecomment-352778884 回答2: remove ^ from package json

TabsNavigator inside StackNavigator

旧巷老猫 提交于 2019-12-03 14:02:16
I'm using React-Navigation and I have a StackNavigator, this is the app.js with the Stack + Tabs Navigator: import React from 'react'; import { AppRegistry } from 'react-native'; import { StackNavigator, TabNavigator } from 'react-navigation'; import LoginScreen from './app/screens/LoginScreen'; import RegisterScreen from './app/screens/RegisterScreen'; import HomeScreen from './app/screens/HomeScreen'; import FriendsScreen from './app/screens/FriendsScreen'; const Stylelist = StackNavigator({ Login:{ screen: LoginScreen, navigationOptions: ({navigation}) =>({ header: null, }), }, Register:{

React Navigation on tab change

泪湿孤枕 提交于 2019-12-03 13:09:20
Without using Redux, how do I detect a tab change with a react navigation tab navigator? I know I need to somehow use onNavigationStateChange but I can't figure out how to update the current view. export default () => <MyTabNav ref={(ref) => { this.nav = ref; }} onNavigationStateChange={(prevState, currentState) => { //call function on current view }} />; bumbur export default () => <MyTabNav ref={(ref) => { this.nav = ref; }} onNavigationStateChange={(prevState, currentState) => { const getCurrentRouteName = (navigationState) => { if (!navigationState) return null; const route =

React Native - Creating Navigator dynamically with React Navigation

余生颓废 提交于 2019-12-03 13:03:57
问题 I am building a mobile application with React Native and I am using React Navigation to build a navigator inside my application. React navigation provided me a good way to handle nested Tab bars inside a drawer which is also inside a Stack Navigator. The problem is that I need to specify components so that I can provide these into the Tab Bar. Lets say we have to fetch some categories from an API and we do not know how many categories are inside the data. Besides, I could not figure out that

How can we center title of react-navigation header?

被刻印的时光 ゝ 提交于 2019-12-03 11:27:40
React-navigation docs are still young, and reading through the issues is not working quite much for me (changes on each version) does anyone have a working method to center title in Android using react-navigation in React Native? Val Use headerTitleStyle : static navigationOptions = { headerTitleStyle: { alignSelf: 'center' }, title: 'Center Title', } Modified 2019/03/12: In year of 2018, after react-navigation v2 release (7 Apr 2018), for some reason alignSelf was not working anymore. Here it is the new working way, using headerLayoutPreset . from @HasanSH: const HomeActivity_StackNavigator =

how to use react-native-web and react-navigation together and access from web url

若如初见. 提交于 2019-12-03 09:59:47
UPDATE : react-navigation web support is done. follow this: https://reactnavigation.org/docs/en/web-support.html ORIGIN : I try to share my code between react-native and web. when I try react-native-web, it works well. but there is only one question, how to access the specific screen from URL? I read the react-navigation docs, there nothing about that. and react-router-native can catch the web URL, but it has navigator likes StackNavigator/DrawerNavigator. and idea about that? 来源: https://stackoverflow.com/questions/49186634/how-to-use-react-native-web-and-react-navigation-together-and-access

React Navigation: How to update navigation title for parent, when value comes from redux and gets updated in child?

别等时光非礼了梦想. 提交于 2019-12-03 06:47:37
I'm using react-navigation and have a StackNavigator with a ParentScreen and a ChildScreen . Both screens have the same navigation bar with a dynamic value from redux. Implemented like described in Issue #313 This works as expected. When I'm in DetailScreen and I update the value for the count variable, it also updates the value in the navigation bar. Problem is, if I go back to the parent scene, there is still the old value in the navigation bar. It doesn't update to the current value in redux store. Child Parent (when I go back) ChildScreen class ChildScreen extends Component { static

Show splash screen before show main screen in react native without using 3rd party library

ⅰ亾dé卋堺 提交于 2019-12-03 04:30:55
问题 I am beginner in react native so may be my question seems silly to all experts. but I am struggling with a basic feature that i want to implement that i want to start my app with splash screen and after few seconds i want to show login screen or main screen. I checked some example but did not found any example with full code so don't know how to use those code snippets in my app. I've tried to apply some code as per documentation but my code is giving error, please have a look and help me.

How should the new context api work with React Native navigator?

陌路散爱 提交于 2019-12-03 04:27:19
问题 I created a multiscreen app using React Navigator following this example: import { createStackNavigator, } from 'react-navigation'; const App = createStackNavigator({ Home: { screen: HomeScreen }, Profile: { screen: ProfileScreen }, }); export default App; Now I'd like to add a global configuration state using the new builtin context api, so I can have some common data which can be manipulated and displayed from multiple screens. The problem is context apparently requires components having a