react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

Navigation.push() thinks componentId is a stack, but it is a component

Open idanlo opened this issue 6 years ago • 4 comments

Issue Description

When calling Navigation.push() giving it the componentId which is passed to the component as a parameter, on Android I get this error - Error: Failed to execute stack command. Stack CustomComponent10 not found..

What happens is that RNN thinks that CustomComponent10 is a stack but it is not, it is a component which is a child of a stack, the wanted behaviour is that RNN pushes a screen above the componentId specified in the parameters. This is only happening in a certain screen while all others screen work fine, and this is only an issue with Android.


Environment

  • React Native Navigation version: 4.0.8
  • React Native version: 0.61.5
  • Platform(s) (iOS, Android, or both?): Android
  • Device info (Simulator/Device? OS version? Debug/Release?): both simulator and device, all OS versions

idanlo avatar Dec 20 '19 13:12 idanlo

@idanlo Did you fix this? What is the solution?

Shane-Loong avatar Jan 07 '20 21:01 Shane-Loong

I'm having a similar issue with a stack within an overlay. @idanlo did you solve it?

zabojad avatar Jan 31 '20 14:01 zabojad

@zabojad I fixed it by giving my stack a stackID and pushing using the stackID instead of this.props.componentID

Naviagation.setRoot({
  root: {
    stack: {
      id: 'myStack'
    }
  }
});

then:

Navigation.push('myStack', 'myScreen');

Shane-Loong avatar Jan 31 '20 16:01 Shane-Loong

Any update on this, is it supposed to be a Stack Id that gets passed?

Contradiction here: https://stackoverflow.com/questions/56321858/why-is-this-props-componentid-needed

In my own app, we're passing Stack Id when pushing screens because otherwise it crashes... This probably means the Back button will never work which is frustrating.

But I don't know, the docs re. simple navigation is very hard to read. Complex actions are possible with this library but simple actions are very difficult.

AlphaJuliettOmega avatar Feb 01 '21 07:02 AlphaJuliettOmega