facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.62k stars 24.29k forks source link

Inconsistent separator lines #46968

Open OtavioStasiak opened 5 hours ago

OtavioStasiak commented 5 hours ago

Description

The thickness of the separator lines in FlatList is inconsistent on android. Here's another issue related to the separator: GitHub Issue.

Captura de Tela 2024-10-10 às 20 08 25

Steps to reproduce

Add a separator to a FlatList with hairlineWidth or 1.

React Native Version

0.73.6

Affected Platforms

Runtime - Android

Output of npx react-native info

Expo 51 from snack.

Stacktrace or Logs

import React from 'react';
import {
  SafeAreaView,
  View,
  FlatList,
  StyleSheet,
  Text,
  StatusBar,
} from 'react-native';

const DATA = [...Array(100).keys()]

const Separator = () => <View style={{ height: StyleSheet.hairlineWidth, backgroundColor: '#000' }} />

const Item = ({title}) => (
  <View style={styles.item}>
    <Text style={styles.title}>{title}</Text>
  </View>
);

const App = () => {
  return (
    <SafeAreaView style={styles.container}>
      <FlatList
        data={DATA}
        renderItem={({item}) => <Item title={item} />}
        ItemSeparatorComponent={Separator}
      />
    </SafeAreaView>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    marginTop: StatusBar.currentHeight || 0,
  },
  item: {
    backgroundColor: 'white',
    padding: 12,
  },
  title: {
    fontSize: 20,
  },
});

export default App;

Reproducer

https://snack.expo.dev/@diegolmello/f6c27a

Screenshots and Videos

Captura de Tela 2024-10-10 às 20 08 25
react-native-bot commented 5 hours ago
:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - 0.73.10. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.
react-native-bot commented 5 hours ago
:warning: Newer Version of React Native is Available!
:information_source: You are on a supported minor version, but it looks like there's a newer patch available - undefined. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.