Skip to content

Commit 8e73982

Browse files
authored
Merge branch 'master' into android-large-dimensions
2 parents 264c84f + f074081 commit 8e73982

File tree

4 files changed

+32
-194
lines changed

4 files changed

+32
-194
lines changed

example/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,7 +2122,7 @@ PODS:
21222122
- React-perflogger (= 0.80.0)
21232123
- React-utils (= 0.80.0)
21242124
- SocketRocket
2125-
- RNSketchCanvas (2.3.1):
2125+
- RNSketchCanvas (2.3.2):
21262126
- boost
21272127
- DoubleConversion
21282128
- fast_float
@@ -2456,7 +2456,7 @@ SPEC CHECKSUMS:
24562456
ReactAppDependencyProvider: 3267432b637c9b38e86961b287f784ee1b08dde0
24572457
ReactCodegen: 5d41e1df061200130dd326e55cdfdf94b0289c6e
24582458
ReactCommon: b028d09a66e60ebd83ca59d8cc9a1216360db147
2459-
RNSketchCanvas: 87252e53ed56bd879078b5e78e46c3930bddfa3f
2459+
RNSketchCanvas: 2df3557620803639579042dc5b94d35bc179bde8
24602460
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
24612461
Yoga: 395b5d614cd7cbbfd76b05d01bd67230a6ad004e
24622462

package-lock.json

Lines changed: 2 additions & 173 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "git",
55
"url": "https://github.com/sourcetoad/react-native-sketch-canvas"
66
},
7-
"version": "2.3.1",
7+
"version": "2.3.2",
88
"description": "react-native-sketch-canvas allows you to draw / sketch on both iOS and Android devices and sync the drawing data between users. Of course you can save as image.",
99
"author": "Terry Lin",
1010
"react-native": "./src/index.tsx",

src/SketchCanvas.tsx

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)