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

Actions.{route} not defined for nested scenes #2045

Closed
SpadarShut opened this issue Jul 16, 2017 · 7 comments
Closed

Actions.{route} not defined for nested scenes #2045

SpadarShut opened this issue Jul 16, 2017 · 7 comments

Comments

@SpadarShut
Copy link

SpadarShut commented Jul 16, 2017

Triggering actions for the most nested screens produce such an error:

undefined is not a function ( evaluating '_reactNativeRouterFlux.Actions.kriyaView()')
import React, { Component } from 'react'
import { Router, Scene, Actions } from 'react-native-router-flux'
import { KriyaView } from '../KriyaView'
import { KriyaEdit } from '../KriyaEdit'
import { HomeTimer } from '../HomeTimer'
import { Kriyas } from '../Kriyas'
import { NavDrawer } from '../NavDrawer'

class Root extends Component {
  render() {
    return (
      <Router>
        <Scene key="root">
          <Scene
            drawer
            contentComponent={NavDrawer}
            key="navDrawer"
            hideNavBar
            drawerPosition="right"
          >
            <Scene
              key="hometimer"
              component={HomeTimer}
              navTransparent
            />
            <Scene
              key="kriyas"
              component={Kriyas}
              title="Kriyas"
              initial
            >
              <Scene
                key="kriyaEdit"
                component={KriyaEdit}
                title="Edit Kriya"
              />
              <Scene
                key="kriyaView"
                component={KriyaView}
                backTitle="View Kriya"
              />
            </Scene>
          </Scene>
        </Scene>
      </Router>
    )
  }
}

export { Root }

I tried not wrapping all the screen in a drawer but still get this error.
Using "react-native-router-flux": "^4.0.0-beta.11"
Calling e.g. Actions.hometimer() works good though.

@aksonov
Copy link
Owner

aksonov commented Jul 16, 2017 via email

@SpadarShut
Copy link
Author

I call it by tapping a button when everything is rendered long ago

@aksonov
Copy link
Owner

aksonov commented Jul 16, 2017 via email

@aksonov
Copy link
Owner

aksonov commented Jul 17, 2017

Oh, parent scenes cannot have component (it is breaking change from v3, please check docs).

@aksonov aksonov closed this as completed Jul 17, 2017
@SpadarShut
Copy link
Author

SpadarShut commented Jul 17, 2017 via email

@aksonov
Copy link
Owner

aksonov commented Jul 17, 2017

for v4 I didn't write anywhere that Scene could have both children and component. I will add check for it to throw exception for next version.

@itinance
Copy link

Any drawbacks available? Running into the same issue after upgrade from v3.39 to v4.0.0.
If i understand it correctly:

Something like:

<ReduxRouter >
        <Scene
          key='drawer'
          component={Drawer}
          open={false}
          >
          <Scene
            key='homeView'
            component={Modal}
            >
            <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 }
              />

will not work anymore when it comes to force a scene to appear like

RouterActions.main() ?

Thanks for clarifing!

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