Skip to content

Commit

Permalink
Move customDirectEventTypes to separate files. (#2786)
Browse files Browse the repository at this point in the history
## Description

`customDirectEventTypes` import inside `createHandler` introduced in #2766 makes web unable to compile since `react-native-web` doesn't provide this object. This PR moves mentioned import into separate file and splits it into `.ts` and `.web.ts` parts 

## Test plan

Tested on web and FabricExample app.
  • Loading branch information
m-bert authored Mar 1, 2024
1 parent fbf451c commit 369e45c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/handlers/createHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import {
DeviceEventEmitter,
EmitterSubscription,
} from 'react-native';
// @ts-ignore - its taken straight from RN
import { customDirectEventTypes } from 'react-native/Libraries/Renderer/shims/ReactNativeViewConfigRegistry';
import { customDirectEventTypes } from './customDirectEventTypes';
// @ts-ignore - it isn't typed by TS & don't have definitelyTyped types
import deepEqual from 'lodash/isEqual';
import RNGestureHandlerModule from '../RNGestureHandlerModule';
Expand Down
2 changes: 2 additions & 0 deletions src/handlers/customDirectEventTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// @ts-ignore - its taken straight from RN
export { customDirectEventTypes } from 'react-native/Libraries/Renderer/shims/ReactNativeViewConfigRegistry';
5 changes: 5 additions & 0 deletions src/handlers/customDirectEventTypes.web.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// customDirectEventTypes doesn't exist in react-native-web, therefore importing it
// directly in createHandler.tsx would end in crash.
const customDirectEventTypes = {};

export { customDirectEventTypes };

0 comments on commit 369e45c

Please sign in to comment.