Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On item: Pressable not detected. TouchableHightligth is detected #73

Open
asalha opened this issue Jun 9, 2021 · 2 comments
Open

On item: Pressable not detected. TouchableHightligth is detected #73

asalha opened this issue Jun 9, 2021 · 2 comments

Comments

@asalha
Copy link

asalha commented Jun 9, 2021

Current Behavior

Very weird behavior. If I use Pressable, the click is detected once over 100 of the times. With TouchableHighlight, it works perfectly!

How to reproduce

When I replace in the code below TouchableHighligth with Pressable, it doesn't work

<ScrollBottomSheet
        style={{ backgroundColor: "#f8f8f8" }}
        ref={bottomSheetRef}
        componentType="FlatList"
        // snapPoints={[128, "50%", windowHeight]}
        snapPoints={[100, windowHeight]}
        initialSnapIndex={1}
        onSettle={(index) => {
          console.log(index);
        }}
        renderHandle={() => (
          <View style={scrollBottomSheet.header}>
            <View style={scrollBottomSheet.panelHandle} />
          </View>
        )}
        data={groupContext.state.userGroupList}
        keyExtractor={(item) => item.id}
        renderItem={({ item }) => {
          return (
            <TouchableHighlight
              onPress={() => {
                console.log("onPress detected on item");
              }}
              onLongPress={() => {
                console.log("longPress detected on item");
              }}
            >
              <Text>{item.id}</Text>
            </TouchableHighlight>
          );
        }}
        contentContainerStyle={scrollBottomSheet.contentContainerStyle}
      />

Your Environment

version
Platform (Android, iOS or both)
react-native-scroll-bottom-sheet
react-native
react-native-gesture-handler
react-native-reanimated
@darkbasic
Copy link

TouchableHighlight works ONLY if you import it from react-native-gesture-handler, not react-native!

@darkbasic
Copy link

TouchableHighlight works ONLY if you import it from react-native-gesture-handler, not react-native!

This fix works only in Android, but not on iOS.

The following one works for both: https://gorhom.github.io/react-native-bottom-sheet/troubleshooting/#pressables--touchables-are-not-working-on-android

Please close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants