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

[iOS] Swipe horizontalOnly not working with RN 0.76.1 #332

Open
smfunder opened this issue Nov 14, 2024 · 0 comments
Open

[iOS] Swipe horizontalOnly not working with RN 0.76.1 #332

smfunder opened this issue Nov 14, 2024 · 0 comments

Comments

@smfunder
Copy link

smfunder commented Nov 14, 2024

I migrated my app to RN 0.76.1 with bridgeless mode disable (due other incompatibilities with other libraries) and the swipe action is no longer working.

Here is an example:

const swipeRef = useRef()

  const rightSwipe = (onDelete) => {
    return (
      <View style={{ position: 'absolute', right: 0, display: 'flex' }}>
        <View style={{ ...styles.swipeDelete, height: style.height ? style.height : 40 }}>
          <Pressable onPress={() => onDelete(swipeRef)} style={[styles.actionText]}>
            <FastImage style={styles.deleteIcon} source={Images.DELETE_CHAT_GROUP} />
          </Pressable>
        </View>
      </View>
    )
  }

  return (
    <View>
      {rightSwipe(onDelete)}
      <Interactable.View
        ref={swipeRef}
        horizontalOnly={true}
        dragEnabled={true}
        style={{ backgroundColor: 'red' }}
        snapPoints={[{ x: -80 }, { x: 0 }]}
        boundaries={{ left: -80, right: 0, bounce: 0 }}
        onSnapStart={event => event.nativeEvent.index !== 1 && onDelete(swipeRef)}>
        <Animated.View style={[containerStyle]}>
          <TouchableOpacity style={style} onPress={onPress}>
            <Image source={icon} style={styles.icon} />
            <Text style={styles.title}>{title}</Text>
            <Image source={Images.ARROW_RIGHT} style={styles.arrow} />
          </TouchableOpacity>
        </Animated.View>
      </Interactable.View>
    </View>
  )

I've been trying to debug a little bit the code for iOS and I've been able to detect that the - (void)handlePan:(UIPanGestureRecognizer *)pan method is called and self.dragBehavior.anchorPoint is updated correctly as I moved the finger in the screen.

But the UI is not moving the container view.

This is with "react-native-interactable": "^2.0.1"

Anyone else facing this issue?

This is working correctly in Android.

I'm using this method to swipe cell in conjunction with FlashLIst from Shopify because this one provides much more performance.

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

1 participant