【问题标题】:How to implement swipe gesture used in Word-Link Game using react-native如何使用 react-native 实现 Word-Link 游戏中使用的滑动手势
【发布时间】:2020-09-07 05:07:38
【问题描述】:

我正在尝试制作类似于 Word-Link 的游戏。我想在多个字母之间滑动并创建一个单词。我如何在 React-Native 中实现这一点。我的一个想法是使用模式锁定系统,但我仍在发布此查询以查找是否有更好的方法来做到这一点。目前我正在使用 ToucableOpacity 按下按钮并生成单词。 [1]:https://i.stack.imgur.com/z4iKW.jpg

            <TouchableOpacity
          onPress={() => {
            this.addLetters(alpha4[0])
            // Alert.alert("A")
            box1 = alpha4[0]

            this.setState({ box1: box1 })
          }}
        >
          <View style={{ width: 50, height: 50, backgroundColor: 'beige' }}>
        <Text style={{ fontSize: 30, fontWeight: 'bold', justifyContent: 'center', textAlignVertical: 'center', textAlign: 'center', borderWidth: 5 }}>{alpha4[0]}</Text>
          </View>
        </TouchableOpacity>

【问题讨论】:

    标签: android node.js react-native swipe multi-touch


    【解决方案1】:

    这个 npm 包提供了在 react-native 中检测滑动手势的功能 https://www.npmjs.com/package/react-native-swipe-gestures

    【讨论】:

    • 如何使用这个 npm 包连接多个组件?
    【解决方案2】:

    onDragonDroponMouseMove。其中,对于 react-native 上的电话,您需要 thisonStartShouldSetResponder, onResponderGrant, onResponderMove.

    【讨论】:

      猜你喜欢
      • 2020-06-17
      • 1970-01-01
      • 2020-12-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多