react-native-pager-view icon indicating copy to clipboard operation
react-native-pager-view copied to clipboard

Couldn't find a navigation context

Open AleeeKoi opened this issue 6 years ago • 2 comments

Hello! All works fine except for the assignment of the ref property. If I create a reference in my functional component like this:

const viewPageRef = React.useRef()

an passing to the ViewPage component:

<ViewPager ref={viewPageRef} style={styles.viewPager} initialPage={0} >
  {pages.map((Comp, i) => (<Comp key={`main-page-view-${i}`} />))}
</ViewPager>

I got the following error:

Couldn't find a navigation context. Have you wrapped your app with 'NavigationContainer'? See https://reactnavigation.org/docs/getting-started for setup instructions.

and yes, my app is wrapped in NavigationContainer. I'm using react-navigation v5.

I'm forgetting something?

Thank you

AleeeKoi avatar Sep 08 '20 15:09 AleeeKoi

Encontrou alguma resposta amigo, estou com o mesmo problema.

BeAmarawn avatar Feb 02 '21 17:02 BeAmarawn

Could you compare with our example ? In the example we are also using rn v5

https://github.com/callstack/react-native-viewpager/blob/master/example/src/App.tsx

troZee avatar Feb 03 '21 13:02 troZee