Skip to content

[Question] How to *really* upgrade from V3 to V4? #2060

@itinance

Description

@itinance

react-native: 0.45.1
react: 16.0.0.-alpha12
react-native-router-flux: 4.0.0-beta11

We ran into issues with our previous setup based on V3 after upgrading to V4. Since V3 is not working any more on RN 0.45.1 due to missing dependencies based in react-native-navigator-experimental, we need a way to keep on running with V4.

These are our scenes:

<ReduxRouter >
        <Scene
          key='drawer'
          component={Drawer}
          open={false}
          >
          <Scene
            key='homeView'
            component={Modal}
            contentComponent={Drawer}
            >
            <Scene key='homeViewNormal'
              hideNavBar={false}
              drawerImage={require('./img/menu.png')}
              navigationBarStyle={{ backgroundColor: COLORS.HEADER_BACKGROUND, borderBottomWidth: 0 }}
              leftButtonIconStyle = {{ tintColor:'white'}}
              titleStyle={{color: 'white', fontSize: normalize(14), fontWeight: 'bold'}}
              >

              <Scene key='main' hideNavBar={false} title='Chats'
                type={ActionConst.REPLACE}
                renderRightButton={this.renderRightButtonForChat}
                component={ChatListViewScene} sceneStyle={getScreenContainerStyle()}
                initial={ currentUser !== null && currentUser.id }
              />

              <Scene key='newEvent' hideNavBar={false} title='New Event'
                component={EventEditViewScene} sceneStyle={getScreenContainerStyle()}
              />

              <Scene key='signin' hideNavBar={true} title='Sign in'
                type={ActionConst.REPLACE}
                component={SignInViewScene}
                initial={ ! currentUser }
              />
              <Scene key='signup' hideNavBar={false} title='Create Account'
                component={SignUpViewScene} sceneStyle={getScreenContainerStyle()}
              />

             // and many many more and so on ....

            </Scene>
          </Scene>
        </Scene>
</ReduxRouter>

In some scenes we push to another scenes with:

Actions.main()

or

Actions.main({type: ActionConst.REPLACE})

But both calls will raise exceptions called

actions[type] is not a function

I've already read #2017 and tried to flatten down our scenes. But this exception persists.

I'm also courious how to deal with Drawer in V4 according to your statement:

Built-in reactnavigation drawer support (use drawer attribute for Scene and contentComponent to use your own Drawer)

But this one i've already placed here and will mention it here also for the sake of completeness:
#1974 (comment)

Is the new drawer-Attribute simply a boolean setting to true when a scene is managed by a drawer? I understood, that contentComponent will now be the attribute where to pass the final Drawer-Component (which was passed with "drawer"-Attribute in V3)

Can you or another contributor please update the docs or give any hints? Thank you :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions