I'm using react-native-modalize with flatListProps but I can't scroll the flatList, I tried panGestureEnabled={false}, or remove the height style but none of them fix it, here is my code:
<Modalize
ref={ref}
children={children}
adjustToContentHeight={true}
onOverlayPress={closeModal}
onClosed={onCloseCallback}
HeaderComponent={renderHeader}
flatListProps={
listData?.length > 0
? {
data: listData,
renderItem: renderListItem,
ItemSeparatorComponent: renderSeparator,
keyExtractor: listKeyExtractor,
contentContainerStyle: dStyles.dataList,
}
: undefined
}
modalStyle={styles.borderRadius}
/>
const dStyles = StyleSheet.create({
dataList: {
height: 400,
},
});
I check the listData and the array has 63 items but the flatList only render the first 9 items.
Fixed by adding to
flatListPropsthese props:initialNumToRender: 10maxToRenderPerBatch:10And add to
<ModalizepropdisableScrollIfPossible={false}I'm not sure why but the
heightis also need to be removed. So this is new code:As I mentioned, I cannot limit the
FlatListheight, so if the list is long enough,<Modalizewill be expanded full screen, that is the limitation of this solution.