Skip to content

Commit

Permalink
Fix pinching broken due to incorrect typeguards (#121)
Browse files Browse the repository at this point in the history
Co-authored-by: thomasvo <[email protected]>
  • Loading branch information
thomasttvo and thomasvo authored Oct 30, 2024
1 parent 115c884 commit 9fc4d62
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
6 changes: 4 additions & 2 deletions lib/commonjs/ReactNativeZoomableView.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/commonjs/ReactNativeZoomableView.js.map

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions lib/module/ReactNativeZoomableView.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/module/ReactNativeZoomableView.js.map

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions src/ReactNativeZoomableView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class ReactNativeZoomableView extends Component<
private set gestureStarted(v: boolean) {
this._gestureStarted = v;
}

public get gestureStarted() {
return this._gestureStarted;
}
Expand Down Expand Up @@ -694,7 +695,8 @@ class ReactNativeZoomableView extends Component<
const gestureCenterPoint = calcGestureCenterPoint(e, gestureState);

if (!gestureCenterPoint) return;
if (!this.state.originalPageX || !this.state.originalPageY) return;
if (this.state.originalPageX == null) return;
if (this.state.originalPageY == null) return;

let zoomCenter = {
x: gestureCenterPoint.x - this.state.originalPageX,
Expand Down Expand Up @@ -771,7 +773,9 @@ class ReactNativeZoomableView extends Component<
) {
const { touches } = gestureResponderEvent.nativeEvent;
const { originalPageY, originalPageX } = this.state;
if (!originalPageX || !originalPageY) return;
if (originalPageX == null) return;
if (originalPageY == null) return;

this.setState({
debugPoints: [
{
Expand Down

0 comments on commit 9fc4d62

Please sign in to comment.