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

map next scenes #2475

Closed
James2516 opened this issue Oct 7, 2017 · 1 comment
Closed

map next scenes #2475

James2516 opened this issue Oct 7, 2017 · 1 comment

Comments

@James2516
Copy link

James2516 commented Oct 7, 2017

Version

Tell us which versions you are using:

  • react-native-router-flux v4.0.0-beta.21
  • react-native v0.48.3
    const scenes = [
      ['Scene1', <Scene1 />],
      ['Scene2', <Scene2 />],
    ].map(([key, Component], i, arr) => [key, () => React.cloneElement(Component, {
      nextScene: (arr[i + 1] || [])[0],
      previousScene: (arr[i - 1] || [])[0],
    })]);

    <Scene>
      {scenes.map(([key, component]) => (
        <Scene key={key} component={component} />
      ))}
    </Scene>

Scene1 and Scene2 has "Previous" and "Next" buttons that navigates to the previous/next scene (based on the scenes array), so the nextScene and previousScene must be passed to the scenes.

Is this the right way to do it?

@aksonov
Copy link
Owner

aksonov commented Oct 17, 2017

Sorry, dynamic declaration is not supported by RNRF

@aksonov aksonov closed this as completed Oct 17, 2017
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

2 participants