Md.*_*lam 5 react-native redux react-redux react-native-android
我有下面的代码库
博览会链接
https://snack.expo.io/@mparvez19861/redux-example
app.js
<Provider store={store}>
<View style={styles.container}>
<Navigator />
</View>
</Provider>
Run Code Online (Sandbox Code Playgroud)
Navigator.js
const AuthStack = createStackNavigator({
// { SignIn: SignInScreen }
// SignIn: { screen: EmailPwdLogin }
Login: { screen: LoginScreen },
Signup: { screen: SignupScreen },
});
const drNav = createDrawerNavigator(
{
Screen2: {
screen: Screen2
},
SignOut: {
screen: SignOutScreen
}
}
)
export default createAppContainer(createSwitchNavigator(
{
// screendesign: screendesign,
SplashScreen: SplashScreen,
App: drNav,
AuthStack: AuthStack
},
{
initialRouteName: 'SplashScreen',
}
));
Run Code Online (Sandbox Code Playgroud)
login.js
import React, { Component } from 'react';
import { StyleSheet, View, Text, TextInput, Button, Alert } from 'react-native';
import { NavigationActions } from 'react-navigation';
import firebase from 'react-native-firebase';
import { connect } from 'react-redux';
import { getUserData, watchUserLogin } from '../redux/app-redux';
const mapStateToProps = (state) => {
return {
userData: state.userData,
};
}
const mapDispatchToProps = (dispatch) => {
return {
getUserData: (user) => { dispatch(getUserData(user)) },
};
}
class LoginScreen extends Component {
constructor(props) {
super(props);
this.state = {
userData: null,
email: "",
password: "",
};
}
onLoginPress = () => {
firebase.auth().signInWithEmailAndPassword(this.state.email, this.state.password)
.then((user) => {
//this.state.userData = user;
this.setState({ userData: user })
this.onGetUserData(user);
// this.props.navigation.navigate("friendsOnWay");
}, (error) => { Alert.alert(error.message); });
}
onGetUserData = (user) => {
this.props.getUserData(user);
}
onCreateAccountPress = () => {
// var navActions = NavigationActions.reset({
// index: 0,
// actions: [NavigationActions.navigate({routeName: "Signup"})]
// });
// this.props.navigation.dispatch(navActions);
// this.props.navigation.navigate("Signup");
}
render() {
return (
<View style={{ paddingTop: 50, alignItems: "center" }}>
<Text>Login</Text>
<TextInput style={{ width: 200, height: 40, borderWidth: 1 }}
value={this.state.email}
onChangeText={(text) => { this.setState({ email: text }) }}
placeholder="Email"
keyboardType="email-address"
autoCapitalize="none"
autoCorrect={false}
/>
<View style={{ paddingTop: 10 }} />
<TextInput style={{ width: 200, height: 40, borderWidth: 1 }}
value={this.state.password}
onChangeText={(text) => { this.setState({ password: text }) }}
placeholder="Password"
secureTextEntry={true}
autoCapitalize="none"
autoCorrect={false}
/>
<Button title="Login" onPress={this.onLoginPress} />
<Button title="Create account..." onPress={this.onCreateAccountPress} />
</View>
);
}
}
const styles = StyleSheet.create({
});
export default connect(mapStateToProps, mapDispatchToProps)(LoginScreen);
Run Code Online (Sandbox Code Playgroud)
投掷错误
TypeError:TypeError:未定义不是函数(计算'((0,_react.useMemo)')
此错误位于:在RCTView(在View.js中)的RCTView(在View.js:45中)的SceneView(在StackViewLayout.js:784中)的ConnectFunction(由SceneView创建)中。 :45)在View(在StackViewLayout.js:782)在RCTView(在View.js:45)在View(在createAnimatedComponent.js:153)在AnimatedComponent(在StackViewCard.js:69)在RCTView(在View.js) :45)在View(在createAnimatedComponent.js:153)在AnimatedComponent(在screens.native.js:59)在Screen(在StackViewCard.js:57)在Card在Card(在createPointerEventsContainer.js:27)在Container(在StackViewLayout) RCTView(View.js:45)中的RCTView(.screens.native.js:83)中的RCTView(.js:860)(RCTView(View.js :)中的ScreenContainer(StackViewLayout.js:311)的View中(.screens.native.js:83)45)在View(在createAnimatedComponent.js:153)在AnimatedComponent(在StackViewLayout.js:307)在PanGestureHandler(在StackViewLayout.js:300)在StackViewLayout(在withOrientation.js:30)在withOrientation(在StackView.js: 79)在RCTView(在View.js:45)在View(在Transitioner.js:214)在Transitioner(在StackView.js:22)在StackView(由Navigator创建)在Navigator(在createKeyboardAwareNavigator.js:12)中在RCTView(在View.js:45)的NavigationContainer(在App.js:94)的Navigator(在createAppContainer.js:388)的SwitchView(由Navigator创建)的SceneView(由SwitchView创建)中的KeyboardAwareNavigator(由SceneView创建)在View(在App.js:93)在提供程序(在App.js:92)在App(在renderApplication.js:34)在View的RCTView(在View.js:45)(在AppContainer.js:98)在AppContainer(在renderApplication.js:在View的RCTView(View.js:45)在AppContainer.js:115): 33)
此错误的位置为:应用程序中(在AppContainer(在renderApplication.js:33)ConnectFunction D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-redux \ lib \ components \ connectAdvanced.js:131:41 updateFunctionComponent D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ Renderer \ oss \ ReactNativeRenderer-dev.js:11441:29 updateSimpleMemoComponent D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ Renderer \ oss \ ReactNativeRenderer-dev.js :11352:4 updateMemoComponent D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ Renderer \ oss \ ReactNativeRenderer-dev.js:11224:8 beginWork D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ Renderer \ oss \ ReactNativeRenderer-dev.js:12824:8 performUnitOfWork D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ Renderer \ oss \ ReactNativeRenderer-dev.js: 16075:21 workLoop D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ Renderer \ oss \ ReactNativeRenderer-dev.js:16115:41 renderRoot D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ Renderer \ oss \ ReactNativeRenderer-dev.js:16219:15 performWorkOnRoot D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ Renderer \ oss \ ReactNativeRenderer-dev.js:17198:17 performWork D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \库\ Renderer \ oss \ ReactNativeRenderer-dev.js:17099:24 performSyncWork D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ Renderer \ oss \ ReactNativeRenderer-dev.js:17060:14 requestWork D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ Renderer \ oss \ ReactNativeRenderer-dev.js:16925:19 scheduleD:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react- native \ Libraries \ Renderer \ oss \ ReactNativeRenderer-dev.js:16724:16 scheduleRootUpdate D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ Renderer \ oss \ ReactNativeRenderer-dev.js:17413:15 updateContainerAtExpirationTime D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ Renderer \ oss \ ReactNativeRenderer-dev.js:17447:28 updateContainer D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ Renderer \ oss \ ReactNativeRenderer-dev.js:17537:4渲染D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ Renderer \ oss \ ReactNativeRenderer-dev.js: 18191:20 renderApplication D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ ReactNative \ renderApplication.js:59:34运行D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react- native \ Libraries \ ReactNative \ AppRegistry.js:101:10 runApplication D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ ReactNative \ AppRegistry.js:195:26 __callFunction D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ BatchedBridge \ MessageQueue.js:366:47 D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ BatchedBridge \ MessageQueue.js:106:26 __guard D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ BatchedBridge \ MessageQueue.js:314:10 callFunctionReturnFlushedQueue D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ BatchedBridge \ MessageQueue.js:105:17\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ BatchedBridge \ MessageQueue.js:314:10 callFunctionReturnFlushedQueue D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ BatchedBridge \ MessageQueue.js:105:17\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ BatchedBridge \ MessageQueue.js:314:10 callFunctionReturnFlushedQueue D:\ Rnd \ React Native \ Project \ WhoAroundMe \ node_modules \ react-native \ Libraries \ BatchedBridge \ MessageQueue.js:105:17
我做错了请帮忙
| 归档时间: |
|
| 查看次数: |
1283 次 |
| 最近记录: |