-
-
Notifications
You must be signed in to change notification settings - Fork 937
Expand file tree
/
Copy pathcodegenUtils.ts
More file actions
33 lines (29 loc) · 1.12 KB
/
codegenUtils.ts
File metadata and controls
33 lines (29 loc) · 1.12 KB
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
// codegen will generate folly::dynamic in place of this type, but it's not exported by RN
// since codegen doesn't really follow imports, this way we can trick it into generating the correct type
// while keeping typescript happy
//
// For booleans: UnsafeMixed<boolean> preserves nullability (true/false/null) vs boolean which defaults to false
// This allows native code to distinguish between "prop not set" vs "prop explicitly set to false"
export type UnsafeMixed<T> = T;
// Fabric doesn't support optional props, so we need to use UnsafeMixed
// https://github.com/rnmapbox/maps/pull/3082#discussion_r1339858750
export type OptionalProp<T> = UnsafeMixed<T>;
// @ts-ignore - CI environment type resolution issue for CodegenTypes
import { Double, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
export type Point = {
x: Int32;
y: Int32;
};
export type NativeCameraStop = {
centerCoordinate?: string;
bounds?: string;
heading?: Double;
pitch?: Double;
zoom?: Double;
paddingLeft?: Double;
paddingRight?: Double;
paddingTop?: Double;
paddingBottom?: Double;
duration?: Double;
mode?: number;
} | null;