Lucas_Santos
Lucas_Santos

Reputation: 4740

Accessibility Actions Not Triggering on FlatList Carousel (iOS and Android)

I’m trying to add accessibility to a FlatList carousel in my React Native app by using Accessibility Actions. I’ve added both the actions and the corresponding function to handle them. However, when I test it in the simulator (both Xcode for iOS and Android Studio), nothing happens when I attempt to trigger the actions.

Here’s a snippet of what I’ve done:

const onAccessibilityAction = (event: any) => {
    console.log("event: ", event);
}

const renderItem = ({ item }) => {
    return (
      <View>
        <Text>{item.name}</Text>
      </View>
    )
}

return (
<ScrollView scrollEnabled={true}>
   <FlatList
      horizontal={true}
      focusable={true}
      accessibilityActions={[
         { name: "increment" },
         { name: "decrement" }
      ]}
      onAccessibilityAction={onAccessibilityAction}
      accessibilityRole="adjustable"
      renderItem={renderItem}
      data={data}
   />
</ScrollView>
)

Am I missing any configuration or step to enable these actions?

Is there a specific way to test this in the simulator for iOS or Android?

React Native: 0.76.6

Upvotes: 1

Views: 50

Answers (0)

Related Questions