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

Cannot Toggle 'SwipeEnabled' Property, Causes Crash #2973

Closed
smilingkylan opened this issue Mar 29, 2018 · 3 comments
Closed

Cannot Toggle 'SwipeEnabled' Property, Causes Crash #2973

smilingkylan opened this issue Mar 29, 2018 · 3 comments

Comments

@smilingkylan
Copy link

Version

Tell us which versions you are using:

  • react-native-router-flux v4.0.0-beta.28
  • react-native v0.51.0

Expected behavior

I am attempting to use Redux in order to toggle the swipeEnabled property from true to false depending upon whether a certain component is in "drag & drop" mode. When I toggle it into drag & drop mode, I am telling redux to toggle a specific boolean that changes the swipeEnabled property from true to false. Once they are done drag & dropping then Redux sets the swipeEnabled property back to true. So swiping between scenes should be disabled while one of my components is dragging and dropping so that if the user happens to drag the item horizontally at all, it should not start to cause a scene transition.

Actual Behavior

When I attempt to toggle the swipeEnabled property from true to false I get the following message:

ExceptionsManager.js:65 Error: There is no route defined for key key1.
Must be one of: 'key3'

This error is located at:
    in CardStack (at CardStackTransitioner.js:97)
    in RCTView (at View.js:112)
    in View (at Transitioner.js:192)
    in Transitioner (at CardStackTransitioner.js:49)
    in CardStackTransitioner (at StackNavigator.js:60)
    in Unknown (at createNavigator.js:52)
    in Navigator (at createNavigationContainer.js:210)
    in NavigationContainer (at OverlayNavigator.js:44)
    in RCTView (at View.js:112)
    in View (at OverlayNavigator.js:43)
    in Unknown (at createNavigator.js:52)
    in Navigator (at createNavigationContainer.js:210)
    in NavigationContainer (at Router.js:70)
    in App (at Router.js:91)
    in Router (created by Connect(Router))
    in Connect(Router) (at Main.ui.js:220)
    in RCTView (at View.js:112)
    in View (at MenuProvider.js:200)
    in RCTView (at View.js:112)
    in View (at MenuProvider.js:199)
    in MenuProvider (at Main.ui.js:219)
    in Main (created by Connect(Main))
    in Connect(Main) (at app.js:156)
    in Provider (at app.js:155)
    in App (at renderApplication.js:35)
    in RCTView (at View.js:112)
    in View (at AppContainer.js:102)
    in RCTView (at View.js:112)
    in View (at AppContainer.js:122)
    in AppContainer (at renderApplication.js:34)

Steps to reproduce

For non-obvious bugs, please fork this component, modify Example project to reproduce your issue and include link here.

  1. Create an application with swipeEnabled={true} on a <Tabs ...> element
  2. Attempt to dynamically change the swipeEnabled property from true to false
@smilingkylan
Copy link
Author

I should mention that it might be easier to implement as a function call, for example: Actions.swipeEnabled(false) or Actions.disableSwipe, for example.

@asciifaceman
Copy link
Contributor

Also usually when you see an error like that (often seen with say Actions.reset) its because it doesn't see the route on the layer it looks. Actions.reset, for example, can only reset to the top level views of the router/top scene etc.

It's hard to say without seeing your code

@aksonov
Copy link
Owner

aksonov commented Jun 6, 2018

@asciifaceman is correct - reset works for top level views. Closing due inactivity

@aksonov aksonov closed this as completed Jun 6, 2018
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