Skip to content

Not working with TouchableOpacity/Pressable #71

@UnnatiTecocraft

Description

@UnnatiTecocraft

"react-native": "0.71.3",
"react": "18.2.0",
"react-native-sortable-grid": "^2.0.0",

<SortableGrid
          itemsPerRow={3}
          style={{
            marginHorizontal: 20,
          }}
        >
          {userImages.map((item, index) => {
            return index === 0 ? (
              <View style={style.imageView} key={"key-index-upload-photo"}>
                <TouchableOpacity
                  onPress={() => setIsVisible(true)}
                  style={style.button}
                >
                  <Subtract />
                </TouchableOpacity>
              </View>
            ) : (
              <Pressable
                key={index}
                onPress={() => {
                  Alert.alert("Pressed!");
                  return 10;
                }}
              >
                <View
                  style={{
                    width: 90,
                    height: 90,
                    // backgroundColor: "red",
                    padding: 10,
                  }}
                >
                  <Image
                    style={{
                      width: "100%",
                      height: "100%",
                    }}
                    source={{
                      uri: item.pic,
                    }}
                  />
                </View>
              </Pressable>
            );
          })}
        </SortableGrid>
XRecorder_20032023_105303.mp4

I want to use sorting grid element and also want to open some alert or modal while pressed that element. But currently If I render element inside Pressable/TouchableOpacity then sorting feature is not working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions