react-navigation

React Navigation + TypeScript Error: Type 'EventStackParams' does not satisfy the constraint 'Record<string, object | undefined>'

倾然丶 夕夏残阳落幕 提交于 2021-01-05 08:53:19
问题 I'm adding TypeScript to my React Native/React Navigation 5 Navigator, but having an issue with Adding EventStackParams to the createStackNavigator() . I've looked through the React Native 5 Docs, StackOverflow, and GitHub, but no luck. What am I doing wrong? Below is my error and the code Error: Type 'EventStackParams' does not satisfy the constraint 'Record<string, object | undefined>'. Index signature is missing in type 'EventStackParams'.ts(2344) Navigation.tsx: // Imports: TypeScript

React Native navigation TypeError: undefined is not an object (evaluating 'Object.keys(routeConfigs)')

穿精又带淫゛_ 提交于 2021-01-04 07:58:36
问题 I have the following code in App.js file:- import React, { Component } from 'react'; import { Platform, StyleSheet, Text, View } from 'react-native'; import { createAppContainer } from 'react-navigation'; import { createStackNavigator } from 'react-navigation-stack'; import { NavigationContainer} from "react-navigation"; const Home = ({ navigation }) => { return ( <View> <Text>This is Home page!</Text> </View> ) } const Stack = createStackNavigator(); function MyStack() { return ( <Stack

React Native navigation TypeError: undefined is not an object (evaluating 'Object.keys(routeConfigs)')

徘徊边缘 提交于 2021-01-04 07:57:21
问题 I have the following code in App.js file:- import React, { Component } from 'react'; import { Platform, StyleSheet, Text, View } from 'react-native'; import { createAppContainer } from 'react-navigation'; import { createStackNavigator } from 'react-navigation-stack'; import { NavigationContainer} from "react-navigation"; const Home = ({ navigation }) => { return ( <View> <Text>This is Home page!</Text> </View> ) } const Stack = createStackNavigator(); function MyStack() { return ( <Stack

I am using bottom-tabs with a plus button But Plus button is not clickable in half of the area in react native in android Only?

淺唱寂寞╮ 提交于 2021-01-02 07:51:47
问题 I am using @react-navigation/bottom-tabs in the react native. And i need Plus button above the area, So i am able to achieve it, but in the Android Above half area of the Plus icon is not clickable in android.But in IOS it is working fine anybody have an answer about it. 回答1: Kindly use hitSlop property on your button like this to increase the tapping area: hitSlop={{top: 20, bottom: 20, left: 50, right: 50}} 来源: https://stackoverflow.com/questions/64429128/i-am-using-bottom-tabs-with-a-plus

I am using bottom-tabs with a plus button But Plus button is not clickable in half of the area in react native in android Only?

孤者浪人 提交于 2021-01-02 07:51:41
问题 I am using @react-navigation/bottom-tabs in the react native. And i need Plus button above the area, So i am able to achieve it, but in the Android Above half area of the Plus icon is not clickable in android.But in IOS it is working fine anybody have an answer about it. 回答1: Kindly use hitSlop property on your button like this to increase the tapping area: hitSlop={{top: 20, bottom: 20, left: 50, right: 50}} 来源: https://stackoverflow.com/questions/64429128/i-am-using-bottom-tabs-with-a-plus

How to setParams using useEffect and avoid getting infinty renderings?

孤者浪人 提交于 2021-01-02 06:04:20
问题 I'm using react-navigation and I have a dynamic header, so I'm using setParams and getting it in the title. const MyComponent = ({navigation}) => { useEffect(() => { const { setParams, state } = navigation const { params = {} } = state const { description } = params setParams({ headerTitle: description }) }, []) return (...) } MyComponent.navigationOptions = ({ navigation }) => ({ title: navigation.getParam('headerTitle') }) The problem here is that I only want to setParams once (so I use []

How to setParams using useEffect and avoid getting infinty renderings?

早过忘川 提交于 2021-01-02 06:04:19
问题 I'm using react-navigation and I have a dynamic header, so I'm using setParams and getting it in the title. const MyComponent = ({navigation}) => { useEffect(() => { const { setParams, state } = navigation const { params = {} } = state const { description } = params setParams({ headerTitle: description }) }, []) return (...) } MyComponent.navigationOptions = ({ navigation }) => ({ title: navigation.getParam('headerTitle') }) The problem here is that I only want to setParams once (so I use []

How to setParams using useEffect and avoid getting infinty renderings?

北城余情 提交于 2021-01-02 06:04:05
问题 I'm using react-navigation and I have a dynamic header, so I'm using setParams and getting it in the title. const MyComponent = ({navigation}) => { useEffect(() => { const { setParams, state } = navigation const { params = {} } = state const { description } = params setParams({ headerTitle: description }) }, []) return (...) } MyComponent.navigationOptions = ({ navigation }) => ({ title: navigation.getParam('headerTitle') }) The problem here is that I only want to setParams once (so I use []

How to replicate onDidBlur or onWillBlur with React Navigation 5?

若如初见. 提交于 2021-01-01 17:56:05
问题 As they point out in the docs, they've gotten rid of the 4 navigation event listeners and instead decided to use Lifecycle events. But the problem I'm running into with React Navigation 5 is that the blur event doesn't work as I need it to! Before, I could add an onWillBlur listener, and do stuff when the user temporarily leaves (not closes) the app (such as close a socket connection, and then reopen it when the user reenters the app). How can I replicate the onWillBlur or onDidBlur events

How to replicate onDidBlur or onWillBlur with React Navigation 5?

放肆的年华 提交于 2021-01-01 17:53:21
问题 As they point out in the docs, they've gotten rid of the 4 navigation event listeners and instead decided to use Lifecycle events. But the problem I'm running into with React Navigation 5 is that the blur event doesn't work as I need it to! Before, I could add an onWillBlur listener, and do stuff when the user temporarily leaves (not closes) the app (such as close a socket connection, and then reopen it when the user reenters the app). How can I replicate the onWillBlur or onDidBlur events