I'm using the package "react-native-tab-view" in my app. To switch tab the swipe event is working really fine, but when I press the tab I want to go, it doesn't work, I don't know why... This is my component :
export default function TabsMenu() {
const [index, setIndex] = React.useState(0);
const [routes] = React.useState([
{key: 'env', title: 'Env.'},
{key: 'imp', title: 'Imp.'},
{key: 'suppl', title: 'Suppl.'},
{key: 'menus', title: 'Menus.'},
]);
const renderScene = SceneMap({
env: Environnement,
imp: Impression,
suppl: Supplements,
menus: Menus,
});
return (
<TabView
navigationState={{index, routes}}
renderScene={renderScene}
onIndexChange={setIndex}
initialLayout={initialLayout}
style={{flex: 1}}
renderTabBar={props => (
<TabBar
{...props}
renderLabel={this._renderLabel}
getLabelText={({route: {title}}) => title}
indicatorStyle={styles.indicator}
tabStyle={styles.tabStyle}
style={styles.tab}
/>
)}
/>
);
}
The views used for the routes are just : - Form with some inputs - And the "Menus" one, is a "DraggableFlastList", I tried to remove it, and the tab "Press" event still doesn't work...
By the way, my DraggableFlastList prevents me to swipe left/right on my tabs, (because of TouchableOpacity element I guess), so I am really stuck when I am on the tab "Menus"...
If you guys got a solution... :)
This one worked for me