react-native
react-native copied to clipboard
FlatList overflow breaks when using a RefreshControl on Android
Description
Using a FlatList with overflow: 'visible'
works well on Android and iOS, but as soon as a RefreshControl is added, the overflow is hidden on Android only.
Version
0.69.1
Output of npx react-native info
System: OS: macOS 12.4 CPU: (8) x64 Apple M1 Memory: 18.06 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 12.18.3 - ~/.nvm/versions/node/v12.18.3/bin/node Yarn: Not Found npm: 8.9.0 - ~/.nvm/versions/node/v12.18.3/bin/npm Watchman: 2022.07.04.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.2 - /Users/alex/.rvm/gems/ruby-2.7.4/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 2021.1 AI-211.7628.21.2111.8309675 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild Languages: Java: 11.0.15 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.0.0 => 18.0.0 react-native: 0.69.1 => 0.69.1 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
- Create a FlatList with overflow visible and a RefreshControl, encased in a view with some padding at the bottom.
- Observe that on iOS the FlatList items overflow into the padding on the bottom, but on Android the FlatList is bounded by the padding.
- Remove the RefreshControl and observe that the Android FlatList correctly overflows into the padding
Snack, code example, screenshot, or link to a repository
import React from 'react';
import { StyleSheet, View } from 'react-native';
import { NewsCard } from 'components/news-card/NewsCard';
import { panelStyles } from 'styles/panelStyles';
const styles = StyleSheet.create({
newsListWrapper: {
flex: 1,
paddingBottom: 20,
},
flatList: {
overflow: 'visible',
},
});
const NewsList = ({
newsItems,
refetchNews,
refetchingNews,
}) => (
<View style={styles.newsListWrapper}>
<FlatList
style={styles.flatList}
contentContainerStyle={panelStyles}
data={newsItems}
numColumns={2}
keyExtractor={(item) => item.id}
// with this removed, the overflow still works
refreshControl={(
<RefreshControl
onRefresh={refetchNews}
refreshing={refetchingNews}
/>
)}
renderItem={({ item, index }) => {
return (
<View>
<NewsCard newsItem={item} />
</View>
);
}}
/>
</View>
);
Without Refresh Control:
With Refresh Control:
Even when add property onRefresh
also cause this issue
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Closing as stale