سلام دوستان
من با redux و ٍreact navigation یه اپ ساختم اما موقع ران این error رو میده
router.js
class Router extends Component {
render() {
const Render = createRootNavigator();
return (<Render screenProps={1}/>);}}
export default Router
export const AppStack = createBottomTabNavigator(
{Home: {
screen: Home,
navigationOptions: {
tabBarIcon: ({tintColor, focused}) => (
<View
style={[global.tabRouteWrapper, focused ? {backgroundColor: tintColor} : {backgroundColor: 'transparent'}]}>
<IconFontAwesome name="home" color={focused ? theme.white : theme.black} size={30}/>
</View>
),
showLabel: false
},
},
Message: {
screen: Message,
navigationOptions: {
tabBarIcon: ({tintColor, focused}) => (
<View
style={[global.tabRouteWrapper, focused ? {backgroundColor: tintColor} : {backgroundColor: 'transparent'}]}>
<IconFontAwesome name="wechat" color={focused ? theme.white : theme.black} size={30}/>
</View>),
showLabel: false,
drawerLockMode: 'locked-closed'
}
},
RequestSubmitt: {
screen: SubmittRequest,
navigationOptions: {
tabBarIcon: ({ tintColor, focused }) => (
<View style={[global.tabRouteWrapper, focused ? { backgroundColor: tintColor } : { backgroundColor: 'transparent' }]} >
<IconAntDesign name="pluscircleo" color={focused ? theme.white : theme.black} size={30} />
</View>),
showLabel: false,
}
},
Articles: {
screen: Article,
navigationOptions: {
tabBarIcon: ({ tintColor, focused }) => (
<View style={[global.tabRouteWrapper, focused ? { backgroundColor: tintColor } : { backgroundColor: 'transparent' }]} >
<IconFontAwesome name="file-text-o" color={focused ? theme.white : theme.black} size={30} />
</View>),
showLabel: false,
}
},
Profile: {
screen: Profile,
navigationOptions: {
tabBarIcon: ({ tintColor, focused }) => (
<View style={[global.tabRouteWrapper, focused ? { backgroundColor: tintColor } : { backgroundColor: 'transparent' }]} >
<IconFontAwesome name="user" color={focused ? theme.white : theme.black} size={30} />
</View>),
showLabel: false,
}
},
},
options);
export const createRootNavigator = () => {
let initialRouteName = 'AppStack';
return createSwitchNavigator(
{ AppStack:AppStack},
{initialRouteName}
);
};
app.js
const initialState = Router.router.getStateForAction(Router.router.getActionForPathAndParams(Home));
const navReducer = (state = initialState, action) => {
const nextState = Router.router.getStateForAction(action, state);
return nextState || state;
};
const appReducer = combineReducers({
nav: navReducer,
});
const sagaMiddleware =createSagaMiddleware();
const middleware = createReactNavigationReduxMiddleware(
"root",
state => state.nav,
);
const AppState = reduxifyNavigator(Router, "root");
const mapStateToProps = (state) => ({
state: state.nav,
});
const store = createStore(
rootSaga,
appReducer,
applyMiddleware(middleware,sagaMiddleware),
);
const AppWithNavigationState = connect(mapStateToProps)(AppState);
export default class App extends Component<Props> {
render()
return (
<Provider store={store}>
<AppWithNavigationState/>
</Provider>
);
}
}
کسی میدونه مشکل کجاست؟
Cannot read property 'getStateForAction' of undefined
با ورژن پایین تره react-navigation-redux-helpers مشکلم حل شد از دوستان اگر کسی کمک خواست در خدمت هستم
با ورژن پایین تره react-navigation-redux-helpers مشکلم حل شد از دوستان اگر کسی کمک خواست در خدمت هستم
سلام@m.reza.golbaba
دیت پیکر خوب برای ریکت نیتیو شما چیزی دارید من خیلی گشتم چیزی پیدا نکردم میتونید کمکم کنید ؟ ایدی تلگرام من اینه Blackkaiser01@
آیا مایل به ارسال نوتیفیکیشن و اخبار از طرف راکت هستید ؟