-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add noop typescript worklets module (#6650)
## Summary Preparing for #6539 ## Test plan This PR has no real runtime impact
- Loading branch information
Showing
14 changed files
with
149 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 2 additions & 6 deletions
8
packages/react-native-reanimated/src/ReanimatedModule/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
'use strict'; | ||
import { createJSReanimatedModule } from './js-reanimated'; | ||
import { shouldBeUseWeb } from '../PlatformChecker'; | ||
import { createNativeReanimatedModule } from './NativeReanimated'; | ||
|
||
export const ReanimatedModule = shouldBeUseWeb() | ||
? createJSReanimatedModule() | ||
: createNativeReanimatedModule(); | ||
export { ReanimatedModule } from './reanimatedModuleInstance'; | ||
export type { ReanimatedModuleProxy } from './reanimatedModuleProxy'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/react-native-reanimated/src/ReanimatedModule/reanimatedModuleInstance.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
import { createJSReanimatedModule } from './js-reanimated'; | ||
import { shouldBeUseWeb } from '../PlatformChecker'; | ||
import { createNativeReanimatedModule } from './NativeReanimated'; | ||
|
||
export const ReanimatedModule = shouldBeUseWeb() | ||
? createJSReanimatedModule() | ||
: createNativeReanimatedModule(); |
5 changes: 5 additions & 0 deletions
5
packages/react-native-reanimated/src/ReanimatedModule/reanimatedModuleInstance.web.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
import { createJSReanimatedModule } from './js-reanimated'; | ||
|
||
export const ReanimatedModule = createJSReanimatedModule(); |
74 changes: 74 additions & 0 deletions
74
packages/react-native-reanimated/src/ReanimatedModule/reanimatedModuleProxy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
'use strict'; | ||
|
||
import type { | ||
ShareableRef, | ||
ShadowNodeWrapper, | ||
Value3D, | ||
ValueRotation, | ||
LayoutAnimationBatchItem, | ||
} from '../commonTypes'; | ||
import type { WorkletRuntime } from '../runtimes'; | ||
|
||
/** Type of `__reanimatedModuleProxy` injected with JSI. */ | ||
export interface ReanimatedModuleProxy { | ||
makeShareableClone<T>( | ||
value: T, | ||
shouldPersistRemote: boolean, | ||
nativeStateSource?: object | ||
): ShareableRef<T>; | ||
|
||
scheduleOnUI<T>(shareable: ShareableRef<T>): void; | ||
|
||
executeOnUIRuntimeSync<T, R>(shareable: ShareableRef<T>): R; | ||
|
||
createWorkletRuntime( | ||
name: string, | ||
initializer: ShareableRef<() => void> | ||
): WorkletRuntime; | ||
|
||
scheduleOnRuntime<T>( | ||
workletRuntime: WorkletRuntime, | ||
worklet: ShareableRef<T> | ||
): void; | ||
|
||
registerEventHandler<T>( | ||
eventHandler: ShareableRef<T>, | ||
eventName: string, | ||
emitterReactTag: number | ||
): number; | ||
|
||
unregisterEventHandler(id: number): void; | ||
|
||
getViewProp<T>( | ||
viewTagOrShadowNodeWrapper: number | ShadowNodeWrapper, | ||
propName: string, | ||
callback?: (result: T) => void | ||
): Promise<T>; | ||
|
||
enableLayoutAnimations(flag: boolean): void; | ||
|
||
registerSensor( | ||
sensorType: number, | ||
interval: number, | ||
iosReferenceFrame: number, | ||
handler: ShareableRef<(data: Value3D | ValueRotation) => void> | ||
): number; | ||
|
||
unregisterSensor(sensorId: number): void; | ||
|
||
configureProps(uiProps: string[], nativeProps: string[]): void; | ||
|
||
subscribeForKeyboardEvents( | ||
handler: ShareableRef<number>, | ||
isStatusBarTranslucent: boolean, | ||
isNavigationBarTranslucent: boolean | ||
): number; | ||
|
||
unsubscribeFromKeyboardEvents(listenerId: number): void; | ||
|
||
configureLayoutAnimationBatch( | ||
layoutAnimationsBatch: LayoutAnimationBatchItem[] | ||
): void; | ||
|
||
setShouldAnimateExitingForTag(viewTag: number, shouldAnimate: boolean): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/react-native-reanimated/src/worklets/WorkletsModule/JSWorklets.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
import type { IWorkletsModule } from '../../commonTypes'; | ||
|
||
export function createJSWorkletsModule(): IWorkletsModule { | ||
return new JSWorklets(); | ||
} | ||
|
||
class JSWorklets implements IWorkletsModule {} |
9 changes: 9 additions & 0 deletions
9
packages/react-native-reanimated/src/worklets/WorkletsModule/NativeWorklets.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
import type { IWorkletsModule } from '../../commonTypes'; | ||
|
||
export function createNativeWorkletsModule(): IWorkletsModule { | ||
return new NativeWorklets(); | ||
} | ||
|
||
class NativeWorklets {} |
3 changes: 3 additions & 0 deletions
3
packages/react-native-reanimated/src/worklets/WorkletsModule/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
'use strict'; | ||
|
||
export { WorkletsModule } from './workletsModuleInstance'; |
9 changes: 9 additions & 0 deletions
9
packages/react-native-reanimated/src/worklets/WorkletsModule/workletsModuleInstance.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
import { createNativeWorkletsModule } from './NativeWorklets'; | ||
import { shouldBeUseWeb } from '../../PlatformChecker'; | ||
import { createJSWorkletsModule } from './JSWorklets'; | ||
|
||
export const WorkletsModule = shouldBeUseWeb() | ||
? createJSWorkletsModule() | ||
: createNativeWorkletsModule(); |
5 changes: 5 additions & 0 deletions
5
packages/react-native-reanimated/src/worklets/WorkletsModule/workletsModuleInstance.web.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
import { createJSWorkletsModule } from './JSWorklets'; | ||
|
||
export const WorkletsModule = createJSWorkletsModule(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
'use strict'; | ||
|
||
export { WorkletsModule } from './WorkletsModule'; |