@office-iss/react-native-win32 0.0.0-canary.288 → 0.0.0-canary.289
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.flowconfig +3 -2
- package/CHANGELOG.json +22 -1
- package/CHANGELOG.md +16 -7
- package/Libraries/Alert/Alert.d.ts +4 -1
- package/Libraries/Alert/Alert.js +3 -0
- package/Libraries/Animated/Easing.js +13 -15
- package/Libraries/Animated/createAnimatedComponent.js +24 -12
- package/Libraries/Animated/nodes/AnimatedNode.js +2 -1
- package/Libraries/Animated/nodes/AnimatedProps.js +18 -1
- package/Libraries/Animated/nodes/AnimatedValue.js +6 -2
- package/Libraries/Blob/URL.js +23 -10
- package/Libraries/Components/TextInput/Tests/TextInputTest.d.ts +2 -1
- package/Libraries/Components/TextInput/Tests/TextInputTest.js.map +1 -1
- package/Libraries/Components/TextInput/TextInput.d.ts +6 -0
- package/Libraries/Components/TextInput/TextInput.flow.js +36 -3
- package/Libraries/Components/TextInput/TextInput.js +101 -110
- package/Libraries/Components/TextInput/TextInput.win32.js +102 -111
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.d.ts +2 -1
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Image/Tests/ImageWin32Test.d.ts +2 -1
- package/Libraries/Image/Tests/ImageWin32Test.js.map +1 -1
- package/Libraries/Interaction/TaskQueue.js +1 -0
- package/Libraries/Modal/Modal.js +30 -4
- package/Libraries/ReactNative/AppRegistry.flow.js +49 -0
- package/Libraries/ReactNative/AppRegistry.js +2 -322
- package/Libraries/ReactNative/AppRegistry.js.flow +23 -0
- package/Libraries/ReactNative/AppRegistryImpl.js +316 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -4
- package/Libraries/StyleSheet/PlatformColorValueTypesIOS.js +6 -0
- package/Libraries/StyleSheet/StyleSheet.js +5 -197
- package/Libraries/StyleSheet/StyleSheet.js.flow +166 -0
- package/Libraries/StyleSheet/{StyleSheet.win32.js → StyleSheetExports.js} +2 -151
- package/Libraries/StyleSheet/StyleSheetExports.js.flow +110 -0
- package/Libraries/StyleSheet/StyleSheetTypes.js +42 -18
- package/Libraries/Types/CodegenTypesNamespace.d.ts +45 -0
- package/Libraries/{Modal/ModalInjection.js → Types/CodegenTypesNamespace.js} +4 -5
- package/Libraries/Utilities/codegenNativeCommands.d.ts +18 -0
- package/Libraries/Utilities/codegenNativeComponent.d.ts +26 -0
- package/Libraries/vendor/emitter/EventEmitter.js +6 -2
- package/flow/global.js +1 -0
- package/flow/jest.js +4 -2
- package/index.js +47 -43
- package/index.win32.js +60 -55
- package/overrides.json +8 -16
- package/package.json +14 -14
- package/src/private/animated/NativeAnimatedHelper.js +18 -7
- package/src/private/animated/NativeAnimatedHelper.win32.js +18 -7
- package/src/private/animated/createAnimatedPropsHook.js +34 -15
- package/src/private/featureflags/ReactNativeFeatureFlags.js +14 -31
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +9 -1
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +2 -3
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -18
- package/src/private/webapis/dom/nodes/internals/NodeInternals.js +6 -0
- package/src/types/third_party/event-target-shim.d.ts +392 -0
- package/src-win/Libraries/Components/TextInput/Tests/TextInputTest.tsx +7 -7
- package/src-win/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +3 -3
- package/src-win/Libraries/Image/Tests/ImageWin32Test.tsx +1 -1
- package/types/index.d.ts +4 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export * as default from './StyleSheetExports';
|
|
12
|
+
|
|
13
|
+
import type {
|
|
14
|
+
____ColorValue_Internal,
|
|
15
|
+
____DangerouslyImpreciseStyle_Internal,
|
|
16
|
+
____DangerouslyImpreciseStyleProp_Internal,
|
|
17
|
+
____ImageStyle_Internal,
|
|
18
|
+
____ImageStyleProp_Internal,
|
|
19
|
+
____TextStyle_Internal,
|
|
20
|
+
____TextStyleProp_Internal,
|
|
21
|
+
____ViewStyle_Internal,
|
|
22
|
+
____ViewStyleProp_Internal,
|
|
23
|
+
} from './StyleSheetTypes';
|
|
24
|
+
|
|
25
|
+
export type {StyleProp} from './StyleSheetTypes';
|
|
26
|
+
|
|
27
|
+
export type StyleSheetProperties = {
|
|
28
|
+
hairlineWidth: number,
|
|
29
|
+
flatten<T: string>(style: T): T,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type {NativeColorValue} from './StyleSheetTypes';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* This type should be used as the type for anything that is a color. It is
|
|
36
|
+
* most useful when using DynamicColorIOS which can be a string or a dynamic
|
|
37
|
+
* color object.
|
|
38
|
+
*
|
|
39
|
+
* type props = {backgroundColor: ColorValue};
|
|
40
|
+
*/
|
|
41
|
+
export type ColorValue = ____ColorValue_Internal;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* This type should be used as the type for a prop that is passed through
|
|
45
|
+
* to a <View>'s `style` prop. This ensures call sites of the component
|
|
46
|
+
* can't pass styles that View doesn't support such as `fontSize`.`
|
|
47
|
+
*
|
|
48
|
+
* type Props = {style: ViewStyleProp}
|
|
49
|
+
* const MyComponent = (props: Props) => <View style={props.style} />
|
|
50
|
+
*/
|
|
51
|
+
export type ViewStyleProp = ____ViewStyleProp_Internal;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* This type should be used as the type for a prop that is passed through
|
|
55
|
+
* to a <Text>'s `style` prop. This ensures call sites of the component
|
|
56
|
+
* can't pass styles that Text doesn't support such as `resizeMode`.`
|
|
57
|
+
*
|
|
58
|
+
* type Props = {style: TextStyleProp}
|
|
59
|
+
* const MyComponent = (props: Props) => <Text style={props.style} />
|
|
60
|
+
*/
|
|
61
|
+
export type TextStyleProp = ____TextStyleProp_Internal;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* This type should be used as the type for a prop that is passed through
|
|
65
|
+
* to an <Image>'s `style` prop. This ensures call sites of the component
|
|
66
|
+
* can't pass styles that Image doesn't support such as `fontSize`.`
|
|
67
|
+
*
|
|
68
|
+
* type Props = {style: ImageStyleProp}
|
|
69
|
+
* const MyComponent = (props: Props) => <Image style={props.style} />
|
|
70
|
+
*/
|
|
71
|
+
export type ImageStyleProp = ____ImageStyleProp_Internal;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* WARNING: You probably shouldn't be using this type. This type
|
|
75
|
+
* is similar to the ones above except it allows styles that are accepted
|
|
76
|
+
* by all of View, Text, or Image. It is therefore very unsafe to pass this
|
|
77
|
+
* through to an underlying component. Using this is almost always a mistake
|
|
78
|
+
* and using one of the other more restrictive types is likely the right choice.
|
|
79
|
+
*/
|
|
80
|
+
export type DangerouslyImpreciseStyleProp =
|
|
81
|
+
____DangerouslyImpreciseStyleProp_Internal;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Utility type for getting the values for specific style keys.
|
|
85
|
+
*
|
|
86
|
+
* The following is bad because position is more restrictive than 'string':
|
|
87
|
+
* ```
|
|
88
|
+
* type Props = {position: string};
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* You should use the following instead:
|
|
92
|
+
*
|
|
93
|
+
* ```
|
|
94
|
+
* type Props = {position: TypeForStyleKey<'position'>};
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* This will correctly give you the type 'absolute' | 'relative'
|
|
98
|
+
*/
|
|
99
|
+
export type TypeForStyleKey<
|
|
100
|
+
+key: $Keys<____DangerouslyImpreciseStyle_Internal>,
|
|
101
|
+
> = $ElementType<____DangerouslyImpreciseStyle_Internal, key>;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* This type is an object of the different possible style
|
|
105
|
+
* properties that can be specified for View.
|
|
106
|
+
*
|
|
107
|
+
* Note that this isn't a safe way to type a style prop for a component as
|
|
108
|
+
* results from StyleSheet.create return an internal identifier, not
|
|
109
|
+
* an object of styles.
|
|
110
|
+
*
|
|
111
|
+
* If you want to type the style prop of a function,
|
|
112
|
+
* consider using ViewStyleProp.
|
|
113
|
+
*
|
|
114
|
+
* A reasonable usage of this type is for helper functions that return an
|
|
115
|
+
* object of styles to pass to a View that can't be precomputed with
|
|
116
|
+
* StyleSheet.create.
|
|
117
|
+
*/
|
|
118
|
+
export type ViewStyle = ____ViewStyle_Internal;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* This type is an object of the different possible style
|
|
122
|
+
* properties that can be specified for Text.
|
|
123
|
+
*
|
|
124
|
+
* Note that this isn't a safe way to type a style prop for a component as
|
|
125
|
+
* results from StyleSheet.create return an internal identifier, not
|
|
126
|
+
* an object of styles.
|
|
127
|
+
*
|
|
128
|
+
* If you want to type the style prop of a function,
|
|
129
|
+
* consider using TextStyleProp.
|
|
130
|
+
*
|
|
131
|
+
* A reasonable usage of this type is for helper functions that return an
|
|
132
|
+
* object of styles to pass to a Text that can't be precomputed with
|
|
133
|
+
* StyleSheet.create.
|
|
134
|
+
*/
|
|
135
|
+
export type TextStyle = ____TextStyle_Internal;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* This type is an object of the different possible style
|
|
139
|
+
* properties that can be specified for Image.
|
|
140
|
+
*
|
|
141
|
+
* Note that this isn't a safe way to type a style prop for a component as
|
|
142
|
+
* results from StyleSheet.create return an internal identifier, not
|
|
143
|
+
* an object of styles.
|
|
144
|
+
*
|
|
145
|
+
* If you want to type the style prop of a function,
|
|
146
|
+
* consider using ImageStyleProp.
|
|
147
|
+
*
|
|
148
|
+
* A reasonable usage of this type is for helper functions that return an
|
|
149
|
+
* object of styles to pass to an Image that can't be precomputed with
|
|
150
|
+
* StyleSheet.create.
|
|
151
|
+
*/
|
|
152
|
+
export type ImageStyle = ____ImageStyle_Internal;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* WARNING: You probably shouldn't be using this type. This type is an object
|
|
156
|
+
* with all possible style keys and their values. Note that this isn't
|
|
157
|
+
* a safe way to type a style prop for a component as results from
|
|
158
|
+
* StyleSheet.create return an internal identifier, not an object of styles.
|
|
159
|
+
*
|
|
160
|
+
* If you want to type the style prop of a function, consider using
|
|
161
|
+
* ViewStyleProp, TextStyleProp, or ImageStyleProp.
|
|
162
|
+
*
|
|
163
|
+
* This should only be used by very core utilities that operate on an object
|
|
164
|
+
* containing any possible style value.
|
|
165
|
+
*/
|
|
166
|
+
export type DangerouslyImpreciseStyle = ____DangerouslyImpreciseStyle_Internal;
|
|
@@ -10,18 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
import type {
|
|
14
|
-
____ColorValue_Internal,
|
|
15
|
-
____DangerouslyImpreciseStyle_Internal,
|
|
16
|
-
____DangerouslyImpreciseStyleProp_Internal,
|
|
17
|
-
____ImageStyle_Internal,
|
|
18
|
-
____ImageStyleProp_Internal,
|
|
19
|
-
____Styles_Internal,
|
|
20
|
-
____TextStyle_Internal,
|
|
21
|
-
____TextStyleProp_Internal,
|
|
22
|
-
____ViewStyle_Internal,
|
|
23
|
-
____ViewStyleProp_Internal,
|
|
24
|
-
} from './StyleSheetTypes';
|
|
13
|
+
import type {____Styles_Internal} from './StyleSheetTypes';
|
|
25
14
|
|
|
26
15
|
import composeStyles from '../../src/private/styles/composeStyles';
|
|
27
16
|
import flatten from './flattenStyle';
|
|
@@ -29,146 +18,8 @@ import flatten from './flattenStyle';
|
|
|
29
18
|
const ReactNativeStyleAttributes =
|
|
30
19
|
require('../Components/View/ReactNativeStyleAttributes').default;
|
|
31
20
|
const PixelRatio = require('../Utilities/PixelRatio').default;
|
|
32
|
-
const Platform = require('../Utilities/Platform').default; // [Win32]
|
|
33
21
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* This type should be used as the type for anything that is a color. It is
|
|
38
|
-
* most useful when using DynamicColorIOS which can be a string or a dynamic
|
|
39
|
-
* color object.
|
|
40
|
-
*
|
|
41
|
-
* type props = {backgroundColor: ColorValue};
|
|
42
|
-
*/
|
|
43
|
-
export type ColorValue = ____ColorValue_Internal;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* This type should be used as the type for a prop that is passed through
|
|
47
|
-
* to a <View>'s `style` prop. This ensures call sites of the component
|
|
48
|
-
* can't pass styles that View doesn't support such as `fontSize`.`
|
|
49
|
-
*
|
|
50
|
-
* type Props = {style: ViewStyleProp}
|
|
51
|
-
* const MyComponent = (props: Props) => <View style={props.style} />
|
|
52
|
-
*/
|
|
53
|
-
export type ViewStyleProp = ____ViewStyleProp_Internal;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* This type should be used as the type for a prop that is passed through
|
|
57
|
-
* to a <Text>'s `style` prop. This ensures call sites of the component
|
|
58
|
-
* can't pass styles that Text doesn't support such as `resizeMode`.`
|
|
59
|
-
*
|
|
60
|
-
* type Props = {style: TextStyleProp}
|
|
61
|
-
* const MyComponent = (props: Props) => <Text style={props.style} />
|
|
62
|
-
*/
|
|
63
|
-
export type TextStyleProp = ____TextStyleProp_Internal;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* This type should be used as the type for a prop that is passed through
|
|
67
|
-
* to an <Image>'s `style` prop. This ensures call sites of the component
|
|
68
|
-
* can't pass styles that Image doesn't support such as `fontSize`.`
|
|
69
|
-
*
|
|
70
|
-
* type Props = {style: ImageStyleProp}
|
|
71
|
-
* const MyComponent = (props: Props) => <Image style={props.style} />
|
|
72
|
-
*/
|
|
73
|
-
export type ImageStyleProp = ____ImageStyleProp_Internal;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* WARNING: You probably shouldn't be using this type. This type
|
|
77
|
-
* is similar to the ones above except it allows styles that are accepted
|
|
78
|
-
* by all of View, Text, or Image. It is therefore very unsafe to pass this
|
|
79
|
-
* through to an underlying component. Using this is almost always a mistake
|
|
80
|
-
* and using one of the other more restrictive types is likely the right choice.
|
|
81
|
-
*/
|
|
82
|
-
export type DangerouslyImpreciseStyleProp =
|
|
83
|
-
____DangerouslyImpreciseStyleProp_Internal;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Utility type for getting the values for specific style keys.
|
|
87
|
-
*
|
|
88
|
-
* The following is bad because position is more restrictive than 'string':
|
|
89
|
-
* ```
|
|
90
|
-
* type Props = {position: string};
|
|
91
|
-
* ```
|
|
92
|
-
*
|
|
93
|
-
* You should use the following instead:
|
|
94
|
-
*
|
|
95
|
-
* ```
|
|
96
|
-
* type Props = {position: TypeForStyleKey<'position'>};
|
|
97
|
-
* ```
|
|
98
|
-
*
|
|
99
|
-
* This will correctly give you the type 'absolute' | 'relative'
|
|
100
|
-
*/
|
|
101
|
-
export type TypeForStyleKey<
|
|
102
|
-
+key: $Keys<____DangerouslyImpreciseStyle_Internal>,
|
|
103
|
-
> = $ElementType<____DangerouslyImpreciseStyle_Internal, key>;
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* This type is an object of the different possible style
|
|
107
|
-
* properties that can be specified for View.
|
|
108
|
-
*
|
|
109
|
-
* Note that this isn't a safe way to type a style prop for a component as
|
|
110
|
-
* results from StyleSheet.create return an internal identifier, not
|
|
111
|
-
* an object of styles.
|
|
112
|
-
*
|
|
113
|
-
* If you want to type the style prop of a function,
|
|
114
|
-
* consider using ViewStyleProp.
|
|
115
|
-
*
|
|
116
|
-
* A reasonable usage of this type is for helper functions that return an
|
|
117
|
-
* object of styles to pass to a View that can't be precomputed with
|
|
118
|
-
* StyleSheet.create.
|
|
119
|
-
*/
|
|
120
|
-
export type ViewStyle = ____ViewStyle_Internal;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* This type is an object of the different possible style
|
|
124
|
-
* properties that can be specified for Text.
|
|
125
|
-
*
|
|
126
|
-
* Note that this isn't a safe way to type a style prop for a component as
|
|
127
|
-
* results from StyleSheet.create return an internal identifier, not
|
|
128
|
-
* an object of styles.
|
|
129
|
-
*
|
|
130
|
-
* If you want to type the style prop of a function,
|
|
131
|
-
* consider using TextStyleProp.
|
|
132
|
-
*
|
|
133
|
-
* A reasonable usage of this type is for helper functions that return an
|
|
134
|
-
* object of styles to pass to a Text that can't be precomputed with
|
|
135
|
-
* StyleSheet.create.
|
|
136
|
-
*/
|
|
137
|
-
export type TextStyle = ____TextStyle_Internal;
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* This type is an object of the different possible style
|
|
141
|
-
* properties that can be specified for Image.
|
|
142
|
-
*
|
|
143
|
-
* Note that this isn't a safe way to type a style prop for a component as
|
|
144
|
-
* results from StyleSheet.create return an internal identifier, not
|
|
145
|
-
* an object of styles.
|
|
146
|
-
*
|
|
147
|
-
* If you want to type the style prop of a function,
|
|
148
|
-
* consider using ImageStyleProp.
|
|
149
|
-
*
|
|
150
|
-
* A reasonable usage of this type is for helper functions that return an
|
|
151
|
-
* object of styles to pass to an Image that can't be precomputed with
|
|
152
|
-
* StyleSheet.create.
|
|
153
|
-
*/
|
|
154
|
-
export type ImageStyle = ____ImageStyle_Internal;
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* WARNING: You probably shouldn't be using this type. This type is an object
|
|
158
|
-
* with all possible style keys and their values. Note that this isn't
|
|
159
|
-
* a safe way to type a style prop for a component as results from
|
|
160
|
-
* StyleSheet.create return an internal identifier, not an object of styles.
|
|
161
|
-
*
|
|
162
|
-
* If you want to type the style prop of a function, consider using
|
|
163
|
-
* ViewStyleProp, TextStyleProp, or ImageStyleProp.
|
|
164
|
-
*
|
|
165
|
-
* This should only be used by very core utilities that operate on an object
|
|
166
|
-
* containing any possible style value.
|
|
167
|
-
*/
|
|
168
|
-
export type DangerouslyImpreciseStyle = ____DangerouslyImpreciseStyle_Internal;
|
|
169
|
-
|
|
170
|
-
let hairlineWidth: number =
|
|
171
|
-
Platform.OS === 'win32' ? 0.5 : PixelRatio.roundToNearestPixel(0.4); // TODO(windows ISS) - Avoid calls to PixelRatio - needs multi window support
|
|
22
|
+
let hairlineWidth: number = PixelRatio.roundToNearestPixel(0.4);
|
|
172
23
|
if (hairlineWidth === 0) {
|
|
173
24
|
hairlineWidth = 1 / PixelRatio.get();
|
|
174
25
|
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {____Styles_Internal} from './StyleSheetTypes';
|
|
12
|
+
|
|
13
|
+
import composeStyles from '../../src/private/styles/composeStyles';
|
|
14
|
+
import flattenStyle from './flattenStyle';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* This is defined as the width of a thin line on the platform. It can be
|
|
18
|
+
* used as the thickness of a border or division between two elements.
|
|
19
|
+
* Example:
|
|
20
|
+
* ```
|
|
21
|
+
* {
|
|
22
|
+
* borderBottomColor: '#bbb',
|
|
23
|
+
* borderBottomWidth: StyleSheet.hairlineWidth
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* This constant will always be a round number of pixels (so a line defined
|
|
28
|
+
* by it look crisp) and will try to match the standard width of a thin line
|
|
29
|
+
* on the underlying platform. However, you should not rely on it being a
|
|
30
|
+
* constant size, because on different platforms and screen densities its
|
|
31
|
+
* value may be calculated differently.
|
|
32
|
+
*/
|
|
33
|
+
declare export const hairlineWidth: number;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A very common pattern is to create overlays with position absolute and zero positioning,
|
|
37
|
+
* so `absoluteFill` can be used for convenience and to reduce duplication of these repeated
|
|
38
|
+
* styles.
|
|
39
|
+
*/
|
|
40
|
+
declare export const absoluteFill: any;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Sometimes you may want `absoluteFill` but with a couple tweaks - `absoluteFillObject` can be
|
|
44
|
+
* used to create a customized entry in a `StyleSheet`, e.g.:
|
|
45
|
+
*
|
|
46
|
+
* const styles = StyleSheet.create({
|
|
47
|
+
* wrapper: {
|
|
48
|
+
* ...StyleSheet.absoluteFillObject,
|
|
49
|
+
* top: 10,
|
|
50
|
+
* backgroundColor: 'transparent',
|
|
51
|
+
* },
|
|
52
|
+
* });
|
|
53
|
+
*/
|
|
54
|
+
declare export const absoluteFillObject: {
|
|
55
|
+
+bottom: 0,
|
|
56
|
+
+left: 0,
|
|
57
|
+
+position: 'absolute',
|
|
58
|
+
+right: 0,
|
|
59
|
+
+top: 0,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Combines two styles such that style2 will override any styles in style1.
|
|
64
|
+
* If either style is falsy, the other one is returned without allocating
|
|
65
|
+
* an array, saving allocations and maintaining reference equality for
|
|
66
|
+
* PureComponent checks.
|
|
67
|
+
*/
|
|
68
|
+
declare export const compose: typeof composeStyles;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Flattens an array of style objects, into one aggregated style object.
|
|
72
|
+
*
|
|
73
|
+
* Example:
|
|
74
|
+
* ```
|
|
75
|
+
* const styles = StyleSheet.create({
|
|
76
|
+
* listItem: {
|
|
77
|
+
* flex: 1,
|
|
78
|
+
* fontSize: 16,
|
|
79
|
+
* color: 'white'
|
|
80
|
+
* },
|
|
81
|
+
* selectedListItem: {
|
|
82
|
+
* color: 'green'
|
|
83
|
+
* }
|
|
84
|
+
* });
|
|
85
|
+
*
|
|
86
|
+
* StyleSheet.flatten([styles.listItem, styles.selectedListItem])
|
|
87
|
+
* // returns { flex: 1, fontSize: 16, color: 'green' }
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
declare export const flatten: typeof flattenStyle;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* WARNING: EXPERIMENTAL. Breaking changes will probably happen a lot and will
|
|
94
|
+
* not be reliably announced. The whole thing might be deleted, who knows? Use
|
|
95
|
+
* at your own risk.
|
|
96
|
+
*
|
|
97
|
+
* Sets a function to use to pre-process a style property value. This is used
|
|
98
|
+
* internally to process color and transform values. You should not use this
|
|
99
|
+
* unless you really know what you are doing and have exhausted other options.
|
|
100
|
+
*/
|
|
101
|
+
declare export const setStyleAttributePreprocessor: (
|
|
102
|
+
property: string,
|
|
103
|
+
process: (nextProp: any) => any,
|
|
104
|
+
) => void;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* An identity function for creating style sheets.
|
|
108
|
+
*/
|
|
109
|
+
// $FlowFixMe[unsupported-variance-annotation]
|
|
110
|
+
declare export const create: <+S: ____Styles_Internal>(obj: S) => $ReadOnly<S>;
|
|
@@ -760,10 +760,7 @@ type ____BlendMode_Internal =
|
|
|
760
760
|
| 'color'
|
|
761
761
|
| 'luminosity';
|
|
762
762
|
|
|
763
|
-
export type
|
|
764
|
-
...$Exact<____LayoutStyle_Internal>,
|
|
765
|
-
...$Exact<____ShadowStyle_Internal>,
|
|
766
|
-
...$Exact<____TransformStyle_Internal>,
|
|
763
|
+
export type ____ViewStyle_InternalBase = $ReadOnly<{
|
|
767
764
|
backfaceVisibility?: 'visible' | 'hidden',
|
|
768
765
|
backgroundColor?: ____ColorValue_Internal,
|
|
769
766
|
borderColor?: ____ColorValue_Internal,
|
|
@@ -813,6 +810,13 @@ export type ____ViewStyle_InternalCore = $ReadOnly<{
|
|
|
813
810
|
isolation?: 'auto' | 'isolate',
|
|
814
811
|
}>;
|
|
815
812
|
|
|
813
|
+
export type ____ViewStyle_InternalCore = $ReadOnly<{
|
|
814
|
+
...$Exact<____LayoutStyle_Internal>,
|
|
815
|
+
...$Exact<____ShadowStyle_Internal>,
|
|
816
|
+
...$Exact<____TransformStyle_Internal>,
|
|
817
|
+
...____ViewStyle_InternalBase,
|
|
818
|
+
}>;
|
|
819
|
+
|
|
816
820
|
export type ____ViewStyle_Internal = $ReadOnly<{
|
|
817
821
|
...____ViewStyle_InternalCore,
|
|
818
822
|
...____ViewStyle_InternalOverrides,
|
|
@@ -903,8 +907,7 @@ export type ____FontVariantArray_Internal = $ReadOnlyArray<
|
|
|
903
907
|
| 'stylistic-twenty',
|
|
904
908
|
>;
|
|
905
909
|
|
|
906
|
-
|
|
907
|
-
...$Exact<____ViewStyle_Internal>,
|
|
910
|
+
type ____TextStyle_InternalBase = $ReadOnly<{
|
|
908
911
|
color?: ____ColorValue_Internal,
|
|
909
912
|
fontFamily?: string,
|
|
910
913
|
fontSize?: number,
|
|
@@ -935,6 +938,11 @@ export type ____TextStyle_InternalCore = $ReadOnly<{
|
|
|
935
938
|
writingDirection?: 'auto' | 'ltr' | 'rtl',
|
|
936
939
|
}>;
|
|
937
940
|
|
|
941
|
+
export type ____TextStyle_InternalCore = $ReadOnly<{
|
|
942
|
+
...$Exact<____ViewStyle_Internal>,
|
|
943
|
+
...____TextStyle_InternalBase,
|
|
944
|
+
}>;
|
|
945
|
+
|
|
938
946
|
export type ____TextStyle_Internal = $ReadOnly<{
|
|
939
947
|
...____TextStyle_InternalCore,
|
|
940
948
|
...____TextStyle_InternalOverrides,
|
|
@@ -967,24 +975,24 @@ export type ____DangerouslyImpreciseStyle_Internal = $ReadOnly<{
|
|
|
967
975
|
...
|
|
968
976
|
}>;
|
|
969
977
|
|
|
970
|
-
type
|
|
978
|
+
export type StyleProp<+T> =
|
|
971
979
|
| null
|
|
972
980
|
| void
|
|
973
981
|
| T
|
|
974
982
|
| false
|
|
975
983
|
| ''
|
|
976
|
-
| $ReadOnlyArray<
|
|
984
|
+
| $ReadOnlyArray<StyleProp<T>>;
|
|
977
985
|
|
|
978
|
-
export type ____DangerouslyImpreciseStyleProp_Internal =
|
|
986
|
+
export type ____DangerouslyImpreciseStyleProp_Internal = StyleProp<
|
|
979
987
|
Partial<____DangerouslyImpreciseStyle_Internal>,
|
|
980
988
|
>;
|
|
981
|
-
export type ____ViewStyleProp_Internal =
|
|
989
|
+
export type ____ViewStyleProp_Internal = StyleProp<
|
|
982
990
|
$ReadOnly<Partial<____ViewStyle_Internal>>,
|
|
983
991
|
>;
|
|
984
|
-
export type ____TextStyleProp_Internal =
|
|
992
|
+
export type ____TextStyleProp_Internal = StyleProp<
|
|
985
993
|
$ReadOnly<Partial<____TextStyle_Internal>>,
|
|
986
994
|
>;
|
|
987
|
-
export type ____ImageStyleProp_Internal =
|
|
995
|
+
export type ____ImageStyleProp_Internal = StyleProp<
|
|
988
996
|
$ReadOnly<Partial<____ImageStyle_Internal>>,
|
|
989
997
|
>;
|
|
990
998
|
|
|
@@ -995,10 +1003,26 @@ export type ____Styles_Internal = {
|
|
|
995
1003
|
...
|
|
996
1004
|
};
|
|
997
1005
|
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1006
|
+
// A depth limiter, to avoid TS2589 in TypeScript. This and
|
|
1007
|
+
// ____FlattenStyleProp_Helper should be considered internal.
|
|
1008
|
+
type FlattenDepthLimiter = [void, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
|
1009
|
+
type ____FlattenStyleProp_Helper<
|
|
1010
|
+
+TStyleProp: StyleProp<mixed>,
|
|
1011
|
+
Depth: $Values<FlattenDepthLimiter> = 9,
|
|
1012
|
+
> = Depth extends 0
|
|
1001
1013
|
? empty
|
|
1002
|
-
: TStyleProp extends
|
|
1003
|
-
?
|
|
1004
|
-
: TStyleProp
|
|
1014
|
+
: TStyleProp extends null | void | false | ''
|
|
1015
|
+
? empty
|
|
1016
|
+
: // When TStyleProp is an array, recurse with decremented Depth
|
|
1017
|
+
TStyleProp extends $ReadOnlyArray<infer V>
|
|
1018
|
+
? ____FlattenStyleProp_Helper<
|
|
1019
|
+
V,
|
|
1020
|
+
Depth extends number ? FlattenDepthLimiter[Depth] : 0,
|
|
1021
|
+
>
|
|
1022
|
+
: TStyleProp;
|
|
1023
|
+
|
|
1024
|
+
export type ____FlattenStyleProp_Internal<+TStyleProp: StyleProp<mixed>> =
|
|
1025
|
+
____FlattenStyleProp_Helper<TStyleProp> extends empty
|
|
1026
|
+
? // $FlowFixMe[unclear-type]
|
|
1027
|
+
any
|
|
1028
|
+
: ____FlattenStyleProp_Helper<TStyleProp>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type {NativeSyntheticEvent} from 'react-native';
|
|
11
|
+
import type {EventSubscription} from 'react-native/Libraries/vendor/emitter/EventEmitter';
|
|
12
|
+
|
|
13
|
+
// Event types
|
|
14
|
+
// We're not using the PaperName, it is only used to codegen view config settings
|
|
15
|
+
|
|
16
|
+
export type BubblingEventHandler<
|
|
17
|
+
T,
|
|
18
|
+
PaperName extends string | never = never,
|
|
19
|
+
> = (event: NativeSyntheticEvent<T>) => void | Promise<void>;
|
|
20
|
+
export type DirectEventHandler<T, PaperName extends string | never = never> = (
|
|
21
|
+
event: NativeSyntheticEvent<T>,
|
|
22
|
+
) => void | Promise<void>;
|
|
23
|
+
|
|
24
|
+
// Prop types
|
|
25
|
+
export type Double = number;
|
|
26
|
+
export type Float = number;
|
|
27
|
+
export type Int32 = number;
|
|
28
|
+
export type UnsafeObject = object;
|
|
29
|
+
export type UnsafeMixed = unknown;
|
|
30
|
+
|
|
31
|
+
type DefaultTypes = number | boolean | string | ReadonlyArray<string>;
|
|
32
|
+
// Default handling, ignore the unused value
|
|
33
|
+
// we're only using it for type checking
|
|
34
|
+
//
|
|
35
|
+
// TODO: (rickhanlonii) T44881457 If a default is provided, it should always be optional
|
|
36
|
+
// but that is currently not supported in the codegen since we require a default
|
|
37
|
+
|
|
38
|
+
export type WithDefault<
|
|
39
|
+
Type extends DefaultTypes,
|
|
40
|
+
Value extends Type | string | undefined | null,
|
|
41
|
+
> = Type | undefined | null;
|
|
42
|
+
|
|
43
|
+
export type EventEmitter<T> = (
|
|
44
|
+
handler: (arg: T) => void | Promise<void>,
|
|
45
|
+
) => EventSubscription;
|
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @flow strict-local
|
|
8
7
|
* @format
|
|
8
|
+
* @flow strict
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
// This module exists to fit CodegenTypes into a namespace under Flow
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
13
|
+
import * as CodegenTypes from './CodegenTypes';
|
|
14
|
+
export type {CodegenTypes};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
interface Options<T extends string> {
|
|
11
|
+
readonly supportedCommands: ReadonlyArray<T>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare function codegenNativeCommands<T extends object>(
|
|
15
|
+
options: Options<keyof T extends string ? keyof T : never>,
|
|
16
|
+
): T;
|
|
17
|
+
|
|
18
|
+
export default codegenNativeCommands;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type {HostComponent} from 'react-native';
|
|
11
|
+
|
|
12
|
+
interface Options {
|
|
13
|
+
readonly interfaceOnly?: boolean | undefined;
|
|
14
|
+
readonly paperComponentName?: string | undefined;
|
|
15
|
+
readonly paperComponentNameDeprecated?: string | undefined;
|
|
16
|
+
readonly excludedPlatforms?: ReadonlyArray<'iOS' | 'android'> | undefined;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type NativeComponentType<T> = HostComponent<T>;
|
|
20
|
+
|
|
21
|
+
declare function codegenNativeComponent<Props extends object>(
|
|
22
|
+
componentName: string,
|
|
23
|
+
options?: Options,
|
|
24
|
+
): NativeComponentType<Props>;
|
|
25
|
+
|
|
26
|
+
export default codegenNativeComponent;
|
|
@@ -72,8 +72,12 @@ export default class EventEmitter<
|
|
|
72
72
|
> = $ReadOnly<Record<string, $ReadOnlyArray<UnsafeObject>>>,
|
|
73
73
|
> implements IEventEmitter<TEventToArgsMap>
|
|
74
74
|
{
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
#registry: Registry<TEventToArgsMap>;
|
|
76
|
+
|
|
77
|
+
constructor() {
|
|
78
|
+
// $FlowFixMe[incompatible-type]
|
|
79
|
+
this.#registry = {};
|
|
80
|
+
}
|
|
77
81
|
|
|
78
82
|
/**
|
|
79
83
|
* Registers a listener that is called when the supplied event is emitted.
|