Skip to content

Bring back onUpdate to Native gesture - #4034

Merged
m-bert merged 1 commit into
mainfrom
@mbert/native-onupdate
Mar 19, 2026
Merged

Bring back onUpdate to Native gesture#4034
m-bert merged 1 commit into
mainfrom
@mbert/native-onupdate

Conversation

@m-bert

@m-bert m-bert commented Mar 19, 2026

Copy link
Copy Markdown
Collaborator

Description

onUpdate callback was removed from Native gesture config. However, Native can be treated as continuous gesture and having this callback might be useful.

Test plan

Tested on Android on the following code:
import { Pressable, ScrollView, StyleSheet, View } from 'react-native';
import {
  RectButton,
  GestureHandlerRootView,
  useNativeGesture,
  GestureDetector,
} from 'react-native-gesture-handler';

export default function App() {
  const native = useNativeGesture({
    onBegin: (e) => {
      console.log('Native onBegin', e, Date.now());
    },
    onUpdate: (e) => {
      console.log('Native onUpdate', e, Date.now());
    },
  });
  return (
    <GestureHandlerRootView style={styles.container}>
      <GestureDetector gesture={native}>
        <Pressable style={styles.box} />
      </GestureDetector>
    </GestureHandlerRootView>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  box: {
    width: 200,
    height: 50,
    borderRadius: 15,
    backgroundColor: '#007AFF',
  },
});

@m-bert
m-bert requested review from Copilot and j-piasecki March 19, 2026 10:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Re-introduces TypeScript support for the onUpdate callback in the v3 Native gesture configuration by treating it as a continuous gesture config (instead of discrete), aligning the type surface with the runtime behavior.

Changes:

  • Switch NativeGestureInternalConfig from BaseDiscreteGestureConfig to BaseGestureConfig to re-enable onUpdate in NativeGestureConfig.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@m-bert
m-bert merged commit 0e91d90 into main Mar 19, 2026
7 checks passed
@m-bert
m-bert deleted the @mbert/native-onupdate branch March 19, 2026 17:03
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