Skip to content

Commit 324a236

Browse files
authored
Remove unnecessary version checks (#3416)
## Description This PR removes checks for RN versions that are no longer necessary in our codebase. ## Test plan Run example apps
1 parent 3ebcd98 commit 324a236

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerModule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ class RNGestureHandlerModule(reactContext: ReactApplicationContext?) :
548548
val event = RNGestureHandlerEvent.obtain(
549549
handler,
550550
handlerFactory.createEventBuilder(handler),
551-
useTopPrefixedName = BuildConfig.REACT_NATIVE_MINOR_VERSION >= 71
551+
true
552552
)
553553
sendEventForNativeAnimatedEvent(event)
554554
} else if (handler.actionType == GestureHandler.ACTION_TYPE_JS_FUNCTION_OLD_API) {

src/handlers/createHandler.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,8 @@ UIManagerAny.genericDirectEventTypes = {
7777
...UIManagerAny.genericDirectEventTypes,
7878
...customGHEventsConfig,
7979
};
80-
// In newer versions of RN the `genericDirectEventTypes` is located in the object
81-
// returned by UIManager.getViewManagerConfig('getConstants') or in older RN UIManager.getConstants(), we need to add it there as well to make
82-
// it compatible with RN 61+
83-
const UIManagerConstants =
84-
UIManagerAny.getViewManagerConfig?.('getConstants') ??
85-
UIManagerAny.getConstants?.();
80+
81+
const UIManagerConstants = UIManagerAny.getViewManagerConfig?.('getConstants');
8682

8783
if (UIManagerConstants) {
8884
UIManagerConstants.genericDirectEventTypes = {

src/handlers/gestures/GestureDetector/utils.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
baseGestureHandlerWithDetectorProps,
1919
} from '../../gestureHandlerCommon';
2020
import { isNewWebImplementationEnabled } from '../../../EnableNewWebImplementation';
21-
import { getReactNativeVersion } from '../../../getReactNativeVersion';
2221
import { RNRenderer } from '../../../RNRenderer';
2322
import { useCallback, useRef, useState } from 'react';
2423
import { Reanimated } from '../reanimatedWrapper';
@@ -133,14 +132,11 @@ export function validateDetectorChildren(ref: any) {
133132
// / \
134133
// NativeView NativeView
135134
if (__DEV__ && Platform.OS !== 'web') {
136-
const REACT_NATIVE_VERSION = getReactNativeVersion();
137135
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
138136
const wrapType =
139-
REACT_NATIVE_VERSION.minor > 63 || REACT_NATIVE_VERSION.major > 0
140-
? // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
141-
ref._reactInternals.elementType
142-
: // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
143-
ref._reactInternalFiber.elementType;
137+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
138+
ref._reactInternals.elementType;
139+
144140
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
145141
let instance =
146142
RNRenderer.findHostInstance_DEPRECATED(

0 commit comments

Comments
 (0)