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

Push new view and come back to the swiper make troubles (wix/react-native-navigation) #757

Open
zagoa opened this issue Apr 11, 2018 · 9 comments

Comments

@zagoa
Copy link

zagoa commented Apr 11, 2018

Which OS ?

Android

Version

  • react-native-swiper v1.5.13
  • react-native v0.54.4

Problem

I use my swiper to do something like Snapchat. I also use wix/React-native-navigation. But in on of my children of the swiper I have a button. This button can push a new view, this is all right ( I have a new view with some kind of things ).
But when I press the back button of my android phone I go back to the swiper view BUT the swipe is broken, I need to do multiple swipes to scroll to another screen of the swiper.

Steps to reproduce

  1. Create a swiper with 2 screen
  2. In one of those screen add a button to push a new view (wix/react-native-navigation).
  3. Then do a pop() or press the back button of an android phone
@ozberkctn
Copy link

i have same problem. any solution ?

@viotti
Copy link

viotti commented Apr 24, 2018

Are you using React Native Navigation v2? If so, I've traced the problem to v2.0.2247.

React Native Swiper works with React Native Navigation v2.0.2246, on Android, but not with v2.0.2247.

This commit, wix/react-native-navigation#3094, seems to break with React Native Swiper.

@viotti
Copy link

viotti commented May 2, 2018

This issue does not happen with React Native Navigation version 2.0.2274.

@zagoa
Copy link
Author

zagoa commented May 2, 2018

So the problem come from react native navigation version 1. I use it because v2 is not released.

@viotti
Copy link

viotti commented May 3, 2018

I did not try React Native Swiper with RNN version 1. But I had the same problem you described with version 2.0.2247. Today I updated RNN to 2.0.2274 and the swiper is behaving properly again.

@Tritty
Copy link

Tritty commented Jun 28, 2018

I have the same problem with v0.44.3RN and v1.1.245 RNN. And I CAN NOT update the RNN. Is there any way to resolve it? Thanks a lot.

@Tritty
Copy link

Tritty commented Jun 28, 2018

Hi,all!I've found the resolusion. Please check at Toggling tabs not working after poping back in Android. This work for me!

Here's my code.

constructor(props: Props) {
    super(props);
    this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
  }

public render(): JSX.Element {
    const { showTouch, flex } = this.state;
    return (
      <View>
            <Swiper
              style={{padding: 0, flex}}
              //other props
            >
              // your component
            </Swiper>
      </View>
    );

private onNavigatorEvent(event) {
    switch (event.id) {
      case "willAppear":
        this.setState({ flex: 1 });
        break;
      case "willDisappear":
        this.setState({ flex: 0 });
        break;
    }
  }
}

I hope it works for u too!

@Tritty
Copy link

Tritty commented Jun 28, 2018

You can alse user RNN's resetTo() to go back you original page. It works too.

@zagoa
Copy link
Author

zagoa commented Jul 16, 2018

Great solution ! Thank you so much.

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

4 participants