Pressable onPress not working inside horizontal FlatList when RTL is enabled #51032
Labels
Component: FlatList
Needs: Author Feedback
Needs: Repro
This issue could be improved with a clear list of steps to reproduce the issue.
Type: Unsupported Version
Issues reported to a version of React Native that is no longer supported
Description
Environment:
React Native version: [0.76.6]
Platform: Android
RTL: Enabled (I18nManager.forceRTL(true))
FlatList: horizontal={true}
Affected components: Pressable, FlatList
Description:
When using a horizontal FlatList in an RTL (right-to-left) layout, the onPress event of a Pressable component inside the list item does not trigger reliably. This issue seems to occur particularly on Android, and only when RTL is enabled.
Expected Behavior:
Pressing on a Pressable inside a horizontal FlatList in RTL mode should consistently trigger the onPress event.
Actual Behavior:
Touch interactions (especially onPress) are not registered. It seems like either the gesture responder system is blocked or the touch area is misaligned. This behavior does not occur in LTR layout or when using ScrollView.
Reproducible Sample Code:
`import React from 'react';
import { FlatList, I18nManager, Pressable, Text, View } from 'react-native';
I18nManager.forceRTL(true); // RTL mode enabled
const data = Array.from({ length: 10 }, (_, i) =>
Item ${i}
);export default function App() {
return (
<FlatList
horizontal
data={data}
keyExtractor={(item) => item}
renderItem={({ item }) => (
<Pressable
onPress={() => console.log('Pressed:', item)}
style={{
width: 100,
height: 100,
margin: 10,
backgroundColor: 'lightblue',
justifyContent: 'center',
alignItems: 'center',
}}
>
{item}
)}
/>
);
}
`
Notes:
The issue disappears when switching to LTR mode.
Switching from Pressable to TouchableOpacity sometimes mitigates the issue, but it's inconsistent.
Removing horizontal or switching to ScrollView avoids the problem but isn't ideal for large lists.
Disabling inverted or tweaking contentContainerStyle didn’t resolve the issue.
Would you like me to help you create a GitHub issue from this, or do you want to post it yourself?
Steps to reproduce
.
React Native Version
0.76.6
Affected Platforms
Runtime - Android
Output of
npx @react-native-community/cli info
Stacktrace or Logs
MANDATORY Reproducer
https://github.com/facebook/react-native/
Screenshots and Videos
No response
The text was updated successfully, but these errors were encountered: