react-native-navigation

React Native Navigation Passing back parameters two screen pop

隐身守侯 提交于 2019-12-20 06:07:29
问题 I have a Screen for Main then it's push to Next for selection and passes parameters to next pushed screen and when you select something in that screen I need to pop(2) and send selected details to the main screen. But pop didn't accept parameters. How to accomplish this. I don't use Redux or MobX. 回答1: You need to do this Screen A: this.props.navigation.navigate('ScreenB', { onPressScreenAFun: (params) => { this.screenAFun(params) }, }) screenAFun = (params) => { console.log(params) } Screen

React Native Navigation Passing back parameters two screen pop

﹥>﹥吖頭↗ 提交于 2019-12-20 06:06:07
问题 I have a Screen for Main then it's push to Next for selection and passes parameters to next pushed screen and when you select something in that screen I need to pop(2) and send selected details to the main screen. But pop didn't accept parameters. How to accomplish this. I don't use Redux or MobX. 回答1: You need to do this Screen A: this.props.navigation.navigate('ScreenB', { onPressScreenAFun: (params) => { this.screenAFun(params) }, }) screenAFun = (params) => { console.log(params) } Screen

How to use two Const in createAppContainer in React native

[亡魂溺海] 提交于 2019-12-12 23:18:20
问题 I am trying to use two Const in createAppContainer but it dose not allow me to do so i have to use createBottomTabNavigator and createStackNavigator both in app.js . here is my code import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; import {createStackNavigator, createAppContainer , createBottomTabNavigator} from 'react-navigation'; import { DrawerNavigator } from 'react-navigation'; import Icon from 'react-native-vector-icons/MaterialIcons'; import AntIcon from

How to trigger an event when a component is shown when using react-native-navigation?

僤鯓⒐⒋嵵緔 提交于 2019-12-12 07:30:44
问题 I am using react-native with react-native-navigation. I would like to reload data when a component is shown. The component is shown when a user clicks on a tab navigation button. Should I use react life cycle events or is there something in react-native-navigation that can trigger a function when a user navigates back to a component? I am using redux, I am not sure if that could be used to help? This issue refers to onDisplay which seems like what I am looking for. However I can't find any

return from navigation in react native give me undefined in this.props.navigation.state.params.filePath

删除回忆录丶 提交于 2019-12-11 16:42:30
问题 i need help :). my project is 2 pages in react native, MainPage and SoundRecord. my init screen is MainPage and when i press the button 'take sound' i move to another component to record sound(i move with react native navigation). when i come back i want to return the filePath(where it save the file..). i want to insert it to the state. when i do this in MainPage: this.state{ filePath: this.props.navigation.state.params.filePath } it give error: undefined is not an object(evaluating 'this

React native: reset route, back to home page

纵然是瞬间 提交于 2019-12-11 15:55:05
问题 My idea is to have 2 navigators: StackNavigator - Home page, login page, sign up page DrawerNavigator - pages for logged in users Now, here's my code: // App.js import React, { Component } from 'react' import { MainNavigator } from './src/components/main/MainNavigator' import { UserNavigator } from './src/components/user/UserNavigator' import { createSwitchNavigator, createAppContainer } from 'react-navigation' export default class App extends Component { constructor(props) { super(props) }

Is there a backToTop in react-native-navigation?

时间秒杀一切 提交于 2019-12-11 08:51:04
问题 When the user hits a tab on a bottom nav bar while already on the screen I'd want to bring the user back to the top of the screen. Anyone know how I can do that using react-native-navigation? 回答1: Figured it out. Add this to the page you want to be scrolled up. constructor(props) { super(props); this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this)); } If you want more info on setting navigator events then you can check out: https://wix.github.io/react-native-navigation/#

npm run android does not launch the Android app

血红的双手。 提交于 2019-12-11 04:15:41
问题 Issue I was able to clear my last issue after ignoring the errors and following the rest of the steps in the React Native Navigation installation. Those warnings went away. However, when I run npm run android , it builds successfully but does not launch the app Configure project :app ... Configure project :react-native-navigation ... Task :app:installDebug ... BUILD SUCCESSFUL in 6s The android emulator goes to its home screen and the app does not launch. What I've Tried I've tried running

Set initial state from navigation props

二次信任 提交于 2019-12-10 17:39:32
问题 I am using React Navigation to route between screen. I have an initial screen which contains a FlatList , onclick of an item I route to a new screen while passing params like this. props.navigation.navigate('Details', { id: props.id, title: props.title }); In the Details screen I can receive it using the following code but how do I set the state considering it's a static function and I do not have access to this.setState() . static navigationOptions = ({navigation}) => { const {params} =

Unable to resolve dependency for '…': Could not resolve project :react-native-navigation

久未见 提交于 2019-12-10 16:04:05
问题 Issue Description After carefully following the instructions in https://wix.github.io/react-native-navigation/#/docs/Installing, I am getting these errors after completing step 4 for Android: ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :react-native-navigation. Show Details Affected Modules: app ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve project :react-native-navigation. Show Details