Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't read property 'router' of null #2049 #2158

Closed
ranasing opened this issue Aug 1, 2017 · 2 comments
Closed

Can't read property 'router' of null #2049 #2158

ranasing opened this issue Aug 1, 2017 · 2 comments

Comments

@ranasing
Copy link

ranasing commented Aug 1, 2017

Sorry, I reposted this because realized that original post was closed.

Can you explain what you mean by this, 'container scene as root'? I am getting the same error. Thanks

Ok, I'm not getting the error any more, but it only shows a blank screen on my Android simulator. Here is the relevant code (update:, it gave me a blank screen, but then went back to the old error above reappeared) :

import React, { Component } from 'react';
import { Scene, Router } from 'react-native-router-flux';
import { createStore, applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import LoginForm from './components/LoginForm';

render() {
const store = createStore(reducers, {}, applyMiddleware(ReduxThunk));
return (
<Provider store={store}> <Router> <Scene key='login' component={LoginForm} title='Login' /> </Router> </Provider>
);
}

**** Only showing render method, because if I take out components and replace with just LoginForm component, it will render correctly.

@mikaello
Copy link
Contributor

mikaello commented Aug 1, 2017

I think container scene as root means that you should have a Scene-component directly under Router-component with key='root' that encapsulates all your other scenes:

render() {
  const store = createStore(reducers, {}, applyMiddleware(ReduxThunk));
  return (
    <Provider store={store}>
      <Router>
        <Scene key='root'>
          <Scene key='login' component={LoginForm} title='Login' initial />
        </Scene>
      </Router>
    </Provider>
  );
}

@ranasing
Copy link
Author

ranasing commented Aug 1, 2017 via email

@aksonov aksonov closed this as completed Aug 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants