Skip to content

Conversation

@m-bert
Copy link
Contributor

@m-bert m-bert commented Sep 15, 2025

Description

This PR adds changeEventCalculator functions into continuous handlers.

Test plan

Tested on the following example:
import * as React from 'react';
import { Animated, Button } from 'react-native';
import {
  GestureHandlerRootView,
  NativeDetector,
  usePan,
} from 'react-native-gesture-handler';

export default function App() {
  const [visible, setVisible] = React.useState(true);

  const gesture = usePan({
    onUpdate: (e) => {
      'worklet';
      console.log(e.handlerData.changeX);
    },
  });

  return (
    <GestureHandlerRootView
      style={{ flex: 1, backgroundColor: 'white', paddingTop: 8 }}>
      <Button
        title="Toggle visibility"
        onPress={() => {
          setVisible(!visible);
        }}
      />

      {visible && (
        <NativeDetector gesture={gesture}>
          <Animated.View
            style={[
              {
                width: 150,
                height: 150,
                backgroundColor: 'blue',
                opacity: 0.5,
                borderWidth: 10,
                borderColor: 'green',
                marginTop: 20,
                marginLeft: 40,
              },
            ]}
          />
        </NativeDetector>
      )}
    </GestureHandlerRootView>
  );
}

@m-bert m-bert marked this pull request as ready for review September 16, 2025 14:11
Base automatically changed from @mbert/gesture-hooks to next September 19, 2025 07:32
@m-bert m-bert requested a review from j-piasecki September 29, 2025 14:42
@m-bert m-bert merged commit 4a12b70 into next Oct 3, 2025
2 checks passed
@m-bert m-bert deleted the @mbert/add-event-calculators branch October 3, 2025 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants