1

I have a BigList element that renders group of Pressable elements. Elements work perfectly most of the time but sometimes they don't respond. It just doesn't press. BigList Element:

<BigList
  data={innerSoldierData}
  keyExtractor={(item) => {
    return `${item.urn}`;
  }}
  numColumns={5}
  itemHeight={250}
  renderItem={(itemData) => {
    return <View style={[
      {
        flex: 1,
        margin: 8,
        marginVertical: 16,
        height: 200,
        borderRadius: 8,
        elevation: 4,
        backgroundColor: "white",
        shadowColor: "black",
        shadowOpacity: 0.25,
        shadowOffset: { width: 0, height: 2 },
        shadowRadius: 8,
        overflow: Platform.OS === "android" ? "hidden" : "visible",
        height: 200,
        justifyContent: "center",
      },
    ]}><Pressable android_ripple={{ color: "#ccc" }}
                  style={({ pressed }) => [
                    { flex: 1 },
                    pressed ? {
                      backgroundColor: "#ccc",
                      opacity: 0.5,
                    } : null,
                  ]}>
      ...other stuff here

    </Pressable></View>;
  }}
  refreshing={isLoading}
  onRefresh={onRefresh}
  refreshControl={<RefreshControl refreshing={isLoading} />}
/>
Saraf
  • 200
  • 10
Eren Talan
  • 51
  • 3
  • I would suggest creating a whole new element called so that the code will not look that complex. Did you try to debug and see if any log emitted while pressing your element? Try to add console.log to your onPress function and see when it works or not – Saraf Jun 15 '23 at 09:26
  • It's actually have "RenderedItem" component in real code.There is no console.log ive already tried – Eren Talan Jun 15 '23 at 10:41
  • It's hard to understand the problem because you did not post the entire BigListComponent and what it renders, but from what can be seen, there is no onPress handling in Pressable component, did you post it all? – Saraf Jun 15 '23 at 13:35
  • Even tough its just console.log in onPress sometimes it doesnt work – Eren Talan Jun 16 '23 at 08:00

0 Answers0