Search code examples
arraysreact-nativereact-native-flatlistflatlist

react native horizontal flatlist not scrolling


I have a horizontal flatlist but it's not scrolling

I don't know the reason yet

Can someone help me?

              <FlatList
                data={dashboardData}
                contentContainerStyle={{
                  width: '100%',
                  paddingHorizontal: 30,
                  flex: 1,
                }}
                keyExtractor={key => key}
                renderItem={renderItem}
                horizontal
                showsHorizontalScrollIndicator={false}
              />

Solution

  • Update contentContainerStyle to,

    ...
    contentContainerStyle={{
      //Remove `flex: 1` and `width` property, that will wrap all of the child views.
      paddingHorizontal: 30,
    }}
    ...