Search code examples
javascriptreactjsreact-nativepaddingreact-native-flatlist

How to scroll past the last item in React Native's FlatList?


Alright, so I have a horizontal list of items in React Native. I want to be able to have a little bit of white space when I scroll all the way to the end of the list, so I want to have a padding of some sort. What can I do to have a white space only at the end of the FlatList element without it affecting the spacing between my list items?


Solution

  • Maybe you can set paddingHorizontal for the FlatList using contentContainerStyle.

          <FlatList             
          contentContainerStyle={{
            paddingHorizontal: 20,
            paddingVertical: 20,
          }}         
    
        />