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

Unhandled JS Exception: _reactNativeRouterFlux.Actions.create is not a function #1992

Closed
isAlmogK opened this issue Jul 9, 2017 · 3 comments

Comments

@isAlmogK
Copy link

isAlmogK commented Jul 9, 2017

Hi,
I'm using the latest version, version 4 and I'm getting the following error

Unhandled JS Exception: _reactNativeRouterFlux.Actions.create is not a function

I'm trying to set up routing with redux, I'm sure I'm doing something wrong.

My router

export const Scenes = Actions.create(
    <Router>
    <Scene key='root'>
        <Scene key="login"
               component={Login}
               title="Login"
               initial
        />
    </Scene>
    </Router>
);

app/index.js

import { Scenes } from "../app/config/Router";
render() {
        return (
            <Provider store={store} >
                <ConnectedRouter scenes={Scenes} />
            </Provider>
        );
    }
@aksonov
Copy link
Owner

aksonov commented Jul 9, 2017

Sorry, I will add this to 'Breaking Changes for v4'. Could you use another syntax to define routes - without Actions.create, just as component. Check Example for more details.

@aksonov
Copy link
Owner

aksonov commented Jul 9, 2017

Added note about Actions.create to README.md

@aksonov aksonov closed this as completed Jul 9, 2017
@isAlmogK
Copy link
Author

isAlmogK commented Jul 9, 2017

I did that and now I'm getting the following error "Failed prop type: Invalid prop children of type array supplied to Provider, expected a single ReactElement."

I understand that provider needs to wrap everything

Here is my update app index.js file

render() {
        return (
            <Provider store={store} >
                /* Breaking changes with react-native-router-flux all
                   routes need to be here and not in a separate routing file, check back for support.
                */
                <Router>
                    <Scene key="root">
                        <Scene key="login" component={Login} />
                        <Scene key="ResetPassword" component={ResetPassword} />
                    </Scene>
                </Router>
            </Provider>
        );
    }

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

2 participants