Mohamad reza golbaba
5 سال پیش توسط Mohamad reza golbaba مطرح شد
3 پاسخ

مشکل کانفیگ redux و react navigation

سلام دوستان
من با 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

ثبت پرسش جدید
Mohamad reza golbaba
تخصص : برنامه نویس Reactjs/React Nati...
@m.reza.golbaba 5 سال پیش مطرح شد
0

با ورژن پایین تره react-navigation-redux-helpers مشکلم حل شد از دوستان اگر کسی کمک خواست در خدمت هستم


Mohamad reza golbaba
تخصص : برنامه نویس Reactjs/React Nati...
@m.reza.golbaba 5 سال پیش آپدیت شد
0

راجع به این موضوع نمیدونید؟
@hesammousavi


Mohamad reza golbaba
تخصص : برنامه نویس Reactjs/React Nati...
@m.reza.golbaba 5 سال پیش مطرح شد
0

با ورژن پایین تره react-navigation-redux-helpers مشکلم حل شد از دوستان اگر کسی کمک خواست در خدمت هستم


ابراهیم موسی رحمتی
تخصص : طراح و برنامه نویس موبایل
@Mansoor7622 5 سال پیش مطرح شد
0

سلام@m.reza.golbaba
دیت پیکر خوب برای ریکت نیتیو شما چیزی دارید من خیلی گشتم چیزی پیدا نکردم میتونید کمکم کنید ؟ ایدی تلگرام من اینه Blackkaiser01@


برای ارسال پاسخ لازم است وارد شده یا ثبت‌نام کنید

ورود یا ثبت‌نام