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

Duplicate scene when Actions.push to child in Stack or Scene group #3112

Closed
zealgt opened this issue Jul 3, 2018 · 2 comments
Closed

Duplicate scene when Actions.push to child in Stack or Scene group #3112

zealgt opened this issue Jul 3, 2018 · 2 comments

Comments

@zealgt
Copy link

zealgt commented Jul 3, 2018

Version

"dependencies": {
"react": "16.4.1",
"react-native": "0.55.4",
"react-native-router-flux": "4.0.0-beta.31"
},

Expected behaviour

When I click "Go to register" it should have only one Register's scene mounted.

Actual behaviour

I got double scenes Register have mount, When you click back Register button then back to Register scene again.
So I'm not sure, Is it a bug or feature?

Steps to reproduce

const Home = (props) => (
  <View style={styles.container}>
    <Text onPress={() => Actions.register()}>
      Go to register
    </Text>
  </View>
)

const Register = (props) => (
  <View style={styles.container}>
    <Text>Register</Text>
  </View>
)

const Register2 = (props) => (
  <View style={styles.container}>
    <Text>Register2</Text>
  </View>
)

export default App = () => (
  <Router style={styles.container}>
    <Scene key="root">
      <Scene key="home" component={Home} title="Home" />
      <Stack key="group1" title="group1">
        <Scene key="register" component={Register} title="Register" />
        <Scene key="register2" component={Register2} title="Register2" />
      </Stack>
    </Scene>
  </Router>
)

My solution

use Actions.group1() instead of Actions.register()

@zealgt zealgt changed the title Duplicate scenes when Actions.push to child in Stack or Scene group Duplicate scene when Actions.push to child in Stack or Scene group Jul 3, 2018
@aksonov
Copy link
Owner

aksonov commented Aug 8, 2018

Your solution is right. Yes, it is 'feature' - first Scene is already part of stack.

@aksonov aksonov closed this as completed Aug 8, 2018
@digitaldavenyc
Copy link

This saved me a bunch of time!

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