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

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

Closed
itinance opened this issue Jul 18, 2017 · 7 comments
Closed

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

itinance opened this issue Jul 18, 2017 · 7 comments

Comments

@itinance
Copy link

itinance commented Jul 18, 2017

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 :)

@aksonov
Copy link
Owner

aksonov commented Jul 18, 2017

  1. Use 'replace' instead of ActionConst.REPLACE within Scene declaration (will add it to breaking change)
  2. Scenes cannot have both 'component' and 'children' (will add assert for the next version)
  3. Drawer syntax was changed (boolean drawer attribute + contentComponent for side menu component + Actions.drawerOpen/Actions.drawerClose to open/close drawer)

@itinance
Copy link
Author

Thank you very much. WIll give it a new try tomorrow

@itinance
Copy link
Author

itinance commented Jul 19, 2017

@aksonov One more question please.

How can i exchange the Menu-Icon, that is used in the NavBar with drawer?

I looked around in NavBar.js and tried to pass a property "leftButtonImage" to the Scene. But this property isn't passed thru to the state, that will passed itself to renderBackButton()

@aksonov
Copy link
Owner

aksonov commented Jul 19, 2017 via email

@itinance
Copy link
Author

itinance commented Jul 19, 2017

Thank you very much!

There is one special detail: on the most outer Scene with drawer={true} the attribute drawerImage={...} needs to be placed.
I think you should add this to the documentation :)

@aksonov
Copy link
Owner

aksonov commented Jul 21, 2017

@itinance Thanks, docs were updated. Closing this ticket.

@aksonov aksonov closed this as completed Jul 21, 2017
@DayaramK
Copy link

hi how can i integrate Drawer using react-native-router-flux: 4.0.0-beta21

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

3 participants