1

嗨,我无法在 react-native-swipe-list-view 中进行向左/向右滑动操作。我阅读了文档,但没有找到任何示例。

您可以看到我在下面的代码中成功使用了一些 onpress 操作。但是onLeftAction不起作用 - 它没有做任何事情(也不打印到控制台)

我的代码:

<SwipeListView
        data={swipeListData}
    /*START ISSUE*/
        leftActionValue={70}
        onLeftAction={(data, rowMap) => {
            console.log("swipeleft");
        }
    /*END ISSUE*/
        }
        renderItem={(data, rowMap) => (
    /*HERE EVERYTHING WORKS*/
    
        )}
    
        renderHiddenItem={(data, rowMap) => (
    /*ALSO IN HERE*/ 
        )}
        leftOpenValue={75}
        rightOpenValue={-75}
    />
4

1 回答 1

1

onLeftAction不回应leftActionValue

您将需要定义leftActivationValue,这将触发onLeftAction

道具的区别:

leftActionValue - 手势释放后行将移动到的左侧操作的 TranslateX 值

onLeftAction - 当行转移到时触发 - leftActivationValue

参考:https ://github.com/jemise111/react-native-swipe-list-view/blob/2f5cdec5ebd6ee320c42e4c9f477d1f072ecb40c/docs/actions.md

于 2021-01-16T15:16:30.197 回答