2

My goal is to program a game assistant - app that runs on the background and does the following:

1) takes screenshot programmatically https://aboutreact.com/take-screenshot-programmatically/ 2) analyzes some pixels of it 3) creates programmatical screen touches based on the screenshot

But I am not sure whether it is possible to use react native for creating screen touches. Any ideas? It appears to be possible in java, at least:

How to programmatically trigger the touch event in android?

Thank you!

Joel
  • 73
  • 1
  • 6

1 Answers1

1

It is possible to handle screen touches in react native using panResponder. You can more about it here:

https://facebook.github.io/react-native/docs/linking-libraries-ios

Also react-native have animated view that could be coupled by panResponder and I think it is applicable for you because you want to develop a game. You can read about react-native animations here:

https://facebook.github.io/react-native/docs/animations

Beside all of this if your game have many motions and is dependent to screen touches react-native maybe is not a good choice. Because react-native performance in such applications would be low. So I recommend be careful about the tech that you want to use.

Meisam Nazari
  • 904
  • 10
  • 18
  • 1
    Instead of detecting screen touches my goal is to generate them programmatically. That is, a game would treat the programmatical touch as if the player touched the screen. Just iterating, because to my knowledge panResponder is not capable of that. But I can be wrong - I am quite new to react-native. – Joel Aug 29 '19 at 20:39
  • 1
    I think panResponder is capable of doing want you want. you can generate your game by react-native elements and when user touches screen you can generate your function that you want. Read about some functions of panResponder like: onStartShouldSetPanResponder, onPanResponderMove, and onPanResponderRelease. I hope it would be helpful. – Meisam Nazari Aug 30 '19 at 06:39