-
-
Notifications
You must be signed in to change notification settings - Fork 937
Expand file tree
/
Copy pathNativeRNMBXViewportModule.ts
More file actions
40 lines (34 loc) · 1022 Bytes
/
NativeRNMBXViewportModule.ts
File metadata and controls
40 lines (34 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import type { TurboModule, CodegenTypes } from 'react-native';
import { TurboModuleRegistry } from 'react-native';
type StateInfo =
| {
kind: 'idle';
}
| {
kind: 'state';
status: string;
}
| {
kind: 'transition';
toState: string;
transition: string;
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
type ObjectOr<_T> = Object;
type StateReal = { kind: 'followPuck' } /* | { kind: 'overview' } */;
type State = ObjectOr<StateReal>;
type TransitionReal =
| { kind: 'immediate' }
| { kind: 'default'; options: { maxDurationMs?: number } };
type Transition = ObjectOr<TransitionReal>;
type ViewRef = CodegenTypes.Int32 | null;
export interface Spec extends TurboModule {
getState(viewRef: ViewRef): Promise<StateInfo>;
transitionTo(
viewRef: ViewRef,
state: State,
transition: Transition,
): Promise<void>;
idle(viewRef: ViewRef): Promise<void>;
}
export default TurboModuleRegistry.getEnforcing<Spec>('RNMBXViewportModule');