Skip to content

Commit 5d8102b

Browse files
authored
[General] Ignore testID property in production environments (#4266)
## Description When in production environments, `testID` is removed from `allowedNativeProps` to prevent it from being passed to the native side. This mean that it no longer falls into the first branch here https://github.com/software-mansion/react-native-gesture-handler/blob/1473f3906e2cc297b92f693fae09b6e789068cfe/packages/react-native-gesture-handler/src/v3/hooks/utils/configUtils.ts#L86-L100 But last, which shows a warning. This PR adds `testID` to `PropsToFilter` so they fall into the second (ignore silently) branch. ## Test plan ~~AI said it's ok~~ Run app in release configuration
1 parent f748e81 commit 5d8102b

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

packages/react-native-gesture-handler/src/v3/hooks/utils/propsWhiteList.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ export const allowedNativeProps = new Set<
4646
'needsPointerData',
4747
]);
4848

49-
// Don't pass testID to the native side in production
50-
if (!__DEV__) {
51-
allowedNativeProps.delete('testID');
52-
}
53-
5449
export const HandlerCallbacks = new Set<
5550
keyof Required<GestureCallbacks<unknown, unknown>>
5651
>([
@@ -86,6 +81,12 @@ export const PropsToFilter = new Set<
8681
'activeOffsetX',
8782
]);
8883

84+
// Don't pass testID to the native side in production
85+
if (!__DEV__) {
86+
allowedNativeProps.delete('testID');
87+
PropsToFilter.add('testID');
88+
}
89+
8990
export const PropsWhiteLists = new Map<
9091
SingleGestureName,
9192
HandlersPropsWhiteList

0 commit comments

Comments
 (0)