PedroBern / react-native-collapsible-tab-view

A cross-platform Collapsible Tab View component for React Native
MIT License
827 stars 160 forks source link

Getting Error: useTabsContext must be inside a Tabs.Container #414

Open RaviDhakadDO opened 3 weeks ago

RaviDhakadDO commented 3 weeks ago

Hello, I am getting following error while using hooks that are provided in documentation such as :- useCurrentTabScrollY();

ERROR Error: useTabsContext must be inside a Tabs.Container

Here is the configuration

"react-native": "0.73.0",
"react-native-collapsible-tab-view": "7.0.1"

Below is the example

import { Tabs, useCurrentTabScrollY } from "react-native-collapsible-tab-view";

 const Example: React.FC = () => {
    const scrollY = useCurrentTabScrollY();

    return (
        <Tabs.Container
            renderHeader={Header}
            headerHeight={HEADER_HEIGHT} 
        >
            <Tabs.Tab name="A">
                <Tabs.FlatList
                    data={DATA}
                    renderItem={renderItem}
                    keyExtractor={identity}
                />
            </Tabs.Tab>
            <Tabs.Tab name="B">
                <Tabs.ScrollView>
                    <View style={[styles.box, styles.boxA]} />
                    <View style={[styles.box, styles.boxB]} />
                </Tabs.ScrollView>
            </Tabs.Tab>
        </Tabs.Container>
)
}

Kindly provide help me on this.

Gaohaoyang commented 3 weeks ago

same here

nerodroid commented 1 week ago

Have the same issue here. @Gaohaoyang @RaviDhakadDO found anything useful ?