In order to build a drawing app, one needs mouse position, preferably in real time (only seems slightly necessary) and a canvas. For the canvas I am using react-native-canvas, and a touchable to detect mouse movement like so:
export default class App extends Component {
render() {
return (
<View style={style.width100}>
<Touchable style={style.width100} onPressIn={() => Alert.alert("TouchStart")} onPressOut={() => Alert.alert("TouchEnd")}>
<Canvas ref={handler}/>
</Touchable>
</View>
)
}
}
const style = Stylesheet.create({
width100: {
width: Dimensions.get('window').width,
height: Dimensions.get('window').height
}
})
This is only a snippet, I've actually got a whole lot more stuff here like imports etc, but this is the important stuff...
The handler
method makes the canvas' background black, which takes up the full screen, however, when I touch the screen, nothing happens.
I've tried using the onPress
handler instead, but same result.
If this is a really basic question, I apologise, I'm quite new. Thanks for understanding.