De-couple the web handlers from React Native (#4381)
## Description Removes the last react-native dependency from `src/web`: - `NativeViewGestureHandler` used `Platform.OS !== 'web'` to guard its DOM-touching `init()` logic from react-native-windows. The guard is now `!canUseDOM() || !(view instanceof Element)` — `canUseDOM()` is a new engine-local duplicate of the `useIsomorphicLayoutEffect` check (checking `window` alone isn't enough, RN defines it on every platform), and `Element` covers SVG-backed views, replacing the `as HTMLElement` cast with real narrowing. - Five timeout fields in the Pan/LongPress/Tap handlers become `ReturnType<typeof setTimeout> | undefined` — `number` breaks compilation for consumers with `@types/node` in their TS program. Pan's `= 0` sentinels are dropped (`clearTimeout(undefined)` is the same no-op). - New lint rule: no react-native imports in `src/web/**`. ## Test plan - `yarn ts-check` clean; `yarn test` 103/103; `yarn lint:js` 0 errors; lint rule verified firing - Verified on react-native-web (expo-example web in Safari): rendering + native-button role detection through the new guard; LongPress activation (the retyped timeout firing); Pan drag incl. the finalize path that clears the never-assigned timeout — the one runtime-visible change
M
Michał Bert committed
1400f675d7846abe18756c68617542cc65080c8e
Parent: 35591ca
Committed by GitHub <noreply@github.com>
on 8/5/2026, 7:32:47 AM