react-native-sortable-grid icon indicating copy to clipboard operation
react-native-sortable-grid copied to clipboard

Not working with TouchableOpacity/Pressable

Open UnnatiTecocraft opened this issue 2 years ago • 0 comments

"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>

https://user-images.githubusercontent.com/99247348/226254146-d1d1af5b-0927-4728-a42d-f3910c9f2630.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.

UnnatiTecocraft avatar Mar 20 '23 05:03 UnnatiTecocraft