Skip to content

Pinch gesture focal point is NAN for iPad trackpad #3864

@DImuthuUpe

Description

@DImuthuUpe

Description

When I use track pad for pinch gesture, the focal point is provided as NaN. Is that the expected behavior?

Steps to reproduce

import * as React from 'react';
import { View } from 'react-native';
import { Gesture, GestureDetector, GestureHandlerRootView } from 'react-native-gesture-handler';

const pinchGesture = Gesture.Pinch().onUpdate((e) => {
  console.log(e);
});

export default function App() {
  return (
    <GestureHandlerRootView style={{ flex: 1 }}>
      <View style={{ flex: 1, backgroundColor: 'white' }}>
        <GestureDetector gesture={pinchGesture}>
          <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
          </View>
        </GestureDetector>
      </View>
    </GestureHandlerRootView>
  );
}

Output of the above code for pinch gesture from apple track pad is.

{ target: 2472,
  focalX: NaN,
  focalY: NaN,
  pointerType: 0,
  handlerTag: 3,
  velocity: 0.03992123938096699,
  numberOfPointers: 0,
  state: 4,
  scale: 1.11993408203125,
  eventName: 'onGestureHandlerEvent',
  scaleChange: 1 }

A link to a Gist, an Expo Snack or a link to a repository based on this template that reproduces the bug.

https://gist.github.com/DImuthuUpe/ef97e4bc4cab7557b0774c6a9e6f4a4e

Gesture Handler version

2.26.0

React Native version

0.78.0

Platforms

iOS

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Platform: iOSThis issue is specific to iOSRepro providedA reproduction with a snack or repo is provided

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions