react-navigation

How to navigate screen on notification open in React Native with One Signal?

安稳与你 提交于 2019-11-27 16:28:53
问题 Here is my code, how can I navigate user to the desired screen when clicked on a notification or button in a notification. componentWillMount() { OneSignal.addEventListener('received', this.onReceived); OneSignal.addEventListener('opened', this.onOpened); OneSignal.addEventListener('registered', this.onRegistered); OneSignal.addEventListener('ids', this.onIds); OneSignal.inFocusDisplaying(2); OneSignal.requestPermissions({ alert: true, badge: true, sound: true }); } componentWillUnmount() {

React Navigation pass props in TabNavigator

*爱你&永不变心* 提交于 2019-11-27 14:48:23
问题 I have props what are loaded from the server on the initial screen. I want to pass them to the rest of the tab screens. However, I have not found any examples online. I know of the screenProps, but have no idea how to set it up. All methods I have tried, have resulted in errors. const EProj = TabNavigator({ Home: { screen: HomeScreen }, Map: { screen: MapG }, Login: { screen: Login }, Profile: { screen: Profile }, }, { tabBarPosition: 'bottom', animationEnabled: true, tabBarOptions: {

react-navigation: Detect when screen, tabbar is activated / appear / focus / blur

一曲冷凌霜 提交于 2019-11-27 14:24:30
问题 Perviously when I wanted to make some actions when screen is opened I put them inside componentDidMount. For example I can fetch some data. like this. componentDidMount() { this.updateData(); } But with react-navigation componentDidMount occurs only one time when user open screen first time, and if later user open this page again it will not trigger componentDidMount. What is proper way to detect when page(screen) is activated and do actions? 回答1: With react-navigation , you can do that.

React Navigation; use image in header?

孤街浪徒 提交于 2019-11-27 12:33:35
问题 I'm using react navigation in a react native project and I want to customize the header with an image. For a color I can use simple styling, but since react native doesn't support background images I need a different solution. 回答1: Update: Since v2 of the library there's an special option for setting the header background, namely headerBackground . This option accepts a React component, so when set to an Image component, it will use that. For example: export default createStackNavigator({

undefined is not an object (evaluating 'RNGestureHandlerModule.State'

做~自己de王妃 提交于 2019-11-27 11:54:11
I have installed react-navigation in my React Native project . Its a starter project doesn't have any codes. But while running project I am facing error like this. Here is my Navigation code import { createStackNavigator } from 'react-navigation'; import Home from './screens/Home'; import WeatherDetail from './screens/WeatherDetail'; const Navigation = createStackNavigator({ Home: { screen: Home }, WeatherDetail: { screen: WeatherDetail } }); export default Navigation; And here is the App.js codes import Navigator from './Router'; export default class App extends Component { render() { return

React Native - React Navigation transitions

混江龙づ霸主 提交于 2019-11-27 11:50:50
I'd like to use React Navigation in my new react native app but I can't find any example showing how to create custom view transitions in there. Default transitions are working fine but I'd like to be able to customize them in few places and the docs don't come very helpfull in this subject. Anyone tried that already? Anywhere I could see a working example? Thanks in advance. You can find detailed version of this post on this link I hope this is clear enough with step-by-step for how to create custom transition. Create a Scene or Two to navigate class SceneOne extends Component { render() {

How to get a height of a Keyboard in React-Native?

不羁的心 提交于 2019-11-27 11:33:40
问题 I am using React-Navigation in my app and the app consists of StackNavigator with multiple screens, some screens of which have TextInput with autoFocus={true} Problem: on these screens when the component renders, the height of the screen is being set in the constructor: constructor(props) { super(props); this.state = { height: Dimensions.get('window').height, }; } But, since the autoFocus of TextInput is true , the keyboard on this screen pops-up on the screen almost instantly after the

Disable back button in react navigation

╄→гoц情女王★ 提交于 2019-11-27 10:06:27
问题 I'm using react native navigation (react-navigation) StackNavigator. it starts from the Login page throughout the whole lifecycle of the app. I don't want to have a back option, returning to the Login screen. Does anyone know how it can be hidden on the screen after the login screen? BTW, I'm also hiding it in the login screen by using: const MainStack = StackNavigator({ Login: { screen: Login, navigationOptions: { title: "Login", header: { visible: false, }, }, }, // ... other screens here }

Resetting the navigation stack for the home screen (React Navigation and React Native)

二次信任 提交于 2019-11-27 04:18:33
问题 I've got a problem with the navigation of React Navigation and React Native. It is about resetting navigation and returning to the home screen. I've build a StackNavigator inside of a DrawerNavigator, and the navigation between home screen and other screens is working. But the problem is, that the navigation stack grows and grows. I'm not sure how to remove a screen from the stack. For example when going from the home screen to the settings screen, then to the entry screen and lastly again to

How to navigate between different nested stacks in react navigation

萝らか妹 提交于 2019-11-27 01:30:52
问题 The Goal Using react navigation, navigate from a screen in a navigator to a screen in a different navigator. More Detail If I have the following Navigator structure: Parent Navigator Nested Navigator 1 screen A screen B Nested Navigator 2 screen C screen D how do I go from screen D under nested navigator 2, to screen A under nested navigator 1? Right now if I try to navigation.navigate to screen A from screen D there will be an error that says it doesn't know about a screen A, only screen C