Open hardikamber opened 3 months 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.72.12. 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. |
:warning: | Missing Reproducible Example |
---|---|
:information_source: | We could not detect a reproducible example in your issue report. Please provide either:
|
⚠️ Missing Reproducible Example ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
- If your bug is UI related: a Snack
- If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.
Same issue here.
The child FlatList
ignores the horizontal={true}
prop.
My react-native version is 0.71.17
.
I am testing it on iOS.
<FlatList
data={["orange", "pink", "red"]}
horizontal={true}
renderItem={({ item }) => {
return (
<View
style={{
flex: 1,
backgroundColor: item,
height: Dimensions.get("window").height,
width: Dimensions.get("window").width,
}}
>
{"orange" === item && (
<View style={{ flex: 1, backgroundColor: "brown" }}>
<FlatList
contentContainerStyle={{ flex: 1 }}
data={["gray", "black", "blue", "green", "yellow"]}
horizontal={true}
showsHorizontalScrollIndicator
renderItem={({ item }) => {
return (
<View
style={{
backgroundColor: item,
height: 100,
width: Dimensions.get("window").width - 10,
}}
/>
);
}}
/>
</View>
)}
</View>
);
}}
snapToInterval={Dimensions.get("window").width}
/>
Description
Flatlist inside a horizontal flatlist is not rendering horizontally
Steps to reproduce
Create a component below import React from 'react'; import { FlatList, View, Text } from 'react-native';
const ParentComponent = () => { const parentData = [{ id: 'a' }, { id: 'b' }]; // Example parent data const childData = [{ id: '1' }, { id: '2' }, { id: '3' }]; // Example child data
const renderChildItem = ({ item }) => ( <View style={{ width: 100, height: 100, margin: 10, backgroundColor: 'lightblue' }}>
);
const renderChildFlatList = () => ( <FlatList data={childData} renderItem={renderChildItem} keyExtractor={item => item.id} horizontal={true} showsHorizontalScrollIndicator={false} /> );
const renderParentItem = ({ item }) => ( <View style={{ width: 200, height: 200, margin: 10, backgroundColor: 'lightcoral' }}>
);
return ( <FlatList data={parentData} renderItem={renderParentItem} keyExtractor={item => item.id} horizontal={true} showsHorizontalScrollIndicator={false} /> ); };
export default ParentComponent;
React Native Version
0.72.0
Affected Platforms
Runtime - Android, Runtime - iOS
Output of
npx react-native info
Stacktrace or Logs
Reproducer
added above
Screenshots and Videos