在本文中,我们将带你了解react-navigation集成redux全局控制在这篇文章中,我们将为您详细介绍react-navigation集成redux全局控制的方方面面,并解答react全局常见
在本文中,我们将带你了解react-navigation集成redux全局控制在这篇文章中,我们将为您详细介绍react-navigation集成redux全局控制的方方面面,并解答react 全局常见的疑惑,同时我们还将给您一些技巧,以帮助您实现更有效的@ react-navigation / native和@ react-navigation / stack读取整个堆栈、@react-navigation/native 和 @react-navigation/stack 应该是我模块的 peerDependencies 或依赖项吗?、javascript – undefined不是函数(评估’_reactNavigation.NavigationActions.reset’)、React Native Functional Components - undefined 不是对象(评估“navigation.navigate”)。
本文目录一览:- react-navigation集成redux全局控制(react 全局)
- @ react-navigation / native和@ react-navigation / stack读取整个堆栈
- @react-navigation/native 和 @react-navigation/stack 应该是我模块的 peerDependencies 或依赖项吗?
- javascript – undefined不是函数(评估’_reactNavigation.NavigationActions.reset’)
- React Native Functional Components - undefined 不是对象(评估“navigation.navigate”)
react-navigation集成redux全局控制(react 全局)
闲话不多说了,关于redux的基础用法我就不多叙述了.这个demo主要是解决你你想在全局改变某一个数据.
源码
@ react-navigation / native和@ react-navigation / stack读取整个堆栈
您可以使用如下所示的useNavigationState钩子来获取当前状态
https://reactnavigation.org/docs/use-navigation-state/
import {useNavigationState} from '@react-navigation/native';
const state = useNavigationState((state) => state);
alert(JSON.stringify(state.routes));
这将在路线中显示屏幕
@react-navigation/native 和 @react-navigation/stack 应该是我模块的 peerDependencies 或依赖项吗?
如何解决@react-navigation/native 和 @react-navigation/stack 应该是我模块的 peerDependencies 或依赖项吗??
我正在编写一个使用以下依赖项的模块:
{
"@react-native-community/masked-view": "^0.1.10","@react-navigation/native": "^5.9.4","@react-navigation/stack": "^5.14.4","@react-native-community/masked-view": "^0.1.10","env-cmd": "^10.1.0","firebase": "^8.4.1","react-native-gesture-handler": "^1.10.3","react-native-reanimated": "^2.1.0","react-native-safe-area-context": "^3.2.0","react-native-screens": "^3.1.1"
}
我知道存储单例状态的依赖项不应该在 dependencies
中,而应该在 devDependencies
和 peerDependencies
中。
我不认为 react-navigation 是一个单独的依赖项,我们可以创建导航的 ref。
可以在我的分布式模块 dependencies
中将这些依赖项用作 package.json
吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
javascript – undefined不是函数(评估’_reactNavigation.NavigationActions.reset’)
splashscreen代码如下:
import React from "react"; import { Animated,Easing } from "react-native"; import LottieView from "lottie-react-native"; import { NavigationActions } from "react-navigation"; export default class SplashScreen extends React.Component { static navigationoptions = { header: null }; constructor() { super(); this.state = { progress: new Animated.Value(0),} } componentDidMount() { setTimeout(() => { this.navigatetoWalkthrough() },3500); Animated.timing(this.state.progress,{ tovalue: 1,duration: 3000,easing: Easing.linear,}).start(); } navigatetoWalkthrough = () => { const navigateAction = NavigationActions.reset({ index: 0,actions: [NavigationActions.navigate({ routeName: "Walkthrough" })],}); this.props.navigation.dispatch(navigateAction); } render() { return( <LottieView source={require("../assets/splash/SplashScreenAnimation.json")} progress={this.state.progress} /> ); } }
我运行应用程序后出现错误:
undefined is not a function (evaluating'_reactNavigation.NavigationActions.reset')
Main.js文件如下所示:
import React from "react"; import { View,Text } from "react-native"; import { createStackNavigator } from "react-navigation"; import SplashScreen from "./screens/SplashScreen"; import Walkthrough from "./screens/Walkthrough"; const Routes = createStackNavigator({ Home: { screen: SplashScreen },Walkthrough: { screen: Walkthrough } }); export default class Main extends React.Component { render() { return <Routes />; } }
任何帮助/反馈?
解决方法
StackActions
.
StackActions
is an object containing methods for generating actions
specific to stack-based navigators. Its methods expand upon the
actions available in NavigationActions.The following actions are supported:
Reset – Replace current state with a new state
Replace – Replace a route at a given key with another route
Push – Add a route on the top of the stack,and navigate forward to it
Pop – Navigate back to prevIoUs routes
PopToTop – Navigate to the top route of the stack,dismissing all other routes
React Native Functional Components - undefined 不是对象(评估“navigation.navigate”)
如何解决React Native Functional Components - undefined 不是对象(评估“navigation.navigate”)?
我正在练习在 React Native 中从类组件迁移到功能组件,但我无法理解如何从组件访问导航。通常我会运行类似 <!-- ITEMS (BOLLEN) VAN GESELECTEERDE AREA -->
<ion-row scrollX="true">
<ion-col size="3" *ngFor="let item of selectedArea.Items">
<!-- Items -->
<ion-button(click)="selectItem(item)">
<ion-label>{{
item.Descriptions[0].Description
}}</ion-label>
</ion-button>
<ion-button>Test</ion-button>
<ion-button>Test</ion-button>
<ion-button>Test</ion-button>
<ion-button>Test</ion-button>
<ion-button>Test</ion-button>
<ion-button>Test</ion-button>
</ion-col>
</ion-row>
<!-- EINDE ITEMS -->
的东西。现在我通常将 .scroll-items {
justify-content: center;
align-items: ;
flex-wrap: Nowrap;
overflow-x: scroll !important;
overflow-y: hidden;
}
作为道具传递。
但在以下示例中似乎不起作用。我哪里错了?我正在使用反应导航:
this.props.navigation.navigate(''screen'')
我在 App.js 中创建了一个堆栈导航器
navigation
解决方法
尝试使用钩子,像这样:
$ brownie console
Brownie v1.14.6 - Python development framework for Ethereum
MyProject is the active project.
Launching ''ganache-cli --accounts 10 --hardfork istanbul --gasLimit 12000000 --mnemonic hill --port 8545 --time 1980-01-01 00:00:00+00:00''...
Brownie environment is ready.
>>> from datetime import datetime
>>> datetime.fromtimestamp(chain.time())
datetime.datetime(2021,5,15,17,28,37) # Should be (1980,1,0)
>>>
关于react-navigation集成redux全局控制和react 全局的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于@ react-navigation / native和@ react-navigation / stack读取整个堆栈、@react-navigation/native 和 @react-navigation/stack 应该是我模块的 peerDependencies 或依赖项吗?、javascript – undefined不是函数(评估’_reactNavigation.NavigationActions.reset’)、React Native Functional Components - undefined 不是对象(评估“navigation.navigate”)的相关知识,请在本站寻找。
本文标签: