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

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

Open
RaviDhakadDO opened this issue May 30, 2024 · 6 comments
Open

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

RaviDhakadDO opened this issue May 30, 2024 · 6 comments
Labels
question Further information is requested

Comments

@RaviDhakadDO
Copy link

RaviDhakadDO commented May 30, 2024

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.

@RaviDhakadDO RaviDhakadDO added the question Further information is requested label May 30, 2024
@Gaohaoyang
Copy link

same here

@nerodroid
Copy link

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

@alextbogdanov
Copy link

Same here!

@hamzawii
Copy link

Same here

@alextbogdanov
Copy link

I was able to fix it by taking out the part that needs to use the context as a separate component, adding the hook there and then nesting it in the <Tabs.Container>

@fistofzen
Copy link

help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants