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

Can I set stroke width manually? #148

Open JasonXDDD opened 4 years ago

JasonXDDD commented 4 years ago

I want to set stroke width manually on Slider, but nextStrokeWidth() function cannot meet my needs. Do like

//origin source code
nextStrokeWidth() {
    if ((this.state.strokeWidth >= this.props.maxStrokeWidth && this._strokeWidthStep > 0) ||
      (this.state.strokeWidth <= this.props.minStrokeWidth && this._strokeWidthStep < 0))
      this._strokeWidthStep = -this._strokeWidthStep
    this.setState({ strokeWidth: this.state.strokeWidth + this._strokeWidthStep })
  }

// hope add new function
setStrokeWidth(newWidth){
// to set props.strokeWidth with newWidth
}

tks.