react-native-windows 0.0.0-canary.563 → 0.0.0-canary.565
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/Libraries/Animated/AnimatedEvent.js +2 -2
- package/Libraries/Animated/createAnimatedComponent.js +3 -3
- package/Libraries/Animated/nodes/AnimatedNode.js +1 -1
- package/Libraries/Animated/nodes/AnimatedStyle.js +5 -2
- package/Libraries/AppState/AppState.js +1 -0
- package/Libraries/BatchedBridge/MessageQueue.js +2 -2
- package/Libraries/Blob/BlobManager.js +1 -0
- package/Libraries/Blob/FileReader.js +3 -3
- package/Libraries/Blob/URL.js +9 -8
- package/Libraries/Components/Button.js +13 -0
- package/Libraries/Components/Button.windows.js +6 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -0
- package/Libraries/Components/Keyboard/Keyboard.js +5 -4
- package/Libraries/Components/ScrollView/ScrollView.js +3 -3
- package/Libraries/Components/StatusBar/StatusBar.js +3 -3
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Image/ImageBackground.js +11 -1
- package/Libraries/Inspector/BoxInspector.js +1 -1
- package/Libraries/Inspector/InspectorPanel.js +1 -1
- package/Libraries/Inspector/NetworkOverlay.js +6 -2
- package/Libraries/Linking/Linking.js +1 -1
- package/Libraries/Lists/CellRenderMask.js +1 -1
- package/Libraries/Lists/FillRateHelper.js +15 -12
- package/Libraries/Lists/FlatList.js +10 -2
- package/Libraries/Lists/StateSafePureComponent.js +85 -0
- package/Libraries/Lists/ViewabilityHelper.js +31 -10
- package/Libraries/Lists/VirtualizeUtils.js +16 -10
- package/Libraries/Lists/VirtualizedList.js +31 -268
- package/Libraries/Lists/VirtualizedListInjection.js +1 -1
- package/Libraries/Lists/VirtualizedListProps.js +285 -0
- package/Libraries/Lists/VirtualizedListProps.windows.js +288 -0
- package/Libraries/Lists/VirtualizedList_EXPERIMENTAL.js +115 -315
- package/Libraries/Lists/VirtualizedSectionList.js +3 -1
- package/Libraries/Lists/__tests__/FlatList-test.js +31 -0
- package/Libraries/Lists/__tests__/ViewabilityHelper-test.js +60 -56
- package/Libraries/Lists/__tests__/VirtualizeUtils-test.js +21 -4
- package/Libraries/Lists/__tests__/VirtualizedList-test.js +5 -1
- package/Libraries/LogBox/Data/LogBoxData.js +2 -2
- package/Libraries/NativeComponent/BaseViewConfig.android.js +1 -0
- package/Libraries/PushNotificationIOS/PushNotificationIOS.js +15 -12
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +312 -217
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +212 -177
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +248 -213
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +311 -218
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +226 -196
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +262 -232
- package/Libraries/Text/TextNativeComponent.js +45 -39
- package/Libraries/Utilities/createPerformanceLogger.js +7 -7
- package/Microsoft.ReactNative/Base/CoreNativeModules.cpp +0 -8
- package/Microsoft.ReactNative/Modules/Animated/AdditionAnimatedNode.cpp +3 -3
- package/Microsoft.ReactNative/Modules/Animated/AdditionAnimatedNode.h +1 -2
- package/Microsoft.ReactNative/Modules/Animated/AnimationDriver.cpp +8 -9
- package/Microsoft.ReactNative/Modules/Animated/AnimationDriver.h +6 -7
- package/Microsoft.ReactNative/Modules/Animated/CalculatedAnimationDriver.cpp +1 -1
- package/Microsoft.ReactNative/Modules/Animated/CalculatedAnimationDriver.h +1 -1
- package/Microsoft.ReactNative/Modules/Animated/DecayAnimationDriver.cpp +3 -3
- package/Microsoft.ReactNative/Modules/Animated/DecayAnimationDriver.h +1 -1
- package/Microsoft.ReactNative/Modules/Animated/DiffClampAnimatedNode.cpp +4 -4
- package/Microsoft.ReactNative/Modules/Animated/DiffClampAnimatedNode.h +1 -2
- package/Microsoft.ReactNative/Modules/Animated/DivisionAnimatedNode.cpp +4 -4
- package/Microsoft.ReactNative/Modules/Animated/DivisionAnimatedNode.h +1 -2
- package/Microsoft.ReactNative/Modules/Animated/EventAnimationDriver.cpp +2 -2
- package/Microsoft.ReactNative/Modules/Animated/EventAnimationDriver.h +1 -1
- package/Microsoft.ReactNative/Modules/Animated/FrameAnimationDriver.cpp +5 -5
- package/Microsoft.ReactNative/Modules/Animated/FrameAnimationDriver.h +2 -2
- package/Microsoft.ReactNative/Modules/Animated/InterpolationAnimatedNode.cpp +7 -7
- package/Microsoft.ReactNative/Modules/Animated/InterpolationAnimatedNode.h +1 -2
- package/Microsoft.ReactNative/Modules/Animated/ModulusAnimatedNode.cpp +3 -3
- package/Microsoft.ReactNative/Modules/Animated/ModulusAnimatedNode.h +2 -2
- package/Microsoft.ReactNative/Modules/Animated/MultiplicationAnimatedNode.cpp +3 -3
- package/Microsoft.ReactNative/Modules/Animated/MultiplicationAnimatedNode.h +1 -2
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedModule.cpp +235 -225
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedModule.h +91 -41
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.cpp +45 -47
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.h +12 -10
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +5 -5
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.h +4 -3
- package/Microsoft.ReactNative/Modules/Animated/SpringAnimationDriver.cpp +13 -14
- package/Microsoft.ReactNative/Modules/Animated/SpringAnimationDriver.h +4 -4
- package/Microsoft.ReactNative/Modules/Animated/StyleAnimatedNode.cpp +3 -3
- package/Microsoft.ReactNative/Modules/Animated/StyleAnimatedNode.h +1 -1
- package/Microsoft.ReactNative/Modules/Animated/SubtractionAnimatedNode.cpp +4 -4
- package/Microsoft.ReactNative/Modules/Animated/SubtractionAnimatedNode.h +1 -1
- package/Microsoft.ReactNative/Modules/Animated/TrackingAnimatedNode.cpp +6 -6
- package/Microsoft.ReactNative/Modules/Animated/TrackingAnimatedNode.h +3 -3
- package/Microsoft.ReactNative/Modules/Animated/TransformAnimatedNode.cpp +7 -8
- package/Microsoft.ReactNative/Modules/Animated/TransformAnimatedNode.h +2 -2
- package/Microsoft.ReactNative/Modules/Animated/ValueAnimatedNode.cpp +3 -5
- package/Microsoft.ReactNative/Modules/Animated/ValueAnimatedNode.h +3 -2
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +5 -0
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.h +1 -0
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +5 -0
- package/PropertySheets/Generated/PackageVersion.g.props +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/LayoutableShadowNode.cpp +22 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/mapbuffer/MapBufferBuilder.cpp +182 -0
- package/codegen/react/components/rnwcore/ComponentDescriptors.h +3 -3
- package/codegen/react/components/rnwcore/EventEmitters.cpp +3 -3
- package/codegen/react/components/rnwcore/EventEmitters.h +19 -18
- package/codegen/react/components/rnwcore/Props.cpp +3 -3
- package/codegen/react/components/rnwcore/Props.h +19 -18
- package/codegen/react/components/rnwcore/ShadowNodes.cpp +3 -3
- package/codegen/react/components/rnwcore/ShadowNodes.h +13 -12
- package/index.js +20 -8
- package/index.windows.js +20 -8
- package/package.json +15 -15
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.h +0 -145
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +0 -344
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/BaseTextProps.cpp +0 -313
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/ViewProps.cpp +0 -465
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/PropsMacros.h +0 -91
package/.flowconfig
CHANGED
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
<PROJECT_ROOT>/Libraries/NewAppScreen/components/ReloadInstructions.js
|
|
32
32
|
<PROJECT_ROOT>/Libraries/Pressability/Pressability.js
|
|
33
33
|
<PROJECT_ROOT>/Libraries/Types/CoreEventTypes.js
|
|
34
|
+
<PROJECT_ROOT>/Libraries/Lists/VirtualizedListProps.js
|
|
34
35
|
|
|
35
36
|
; Ignore react-native files in node_modules since they are copied into project root
|
|
36
37
|
.*/node_modules/react-native/.*
|
|
@@ -100,7 +101,7 @@ suppress_type=$FlowFixMeProps
|
|
|
100
101
|
suppress_type=$FlowFixMeState
|
|
101
102
|
suppress_type=$FlowFixMeEmpty
|
|
102
103
|
|
|
103
|
-
|
|
104
|
+
inference_mode=constrain_writes
|
|
104
105
|
|
|
105
106
|
[lints]
|
|
106
107
|
sketchy-null-number=warn
|
|
@@ -122,4 +123,4 @@ untyped-import
|
|
|
122
123
|
untyped-type-import
|
|
123
124
|
|
|
124
125
|
[version]
|
|
125
|
-
^0.
|
|
126
|
+
^0.184.0
|
|
@@ -177,7 +177,7 @@ class AnimatedEvent {
|
|
|
177
177
|
this._listeners = this._listeners.filter(listener => listener !== callback);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
__attach(viewRef: any, eventName: string) {
|
|
180
|
+
__attach(viewRef: any, eventName: string): void {
|
|
181
181
|
invariant(
|
|
182
182
|
this.__isNative,
|
|
183
183
|
'Only native driven events need to be attached.',
|
|
@@ -191,7 +191,7 @@ class AnimatedEvent {
|
|
|
191
191
|
);
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
__detach(viewTag: any, eventName: string) {
|
|
194
|
+
__detach(viewTag: any, eventName: string): void {
|
|
195
195
|
invariant(
|
|
196
196
|
this.__isNative,
|
|
197
197
|
'Only native driven events need to be detached.',
|
|
@@ -140,7 +140,7 @@ function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
|
|
|
140
140
|
// components. If you want to animate a composite component, you need to
|
|
141
141
|
// re-render it. In this case, we have a fallback that uses forceUpdate.
|
|
142
142
|
// This fallback is also called in Fabric.
|
|
143
|
-
_animatedPropsCallback = () => {
|
|
143
|
+
_animatedPropsCallback = (): void => {
|
|
144
144
|
if (this._component == null) {
|
|
145
145
|
// AnimatedProps is created in will-mount because it's used in render.
|
|
146
146
|
// But this callback may be invoked before mount in async mode,
|
|
@@ -192,7 +192,7 @@ function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
|
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
_setComponentRef = setAndForwardRef({
|
|
195
|
+
_setComponentRef: (ref: React.ElementRef<any>) => void = setAndForwardRef({
|
|
196
196
|
getForwardedRef: () => this.props.forwardedRef,
|
|
197
197
|
setLocalRef: ref => {
|
|
198
198
|
this._prevComponent = this._component;
|
|
@@ -200,7 +200,7 @@ function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
|
|
|
200
200
|
},
|
|
201
201
|
});
|
|
202
202
|
|
|
203
|
-
render() {
|
|
203
|
+
render(): React.Node {
|
|
204
204
|
const animatedProps =
|
|
205
205
|
this._propsAnimated.__getValue(this._initialAnimatedProps) || {};
|
|
206
206
|
const {style = {}, ...props} = animatedProps;
|
|
@@ -53,7 +53,7 @@ class AnimatedNode {
|
|
|
53
53
|
this._listeners = {};
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
__makeNative(platformConfig: ?PlatformConfig) {
|
|
56
|
+
__makeNative(platformConfig: ?PlatformConfig): void {
|
|
57
57
|
if (!this.__isNative) {
|
|
58
58
|
throw new Error('This node cannot be made a "native" animated node');
|
|
59
59
|
}
|
|
@@ -34,7 +34,10 @@ class AnimatedStyle extends AnimatedWithChildren {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
// Recursively get values for nested styles (like iOS's shadowOffset)
|
|
37
|
-
_walkStyleAndGetValues(
|
|
37
|
+
_walkStyleAndGetValues(
|
|
38
|
+
style: any,
|
|
39
|
+
initialStyle: ?Object,
|
|
40
|
+
): {[string]: any | {...}} {
|
|
38
41
|
const updatedStyle: {[string]: any | {...}} = {};
|
|
39
42
|
for (const key in style) {
|
|
40
43
|
const value = style[key];
|
|
@@ -63,7 +66,7 @@ class AnimatedStyle extends AnimatedWithChildren {
|
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
// Recursively get animated values for nested styles (like iOS's shadowOffset)
|
|
66
|
-
_walkStyleAndGetAnimatedValues(style: any) {
|
|
69
|
+
_walkStyleAndGetAnimatedValues(style: any): {[string]: any | {...}} {
|
|
67
70
|
const updatedStyle: {[string]: any | {...}} = {};
|
|
68
71
|
for (const key in style) {
|
|
69
72
|
const value = style[key];
|
|
@@ -76,6 +76,7 @@ class AppState {
|
|
|
76
76
|
// It's possible that the state will have changed here & listeners need to be notified
|
|
77
77
|
if (!eventUpdated && this.currentState !== appStateData.app_state) {
|
|
78
78
|
this.currentState = appStateData.app_state;
|
|
79
|
+
// $FlowFixMe[incompatible-call]
|
|
79
80
|
emitter.emit('appStateDidChange', appStateData);
|
|
80
81
|
}
|
|
81
82
|
}, logError);
|
|
@@ -241,7 +241,7 @@ class MessageQueue {
|
|
|
241
241
|
params: mixed[],
|
|
242
242
|
onFail: ?(...mixed[]) => void,
|
|
243
243
|
onSucc: ?(...mixed[]) => void,
|
|
244
|
-
) {
|
|
244
|
+
): void {
|
|
245
245
|
this.processCallbacks(moduleID, methodID, params, onFail, onSucc);
|
|
246
246
|
|
|
247
247
|
this._queue[MODULE_IDS].push(moduleID);
|
|
@@ -427,7 +427,7 @@ class MessageQueue {
|
|
|
427
427
|
Systrace.endEvent();
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
-
__invokeCallback(cbID: number, args: mixed[]) {
|
|
430
|
+
__invokeCallback(cbID: number, args: mixed[]): void {
|
|
431
431
|
this._lastFlush = Date.now();
|
|
432
432
|
this._eventLoopStartTime = this._lastFlush;
|
|
433
433
|
|
|
@@ -110,6 +110,7 @@ class BlobManager {
|
|
|
110
110
|
*/
|
|
111
111
|
static createFromOptions(options: BlobData): Blob {
|
|
112
112
|
BlobRegistry.register(options.blobId);
|
|
113
|
+
// $FlowFixMe[prop-missing]
|
|
113
114
|
return Object.assign(Object.create(Blob.prototype), {
|
|
114
115
|
data:
|
|
115
116
|
// Reuse the collector instance when creating from an existing blob.
|
|
@@ -73,11 +73,11 @@ class FileReader extends (EventTarget(...READER_EVENTS): any) {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
readAsArrayBuffer() {
|
|
76
|
+
readAsArrayBuffer(): any {
|
|
77
77
|
throw new Error('FileReader.readAsArrayBuffer is not implemented');
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
readAsDataURL(blob: ?Blob) {
|
|
80
|
+
readAsDataURL(blob: ?Blob): void {
|
|
81
81
|
this._aborted = false;
|
|
82
82
|
|
|
83
83
|
if (blob == null) {
|
|
@@ -104,7 +104,7 @@ class FileReader extends (EventTarget(...READER_EVENTS): any) {
|
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
readAsText(blob: ?Blob, encoding: string = 'UTF-8') {
|
|
107
|
+
readAsText(blob: ?Blob, encoding: string = 'UTF-8'): void {
|
|
108
108
|
this._aborted = false;
|
|
109
109
|
|
|
110
110
|
if (blob == null) {
|
package/Libraries/Blob/URL.js
CHANGED
|
@@ -54,7 +54,7 @@ if (
|
|
|
54
54
|
// Small subset from whatwg-url: https://github.com/jsdom/whatwg-url/tree/master/src
|
|
55
55
|
// The reference code bloat comes from Unicode issues with URLs, so those won't work here.
|
|
56
56
|
export class URLSearchParams {
|
|
57
|
-
_searchParams = [];
|
|
57
|
+
_searchParams: Array<Array<string>> = [];
|
|
58
58
|
|
|
59
59
|
constructor(params: any) {
|
|
60
60
|
if (typeof params === 'object') {
|
|
@@ -62,35 +62,36 @@ export class URLSearchParams {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
append(key: string, value: string) {
|
|
65
|
+
append(key: string, value: string): void {
|
|
66
66
|
this._searchParams.push([key, value]);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
delete(name: string) {
|
|
69
|
+
delete(name: string): void {
|
|
70
70
|
throw new Error('URLSearchParams.delete is not implemented');
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
get(name: string) {
|
|
73
|
+
get(name: string): void {
|
|
74
74
|
throw new Error('URLSearchParams.get is not implemented');
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
getAll(name: string) {
|
|
77
|
+
getAll(name: string): void {
|
|
78
78
|
throw new Error('URLSearchParams.getAll is not implemented');
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
has(name: string) {
|
|
81
|
+
has(name: string): void {
|
|
82
82
|
throw new Error('URLSearchParams.has is not implemented');
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
set(name: string, value: string) {
|
|
85
|
+
set(name: string, value: string): void {
|
|
86
86
|
throw new Error('URLSearchParams.set is not implemented');
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
sort() {
|
|
89
|
+
sort(): void {
|
|
90
90
|
throw new Error('URLSearchParams.sort is not implemented');
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
// $FlowFixMe[unsupported-syntax]
|
|
94
|
+
// $FlowFixMe[missing-local-annot]
|
|
94
95
|
[Symbol.iterator]() {
|
|
95
96
|
return this._searchParams[Symbol.iterator]();
|
|
96
97
|
}
|
|
@@ -145,6 +145,11 @@ type ButtonProps = $ReadOnly<{|
|
|
|
145
145
|
accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
|
|
146
146
|
onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
|
|
147
147
|
accessibilityState?: ?AccessibilityState,
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* [Android] Controlling if a view fires accessibility events and if it is reported to accessibility services.
|
|
151
|
+
*/
|
|
152
|
+
importantForAccessibility?: ?('auto' | 'yes' | 'no' | 'no-hide-descendants'),
|
|
148
153
|
accessibilityHint?: ?string,
|
|
149
154
|
accessibilityLanguage?: ?Stringish,
|
|
150
155
|
|}>;
|
|
@@ -264,6 +269,7 @@ class Button extends React.Component<ButtonProps> {
|
|
|
264
269
|
render(): React.Node {
|
|
265
270
|
const {
|
|
266
271
|
accessibilityLabel,
|
|
272
|
+
importantForAccessibility,
|
|
267
273
|
color,
|
|
268
274
|
onPress,
|
|
269
275
|
touchSoundDisabled,
|
|
@@ -315,6 +321,12 @@ class Button extends React.Component<ButtonProps> {
|
|
|
315
321
|
const Touchable =
|
|
316
322
|
Platform.OS === 'android' ? TouchableNativeFeedback : TouchableOpacity;
|
|
317
323
|
|
|
324
|
+
// If `no` is specified for `importantForAccessibility`, it will be changed to `no-hide-descendants` because the text inside should not be focused.
|
|
325
|
+
const _importantForAccessibility =
|
|
326
|
+
importantForAccessibility === 'no'
|
|
327
|
+
? 'no-hide-descendants'
|
|
328
|
+
: importantForAccessibility;
|
|
329
|
+
|
|
318
330
|
return (
|
|
319
331
|
<Touchable
|
|
320
332
|
accessible={accessible}
|
|
@@ -325,6 +337,7 @@ class Button extends React.Component<ButtonProps> {
|
|
|
325
337
|
accessibilityLanguage={accessibilityLanguage}
|
|
326
338
|
accessibilityRole="button"
|
|
327
339
|
accessibilityState={accessibilityState}
|
|
340
|
+
importantForAccessibility={_importantForAccessibility}
|
|
328
341
|
hasTVPreferredFocus={hasTVPreferredFocus}
|
|
329
342
|
nextFocusDown={nextFocusDown}
|
|
330
343
|
nextFocusForward={nextFocusForward}
|
|
@@ -147,6 +147,11 @@ type ButtonProps = $ReadOnly<{|
|
|
|
147
147
|
accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
|
|
148
148
|
onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
|
|
149
149
|
accessibilityState?: ?AccessibilityState,
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* [Android] Controlling if a view fires accessibility events and if it is reported to accessibility services.
|
|
153
|
+
*/
|
|
154
|
+
importantForAccessibility?: ?('auto' | 'yes' | 'no' | 'no-hide-descendants'),
|
|
150
155
|
accessibilityHint?: ?string,
|
|
151
156
|
accessibilityLanguage?: ?Stringish,
|
|
152
157
|
|
|
@@ -285,6 +290,7 @@ class Button extends React.Component<
|
|
|
285
290
|
render(): React.Node {
|
|
286
291
|
const {
|
|
287
292
|
accessibilityLabel,
|
|
293
|
+
importantForAccessibility,
|
|
288
294
|
color,
|
|
289
295
|
onPress,
|
|
290
296
|
touchSoundDisabled,
|
|
@@ -162,6 +162,7 @@ class DrawerLayoutAndroid extends React.Component<Props, State> {
|
|
|
162
162
|
return {Left: 'left', Right: 'right'};
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
// $FlowFixMe[missing-local-annot]
|
|
165
166
|
_nativeRef =
|
|
166
167
|
React.createRef<
|
|
167
168
|
React.ElementRef<typeof AndroidDrawerLayoutNativeComponent>,
|
|
@@ -126,10 +126,11 @@ class Keyboard {
|
|
|
126
126
|
* - `keyboardWillChangeFrame`
|
|
127
127
|
* - `keyboardDidChangeFrame`
|
|
128
128
|
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
129
|
+
* Android versions prior to API 30 rely on observing layout changes when
|
|
130
|
+
* `android:windowSoftInputMode` is set to `adjustResize` or `adjustPan`.
|
|
131
|
+
*
|
|
132
|
+
* `keyboardWillShow` as well as `keyboardWillHide` are not available on Android since there is
|
|
133
|
+
* no native corresponding event.
|
|
133
134
|
*
|
|
134
135
|
* @param {function} callback function to be called when the event fires.
|
|
135
136
|
*/
|
|
@@ -825,7 +825,7 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
825
825
|
}
|
|
826
826
|
}
|
|
827
827
|
|
|
828
|
-
_setNativeRef = setAndForwardRef({
|
|
828
|
+
_setNativeRef: $FlowFixMe = setAndForwardRef({
|
|
829
829
|
getForwardedRef: () => this.props.scrollViewRef,
|
|
830
830
|
setLocalRef: ref => {
|
|
831
831
|
this._scrollViewRef = ref;
|
|
@@ -1107,7 +1107,7 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1107
1107
|
}
|
|
1108
1108
|
};
|
|
1109
1109
|
|
|
1110
|
-
_getKeyForIndex(index: $FlowFixMe, childArray: $FlowFixMe) {
|
|
1110
|
+
_getKeyForIndex(index: $FlowFixMe, childArray: $FlowFixMe): $FlowFixMe {
|
|
1111
1111
|
const child = childArray[index];
|
|
1112
1112
|
return child && child.key;
|
|
1113
1113
|
}
|
|
@@ -1204,7 +1204,7 @@ class ScrollView extends React.Component<Props, State> {
|
|
|
1204
1204
|
_scrollViewRef: ?React.ElementRef<HostComponent<mixed>> = null;
|
|
1205
1205
|
|
|
1206
1206
|
_innerViewRef: ?React.ElementRef<typeof View> = null;
|
|
1207
|
-
_setInnerViewRef = setAndForwardRef({
|
|
1207
|
+
_setInnerViewRef: $FlowFixMe = setAndForwardRef({
|
|
1208
1208
|
getForwardedRef: () => this.props.innerViewRef,
|
|
1209
1209
|
setLocalRef: ref => {
|
|
1210
1210
|
this._innerViewRef = ref;
|
|
@@ -223,9 +223,9 @@ function createStackEntry(props: any): any {
|
|
|
223
223
|
* `currentHeight` (Android only) The height of the status bar.
|
|
224
224
|
*/
|
|
225
225
|
class StatusBar extends React.Component<Props> {
|
|
226
|
-
static _propsStack = [];
|
|
226
|
+
static _propsStack: Array<any> = [];
|
|
227
227
|
|
|
228
|
-
static _defaultProps = createStackEntry({
|
|
228
|
+
static _defaultProps: any = createStackEntry({
|
|
229
229
|
backgroundColor:
|
|
230
230
|
Platform.OS === 'android'
|
|
231
231
|
? NativeStatusBarManagerAndroid.getConstants()
|
|
@@ -309,7 +309,7 @@ class StatusBar extends React.Component<Props> {
|
|
|
309
309
|
* @param color Background color.
|
|
310
310
|
* @param animated Animate the style change.
|
|
311
311
|
*/
|
|
312
|
-
static setBackgroundColor(color: string, animated?: boolean) {
|
|
312
|
+
static setBackgroundColor(color: string, animated?: boolean): void {
|
|
313
313
|
if (Platform.OS !== 'android') {
|
|
314
314
|
console.warn('`setBackgroundColor` is only available on Android');
|
|
315
315
|
return;
|
|
@@ -66,15 +66,25 @@ class ImageBackground extends React.Component<ImageBackgroundProps> {
|
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
render(): React.Node {
|
|
69
|
-
const {
|
|
69
|
+
const {
|
|
70
|
+
children,
|
|
71
|
+
style,
|
|
72
|
+
imageStyle,
|
|
73
|
+
imageRef,
|
|
74
|
+
importantForAccessibility,
|
|
75
|
+
...props
|
|
76
|
+
} = this.props;
|
|
77
|
+
|
|
70
78
|
const flattenedStyle = flattenStyle(style);
|
|
71
79
|
return (
|
|
72
80
|
<View
|
|
73
81
|
accessibilityIgnoresInvertColors={true}
|
|
82
|
+
importantForAccessibility={importantForAccessibility}
|
|
74
83
|
style={style}
|
|
75
84
|
ref={this._captureRef}>
|
|
76
85
|
<Image
|
|
77
86
|
{...props}
|
|
87
|
+
importantForAccessibility={importantForAccessibility}
|
|
78
88
|
style={[
|
|
79
89
|
StyleSheet.absoluteFill,
|
|
80
90
|
{
|
|
@@ -120,7 +120,7 @@ type InspectorPanelButtonProps = $ReadOnly<{|
|
|
|
120
120
|
|}>;
|
|
121
121
|
|
|
122
122
|
class InspectorPanelButton extends React.Component<InspectorPanelButtonProps> {
|
|
123
|
-
render() {
|
|
123
|
+
render(): React.Node {
|
|
124
124
|
return (
|
|
125
125
|
<TouchableHighlight
|
|
126
126
|
onPress={() => this.props.onClick(!this.props.pressed)}
|
|
@@ -95,7 +95,11 @@ class NetworkOverlay extends React.Component<Props, State> {
|
|
|
95
95
|
// scroll to the bottom as new network requests come in, or if the user has
|
|
96
96
|
// intentionally scrolled away from the bottom - to instead flash the scroll bar
|
|
97
97
|
// and keep the current position
|
|
98
|
-
_requestsListViewScrollMetrics
|
|
98
|
+
_requestsListViewScrollMetrics: {
|
|
99
|
+
contentLength: number,
|
|
100
|
+
offset: number,
|
|
101
|
+
visibleLength: number,
|
|
102
|
+
} = {
|
|
99
103
|
offset: 0,
|
|
100
104
|
visibleLength: 0,
|
|
101
105
|
contentLength: 0,
|
|
@@ -363,7 +367,7 @@ class NetworkOverlay extends React.Component<Props, State> {
|
|
|
363
367
|
);
|
|
364
368
|
};
|
|
365
369
|
|
|
366
|
-
_renderItemDetail(id: number) {
|
|
370
|
+
_renderItemDetail(id: number): React.Node {
|
|
367
371
|
const requestItem = this.state.requests[id];
|
|
368
372
|
const details = Object.keys(requestItem).map(key => {
|
|
369
373
|
if (key === 'id') {
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
+
import type {FrameMetricProps} from './VirtualizedListProps';
|
|
14
|
+
|
|
13
15
|
export type FillRateInfo = Info;
|
|
14
16
|
|
|
15
17
|
class Info {
|
|
@@ -47,12 +49,12 @@ let _sampleRate = DEBUG ? 1 : null;
|
|
|
47
49
|
* `SceneTracker.getActiveScene` to determine the context of the events.
|
|
48
50
|
*/
|
|
49
51
|
class FillRateHelper {
|
|
50
|
-
_anyBlankStartTime =
|
|
52
|
+
_anyBlankStartTime: ?number = null;
|
|
51
53
|
_enabled = false;
|
|
52
|
-
_getFrameMetrics: (index: number) => ?FrameMetrics;
|
|
53
|
-
_info = new Info();
|
|
54
|
-
_mostlyBlankStartTime =
|
|
55
|
-
_samplesStartTime =
|
|
54
|
+
_getFrameMetrics: (index: number, props: FrameMetricProps) => ?FrameMetrics;
|
|
55
|
+
_info: Info = new Info();
|
|
56
|
+
_mostlyBlankStartTime: ?number = null;
|
|
57
|
+
_samplesStartTime: ?number = null;
|
|
56
58
|
|
|
57
59
|
static addListener(callback: FillRateInfo => void): {
|
|
58
60
|
remove: () => void,
|
|
@@ -77,7 +79,9 @@ class FillRateHelper {
|
|
|
77
79
|
_minSampleCount = minSampleCount;
|
|
78
80
|
}
|
|
79
81
|
|
|
80
|
-
constructor(
|
|
82
|
+
constructor(
|
|
83
|
+
getFrameMetrics: (index: number, props: FrameMetricProps) => ?FrameMetrics,
|
|
84
|
+
) {
|
|
81
85
|
this._getFrameMetrics = getFrameMetrics;
|
|
82
86
|
this._enabled = (_sampleRate || 0) > Math.random();
|
|
83
87
|
this._resetData();
|
|
@@ -134,8 +138,7 @@ class FillRateHelper {
|
|
|
134
138
|
|
|
135
139
|
computeBlankness(
|
|
136
140
|
props: {
|
|
137
|
-
|
|
138
|
-
getItemCount: (data: any) => number,
|
|
141
|
+
...FrameMetricProps,
|
|
139
142
|
initialNumToRender?: ?number,
|
|
140
143
|
...
|
|
141
144
|
},
|
|
@@ -181,9 +184,9 @@ class FillRateHelper {
|
|
|
181
184
|
|
|
182
185
|
let blankTop = 0;
|
|
183
186
|
let first = state.first;
|
|
184
|
-
let firstFrame = this._getFrameMetrics(first);
|
|
187
|
+
let firstFrame = this._getFrameMetrics(first, props);
|
|
185
188
|
while (first <= state.last && (!firstFrame || !firstFrame.inLayout)) {
|
|
186
|
-
firstFrame = this._getFrameMetrics(first);
|
|
189
|
+
firstFrame = this._getFrameMetrics(first, props);
|
|
187
190
|
first++;
|
|
188
191
|
}
|
|
189
192
|
// Only count blankTop if we aren't rendering the first item, otherwise we will count the header
|
|
@@ -196,9 +199,9 @@ class FillRateHelper {
|
|
|
196
199
|
}
|
|
197
200
|
let blankBottom = 0;
|
|
198
201
|
let last = state.last;
|
|
199
|
-
let lastFrame = this._getFrameMetrics(last);
|
|
202
|
+
let lastFrame = this._getFrameMetrics(last, props);
|
|
200
203
|
while (last >= state.first && (!lastFrame || !lastFrame.inLayout)) {
|
|
201
|
-
lastFrame = this._getFrameMetrics(last);
|
|
204
|
+
lastFrame = this._getFrameMetrics(last, props);
|
|
202
205
|
last--;
|
|
203
206
|
}
|
|
204
207
|
// Only count blankBottom if we aren't rendering the last item, otherwise we will count the
|
|
@@ -433,6 +433,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
|
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
+
// $FlowFixMe[missing-local-annot]
|
|
436
437
|
componentDidUpdate(prevProps: Props<ItemT>) {
|
|
437
438
|
invariant(
|
|
438
439
|
prevProps.numColumns === this.props.numColumns,
|
|
@@ -463,6 +464,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
|
|
|
463
464
|
this._listRef = ref;
|
|
464
465
|
};
|
|
465
466
|
|
|
467
|
+
// $FlowFixMe[missing-local-annot]
|
|
466
468
|
_checkProps(props: Props<ItemT>) {
|
|
467
469
|
const {
|
|
468
470
|
// $FlowFixMe[prop-missing] this prop doesn't exist, is only used for an invariant
|
|
@@ -494,13 +496,15 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
|
|
|
494
496
|
);
|
|
495
497
|
}
|
|
496
498
|
|
|
499
|
+
// $FlowFixMe[missing-local-annot]
|
|
497
500
|
_getItem = (data: Array<ItemT>, index: number) => {
|
|
498
501
|
const numColumns = numColumnsOrDefault(this.props.numColumns);
|
|
499
502
|
if (numColumns > 1) {
|
|
500
503
|
const ret = [];
|
|
501
504
|
for (let kk = 0; kk < numColumns; kk++) {
|
|
502
|
-
const
|
|
503
|
-
if (
|
|
505
|
+
const itemIndex = index * numColumns + kk;
|
|
506
|
+
if (itemIndex < data.length) {
|
|
507
|
+
const item = data[itemIndex];
|
|
504
508
|
ret.push(item);
|
|
505
509
|
}
|
|
506
510
|
}
|
|
@@ -519,6 +523,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
|
|
|
519
523
|
}
|
|
520
524
|
};
|
|
521
525
|
|
|
526
|
+
// $FlowFixMe[missing-local-annot]
|
|
522
527
|
_keyExtractor = (items: ItemT | Array<ItemT>, index: number) => {
|
|
523
528
|
const numColumns = numColumnsOrDefault(this.props.numColumns);
|
|
524
529
|
const keyExtractor = this.props.keyExtractor ?? defaultKeyExtractor;
|
|
@@ -560,6 +565,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
|
|
|
560
565
|
changed: Array<ViewToken>,
|
|
561
566
|
...
|
|
562
567
|
}) => void,
|
|
568
|
+
// $FlowFixMe[missing-local-annot]
|
|
563
569
|
) {
|
|
564
570
|
return (info: {
|
|
565
571
|
viewableItems: Array<ViewToken>,
|
|
@@ -589,6 +595,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
|
|
|
589
595
|
columnWrapperStyle: ?ViewStyleProp,
|
|
590
596
|
numColumns: ?number,
|
|
591
597
|
extraData: ?any,
|
|
598
|
+
// $FlowFixMe[missing-local-annot]
|
|
592
599
|
) => {
|
|
593
600
|
const cols = numColumnsOrDefault(numColumns);
|
|
594
601
|
|
|
@@ -643,6 +650,7 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
|
|
|
643
650
|
};
|
|
644
651
|
};
|
|
645
652
|
|
|
653
|
+
// $FlowFixMe[missing-local-annot]
|
|
646
654
|
_memoizedRenderer = memoizeOne(this._renderer);
|
|
647
655
|
|
|
648
656
|
render(): React.Node {
|
|
@@ -0,0 +1,85 @@
|
|
|
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 strict
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
import invariant from 'invariant';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* `setState` is called asynchronously, and should not rely on the value of
|
|
16
|
+
* `this.props` or `this.state`:
|
|
17
|
+
* https://reactjs.org/docs/state-and-lifecycle.html#state-updates-may-be-asynchronous
|
|
18
|
+
*
|
|
19
|
+
* SafePureComponent adds runtime enforcement, to catch cases where these
|
|
20
|
+
* variables are read in a state updater function, instead of the ones passed
|
|
21
|
+
* in.
|
|
22
|
+
*/
|
|
23
|
+
export default class StateSafePureComponent<
|
|
24
|
+
Props,
|
|
25
|
+
State: interface {},
|
|
26
|
+
> extends React.PureComponent<Props, State> {
|
|
27
|
+
_inAsyncStateUpdate = false;
|
|
28
|
+
|
|
29
|
+
constructor(props: Props) {
|
|
30
|
+
super(props);
|
|
31
|
+
this._installSetStateHooks();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
setState(
|
|
35
|
+
partialState: ?($Shape<State> | ((State, Props) => ?$Shape<State>)),
|
|
36
|
+
callback?: () => mixed,
|
|
37
|
+
): void {
|
|
38
|
+
if (typeof partialState === 'function') {
|
|
39
|
+
super.setState((state, props) => {
|
|
40
|
+
this._inAsyncStateUpdate = true;
|
|
41
|
+
let ret;
|
|
42
|
+
try {
|
|
43
|
+
ret = partialState(state, props);
|
|
44
|
+
} catch (err) {
|
|
45
|
+
throw err;
|
|
46
|
+
} finally {
|
|
47
|
+
this._inAsyncStateUpdate = false;
|
|
48
|
+
}
|
|
49
|
+
return ret;
|
|
50
|
+
}, callback);
|
|
51
|
+
} else {
|
|
52
|
+
super.setState(partialState, callback);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
_installSetStateHooks() {
|
|
57
|
+
const that = this;
|
|
58
|
+
let {props, state} = this;
|
|
59
|
+
|
|
60
|
+
Object.defineProperty(this, 'props', {
|
|
61
|
+
get() {
|
|
62
|
+
invariant(
|
|
63
|
+
!that._inAsyncStateUpdate,
|
|
64
|
+
'"this.props" should not be accessed during state updates',
|
|
65
|
+
);
|
|
66
|
+
return props;
|
|
67
|
+
},
|
|
68
|
+
set(newProps: Props) {
|
|
69
|
+
props = newProps;
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(this, 'state', {
|
|
73
|
+
get() {
|
|
74
|
+
invariant(
|
|
75
|
+
!that._inAsyncStateUpdate,
|
|
76
|
+
'"this.state" should not be acceessed during state updates',
|
|
77
|
+
);
|
|
78
|
+
return state;
|
|
79
|
+
},
|
|
80
|
+
set(newState: State) {
|
|
81
|
+
state = newState;
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|