React-native-tab-view: React-native 0.61.0-rc.3 Can't swipe between tabs

Created on 10 Sep 2019  路  14Comments  路  Source: satya164/react-native-tab-view

Current behaviour

On Android only
On react-native 0.61.0-rc.3
can't swipe between tabs

Expected behaviour

On Android with react-native 0.61.0-rc.3
Will swipe between tabs when I set "swipeEnabled"

Code sample

import * as React from 'react';
import { View, StyleSheet, Dimensions } from 'react-native';
import { TabView, SceneMap } from 'react-native-tab-view';

const FirstRoute = () => (
  <View style={[styles.scene, { backgroundColor: '#ff4081' }]} />
);

const SecondRoute = () => (
  <View style={[styles.scene, { backgroundColor: '#673ab7' }]} />
);

export default class TabViewExample extends React.Component {
  state = {
    index: 0,
    routes: [
      { key: 'first', title: 'First' },
      { key: 'second', title: 'Second' },
    ],
  };

  render() {
    return (
      <TabView
        navigationState={this.state}
        renderScene={SceneMap({
          first: FirstRoute,
          second: SecondRoute,
        })}
        onIndexChange={index => this.setState({ index })}
        initialLayout={{ width: Dimensions.get('window').width }}
      />
    );
  }
}

const styles = StyleSheet.create({
  scene: {
    flex: 1,
  },
});

What have you tried

react native 0.60.5 Same code

Your Environment

| software | version
| ---------------------------- | -------
| ios or android | android
| react-native | 0.61.0-rc.3
| react-native-tab-view |2.10.0
| react-native-gesture-handler |1.4.1
| react-native-reanimated |1.2.0
| node |11.10.0
| npm or yarn |yarn

bug needs repro

Most helpful comment

Android app crash in release when swipe tab but debug is ok.

"react-native": "0.61.2",
"react-native-gesture-handler": "^1.4.1",
"react-native-reanimated": "^1.3.0",

All 14 comments

Can you provide a repro?

same issue in React-native 0.61.0-rc.3

You can test it here: https://github.com/DomiR/react-navigation5-swipe-problem. I've just verified this on android.

is there anyone found workaround for this, getting the same issue on android.

I have the same issue with react-native 0.61.1 on android

I have the same issue with react-native 0.61.2 ,react-native-reanimated: 1.3.0, react-native-gesture-handler:1.4.1, react-native-tab-view : 2.10.0 on android

Update:
Adding this in MainActivity.java solved my issue

import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;

@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
}

The previous comment fixes it for me on Debug mode, but makes the app crash in release mode.

Android app crash in release when swipe tab but debug is ok.

"react-native": "0.61.2",
"react-native-gesture-handler": "^1.4.1",
"react-native-reanimated": "^1.3.0",

iOS Release App is also crashed

My system information -

System: OS: macOS Mojave 10.14.5 CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz Memory: 40.50 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.4.1 - ~/.nvm/versions/node/v10.4.1/bin/node npm: 6.1.0 - ~/.nvm/versions/node/v10.4.1/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0 Android SDK: API Levels: 23, 24, 25, 26, 27, 28, 29 Build Tools: 23.0.1, 25.0.3, 26.0.2, 27.0.3, 28.0.0, 28.0.2, 28.0.3, 29.0.2 System Images: android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom IDEs: Xcode: 11.0/11A420a - /usr/bin/xcodebuild npmPackages: @react-native-community/cli: ^2.9.0 => 2.9.0 react: 16.9.0 => 16.9.0 react-native: 0.61.1 => 0.61.1 npmGlobalPackages: react-native-create-library: 3.1.2

same problem ios release

extractEvents@94:13054
@94:13845
_e@94:88659
Ne@94:13582
Ue@94:13755
receiveEvent@94:14164
value@24:3685
@24:841
value@24:2939
value@24:813
value@:
'
* First throw call stack:
(0x18ea05c30 0x18e7200c8 0x10496ccd0 0x1049de9a8 0x18ea0c724 0x18e8d5280 0x18e8d5e90 0x10499f680 0x1049a1790 0x1049a14f4 0x105915e48 0x1059172a8 0x10591e938 0x10591f528 0x10592a4e8 0x18e712aa0 0x18e718c78)
libc++abi.dylib: terminating with uncaught exception of type NSException

rn 0.61.2
"react-native-gesture-handler": "^1.4.1",
"react-native-reanimated": "^1.3.0",

TouchableOpacity from gesture handler inside the TabView crash the app in iOS release too

same issue +1 on RN 0.61.2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

karthikeyansundaram2 picture karthikeyansundaram2  路  3Comments

moerabaya picture moerabaya  路  4Comments

QuentinBrosse picture QuentinBrosse  路  4Comments

jasonkw9 picture jasonkw9  路  3Comments

jouderianjr picture jouderianjr  路  3Comments