Search code examples
reactjsreact-nativereduxreact-native-router-flux

Error while using react-native-router-flux


just starting a new project with react-native redux and every thing works fine when is started to add a router using the "react-native-router-flux"

i first had a problem that the react-native was also installed in the node_modules inside the react-native-router-flux folder. so i removed the "react-native" from the "react-native-router-flux"

and getting this error : Cannot read property 'addEventListener' of undefined

app.js :

const store = createStore(reducers, {}, applyMiddleware(ReduxThunk));

class App extends Component {

componentWillMount() {
    firebase.initializeApp({
       some firebase settings
    });
}

render() {
    return (
        <Provider store={store}>
            <Router/>
        </Provider>

    );
  }
};
export default App;

Router.js :

const RouterComponent = () => {
return (
    <Router sceneStylr={{paddingTop:65}}>
            <Scene key="login" component={LoginForm} title="Please Login"/>
    </Router>
 )
};
export default RouterComponent;

Solution

  • I had the same problem a couple of days ago. It seems like RNRF does not work properly when added to the newly updated version of react. You can also see that RNRF has another version of react whilst your's probably has the new alpha version.

    You can fix this issue by downgrading to [email protected] and installing [email protected].

    Hope this helps.