Skip to content

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

Open
@smfunder

Description

@smfunder

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions