terrylinla / react-native-sketch-canvas

A React Native component for drawing by touching on both iOS and Android.
MIT License
692 stars 450 forks source link

How can I know whether the eraser is active? #171

Open arunnambissan opened 4 years ago

arunnambissan commented 4 years ago

How can I know whether the eraser is active? I want to change the eraser component color when the eraser is active.

arunnambissan commented 4 years ago

I found a workaround as below:

eraseComponent={<View onTouchStart={() => this.setState({eraserActive: true})}>
    <Text>Eraser</Text>
</View>}

strokeSelectedComponent={(color, index, changed) => {
    if (changed) {
        this.setState({eraserActive: false})
    }
    .
    .
    .
})