Skip to content

Conversation

@m-bert
Copy link
Contributor

@m-bert m-bert commented Nov 3, 2025

Description

For now, NativeDetector doesn't throw error when it is used outside of GestureHandlerRootView. This PR moves check from LegacyDetector to GestureDetector.

Test plan

Tested on the following example:
import React from 'react';
import { StyleSheet, View } from 'react-native';
import { usePan, GestureDetector } from 'react-native-gesture-handler';

export default function EmptyExample() {
  const pan = usePan({});

  return (
    <View style={styles.container}>
      <GestureDetector gesture={pan}>
        <View style={{ width: 300, height: 300, backgroundColor: 'green' }} />
      </GestureDetector>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
});

@m-bert m-bert requested a review from j-piasecki November 3, 2025 11:00
@j-piasecki
Copy link
Member

Will we be exporting LegacyGestureDetector as a standalone component? If so, the check should stay in both.

@m-bert
Copy link
Contributor Author

m-bert commented Nov 3, 2025

Will we be exporting LegacyGestureDetector as a standalone component? If so, the check should stay in both.

Well, if exporting everything as GestureDetector works fine I don't think we have to export it as a standalone component. WDYT @akwasniewski?

@akwasniewski
Copy link
Contributor

Will we be exporting LegacyGestureDetector as a standalone component? If so, the check should stay in both.

Well, if exporting everything as GestureDetector works fine I don't think we have to export it as a standalone component. WDYT @akwasniewski?

The idea of putting all detectors in the new GestureDetector was not to export them seperately. We only want to export this multi-use component, I think it's less effort for the user.

@m-bert m-bert merged commit ad2029d into next Nov 5, 2025
2 checks passed
@m-bert m-bert deleted the @mbert/throw-detector-error branch November 5, 2025 10:05
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.

4 participants