@@ -156,25 +156,11 @@ class SketchCanvas extends React.Component<SketchCanvasProps, CanvasState> {
156156 }
157157 } ,
158158 onPanResponderRelease : ( _evt , _gestureState ) => {
159- if ( ! this . props . touchEnabled ) {
160- return ;
161- }
162- if ( this . _path ) {
163- this . props . onStrokeEnd ?.( {
164- path : this . _path ,
165- size : this . _size ,
166- drawer : this . props . user ,
167- } ) ;
168- this . _paths . push ( {
169- path : this . _path ,
170- size : this . _size ,
171- drawer : this . props . user ,
172- } ) ;
173- }
159+ this . _handleStrokeEnd ( ) ;
160+ } ,
174161
175- if ( this . ref . current ) {
176- Commands . endPath ( this . ref . current ) ;
177- }
162+ onPanResponderTerminate : ( _evt , _gestureState ) => {
163+ this . _handleStrokeEnd ( ) ;
178164 } ,
179165
180166 onShouldBlockNativeResponder : ( _evt , _gestureState ) => {
@@ -183,6 +169,29 @@ class SketchCanvas extends React.Component<SketchCanvasProps, CanvasState> {
183169 } ) ;
184170 }
185171
172+ _handleStrokeEnd = ( ) => {
173+ if ( ! this . props . touchEnabled ) {
174+ return ;
175+ }
176+
177+ if ( this . _path ) {
178+ this . props . onStrokeEnd ?.( {
179+ path : this . _path ,
180+ size : this . _size ,
181+ drawer : this . props . user ,
182+ } ) ;
183+ this . _paths . push ( {
184+ path : this . _path ,
185+ size : this . _size ,
186+ drawer : this . props . user ,
187+ } ) ;
188+ }
189+
190+ if ( this . ref . current ) {
191+ Commands . endPath ( this . ref . current ) ;
192+ }
193+ } ;
194+
186195 _processText ( text : any ) {
187196 text &&
188197 text . forEach (
0 commit comments