0

I'm using React Native with Redux and React Native Router Flux but I'm getting the following error "_reactNativeRouterFlux.Actions.create is not a function" I followed the docs on the correct setup not sure what's going on

routes reducer

import { ActionConst } from 'react-native-router-flux';

const initialState = {
    scene: {},
};

export default function routesReducer(state = initialState, action = {}) {
    switch (action.type) {
        // focus action is dispatched when a new screen comes into focus
        case ActionConst.FOCUS:
            return {
                ...state,
                scene: action.scene,
            };

        // ...other actions

        default:
            return state;
    }
}

index reducer

export default combineReducers({
    //Scenes,
    routesReducer,
    oauth: oauthReducer,
    navBar: navReducer,
});

my store

const enhancer = compose(
   applyMiddleware(
        thunk,
    ),
);

const store = createStore(
    reducers,
    enhancer,
    autoRehydrate(),
);

app index

// I have the correct imports 
const ConnectedRouter = connect()(Router);
import { scenes } from "../app/config/Router";

render() {
        return (
            <Provider store={store} >
                <ConnectedRouter scenes={scenes} />
            </Provider>
        );
    }

my routes

export const scenes = Actions.create(
    <Scene key="root">
        <Scene key="login" component={Login} />
    </Scene>
);
Almog
  • 2,639
  • 6
  • 30
  • 59

1 Answers1

0

Sorry, Actions.create way is not supported yet. Could you try

const App = () =>
<Router><Scene key="root">
    <Scene key="Start" component={Start} hideNavBar={true} duration={0}/>
    <Scene key="Login" component={Login} hideNavBar={true}  duration={0}/>
    <Scene key="ChatList" component={ChatList} duration={0}/>
  </Scene>
</Router>

I just ran in to the same problem and found out that this is the only way to solve the issue. https://github.com/aksonov/react-native-router-flux/issues/1975

  • Yes I saw the update, the issue now is that I'm using Redux and there is some error when wrapping the scene in provider - https://github.com/aksonov/react-native-router-flux/issues/1998 – Almog Jul 10 '17 at 05:31