1

Pushing a screen of a React Navigation Stack with a FlatList will break the scrolling support on Web.

Tried several suggested solutions - none of these worked:

  • Including a parent View with flex property style={{flex: 1}}
  • Replacing FlatList with a ScrollView

What worked for me was adding a flex property to cardStyle in screenOptions of the React Navigation stack navigator:

<Stack.Navigator mode="card" screenOptions={{ cardStyle: { flex: 1 } }}>
  <Stack.Screen name="MyScreen" component={MyScreen} />
</Stack.Navigator>

3 Answers 3

6

What worked for me was adding a flex property to cardStyle in screenOptions of the React Navigation stack navigator:

<Stack.Navigator mode="card" screenOptions={{ cardStyle: { flex: 1 } }}>
  <Stack.Screen name="MyScreen" component={MyScreen} />
</Stack.Navigator>

See also: https://github.com/react-navigation/react-navigation/issues/6165

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for this question and answer, been searching for the solution for ages
0

I had this error and spent an age trying to find the source. I had a FlatList which assumed was the to blame... but the error remained even after commenting out.... after much cache flushing... I traced the problem to having a native base Select inside a native base Modal.

Comments

0

This solution works for me. We limit the view's height by using flexGrow: 1 and enabling overflow.

<Stack.Navigator
  screenOptions={{
    contentStyle: ((Platform.OS === 'web') ? {
      flexGrow: 1,
      overflow: 'scroll'
    } : {}),
  }}
>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.