ptomasroos / react-native-scrollable-tab-view

Tabbed navigation that you can swipe between, each tab can have its own ScrollView and maintain its own scroll position between swipes. Pleasantly animated. Customizable tab bar
https://www.npmjs.com/package/react-native-scrollable-tab-view
6.93k stars 2.29k forks source link

onChangeTab results in undefined error #1193

Open mmckinley8 opened 1 year ago

mmckinley8 commented 1 year ago

Steps to Reproduce

Change a tab

Expected Behavior

Tab should change

Actual Behavior

Nothing happens, results in error. CHANGING TAB never prints out. Just get the undefined error.

      <ScrollableTabView
        initialPage={0}
        locked={false}
        onChangeTab={({ i, from }) => {
          console.log('CHANGING TAB', i, from)
          return i !== from && setSelectedTab(i)
        }}
        renderTabBar={() => <ScrollableTabBar inactiveTextColor="#425164" />}
        scrollWithoutAnimation={false}
        style={{ backgroundColor: 'white' }}
        tabBarActiveTextColor="#3D7BCC"
        tabBarBackgroundColor="white"
        tabBarInActiveTextColor="#425164"
        tabBarTextStyle={{ fontFamily: 'Calibre-Medium', fontWeight: '500', fontSize: 17 }}
        tabBarUnderlineStyle={{ backgroundColor: '#3D7BCC' }}
      >
        {topics.map((item, index) => {
          return <View isSelected={selectedTab === index} key={item.id} tabLabel={item.label} />
        })}
      </ScrollableTabView>
shukerullah commented 1 year ago

The issue has been fixed, but it hasn't been updated on npm yet. Temporary fix: yarn add https://github.com/ptomasroos/react-native-scrollable-tab-view