react-native-windows 0.0.0-canary.451 → 0.0.0-canary.455
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 +1 -2
- package/Libraries/Animated/AnimatedImplementation.js +39 -7
- package/Libraries/Animated/AnimatedMock.js +6 -3
- package/Libraries/Animated/animations/SpringAnimation.js +10 -0
- package/Libraries/Animated/animations/TimingAnimation.js +5 -0
- package/Libraries/Animated/nodes/AnimatedColor.js +316 -0
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +2 -2
- package/Libraries/Animated/nodes/AnimatedNode.js +2 -2
- package/Libraries/Animated/nodes/AnimatedValue.js +1 -1
- package/Libraries/Components/Pressable/Pressable.js +2 -3
- package/Libraries/Components/Pressable/Pressable.windows.js +2 -3
- package/Libraries/Components/TextInput/TextInput.js +0 -7
- package/Libraries/Components/TextInput/TextInput.windows.js +0 -7
- package/Libraries/Components/View/ViewNativeComponent.js +64 -7
- package/Libraries/Components/View/ViewPropTypes.js +2 -2
- package/Libraries/Components/View/ViewPropTypes.windows.js +2 -2
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/setUpReactDevTools.js +3 -2
- package/Libraries/EventEmitter/NativeEventEmitter.js +3 -3
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +2 -1
- package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +3 -3
- package/Libraries/Image/Image.android.js +0 -6
- package/Libraries/Image/Image.ios.js +0 -6
- package/Libraries/Image/Image.windows.js +0 -6
- package/Libraries/Inspector/Inspector.js +2 -4
- package/Libraries/Linking/Linking.js +1 -1
- package/Libraries/Lists/VirtualizedList.js +17 -19
- package/Libraries/Lists/VirtualizedSectionList.js +1 -2
- package/Libraries/NativeComponent/PlatformBaseViewConfig.js +452 -0
- package/Libraries/NativeComponent/StaticViewConfigValidator.js +12 -12
- package/Libraries/NativeComponent/ViewConfig.js +4 -4
- package/Libraries/NativeComponent/ViewConfigIgnore.js +27 -0
- package/Libraries/Pressability/PressabilityDebug.js +5 -9
- package/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js +1 -0
- package/Libraries/ReactNative/DummyUIManager.js +5 -3
- package/Libraries/ReactNative/UIManager.js +1 -2
- package/Libraries/StyleSheet/EdgeInsetsPropType.js +4 -1
- package/Libraries/Text/Text.js +0 -6
- package/Libraries/Text/Text.windows.js +0 -6
- package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +3 -3
- package/Libraries/vendor/emitter/_EmitterSubscription.js +1 -1
- package/Libraries/vendor/emitter/_EventEmitter.js +1 -1
- package/Libraries/vendor/emitter/_EventSubscription.js +1 -1
- package/Microsoft.ReactNative/Base/CoreNativeModules.cpp +1 -4
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +9 -10
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +1 -1
- package/Microsoft.ReactNative/ReactPackageBuilder.cpp +1 -1
- package/Microsoft.ReactNative/TurboModulesProvider.cpp +3 -2
- package/Microsoft.ReactNative/TurboModulesProvider.h +4 -1
- package/Microsoft.ReactNative/Views/TouchEventHandler.cpp +122 -2
- package/Microsoft.ReactNative/Views/TouchEventHandler.h +2 -1
- package/PropertySheets/External/Microsoft.ReactNative.Uwp.CSharpApp.targets +9 -4
- package/PropertySheets/External/Microsoft.ReactNative.Uwp.CSharpLib.targets +5 -0
- package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppApp.SourceReferences.targets +18 -0
- package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppApp.targets +7 -8
- package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppLib.targets +5 -0
- package/PropertySheets/Generated/PackageVersion.g.props +1 -1
- package/PropertySheets/JSEngine.props +1 -1
- package/Shared/CreateModules.h +4 -0
- package/Shared/IHttpResource.h +32 -13
- package/Shared/Modules/HttpModule.cpp +198 -0
- package/Shared/Modules/HttpModule.h +53 -0
- package/Shared/Modules/WebSocketModule.cpp +4 -0
- package/Shared/OInstance.cpp +21 -1
- package/Shared/Shared.vcxitems +6 -0
- package/Shared/Shared.vcxitems.filters +21 -0
- package/Shared/Utils/WinRTConversions.cpp +22 -0
- package/Shared/Utils/WinRTConversions.h +15 -0
- package/Shared/WinRTHttpResource.cpp +317 -0
- package/Shared/WinRTHttpResource.h +71 -0
- package/Shared/WinRTWebSocketResource.cpp +14 -20
- package/codegen/NativePushNotificationManagerIOSSpec.g.h +2 -0
- package/index.js +12 -12
- package/index.windows.js +12 -12
- package/metro.config.js +3 -70
- package/package.json +15 -15
- package/template/cpp-app/proj/MyApp.vcxproj +0 -1
- package/template/cpp-lib/proj/MyLib.vcxproj +0 -1
- package/template/cs-app/proj/MyApp.csproj +0 -16
- package/template/metro.devMode.config.js +2 -51
- package/Libraries/Components/View/ReactNativeViewViewConfig.js +0 -360
- package/Libraries/Components/View/ReactNativeViewViewConfig.windows.js +0 -390
- package/Libraries/Components/View/ReactNativeViewViewConfigAndroid.js +0 -83
- package/Libraries/ReactNative/UIManagerInjection.js +0 -15
package/.flowconfig
CHANGED
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
<PROJECT_ROOT>/Libraries/Components/Touchable/TouchableOpacity.js
|
|
21
21
|
<PROJECT_ROOT>/Libraries/Components/Touchable/TouchableWithoutFeedback.js
|
|
22
22
|
<PROJECT_ROOT>/Libraries/Components/View/ReactNativeViewAttributes.js
|
|
23
|
-
<PROJECT_ROOT>/Libraries/Components/View/ReactNativeViewViewConfig.js
|
|
24
23
|
<PROJECT_ROOT>/Libraries/Components/View/ViewAccessibility.js
|
|
25
24
|
<PROJECT_ROOT>/Libraries/Components/View/ViewPropTypes.js
|
|
26
25
|
<PROJECT_ROOT>/Libraries/Components/View/View.js
|
|
@@ -118,4 +117,4 @@ untyped-import
|
|
|
118
117
|
untyped-type-import
|
|
119
118
|
|
|
120
119
|
[version]
|
|
121
|
-
^0.
|
|
120
|
+
^0.171.0
|
|
@@ -38,6 +38,8 @@ import type {DecayAnimationConfig} from './animations/DecayAnimation';
|
|
|
38
38
|
import type {SpringAnimationConfig} from './animations/SpringAnimation';
|
|
39
39
|
import type {Mapping, EventConfig} from './AnimatedEvent';
|
|
40
40
|
|
|
41
|
+
import AnimatedColor from './nodes/AnimatedColor';
|
|
42
|
+
|
|
41
43
|
export type CompositeAnimation = {
|
|
42
44
|
start: (callback?: ?EndCallback) => void,
|
|
43
45
|
stop: () => void,
|
|
@@ -102,7 +104,7 @@ const _combineCallbacks = function (
|
|
|
102
104
|
};
|
|
103
105
|
|
|
104
106
|
const maybeVectorAnim = function (
|
|
105
|
-
value: AnimatedValue | AnimatedValueXY,
|
|
107
|
+
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
|
|
106
108
|
config: Object,
|
|
107
109
|
anim: (value: AnimatedValue, config: Object) => CompositeAnimation,
|
|
108
110
|
): ?CompositeAnimation {
|
|
@@ -121,16 +123,42 @@ const maybeVectorAnim = function (
|
|
|
121
123
|
// We use `stopTogether: false` here because otherwise tracking will break
|
|
122
124
|
// because the second animation will get stopped before it can update.
|
|
123
125
|
return parallel([aX, aY], {stopTogether: false});
|
|
126
|
+
} else if (value instanceof AnimatedColor) {
|
|
127
|
+
const configR = {...config};
|
|
128
|
+
const configG = {...config};
|
|
129
|
+
const configB = {...config};
|
|
130
|
+
const configA = {...config};
|
|
131
|
+
for (const key in config) {
|
|
132
|
+
const {r, g, b, a} = config[key];
|
|
133
|
+
if (
|
|
134
|
+
r !== undefined &&
|
|
135
|
+
g !== undefined &&
|
|
136
|
+
b !== undefined &&
|
|
137
|
+
a !== undefined
|
|
138
|
+
) {
|
|
139
|
+
configR[key] = r;
|
|
140
|
+
configG[key] = g;
|
|
141
|
+
configB[key] = b;
|
|
142
|
+
configA[key] = a;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const aR = anim((value: AnimatedColor).r, configR);
|
|
146
|
+
const aG = anim((value: AnimatedColor).g, configG);
|
|
147
|
+
const aB = anim((value: AnimatedColor).b, configB);
|
|
148
|
+
const aA = anim((value: AnimatedColor).a, configA);
|
|
149
|
+
// We use `stopTogether: false` here because otherwise tracking will break
|
|
150
|
+
// because the second animation will get stopped before it can update.
|
|
151
|
+
return parallel([aR, aG, aB, aA], {stopTogether: false});
|
|
124
152
|
}
|
|
125
153
|
return null;
|
|
126
154
|
};
|
|
127
155
|
|
|
128
156
|
const spring = function (
|
|
129
|
-
value: AnimatedValue | AnimatedValueXY,
|
|
157
|
+
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
|
|
130
158
|
config: SpringAnimationConfig,
|
|
131
159
|
): CompositeAnimation {
|
|
132
160
|
const start = function (
|
|
133
|
-
animatedValue: AnimatedValue | AnimatedValueXY,
|
|
161
|
+
animatedValue: AnimatedValue | AnimatedValueXY | AnimatedColor,
|
|
134
162
|
configuration: SpringAnimationConfig,
|
|
135
163
|
callback?: ?EndCallback,
|
|
136
164
|
): void {
|
|
@@ -179,11 +207,11 @@ const spring = function (
|
|
|
179
207
|
};
|
|
180
208
|
|
|
181
209
|
const timing = function (
|
|
182
|
-
value: AnimatedValue | AnimatedValueXY,
|
|
210
|
+
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
|
|
183
211
|
config: TimingAnimationConfig,
|
|
184
212
|
): CompositeAnimation {
|
|
185
213
|
const start = function (
|
|
186
|
-
animatedValue: AnimatedValue | AnimatedValueXY,
|
|
214
|
+
animatedValue: AnimatedValue | AnimatedValueXY | AnimatedColor,
|
|
187
215
|
configuration: TimingAnimationConfig,
|
|
188
216
|
callback?: ?EndCallback,
|
|
189
217
|
): void {
|
|
@@ -233,11 +261,11 @@ const timing = function (
|
|
|
233
261
|
};
|
|
234
262
|
|
|
235
263
|
const decay = function (
|
|
236
|
-
value: AnimatedValue | AnimatedValueXY,
|
|
264
|
+
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
|
|
237
265
|
config: DecayAnimationConfig,
|
|
238
266
|
): CompositeAnimation {
|
|
239
267
|
const start = function (
|
|
240
|
-
animatedValue: AnimatedValue | AnimatedValueXY,
|
|
268
|
+
animatedValue: AnimatedValue | AnimatedValueXY | AnimatedColor,
|
|
241
269
|
configuration: DecayAnimationConfig,
|
|
242
270
|
callback?: ?EndCallback,
|
|
243
271
|
): void {
|
|
@@ -547,6 +575,10 @@ module.exports = {
|
|
|
547
575
|
* See https://reactnative.dev/docs/animatedvaluexy
|
|
548
576
|
*/
|
|
549
577
|
ValueXY: AnimatedValueXY,
|
|
578
|
+
/**
|
|
579
|
+
* Value class for driving color animations.
|
|
580
|
+
*/
|
|
581
|
+
Color: AnimatedColor,
|
|
550
582
|
/**
|
|
551
583
|
* Exported to use the Interpolation type in flow.
|
|
552
584
|
*
|
|
@@ -24,6 +24,8 @@ import type {TimingAnimationConfig} from './animations/TimingAnimation';
|
|
|
24
24
|
import type {DecayAnimationConfig} from './animations/DecayAnimation';
|
|
25
25
|
import type {SpringAnimationConfig} from './animations/SpringAnimation';
|
|
26
26
|
|
|
27
|
+
import AnimatedColor from './nodes/AnimatedColor';
|
|
28
|
+
|
|
27
29
|
/**
|
|
28
30
|
* Animations are a source of flakiness in snapshot testing. This mock replaces
|
|
29
31
|
* animation functions from AnimatedImplementation with empty animations for
|
|
@@ -89,7 +91,7 @@ const mockCompositeAnimation = (
|
|
|
89
91
|
});
|
|
90
92
|
|
|
91
93
|
const spring = function (
|
|
92
|
-
value: AnimatedValue | AnimatedValueXY,
|
|
94
|
+
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
|
|
93
95
|
config: SpringAnimationConfig,
|
|
94
96
|
): CompositeAnimation {
|
|
95
97
|
const anyValue: any = value;
|
|
@@ -103,7 +105,7 @@ const spring = function (
|
|
|
103
105
|
};
|
|
104
106
|
|
|
105
107
|
const timing = function (
|
|
106
|
-
value: AnimatedValue | AnimatedValueXY,
|
|
108
|
+
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
|
|
107
109
|
config: TimingAnimationConfig,
|
|
108
110
|
): CompositeAnimation {
|
|
109
111
|
const anyValue: any = value;
|
|
@@ -117,7 +119,7 @@ const timing = function (
|
|
|
117
119
|
};
|
|
118
120
|
|
|
119
121
|
const decay = function (
|
|
120
|
-
value: AnimatedValue | AnimatedValueXY,
|
|
122
|
+
value: AnimatedValue | AnimatedValueXY | AnimatedColor,
|
|
121
123
|
config: DecayAnimationConfig,
|
|
122
124
|
): CompositeAnimation {
|
|
123
125
|
return emptyAnimation;
|
|
@@ -164,6 +166,7 @@ const loop = function (
|
|
|
164
166
|
module.exports = {
|
|
165
167
|
Value: AnimatedValue,
|
|
166
168
|
ValueXY: AnimatedValueXY,
|
|
169
|
+
Color: AnimatedColor,
|
|
167
170
|
Interpolation: AnimatedInterpolation,
|
|
168
171
|
Node: AnimatedNode,
|
|
169
172
|
decay,
|
|
@@ -23,6 +23,8 @@ const {shouldUseNativeDriver} = require('../NativeAnimatedHelper');
|
|
|
23
23
|
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
|
24
24
|
import type {AnimationConfig, EndCallback} from './Animation';
|
|
25
25
|
|
|
26
|
+
import AnimatedColor from '../nodes/AnimatedColor';
|
|
27
|
+
|
|
26
28
|
export type SpringAnimationConfig = {
|
|
27
29
|
...AnimationConfig,
|
|
28
30
|
toValue:
|
|
@@ -34,6 +36,14 @@ export type SpringAnimationConfig = {
|
|
|
34
36
|
...
|
|
35
37
|
}
|
|
36
38
|
| AnimatedValueXY
|
|
39
|
+
| {
|
|
40
|
+
r: number,
|
|
41
|
+
g: number,
|
|
42
|
+
b: number,
|
|
43
|
+
a: number,
|
|
44
|
+
...
|
|
45
|
+
}
|
|
46
|
+
| AnimatedColor
|
|
37
47
|
| AnimatedInterpolation,
|
|
38
48
|
overshootClamping?: boolean,
|
|
39
49
|
restDisplacementThreshold?: number,
|
|
@@ -19,6 +19,9 @@ const {shouldUseNativeDriver} = require('../NativeAnimatedHelper');
|
|
|
19
19
|
|
|
20
20
|
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
|
21
21
|
import type {AnimationConfig, EndCallback} from './Animation';
|
|
22
|
+
import type {RgbaValue} from '../nodes/AnimatedColor';
|
|
23
|
+
|
|
24
|
+
import AnimatedColor from '../nodes/AnimatedColor';
|
|
22
25
|
|
|
23
26
|
export type TimingAnimationConfig = {
|
|
24
27
|
...AnimationConfig,
|
|
@@ -31,6 +34,8 @@ export type TimingAnimationConfig = {
|
|
|
31
34
|
...
|
|
32
35
|
}
|
|
33
36
|
| AnimatedValueXY
|
|
37
|
+
| RgbaValue
|
|
38
|
+
| AnimatedColor
|
|
34
39
|
| AnimatedInterpolation,
|
|
35
40
|
easing?: (value: number) => number,
|
|
36
41
|
duration?: number,
|
|
@@ -0,0 +1,316 @@
|
|
|
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
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
import AnimatedValue from './AnimatedValue';
|
|
14
|
+
import AnimatedWithChildren from './AnimatedWithChildren';
|
|
15
|
+
import normalizeColor from '../../StyleSheet/normalizeColor';
|
|
16
|
+
import {processColorObject} from '../../StyleSheet/PlatformColorValueTypes';
|
|
17
|
+
|
|
18
|
+
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
|
19
|
+
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
|
20
|
+
import type {NativeColorValue} from '../../StyleSheet/PlatformColorValueTypes';
|
|
21
|
+
|
|
22
|
+
type ColorListenerCallback = (value: string) => mixed;
|
|
23
|
+
export type RgbaValue = {
|
|
24
|
+
+r: number,
|
|
25
|
+
+g: number,
|
|
26
|
+
+b: number,
|
|
27
|
+
+a: number,
|
|
28
|
+
...
|
|
29
|
+
};
|
|
30
|
+
type RgbaAnimatedValue = {
|
|
31
|
+
+r: AnimatedValue,
|
|
32
|
+
+g: AnimatedValue,
|
|
33
|
+
+b: AnimatedValue,
|
|
34
|
+
+a: AnimatedValue,
|
|
35
|
+
...
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const defaultColor: RgbaValue = {r: 0, g: 0, b: 0, a: 1.0};
|
|
39
|
+
let _uniqueId = 1;
|
|
40
|
+
|
|
41
|
+
/* eslint no-bitwise: 0 */
|
|
42
|
+
function processColor(color?: ?ColorValue): ?(RgbaValue | NativeColorValue) {
|
|
43
|
+
if (color === undefined || color === null) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let normalizedColor = normalizeColor(color);
|
|
48
|
+
if (normalizedColor === undefined || normalizedColor === null) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (typeof normalizedColor === 'object') {
|
|
53
|
+
const processedColorObj = processColorObject(normalizedColor);
|
|
54
|
+
if (processedColorObj != null) {
|
|
55
|
+
return processedColorObj;
|
|
56
|
+
}
|
|
57
|
+
} else if (typeof normalizedColor === 'number') {
|
|
58
|
+
const r = (normalizedColor & 0xff000000) >>> 24;
|
|
59
|
+
const g = (normalizedColor & 0x00ff0000) >>> 16;
|
|
60
|
+
const b = (normalizedColor & 0x0000ff00) >>> 8;
|
|
61
|
+
const a = (normalizedColor & 0x000000ff) / 255;
|
|
62
|
+
|
|
63
|
+
return {r, g, b, a};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function isRgbaValue(value: any): boolean {
|
|
70
|
+
return (
|
|
71
|
+
value &&
|
|
72
|
+
typeof value.r === 'number' &&
|
|
73
|
+
typeof value.g === 'number' &&
|
|
74
|
+
typeof value.b === 'number' &&
|
|
75
|
+
typeof value.a === 'number'
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function isRgbaAnimatedValue(value: any): boolean {
|
|
80
|
+
return (
|
|
81
|
+
value &&
|
|
82
|
+
value.r instanceof AnimatedValue &&
|
|
83
|
+
value.g instanceof AnimatedValue &&
|
|
84
|
+
value.b instanceof AnimatedValue &&
|
|
85
|
+
value.a instanceof AnimatedValue
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export default class AnimatedColor extends AnimatedWithChildren {
|
|
90
|
+
r: AnimatedValue;
|
|
91
|
+
g: AnimatedValue;
|
|
92
|
+
b: AnimatedValue;
|
|
93
|
+
a: AnimatedValue;
|
|
94
|
+
nativeColor: Object;
|
|
95
|
+
_listeners: {
|
|
96
|
+
[key: string]: {
|
|
97
|
+
r: string,
|
|
98
|
+
g: string,
|
|
99
|
+
b: string,
|
|
100
|
+
a: string,
|
|
101
|
+
...
|
|
102
|
+
},
|
|
103
|
+
...
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
constructor(valueIn?: ?(RgbaValue | RgbaAnimatedValue | ColorValue)) {
|
|
107
|
+
super();
|
|
108
|
+
let value: RgbaValue | RgbaAnimatedValue | ColorValue =
|
|
109
|
+
valueIn ?? defaultColor;
|
|
110
|
+
this.setValue(value);
|
|
111
|
+
this._listeners = {};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Directly set the value. This will stop any animations running on the value
|
|
116
|
+
* and update all the bound properties.
|
|
117
|
+
*/
|
|
118
|
+
setValue(value: RgbaValue | RgbaAnimatedValue | ColorValue): void {
|
|
119
|
+
if (isRgbaAnimatedValue(value)) {
|
|
120
|
+
// $FlowIgnore[incompatible-cast] - Type is verified above
|
|
121
|
+
const rgbaAnimatedValue: RgbaAnimatedValue = (value: RgbaAnimatedValue);
|
|
122
|
+
this.r = rgbaAnimatedValue.r;
|
|
123
|
+
this.g = rgbaAnimatedValue.g;
|
|
124
|
+
this.b = rgbaAnimatedValue.b;
|
|
125
|
+
this.a = rgbaAnimatedValue.a;
|
|
126
|
+
} else {
|
|
127
|
+
// Handle potential parsable string color or platform color object
|
|
128
|
+
if (!isRgbaValue(value)) {
|
|
129
|
+
// $FlowIgnore[incompatible-cast] - Type is verified via conditionals
|
|
130
|
+
value = processColor((value: ColorValue)) ?? defaultColor;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (!isRgbaValue(value)) {
|
|
134
|
+
// We are using a platform color
|
|
135
|
+
this.nativeColor = value;
|
|
136
|
+
value = defaultColor;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (isRgbaValue(value)) {
|
|
140
|
+
// $FlowIgnore[incompatible-cast] - Type is verified via conditionals
|
|
141
|
+
const rgbaValue: RgbaValue = (value: RgbaValue);
|
|
142
|
+
|
|
143
|
+
if (this.r) {
|
|
144
|
+
this.r.setValue(rgbaValue.r);
|
|
145
|
+
} else {
|
|
146
|
+
this.r = new AnimatedValue(rgbaValue.r);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (this.g) {
|
|
150
|
+
this.g.setValue(rgbaValue.g);
|
|
151
|
+
} else {
|
|
152
|
+
this.g = new AnimatedValue(rgbaValue.g);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (this.b) {
|
|
156
|
+
this.b.setValue(rgbaValue.b);
|
|
157
|
+
} else {
|
|
158
|
+
this.b = new AnimatedValue(rgbaValue.b);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (this.a) {
|
|
162
|
+
this.a.setValue(rgbaValue.a);
|
|
163
|
+
} else {
|
|
164
|
+
this.a = new AnimatedValue(rgbaValue.a);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (this.nativeColor) {
|
|
169
|
+
this.__makeNative();
|
|
170
|
+
// TODO (T111170195): In order to support setValue() with a platform color, update the
|
|
171
|
+
// native AnimatedNode (if it exists) with a new config.
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Sets an offset that is applied on top of whatever value is set, whether
|
|
178
|
+
* via `setValue`, an animation, or `Animated.event`. Useful for compensating
|
|
179
|
+
* things like the start of a pan gesture.
|
|
180
|
+
*/
|
|
181
|
+
setOffset(offset: RgbaValue): void {
|
|
182
|
+
this.r.setOffset(offset.r);
|
|
183
|
+
this.g.setOffset(offset.g);
|
|
184
|
+
this.b.setOffset(offset.b);
|
|
185
|
+
this.a.setOffset(offset.a);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Merges the offset value into the base value and resets the offset to zero.
|
|
190
|
+
* The final output of the value is unchanged.
|
|
191
|
+
*/
|
|
192
|
+
flattenOffset(): void {
|
|
193
|
+
this.r.flattenOffset();
|
|
194
|
+
this.g.flattenOffset();
|
|
195
|
+
this.b.flattenOffset();
|
|
196
|
+
this.a.flattenOffset();
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Sets the offset value to the base value, and resets the base value to
|
|
201
|
+
* zero. The final output of the value is unchanged.
|
|
202
|
+
*/
|
|
203
|
+
extractOffset(): void {
|
|
204
|
+
this.r.extractOffset();
|
|
205
|
+
this.g.extractOffset();
|
|
206
|
+
this.b.extractOffset();
|
|
207
|
+
this.a.extractOffset();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Adds an asynchronous listener to the value so you can observe updates from
|
|
212
|
+
* animations. This is useful because there is no way to synchronously read
|
|
213
|
+
* the value because it might be driven natively.
|
|
214
|
+
*
|
|
215
|
+
* Returns a string that serves as an identifier for the listener.
|
|
216
|
+
*/
|
|
217
|
+
addListener(callback: ColorListenerCallback): string {
|
|
218
|
+
const id = String(_uniqueId++);
|
|
219
|
+
const jointCallback = ({value: number}) => {
|
|
220
|
+
callback(this.__getValue());
|
|
221
|
+
};
|
|
222
|
+
this._listeners[id] = {
|
|
223
|
+
r: this.r.addListener(jointCallback),
|
|
224
|
+
g: this.g.addListener(jointCallback),
|
|
225
|
+
b: this.b.addListener(jointCallback),
|
|
226
|
+
a: this.a.addListener(jointCallback),
|
|
227
|
+
};
|
|
228
|
+
return id;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Unregister a listener. The `id` param shall match the identifier
|
|
233
|
+
* previously returned by `addListener()`.
|
|
234
|
+
*/
|
|
235
|
+
removeListener(id: string): void {
|
|
236
|
+
this.r.removeListener(this._listeners[id].r);
|
|
237
|
+
this.g.removeListener(this._listeners[id].g);
|
|
238
|
+
this.b.removeListener(this._listeners[id].b);
|
|
239
|
+
this.a.removeListener(this._listeners[id].a);
|
|
240
|
+
delete this._listeners[id];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Remove all registered listeners.
|
|
245
|
+
*/
|
|
246
|
+
removeAllListeners(): void {
|
|
247
|
+
this.r.removeAllListeners();
|
|
248
|
+
this.g.removeAllListeners();
|
|
249
|
+
this.b.removeAllListeners();
|
|
250
|
+
this.a.removeAllListeners();
|
|
251
|
+
this._listeners = {};
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Stops any running animation or tracking. `callback` is invoked with the
|
|
256
|
+
* final value after stopping the animation, which is useful for updating
|
|
257
|
+
* state to match the animation position with layout.
|
|
258
|
+
*/
|
|
259
|
+
stopAnimation(callback?: (value: string) => void): void {
|
|
260
|
+
this.r.stopAnimation();
|
|
261
|
+
this.g.stopAnimation();
|
|
262
|
+
this.b.stopAnimation();
|
|
263
|
+
this.a.stopAnimation();
|
|
264
|
+
callback && callback(this.__getValue());
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Stops any animation and resets the value to its original.
|
|
269
|
+
*/
|
|
270
|
+
resetAnimation(callback?: (value: string) => void): void {
|
|
271
|
+
this.r.resetAnimation();
|
|
272
|
+
this.g.resetAnimation();
|
|
273
|
+
this.b.resetAnimation();
|
|
274
|
+
this.a.resetAnimation();
|
|
275
|
+
callback && callback(this.__getValue());
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
__getValue(): string {
|
|
279
|
+
return `rgba(${this.r.__getValue()}, ${this.g.__getValue()}, ${this.b.__getValue()}, ${this.a.__getValue()})`;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
__attach(): void {
|
|
283
|
+
this.r.__addChild(this);
|
|
284
|
+
this.g.__addChild(this);
|
|
285
|
+
this.b.__addChild(this);
|
|
286
|
+
this.a.__addChild(this);
|
|
287
|
+
super.__attach();
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
__detach(): void {
|
|
291
|
+
this.r.__removeChild(this);
|
|
292
|
+
this.g.__removeChild(this);
|
|
293
|
+
this.b.__removeChild(this);
|
|
294
|
+
this.a.__removeChild(this);
|
|
295
|
+
super.__detach();
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
__makeNative(platformConfig: ?PlatformConfig) {
|
|
299
|
+
this.r.__makeNative(platformConfig);
|
|
300
|
+
this.g.__makeNative(platformConfig);
|
|
301
|
+
this.b.__makeNative(platformConfig);
|
|
302
|
+
this.a.__makeNative(platformConfig);
|
|
303
|
+
super.__makeNative(platformConfig);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
__getNativeConfig(): {...} {
|
|
307
|
+
return {
|
|
308
|
+
type: 'color',
|
|
309
|
+
r: this.r.__getNativeTag(),
|
|
310
|
+
g: this.g.__getNativeTag(),
|
|
311
|
+
b: this.b.__getNativeTag(),
|
|
312
|
+
a: this.a.__getNativeTag(),
|
|
313
|
+
nativeColor: this.nativeColor,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
}
|
|
@@ -23,14 +23,14 @@ import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
|
|
23
23
|
|
|
24
24
|
type ExtrapolateType = 'extend' | 'identity' | 'clamp';
|
|
25
25
|
|
|
26
|
-
export type InterpolationConfigType = {
|
|
26
|
+
export type InterpolationConfigType = $ReadOnly<{
|
|
27
27
|
inputRange: $ReadOnlyArray<number>,
|
|
28
28
|
outputRange: $ReadOnlyArray<number> | $ReadOnlyArray<string>,
|
|
29
29
|
easing?: (input: number) => number,
|
|
30
30
|
extrapolate?: ExtrapolateType,
|
|
31
31
|
extrapolateLeft?: ExtrapolateType,
|
|
32
32
|
extrapolateRight?: ExtrapolateType,
|
|
33
|
-
}
|
|
33
|
+
}>;
|
|
34
34
|
|
|
35
35
|
const linear = (t: number) => t;
|
|
36
36
|
|
|
@@ -130,12 +130,12 @@ class AnimatedNode {
|
|
|
130
130
|
if (data.tag !== this.__getNativeTag()) {
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
|
-
this.
|
|
133
|
+
this.__onAnimatedValueUpdateReceived(data.value);
|
|
134
134
|
},
|
|
135
135
|
);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
__onAnimatedValueUpdateReceived(value: number) {
|
|
139
139
|
this.__callListeners(value);
|
|
140
140
|
}
|
|
141
141
|
|
|
@@ -22,7 +22,7 @@ import type {
|
|
|
22
22
|
} from '../View/ViewAccessibility';
|
|
23
23
|
import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
|
|
24
24
|
import usePressability from '../../Pressability/usePressability';
|
|
25
|
-
import {
|
|
25
|
+
import {type RectOrSize} from '../../StyleSheet/Rect';
|
|
26
26
|
import type {
|
|
27
27
|
LayoutEvent,
|
|
28
28
|
MouseEvent,
|
|
@@ -181,6 +181,7 @@ function Pressable(props: Props, forwardedRef): React.Node {
|
|
|
181
181
|
delayLongPress,
|
|
182
182
|
disabled,
|
|
183
183
|
focusable,
|
|
184
|
+
hitSlop,
|
|
184
185
|
onHoverIn,
|
|
185
186
|
onHoverOut,
|
|
186
187
|
onLongPress,
|
|
@@ -201,8 +202,6 @@ function Pressable(props: Props, forwardedRef): React.Node {
|
|
|
201
202
|
|
|
202
203
|
const [pressed, setPressed] = usePressState(testOnly_pressed === true);
|
|
203
204
|
|
|
204
|
-
const hitSlop = normalizeRect(props.hitSlop);
|
|
205
|
-
|
|
206
205
|
const accessibilityState =
|
|
207
206
|
disabled != null
|
|
208
207
|
? {...props.accessibilityState, disabled}
|
|
@@ -22,7 +22,7 @@ import type {
|
|
|
22
22
|
} from '../View/ViewAccessibility';
|
|
23
23
|
import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
|
|
24
24
|
import usePressability from '../../Pressability/usePressability';
|
|
25
|
-
import {
|
|
25
|
+
import {type RectOrSize} from '../../StyleSheet/Rect';
|
|
26
26
|
import type {
|
|
27
27
|
LayoutEvent,
|
|
28
28
|
MouseEvent,
|
|
@@ -227,6 +227,7 @@ function Pressable(props: Props, forwardedRef): React.Node {
|
|
|
227
227
|
delayLongPress,
|
|
228
228
|
disabled,
|
|
229
229
|
focusable,
|
|
230
|
+
hitSlop,
|
|
230
231
|
onHoverIn,
|
|
231
232
|
onHoverOut,
|
|
232
233
|
onLongPress,
|
|
@@ -269,8 +270,6 @@ function Pressable(props: Props, forwardedRef): React.Node {
|
|
|
269
270
|
|
|
270
271
|
const [pressed, setPressed] = usePressState(testOnly_pressed === true);
|
|
271
272
|
|
|
272
|
-
const hitSlop = normalizeRect(props.hitSlop);
|
|
273
|
-
|
|
274
273
|
const accessibilityState =
|
|
275
274
|
disabled != null
|
|
276
275
|
? {...props.accessibilityState, disabled}
|
|
@@ -1341,13 +1341,6 @@ const ExportedForwardRef: React.AbstractComponent<
|
|
|
1341
1341
|
);
|
|
1342
1342
|
});
|
|
1343
1343
|
|
|
1344
|
-
/**
|
|
1345
|
-
* Switch to `deprecated-react-native-prop-types` for compatibility with future
|
|
1346
|
-
* releases. This is deprecated and will be removed in the future.
|
|
1347
|
-
*/
|
|
1348
|
-
ExportedForwardRef.propTypes =
|
|
1349
|
-
require('deprecated-react-native-prop-types').TextInputPropTypes;
|
|
1350
|
-
|
|
1351
1344
|
// $FlowFixMe[prop-missing]
|
|
1352
1345
|
ExportedForwardRef.State = {
|
|
1353
1346
|
currentlyFocusedInput: TextInputState.currentlyFocusedInput,
|
|
@@ -1455,13 +1455,6 @@ const ExportedForwardRef: React.AbstractComponent<
|
|
|
1455
1455
|
);
|
|
1456
1456
|
});
|
|
1457
1457
|
|
|
1458
|
-
/**
|
|
1459
|
-
* Switch to `deprecated-react-native-prop-types` for compatibility with future
|
|
1460
|
-
* releases. This is deprecated and will be removed in the future.
|
|
1461
|
-
*/
|
|
1462
|
-
ExportedForwardRef.propTypes =
|
|
1463
|
-
require('deprecated-react-native-prop-types').TextInputPropTypes;
|
|
1464
|
-
|
|
1465
1458
|
// $FlowFixMe[prop-missing]
|
|
1466
1459
|
ExportedForwardRef.State = {
|
|
1467
1460
|
currentlyFocusedInput: TextInputState.currentlyFocusedInput,
|