react-native icon indicating copy to clipboard operation
react-native copied to clipboard

FlatList overflow breaks when using a RefreshControl on Android

Open alex-gale opened this issue 2 years ago • 1 comments

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

  1. Create a FlatList with overflow visible and a RefreshControl, encased in a view with some padding at the bottom.
  2. Observe that on iOS the FlatList items overflow into the padding on the bottom, but on Android the FlatList is bounded by the padding.
  3. 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: Screenshot 2022-07-12 at 16 28 31

With Refresh Control: Screenshot 2022-07-12 at 16 28 44

alex-gale avatar Jul 12 '22 15:07 alex-gale

Even when add property onRefresh also cause this issue

doublelam avatar Oct 22 '22 14:10 doublelam

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.

github-actions[bot] avatar Apr 20 '23 18:04 github-actions[bot]

Closing as stale

cortinico avatar Dec 04 '23 10:12 cortinico