5

I have below codebase

Expo link

https://snack.expo.io/@mparvez19861/redux-example

app.js

 <Provider store={store}>
                <View style={styles.container}>
                    <Navigator />
                </View>
            </Provider>

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',
  }
));

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);

Throwing error

TypeError: TypeError: undefined is not a function (evaluating '(0, _react.useMemo)')

This error is located at: in ConnectFunction (created by SceneView) in SceneView (at StackViewLayout.js:784) in RCTView (at View.js:45) in View (at StackViewLayout.js:783) in RCTView (at View.js:45) in View (at StackViewLayout.js:782) in RCTView (at View.js:45) in View (at createAnimatedComponent.js:153) in AnimatedComponent (at StackViewCard.js:69) in RCTView (at View.js:45) in View (at createAnimatedComponent.js:153) in AnimatedComponent (at screens.native.js:59) in Screen (at StackViewCard.js:57) in Card (at createPointerEventsContainer.js:27) in Container (at StackViewLayout.js:860) in RCTView (at View.js:45) in View (at screens.native.js:83) in ScreenContainer (at StackViewLayout.js:311) in RCTView (at View.js:45) in View (at createAnimatedComponent.js:153) in AnimatedComponent (at StackViewLayout.js:307) in PanGestureHandler (at StackViewLayout.js:300) in StackViewLayout (at withOrientation.js:30) in withOrientation (at StackView.js:79) in RCTView (at View.js:45) in View (at Transitioner.js:214) in Transitioner (at StackView.js:22) in StackView (created by Navigator) in Navigator (at createKeyboardAwareNavigator.js:12) in KeyboardAwareNavigator (created by SceneView) in SceneView (created by SwitchView) in SwitchView (created by Navigator) in Navigator (at createAppContainer.js:388) in NavigationContainer (at App.js:94) in RCTView (at View.js:45) in View (at App.js:93) in Provider (at App.js:92) in App (at renderApplication.js:34) in RCTView (at View.js:45) in View (at AppContainer.js:98) in RCTView (at View.js:45) in View (at AppContainer.js:115) in AppContainer (at renderApplication.js:33)

This error is located at: in NavigationContainer (at App.js:94) in RCTView (at View.js:45) in View (at App.js:93) in Provider (at App.js:92) in App (at renderApplication.js:34) in RCTView (at View.js:45) in View (at AppContainer.js:98) in RCTView (at View.js:45) in View (at AppContainer.js:115) in AppContainer (at 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\Libraries\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 scheduleWork D:\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 render 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 run 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

What I am doing wrong please help

9
  • Is that your stacktrace or is there more? Commented Apr 9, 2019 at 13:15
  • Full error updated Commented Apr 9, 2019 at 13:27
  • Does your redux provider wrap around the root navigator(react-navigation)? Commented Apr 9, 2019 at 13:29
  • I have updaetd the navigator file Commented Apr 9, 2019 at 13:32
  • When does the error occur i.e on click of a button or when you just run the app? Commented Apr 9, 2019 at 13:35

3 Answers 3

3

Version 7.0.1 of redux-sagas "now require a minimum React version of 16.8.4 or higher."

Sign up to request clarification or add additional context in comments.

2 Comments

Do you mean react-redux?
Did I mean react-redux? Nope
2

i had the same problem i used react-native version 0.58.6 and react-redux version 6.0.1 and it worked well.

Comments

2

I was getting same error. I updated my versions for react and react native to last version as well as redux and react-redux. It's solved then. Hope works for you too.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.