@office-iss/react-native-win32 0.0.0-canary.274 → 0.0.0-canary.276
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 +5 -1
- package/CHANGELOG.json +31 -1
- package/CHANGELOG.md +20 -4
- package/Libraries/ActionSheetIOS/ActionSheetIOS.d.ts +1 -0
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +13 -0
- package/Libraries/Animated/animations/Animation.js +1 -5
- package/Libraries/Animated/components/AnimatedFlatList.js +1 -1
- package/Libraries/Animated/components/AnimatedSectionList.js +3 -1
- package/Libraries/Animated/useAnimatedProps.js +2 -14
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +16 -2
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +21 -2
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +2 -0
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +0 -1
- package/Libraries/Components/ScrollView/ScrollView.js +35 -74
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +0 -2
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +0 -1
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
- package/Libraries/Components/TextInput/TextInput.flow.js +6 -0
- package/Libraries/Components/TextInput/TextInput.js +7 -1
- package/Libraries/Components/TextInput/TextInput.win32.js +7 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -2
- package/Libraries/Components/View/ViewPropTypes.d.ts +7 -0
- package/Libraries/Components/View/ViewPropTypes.js +0 -3
- package/Libraries/Components/View/ViewPropTypes.win32.js +0 -3
- package/Libraries/Core/ExceptionsManager.js +7 -4
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/setUpErrorHandling.js +20 -18
- package/Libraries/Core/setUpTimers.js +4 -12
- package/Libraries/Image/Image.android.js +0 -2
- package/Libraries/Image/Image.d.ts +2 -0
- package/Libraries/Image/ImageProps.js +2 -1
- package/Libraries/Image/ImageResizeMode.d.ts +8 -1
- package/Libraries/Image/ImageResizeMode.js +4 -1
- package/Libraries/Image/ImageSource.d.ts +0 -2
- package/Libraries/Image/ImageSource.js +0 -2
- package/Libraries/Image/ImageUtils.js +6 -3
- package/Libraries/Image/ImageViewNativeComponent.js +3 -1
- package/Libraries/Inspector/Inspector.win32.js +1 -1
- package/Libraries/Interaction/InteractionManager.js +6 -1
- package/Libraries/Interaction/InteractionManagerStub.js +176 -0
- package/Libraries/Lists/FlatList.js +2 -2
- package/Libraries/LogBox/LogBox.js +1 -1
- package/Libraries/LogBox/UI/AnsiHighlight.js +26 -17
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +6 -1
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.win32.js +6 -1
- package/Libraries/Modal/Modal.d.ts +5 -0
- package/Libraries/Modal/Modal.js +17 -0
- package/Libraries/NewAppScreen/components/HermesBadge.js +1 -1
- package/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +49 -2
- package/Libraries/Pressability/usePressability.js +4 -1
- package/Libraries/ReactNative/AppRegistry.js +0 -6
- package/Libraries/ReactNative/RendererImplementation.js +12 -12
- package/Libraries/ReactNative/renderApplication.js +3 -4
- package/Libraries/ReactNative/requireNativeComponent.js +2 -1
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +26149 -15434
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +1630 -2675
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +1691 -2954
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +27069 -16192
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +1657 -2714
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +1733 -2980
- package/Libraries/Renderer/shims/ReactFabric.js +3 -3
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
- package/Libraries/Renderer/shims/ReactNative.js +3 -3
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +7 -1
- package/Libraries/StyleSheet/StyleSheetTypes.js +5 -4
- package/Libraries/StyleSheet/processBackgroundImage.js +87 -110
- package/Libraries/TurboModule/TurboModuleRegistry.js +5 -5
- package/Libraries/Utilities/Appearance.js +3 -1
- package/Libraries/Utilities/BackHandler.android.js +6 -18
- package/Libraries/Utilities/BackHandler.d.ts +0 -4
- package/Libraries/Utilities/BackHandler.ios.js +0 -7
- package/Libraries/Utilities/BackHandler.win32.js +6 -18
- package/Libraries/Utilities/__mocks__/BackHandler.js +3 -8
- package/jest/setup.js +5 -1
- package/overrides.json +9 -9
- package/package.json +14 -14
- package/src/private/components/HScrollViewNativeComponents.js +1 -26
- package/src/private/components/VScrollViewNativeComponents.js +2 -24
- package/src/private/featureflags/ReactNativeFeatureFlags.js +24 -55
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +2 -7
- package/src/private/setup/setUpDOM.js +14 -6
- package/src/private/setup/setUpMutationObserver.js +5 -0
- package/src/private/specs/components/RCTModalHostViewNativeComponent.js +8 -0
- package/src/private/specs/modules/NativeAccessibilityInfo.js +6 -0
- package/src/private/specs/modules/NativeAccessibilityInfoWin32.js +6 -0
- package/src/private/specs/modules/NativeActionSheetManager.js +2 -0
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +96 -11
- package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +26 -0
- package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -0
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
- package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +9 -0
- package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +7 -0
- package/Libraries/ReactNative/ReactFabricInternals.js +0 -17
- package/src/private/components/useSyncOnScroll.js +0 -48
- package/types/experimental.d.ts +0 -59
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @noformat
|
|
8
8
|
* @nolint
|
|
9
9
|
* @flow
|
|
10
|
-
* @generated SignedSource<<
|
|
10
|
+
* @generated SignedSource<<cf323fc5ca893bab5669c7d321660412>>
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
@@ -16,7 +16,7 @@ import {BatchedBridge} from 'react-native/Libraries/ReactPrivate/ReactNativePriv
|
|
|
16
16
|
|
|
17
17
|
import type {ReactFabricType} from './ReactNativeTypes';
|
|
18
18
|
|
|
19
|
-
let ReactFabric;
|
|
19
|
+
let ReactFabric: ReactFabricType;
|
|
20
20
|
|
|
21
21
|
if (__DEV__) {
|
|
22
22
|
ReactFabric = require('../implementations/ReactFabric-dev');
|
|
@@ -30,4 +30,4 @@ if (global.RN$Bridgeless !== true) {
|
|
|
30
30
|
BatchedBridge.registerCallableModule('ReactFabric', ReactFabric);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
export default ReactFabric;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @noformat
|
|
8
8
|
* @nolint
|
|
9
9
|
* @flow strict-local
|
|
10
|
-
* @generated SignedSource<<
|
|
10
|
+
* @generated SignedSource<<908f5fb85384725318e261f40e49d9a6>>
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
@@ -16,4 +16,4 @@ const ReactFeatureFlags = {
|
|
|
16
16
|
debugRenderPhaseSideEffects: false,
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
export default ReactFeatureFlags;
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
* @noformat
|
|
8
8
|
* @nolint
|
|
9
9
|
* @flow
|
|
10
|
-
* @generated SignedSource<<
|
|
10
|
+
* @generated SignedSource<<8f46fdc9267fcc4fdc9e76842fe24066>>
|
|
11
11
|
*/
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
14
|
import type {ReactNativeType} from './ReactNativeTypes';
|
|
15
15
|
|
|
16
|
-
let ReactNative;
|
|
16
|
+
let ReactNative: ReactNativeType;
|
|
17
17
|
|
|
18
18
|
if (__DEV__) {
|
|
19
19
|
ReactNative = require('../implementations/ReactNativeRenderer-dev');
|
|
@@ -21,4 +21,4 @@ if (__DEV__) {
|
|
|
21
21
|
ReactNative = require('../implementations/ReactNativeRenderer-prod');
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
export default ReactNative;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @noformat
|
|
8
8
|
* @nolint
|
|
9
9
|
* @flow strict-local
|
|
10
|
-
* @generated SignedSource<<
|
|
10
|
+
* @generated SignedSource<<52163887de05f1cff05388145cf85b3b>>
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
@@ -32,4 +32,4 @@ const createReactNativeComponentClass = function (
|
|
|
32
32
|
return register(name, callback);
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
export default createReactNativeComponentClass;
|
|
@@ -434,6 +434,12 @@ export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
|
|
|
434
434
|
cursor?: CursorValue | undefined;
|
|
435
435
|
boxShadow?: ReadonlyArray<BoxShadowValue> | string | undefined;
|
|
436
436
|
filter?: ReadonlyArray<FilterFunction> | string | undefined;
|
|
437
|
+
|
|
438
|
+
mixBlendMode?: BlendMode | undefined;
|
|
439
|
+
experimental_backgroundImage?:
|
|
440
|
+
| ReadonlyArray<GradientValue>
|
|
441
|
+
| string
|
|
442
|
+
| undefined;
|
|
437
443
|
}
|
|
438
444
|
|
|
439
445
|
export type FontVariant =
|
|
@@ -562,6 +568,6 @@ export interface ImageStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
|
|
|
562
568
|
overlayColor?: ColorValue | undefined;
|
|
563
569
|
tintColor?: ColorValue | undefined;
|
|
564
570
|
opacity?: AnimatableNumericValue | undefined;
|
|
565
|
-
objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | undefined;
|
|
571
|
+
objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none' | undefined;
|
|
566
572
|
cursor?: CursorValue | undefined;
|
|
567
573
|
}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
13
|
import type AnimatedNode from '../Animated/nodes/AnimatedNode';
|
|
14
|
+
import type {ImageResizeMode} from './../Image/ImageResizeMode';
|
|
14
15
|
import type {
|
|
15
16
|
____DangerouslyImpreciseStyle_InternalOverrides,
|
|
16
17
|
____ImageStyle_InternalOverrides,
|
|
@@ -941,8 +942,8 @@ export type ____TextStyle_Internal = $ReadOnly<{
|
|
|
941
942
|
|
|
942
943
|
export type ____ImageStyle_InternalCore = $ReadOnly<{
|
|
943
944
|
...$Exact<____ViewStyle_Internal>,
|
|
944
|
-
resizeMode?:
|
|
945
|
-
objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down',
|
|
945
|
+
resizeMode?: ImageResizeMode,
|
|
946
|
+
objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none',
|
|
946
947
|
tintColor?: ____ColorValue_Internal,
|
|
947
948
|
overlayColor?: string,
|
|
948
949
|
}>;
|
|
@@ -954,8 +955,8 @@ export type ____ImageStyle_Internal = $ReadOnly<{
|
|
|
954
955
|
|
|
955
956
|
export type ____DangerouslyImpreciseStyle_InternalCore = $ReadOnly<{
|
|
956
957
|
...$Exact<____TextStyle_Internal>,
|
|
957
|
-
resizeMode?:
|
|
958
|
-
objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down',
|
|
958
|
+
resizeMode?: ImageResizeMode,
|
|
959
|
+
objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | 'none',
|
|
959
960
|
tintColor?: ____ColorValue_Internal,
|
|
960
961
|
overlayColor?: string,
|
|
961
962
|
}>;
|
|
@@ -14,25 +14,28 @@ import type {ProcessedColorValue} from './processColor';
|
|
|
14
14
|
import type {GradientValue} from './StyleSheetTypes';
|
|
15
15
|
|
|
16
16
|
const processColor = require('./processColor').default;
|
|
17
|
-
const
|
|
18
|
-
/^to\s+(?:top|bottom|left|right)(?:\s+(?:top|bottom|left|right))
|
|
17
|
+
const DIRECTION_KEYWORD_REGEX =
|
|
18
|
+
/^to\s+(?:top|bottom|left|right)(?:\s+(?:top|bottom|left|right))?/i;
|
|
19
19
|
const ANGLE_UNIT_REGEX = /^([+-]?\d*\.?\d+)(deg|grad|rad|turn)$/i;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
21
|
+
type LinearGradientDirection =
|
|
22
|
+
| {type: 'angle', value: number}
|
|
23
|
+
| {type: 'keyword', value: string};
|
|
25
24
|
|
|
26
25
|
type ParsedGradientValue = {
|
|
27
26
|
type: 'linearGradient',
|
|
28
|
-
|
|
29
|
-
end: {x: number, y: number},
|
|
27
|
+
direction: LinearGradientDirection,
|
|
30
28
|
colorStops: $ReadOnlyArray<{
|
|
31
29
|
color: ProcessedColorValue,
|
|
32
30
|
position: number,
|
|
33
31
|
}>,
|
|
34
32
|
};
|
|
35
33
|
|
|
34
|
+
const DEFAULT_DIRECTION: LinearGradientDirection = {
|
|
35
|
+
type: 'angle',
|
|
36
|
+
value: 180,
|
|
37
|
+
};
|
|
38
|
+
|
|
36
39
|
export default function processBackgroundImage(
|
|
37
40
|
backgroundImage: ?($ReadOnlyArray<GradientValue> | string),
|
|
38
41
|
): $ReadOnlyArray<ParsedGradientValue> {
|
|
@@ -76,37 +79,43 @@ export default function processBackgroundImage(
|
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
let
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (
|
|
96
|
-
|
|
82
|
+
let direction: LinearGradientDirection = DEFAULT_DIRECTION;
|
|
83
|
+
const bgDirection =
|
|
84
|
+
bgImage.direction != null ? bgImage.direction.toLowerCase() : null;
|
|
85
|
+
|
|
86
|
+
if (bgDirection != null) {
|
|
87
|
+
if (ANGLE_UNIT_REGEX.test(bgDirection)) {
|
|
88
|
+
const parsedAngle = getAngleInDegrees(bgDirection);
|
|
89
|
+
if (parsedAngle != null) {
|
|
90
|
+
direction = {
|
|
91
|
+
type: 'angle',
|
|
92
|
+
value: parsedAngle,
|
|
93
|
+
};
|
|
94
|
+
} else {
|
|
95
|
+
// If an angle is invalid, return an empty array and do not apply any gradient. Same as web.
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
} else if (DIRECTION_KEYWORD_REGEX.test(bgDirection)) {
|
|
99
|
+
const parsedDirection = getDirectionForKeyword(bgDirection);
|
|
100
|
+
if (parsedDirection != null) {
|
|
101
|
+
direction = parsedDirection;
|
|
102
|
+
} else {
|
|
103
|
+
// If a direction is invalid, return an empty array and do not apply any gradient. Same as web.
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
// If a direction is invalid, return an empty array and do not apply any gradient. Same as web.
|
|
108
|
+
return [];
|
|
97
109
|
}
|
|
98
110
|
}
|
|
99
111
|
|
|
100
112
|
const fixedColorStops = getFixedColorStops(processedColorStops);
|
|
101
113
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
colorStops: fixedColorStops,
|
|
108
|
-
});
|
|
109
|
-
}
|
|
114
|
+
result = result.concat({
|
|
115
|
+
type: 'linearGradient',
|
|
116
|
+
direction,
|
|
117
|
+
colorStops: fixedColorStops,
|
|
118
|
+
});
|
|
110
119
|
}
|
|
111
120
|
}
|
|
112
121
|
|
|
@@ -118,30 +127,39 @@ function parseCSSLinearGradient(
|
|
|
118
127
|
): $ReadOnlyArray<ParsedGradientValue> {
|
|
119
128
|
const gradients = [];
|
|
120
129
|
let match;
|
|
130
|
+
|
|
131
|
+
// matches one or more linear-gradient functions in CSS
|
|
121
132
|
const linearGradientRegex = /linear-gradient\s*\(((?:\([^)]*\)|[^())])*)\)/gi;
|
|
122
133
|
|
|
123
134
|
while ((match = linearGradientRegex.exec(cssString))) {
|
|
124
135
|
const gradientContent = match[1];
|
|
125
136
|
const parts = gradientContent.split(',');
|
|
126
|
-
let
|
|
137
|
+
let direction: LinearGradientDirection = DEFAULT_DIRECTION;
|
|
127
138
|
const trimmedDirection = parts[0].trim().toLowerCase();
|
|
139
|
+
|
|
140
|
+
// matches individual color stops in a gradient function
|
|
141
|
+
// supports various color formats: named colors, hex colors, rgb(a), and hsl(a)
|
|
142
|
+
// e.g. "red 20%", "blue 50%", "rgba(0, 0, 0, 0.5) 30% 50%"
|
|
143
|
+
// TODO: does not support color hint syntax yet. It is WIP.
|
|
128
144
|
const colorStopRegex =
|
|
129
145
|
/\s*((?:(?:rgba?|hsla?)\s*\([^)]+\))|#[0-9a-fA-F]+|[a-zA-Z]+)(?:\s+(-?[0-9.]+%?)(?:\s+(-?[0-9.]+%?))?)?\s*/gi;
|
|
130
146
|
|
|
131
147
|
if (ANGLE_UNIT_REGEX.test(trimmedDirection)) {
|
|
132
|
-
const
|
|
133
|
-
if (
|
|
134
|
-
|
|
148
|
+
const parsedAngle = getAngleInDegrees(trimmedDirection);
|
|
149
|
+
if (parsedAngle != null) {
|
|
150
|
+
direction = {
|
|
151
|
+
type: 'angle',
|
|
152
|
+
value: parsedAngle,
|
|
153
|
+
};
|
|
135
154
|
parts.shift();
|
|
136
155
|
} else {
|
|
137
156
|
// If an angle is invalid, return an empty array and do not apply any gradient. Same as web.
|
|
138
157
|
return [];
|
|
139
158
|
}
|
|
140
|
-
} else if (
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
points = parsedPoints;
|
|
159
|
+
} else if (DIRECTION_KEYWORD_REGEX.test(trimmedDirection)) {
|
|
160
|
+
const parsedDirection = getDirectionForKeyword(trimmedDirection);
|
|
161
|
+
if (parsedDirection != null) {
|
|
162
|
+
direction = parsedDirection;
|
|
145
163
|
parts.shift();
|
|
146
164
|
} else {
|
|
147
165
|
// If a direction is invalid, return an empty array and do not apply any gradient. Same as web.
|
|
@@ -198,8 +216,7 @@ function parseCSSLinearGradient(
|
|
|
198
216
|
|
|
199
217
|
gradients.push({
|
|
200
218
|
type: 'linearGradient',
|
|
201
|
-
|
|
202
|
-
end: points.end,
|
|
219
|
+
direction,
|
|
203
220
|
colorStops: fixedColorStops,
|
|
204
221
|
});
|
|
205
222
|
}
|
|
@@ -207,83 +224,43 @@ function parseCSSLinearGradient(
|
|
|
207
224
|
return gradients;
|
|
208
225
|
}
|
|
209
226
|
|
|
210
|
-
function
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
227
|
+
function getDirectionForKeyword(direction?: string): ?LinearGradientDirection {
|
|
228
|
+
if (direction == null) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
214
231
|
// Remove extra whitespace
|
|
215
|
-
const
|
|
232
|
+
const normalized = direction.replace(/\s+/g, ' ').toLowerCase();
|
|
216
233
|
|
|
217
|
-
switch (
|
|
234
|
+
switch (normalized) {
|
|
235
|
+
case 'to top':
|
|
236
|
+
return {type: 'angle', value: 0};
|
|
218
237
|
case 'to right':
|
|
219
|
-
return {
|
|
220
|
-
start: {x: 0, y: 0.5},
|
|
221
|
-
end: {x: 1, y: 0.5},
|
|
222
|
-
};
|
|
223
|
-
case 'to left':
|
|
224
|
-
return {
|
|
225
|
-
start: {x: 1, y: 0.5},
|
|
226
|
-
end: {x: 0, y: 0.5},
|
|
227
|
-
};
|
|
238
|
+
return {type: 'angle', value: 90};
|
|
228
239
|
case 'to bottom':
|
|
229
|
-
return
|
|
230
|
-
case 'to
|
|
231
|
-
return {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
};
|
|
240
|
+
return {type: 'angle', value: 180};
|
|
241
|
+
case 'to left':
|
|
242
|
+
return {type: 'angle', value: 270};
|
|
243
|
+
case 'to top right':
|
|
244
|
+
case 'to right top':
|
|
245
|
+
return {type: 'keyword', value: 'to top right'};
|
|
235
246
|
case 'to bottom right':
|
|
236
247
|
case 'to right bottom':
|
|
237
|
-
return {
|
|
238
|
-
start: {x: 0, y: 0},
|
|
239
|
-
end: {x: 1, y: 1},
|
|
240
|
-
};
|
|
248
|
+
return {type: 'keyword', value: 'to bottom right'};
|
|
241
249
|
case 'to top left':
|
|
242
250
|
case 'to left top':
|
|
243
|
-
return {
|
|
244
|
-
start: {x: 1, y: 1},
|
|
245
|
-
end: {x: 0, y: 0},
|
|
246
|
-
};
|
|
251
|
+
return {type: 'keyword', value: 'to top left'};
|
|
247
252
|
case 'to bottom left':
|
|
248
253
|
case 'to left bottom':
|
|
249
|
-
return {
|
|
250
|
-
start: {x: 1, y: 0},
|
|
251
|
-
end: {x: 0, y: 1},
|
|
252
|
-
};
|
|
253
|
-
case 'to top right':
|
|
254
|
-
case 'to right top':
|
|
255
|
-
return {
|
|
256
|
-
start: {x: 0, y: 1},
|
|
257
|
-
end: {x: 1, y: 0},
|
|
258
|
-
};
|
|
254
|
+
return {type: 'keyword', value: 'to bottom left'};
|
|
259
255
|
default:
|
|
260
256
|
return null;
|
|
261
257
|
}
|
|
262
258
|
}
|
|
263
259
|
|
|
264
|
-
function
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
} {
|
|
268
|
-
// Normalize angle to be between 0 and 2π
|
|
269
|
-
let angleRadiansNormalized = angleRadians % (2 * Math.PI);
|
|
270
|
-
if (angleRadiansNormalized < 0) {
|
|
271
|
-
angleRadiansNormalized += 2 * Math.PI;
|
|
260
|
+
function getAngleInDegrees(angle?: string): ?number {
|
|
261
|
+
if (angle == null) {
|
|
262
|
+
return null;
|
|
272
263
|
}
|
|
273
|
-
|
|
274
|
-
const endX = 0.5 + 0.5 * Math.sin(angleRadiansNormalized);
|
|
275
|
-
const endY = 0.5 - 0.5 * Math.cos(angleRadiansNormalized);
|
|
276
|
-
|
|
277
|
-
const startX = 1 - endX;
|
|
278
|
-
const startY = 1 - endY;
|
|
279
|
-
|
|
280
|
-
return {
|
|
281
|
-
start: {x: startX, y: startY},
|
|
282
|
-
end: {x: endX, y: endY},
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
function parseAngle(angle: string): ?number {
|
|
287
264
|
const match = angle.match(ANGLE_UNIT_REGEX);
|
|
288
265
|
if (!match) {
|
|
289
266
|
return null;
|
|
@@ -294,13 +271,13 @@ function parseAngle(angle: string): ?number {
|
|
|
294
271
|
const numericValue = parseFloat(value);
|
|
295
272
|
switch (unit) {
|
|
296
273
|
case 'deg':
|
|
297
|
-
return
|
|
274
|
+
return numericValue;
|
|
298
275
|
case 'grad':
|
|
299
|
-
return
|
|
276
|
+
return numericValue * 0.9; // 1 grad = 0.9 degrees
|
|
300
277
|
case 'rad':
|
|
301
|
-
return numericValue;
|
|
278
|
+
return (numericValue * 180) / Math.PI;
|
|
302
279
|
case 'turn':
|
|
303
|
-
return numericValue *
|
|
280
|
+
return numericValue * 360; // 1 turn = 360 degrees
|
|
304
281
|
default:
|
|
305
282
|
return null;
|
|
306
283
|
}
|
|
@@ -16,9 +16,6 @@ const NativeModules = require('../BatchedBridge/NativeModules');
|
|
|
16
16
|
|
|
17
17
|
const turboModuleProxy = global.__turboModuleProxy;
|
|
18
18
|
|
|
19
|
-
const useLegacyNativeModuleInterop =
|
|
20
|
-
global.RN$Bridgeless !== true || global.RN$TurboInterop === true;
|
|
21
|
-
|
|
22
19
|
function requireModule<T: TurboModule>(name: string): ?T {
|
|
23
20
|
if (turboModuleProxy != null) {
|
|
24
21
|
const module: ?T = turboModuleProxy(name);
|
|
@@ -27,8 +24,11 @@ function requireModule<T: TurboModule>(name: string): ?T {
|
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
26
|
|
|
30
|
-
if (
|
|
31
|
-
|
|
27
|
+
if (
|
|
28
|
+
global.RN$Bridgeless !== true ||
|
|
29
|
+
global.RN$TurboInterop === true ||
|
|
30
|
+
global.RN$UnifiedNativeModuleProxy === true
|
|
31
|
+
) {
|
|
32
32
|
const legacyModule: ?T = NativeModules[name];
|
|
33
33
|
if (legacyModule != null) {
|
|
34
34
|
return legacyModule;
|
|
@@ -105,7 +105,9 @@ export function setColorScheme(colorScheme: ?ColorSchemeName): void {
|
|
|
105
105
|
const {NativeAppearance} = state;
|
|
106
106
|
if (NativeAppearance != null) {
|
|
107
107
|
NativeAppearance.setColorScheme(colorScheme ?? 'unspecified');
|
|
108
|
-
state.appearance = {
|
|
108
|
+
state.appearance = {
|
|
109
|
+
colorScheme: toColorScheme(NativeAppearance.getColorScheme()),
|
|
110
|
+
};
|
|
109
111
|
}
|
|
110
112
|
}
|
|
111
113
|
|
|
@@ -59,10 +59,6 @@ type TBackHandler = {|
|
|
|
59
59
|
eventName: BackPressEventName,
|
|
60
60
|
handler: () => ?boolean,
|
|
61
61
|
) => {remove: () => void, ...},
|
|
62
|
-
+removeEventListener: (
|
|
63
|
-
eventName: BackPressEventName,
|
|
64
|
-
handler: () => ?boolean,
|
|
65
|
-
) => void,
|
|
66
62
|
|};
|
|
67
63
|
const BackHandler: TBackHandler = {
|
|
68
64
|
exitApp: function (): void {
|
|
@@ -86,22 +82,14 @@ const BackHandler: TBackHandler = {
|
|
|
86
82
|
_backPressSubscriptions.push(handler);
|
|
87
83
|
}
|
|
88
84
|
return {
|
|
89
|
-
remove: (): void =>
|
|
85
|
+
remove: (): void => {
|
|
86
|
+
const index = _backPressSubscriptions.indexOf(handler);
|
|
87
|
+
if (index !== -1) {
|
|
88
|
+
_backPressSubscriptions.splice(index, 1);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
90
91
|
};
|
|
91
92
|
},
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Removes the event handler.
|
|
95
|
-
*/
|
|
96
|
-
removeEventListener: function (
|
|
97
|
-
eventName: BackPressEventName,
|
|
98
|
-
handler: () => ?boolean,
|
|
99
|
-
): void {
|
|
100
|
-
const index = _backPressSubscriptions.indexOf(handler);
|
|
101
|
-
if (index !== -1) {
|
|
102
|
-
_backPressSubscriptions.splice(index, 1);
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
93
|
};
|
|
106
94
|
|
|
107
95
|
module.exports = BackHandler;
|
|
@@ -28,10 +28,6 @@ export interface BackHandlerStatic {
|
|
|
28
28
|
eventName: BackPressEventName,
|
|
29
29
|
handler: () => boolean | null | undefined,
|
|
30
30
|
): NativeEventSubscription;
|
|
31
|
-
removeEventListener(
|
|
32
|
-
eventName: BackPressEventName,
|
|
33
|
-
handler: () => boolean | null | undefined,
|
|
34
|
-
): void;
|
|
35
31
|
}
|
|
36
32
|
|
|
37
33
|
export const BackHandler: BackHandlerStatic;
|
|
@@ -10,8 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
module.exports = require('../Components/UnimplementedViews/UnimplementedView');
|
|
14
|
-
|
|
15
13
|
type BackPressEventName = 'backPress' | 'hardwareBackPress';
|
|
16
14
|
|
|
17
15
|
function emptyFunction(): void {}
|
|
@@ -22,10 +20,6 @@ type TBackHandler = {|
|
|
|
22
20
|
eventName: BackPressEventName,
|
|
23
21
|
handler: () => ?boolean,
|
|
24
22
|
) => {remove: () => void, ...},
|
|
25
|
-
+removeEventListener: (
|
|
26
|
-
eventName: BackPressEventName,
|
|
27
|
-
handler: () => ?boolean,
|
|
28
|
-
) => void,
|
|
29
23
|
|};
|
|
30
24
|
|
|
31
25
|
let BackHandler: TBackHandler = {
|
|
@@ -35,7 +29,6 @@ let BackHandler: TBackHandler = {
|
|
|
35
29
|
remove: emptyFunction,
|
|
36
30
|
};
|
|
37
31
|
},
|
|
38
|
-
removeEventListener(_eventName: BackPressEventName, _handler: Function) {},
|
|
39
32
|
};
|
|
40
33
|
|
|
41
34
|
module.exports = BackHandler;
|
|
@@ -59,10 +59,6 @@ type TBackHandler = {|
|
|
|
59
59
|
eventName: BackPressEventName,
|
|
60
60
|
handler: () => ?boolean,
|
|
61
61
|
) => {remove: () => void, ...},
|
|
62
|
-
+removeEventListener: (
|
|
63
|
-
eventName: BackPressEventName,
|
|
64
|
-
handler: () => ?boolean,
|
|
65
|
-
) => void,
|
|
66
62
|
|};
|
|
67
63
|
const BackHandler: TBackHandler = {
|
|
68
64
|
exitApp: function (): void {
|
|
@@ -86,22 +82,14 @@ const BackHandler: TBackHandler = {
|
|
|
86
82
|
_backPressSubscriptions.push(handler);
|
|
87
83
|
}
|
|
88
84
|
return {
|
|
89
|
-
remove: (): void =>
|
|
85
|
+
remove: (): void => {
|
|
86
|
+
const index = _backPressSubscriptions.indexOf(handler);
|
|
87
|
+
if (index !== -1) {
|
|
88
|
+
_backPressSubscriptions.splice(index, 1);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
90
91
|
};
|
|
91
92
|
},
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Removes the event handler.
|
|
95
|
-
*/
|
|
96
|
-
removeEventListener: function (
|
|
97
|
-
eventName: BackPressEventName,
|
|
98
|
-
handler: () => ?boolean,
|
|
99
|
-
): void {
|
|
100
|
-
const index = _backPressSubscriptions.indexOf(handler);
|
|
101
|
-
if (index !== -1) {
|
|
102
|
-
_backPressSubscriptions.splice(index, 1);
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
93
|
};
|
|
106
94
|
|
|
107
95
|
module.exports = BackHandler;
|
|
@@ -20,17 +20,12 @@ const BackHandler = {
|
|
|
20
20
|
): {remove: () => void} {
|
|
21
21
|
_backPressSubscriptions.add(handler);
|
|
22
22
|
return {
|
|
23
|
-
remove: () =>
|
|
23
|
+
remove: () => {
|
|
24
|
+
_backPressSubscriptions.delete(handler);
|
|
25
|
+
},
|
|
24
26
|
};
|
|
25
27
|
},
|
|
26
28
|
|
|
27
|
-
removeEventListener: function (
|
|
28
|
-
eventName: BackPressEventName,
|
|
29
|
-
handler: () => ?boolean,
|
|
30
|
-
): void {
|
|
31
|
-
_backPressSubscriptions.delete(handler);
|
|
32
|
-
},
|
|
33
|
-
|
|
34
29
|
mockPressBack: function () {
|
|
35
30
|
let invokeDefault = true;
|
|
36
31
|
const subscriptions = [..._backPressSubscriptions].reverse();
|
package/jest/setup.js
CHANGED