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

ActionConst.REPLACE breaks #2804

Closed
jsaguiar opened this issue Jan 17, 2018 · 13 comments
Closed

ActionConst.REPLACE breaks #2804

jsaguiar opened this issue Jan 17, 2018 · 13 comments

Comments

@jsaguiar
Copy link

jsaguiar commented Jan 17, 2018

Version

Tell us which versions you are using:

  • react-native-router-flux 4.0.0-beta.27
  • react-native v0.52.0

Expected behaviour

Not to break

Actual behaviour

Break

" TypeError: Cannot read property 'map' of undefined"

Steps to reproduce

<Overlay>
   <Stack hideNavBar>
      //...
     <Modal hideNavBar
       key={"key1"}
       initial
       type={ActionConst.REPLACE}
     >
       <Drawer key='root' contentComponent={MenuScreen} initial>
         <Scene key={"key2"} component={AScreen} type={ActionConst.REPLACE} initial />
         <Scene key={"key3"} component={BScreen} type={ActionConst.REPLACE} />
       </Drawer>
@TareqElMasriDev
Copy link

Same

@TareqElMasriDev
Copy link

Solve it by downgrading to 4.0.0-beta.20

@jsaguiar
Copy link
Author

4.0.0-beta.27 works for me!

@kylethebaker
Copy link

We started running into this too on the latest version using Actions.reset('someScene').

The full error that I get is:

TypeError: Cannot read property 'map' of undefined
    at Object.getStateForAction (StackRouter.js:263)
    at reducer (Reducer.js:74)
    at NavigationStore.nextState (navigationStore.js:550)
    at NavigationStore.dispatch (navigationStore.js:553)
    at NavigationStore.replace (navigationStore.js:675)
    at AuthActions.js:185
    at tryCallOne (core.js:37)
    at core.js:123
    at JSTimers.js:301
    at _callTimer (JSTimers.js:154)

@rxicon
Copy link

rxicon commented Jan 18, 2018

Same react-native-router-flux 4.0.0-beta.28 had this problem

@kylethebaker
Copy link

In the meantime I've rolled back to beta25 and it appears to be working. It looks like react-navigation was upped from beta.21 to beta.22 in this version which could have caused the regression. That is the earliest version back where I saw a change that might be having an effect and the stack trace shows the error as coming from react-navigation. That is my hunch to what the cause is at least, I haven't investigated too much.

@Blapi
Copy link
Collaborator

Blapi commented Jan 18, 2018

This is a known issue #2799

I'm closing this but if you want to use 0.28, do as what @sharkrice said, otherwise, if you don't need the features from 0.28, I suggest you to downgrade to a stable version (like 0.24 in my case) until it's fixed.

@Blapi Blapi closed this as completed Jan 18, 2018
@holasebas
Copy link

4.0.0-beta.27 works for me!

@redwind
Copy link

redwind commented Jan 25, 2018

got issue for 4.0.0-beta.28, downgrade to 4.0.0-beta.27 works for me!

@LiuTing0403
Copy link

got issue for 4.0.0-beta.24 with node v7.10.0, upgrade to 4.0.0-beta.27 works for me.
upgrade node to v8.9.4 with 4.0.0-beta.24 also worked.

@Ekhui
Copy link

Ekhui commented Jan 31, 2018

@LiuTing0403 我用0.22到0.28都试了一遍 仍然存在这个问题 是不是和RN的版本有关呢 我的是0.52.2

@abrantes01
Copy link

Got the same issue. Downgrade to 4.0.0-beta.27 "fixed" it.

@afilp
Copy link

afilp commented Jan 9, 2019

Hi, in 4.0.6 the REPLACE does not work as expected, no errors but the route is not replaced properly.

Any news on this?

I think that this code is also problematic here:
const routes = [...parent.routes.slice(0, index - 1), ...parent.routes.slice(index)];

Shouldn't it be this?
const routes = [...parent.routes.slice(0, index), ...parent.routes.slice(index + 1)];

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