0

I am trying to make a game similar to Word-Link. I want to swipe between multiple letters and create a word. How can i implement this in React-Native. One idea i had was to use the patter lock system but i am still posting this query to find if there is a better way to do it. Currently I am using ToucableOpacity to press the button and generate words. [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>

2 Answers2

0

This npm package provides functionality for detecting swipe gestures in react-native https://www.npmjs.com/package/react-native-swipe-gestures

Apps Maven
  • 1,314
  • 1
  • 4
  • 17
0

onDrag, onDrop, onMouseMove. Which, for phone on react-native you need this. onStartShouldSetResponder, onResponderGrant, onResponderMove.

Tyler2P
  • 2,324
  • 26
  • 22
  • 31
Chirag Dave
  • 786
  • 6
  • 5