@office-iss/react-native-win32 0.0.0-canary.286 → 0.0.0-canary.288
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 +4 -1
- package/CHANGELOG.json +57 -1
- package/CHANGELOG.md +23 -4
- package/Libraries/Alert/RCTAlertManager.js.flow +18 -0
- package/Libraries/Animated/Animated.js +8 -37
- package/Libraries/Animated/Animated.js.flow +15 -0
- package/Libraries/Animated/AnimatedExports.js +47 -0
- package/Libraries/Animated/AnimatedExports.js.flow +48 -0
- package/Libraries/Animated/useAnimatedValue.js +1 -3
- package/Libraries/Blob/URLSearchParams.js.flow +23 -0
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +1 -1
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js.flow +20 -0
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +8 -8
- package/Libraries/Components/Button.js +2 -2
- package/Libraries/Components/Button.win32.js +2 -2
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +14 -100
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +64 -4
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +138 -0
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +7 -4
- package/Libraries/Components/LayoutConformance/LayoutConformance.js +6 -4
- package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +1 -1
- package/Libraries/Components/Pressable/Pressable.js +18 -63
- package/Libraries/Components/Pressable/Pressable.win32.js +19 -65
- package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +4 -46
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +10 -4
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +54 -0
- package/Libraries/Components/RefreshControl/RefreshControl.js +10 -7
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +2 -1
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +1 -1
- package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +1 -1
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +2 -4
- package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +2 -4
- package/Libraries/Components/ScrollView/ScrollView.js +43 -59
- package/Libraries/Components/ScrollView/ScrollViewCommands.js +1 -1
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +2 -4
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +6 -7
- package/Libraries/Components/StatusBar/StatusBar.js +33 -22
- package/Libraries/Components/Switch/Switch.js +70 -41
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +2 -4
- package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +2 -4
- package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +2 -4
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
- package/Libraries/Components/TextInput/TextInput.flow.js +10 -12
- package/Libraries/Components/TextInput/TextInput.js +22 -28
- package/Libraries/Components/TextInput/TextInput.win32.js +22 -28
- package/Libraries/Components/TextInput/TextInputState.js +2 -18
- package/Libraries/Components/TextInput/TextInputState.win32.js +2 -18
- package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +1 -1
- package/Libraries/Components/Touchable/Touchable.js +7 -7
- package/Libraries/Components/Touchable/Touchable.win32.js +7 -7
- package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
- package/Libraries/Components/Touchable/TouchableHighlight.js +35 -14
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +95 -47
- package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +248 -43
- package/Libraries/Components/Touchable/TouchableOpacity.js +52 -10
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +112 -59
- package/Libraries/Components/View/View.js +1 -1
- package/Libraries/Components/View/View.win32.js +1 -1
- package/Libraries/Components/View/ViewNativeComponent.js +2 -4
- package/Libraries/Components/View/ViewPropTypes.js +15 -12
- package/Libraries/Components/View/ViewPropTypes.win32.js +74 -71
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/setUpReactDevTools.js +2 -0
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +10 -7
- package/Libraries/Image/Image.android.js +1 -1
- package/Libraries/Image/Image.js.flow +27 -0
- package/Libraries/Image/ImageBackground.js +1 -1
- package/Libraries/Image/ImageProps.js +97 -30
- package/Libraries/Image/ImageTypes.flow.js +16 -6
- package/Libraries/Image/ImageViewNativeComponent.js +3 -5
- package/Libraries/Image/TextInlineImageNativeComponent.js +2 -4
- package/Libraries/Interaction/InteractionManager.js +9 -1
- package/Libraries/Interaction/PanResponder.js +11 -11
- package/Libraries/Interaction/TaskQueue.js +2 -2
- package/Libraries/Lists/FlatList.js +8 -7
- package/Libraries/LogBox/LogBox.js +1 -1
- package/Libraries/NativeComponent/BaseViewConfig.js.flow +14 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
- package/Libraries/Network/RCTNetworking.js.flow +44 -0
- package/Libraries/Network/XMLHttpRequest_new.js +3 -0
- package/Libraries/Network/XMLHttpRequest_old.js +3 -0
- package/Libraries/Pressability/HoverState.js +1 -0
- package/Libraries/Pressability/HoverState.win32.js +1 -0
- package/Libraries/Pressability/Pressability.js +2 -2
- package/Libraries/Pressability/Pressability.win32.js +3 -3
- package/Libraries/ReactNative/FabricUIManager.js +5 -3
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +7 -5
- package/Libraries/ReactNative/RendererImplementation.js +3 -5
- package/Libraries/ReactNative/requireNativeComponent.js +1 -1
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +12 -0
- package/Libraries/Renderer/shims/ReactNativeTypes.js +39 -91
- package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +22 -0
- package/Libraries/Text/Text.d.ts +1 -1
- package/Libraries/Text/Text.js +3 -1
- package/Libraries/Text/Text.win32.js +3 -1
- package/Libraries/Text/TextNativeComponent.js +1 -1
- package/Libraries/Text/TextNativeComponent.win32.js +1 -1
- package/Libraries/Text/TextProps.js +124 -84
- package/Libraries/Text/TextProps.win32.js +124 -84
- package/Libraries/Types/CoreEventTypes.js +1 -1
- package/Libraries/Types/CoreEventTypes.win32.js +1 -1
- package/Libraries/Types/ReactDevToolsTypes.js +4 -8
- package/Libraries/Utilities/BackHandler.js.flow +25 -0
- package/Libraries/Utilities/DevSettings.js +14 -0
- package/Libraries/Utilities/Dimensions.js +5 -0
- package/Libraries/Utilities/Dimensions.win32.js +5 -0
- package/{flow/Position.js → Libraries/Utilities/Platform.js.flow} +3 -6
- package/Libraries/Utilities/PlatformTypes.js +97 -7
- package/Libraries/Utilities/codegenNativeComponent.js +1 -1
- package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +2 -4
- package/index.win32.js +3 -4
- package/overrides.json +24 -24
- package/package.json +15 -16
- package/src/private/components/HScrollViewNativeComponents.js +1 -1
- package/src/private/components/VScrollViewNativeComponents.js +1 -1
- package/src/private/featureflags/ReactNativeFeatureFlags.js +11 -6
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +3 -2
- package/src/private/inspector/getInspectorDataForViewAtPoint.js +2 -4
- package/src/private/setup/setUpDOM.js +36 -1
- package/src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/AndroidDrawerLayoutNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/RCTInputAccessoryViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/RCTSafeAreaViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js +1 -1
- package/src/private/types/HostComponent.js +16 -0
- package/src/private/types/HostInstance.js +50 -0
- package/src/private/webapis/dom/nodes/ReactNativeDocument.js +1 -0
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +40 -32
- package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +1 -1
- package/src/private/webapis/dom/nodes/ReadOnlyElement.js +1 -1
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +1 -1
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +4 -4
- package/src/private/webapis/mutationobserver/MutationObserver.js +9 -9
- package/src/private/webapis/performance/PerformanceObserver.js +6 -6
- package/src/types/globals.d.ts +628 -0
- package/src-win/Libraries/Text/Text.d.ts +1 -1
- package/types/index.d.ts +2 -53
- package/types/modules/globals.d.ts +0 -599
|
@@ -4,7 +4,7 @@
|
|
|
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
|
|
7
|
+
* @flow strict-local
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -29,6 +29,11 @@ export default function setUpDOM() {
|
|
|
29
29
|
() => require('../webapis/geometry/DOMRectReadOnly').default,
|
|
30
30
|
);
|
|
31
31
|
|
|
32
|
+
polyfillGlobal(
|
|
33
|
+
'DOMRectList',
|
|
34
|
+
() => require('../webapis/geometry/DOMRectList').default,
|
|
35
|
+
);
|
|
36
|
+
|
|
32
37
|
polyfillGlobal(
|
|
33
38
|
'HTMLCollection',
|
|
34
39
|
() => require('../webapis/dom/oldstylecollections/HTMLCollection').default,
|
|
@@ -38,4 +43,34 @@ export default function setUpDOM() {
|
|
|
38
43
|
'NodeList',
|
|
39
44
|
() => require('../webapis/dom/oldstylecollections/NodeList').default,
|
|
40
45
|
);
|
|
46
|
+
|
|
47
|
+
polyfillGlobal(
|
|
48
|
+
'Node',
|
|
49
|
+
() => require('../webapis/dom/nodes/ReadOnlyNode').default,
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
polyfillGlobal(
|
|
53
|
+
'Document',
|
|
54
|
+
() => require('../webapis/dom/nodes/ReactNativeDocument').default,
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
polyfillGlobal(
|
|
58
|
+
'CharacterData',
|
|
59
|
+
() => require('../webapis/dom/nodes/ReadOnlyCharacterData').default,
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
polyfillGlobal(
|
|
63
|
+
'Text',
|
|
64
|
+
() => require('../webapis/dom/nodes/ReadOnlyText').default,
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
polyfillGlobal(
|
|
68
|
+
'Element',
|
|
69
|
+
() => require('../webapis/dom/nodes/ReadOnlyElement').default,
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
polyfillGlobal(
|
|
73
|
+
'HTMLElement',
|
|
74
|
+
() => require('../webapis/dom/nodes/ReactNativeElement').default,
|
|
75
|
+
);
|
|
41
76
|
}
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
|
12
|
-
import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
|
|
13
12
|
import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheet';
|
|
14
13
|
import type {WithDefault} from '../../../../Libraries/Types/CodegenTypes';
|
|
14
|
+
import type {HostComponent} from '../../types/HostComponent';
|
|
15
15
|
|
|
16
16
|
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
|
17
17
|
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
|
12
|
-
import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
|
|
13
12
|
import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheet';
|
|
14
13
|
import type {
|
|
15
14
|
DirectEventHandler,
|
|
@@ -17,6 +16,7 @@ import type {
|
|
|
17
16
|
Int32,
|
|
18
17
|
WithDefault,
|
|
19
18
|
} from '../../../../Libraries/Types/CodegenTypes';
|
|
19
|
+
import type {HostComponent} from '../../types/HostComponent';
|
|
20
20
|
|
|
21
21
|
import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNativeCommands';
|
|
22
22
|
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
package/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
|
12
|
-
import type {HostComponent} from '
|
|
12
|
+
import type {HostComponent} from '../../types/HostComponent';
|
|
13
13
|
|
|
14
14
|
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
|
15
15
|
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
|
12
|
-
import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
|
|
13
12
|
import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheet';
|
|
14
13
|
import type {
|
|
15
14
|
DirectEventHandler,
|
|
16
15
|
Float,
|
|
17
16
|
WithDefault,
|
|
18
17
|
} from '../../../../Libraries/Types/CodegenTypes';
|
|
18
|
+
import type {HostComponent} from '../../types/HostComponent';
|
|
19
19
|
|
|
20
20
|
import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNativeCommands';
|
|
21
21
|
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
|
12
|
-
import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
|
|
13
12
|
import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheet';
|
|
14
13
|
import type {
|
|
15
14
|
BubblingEventHandler,
|
|
16
15
|
Int32,
|
|
17
16
|
WithDefault,
|
|
18
17
|
} from '../../../../Libraries/Types/CodegenTypes';
|
|
18
|
+
import type {HostComponent} from '../../types/HostComponent';
|
|
19
19
|
|
|
20
20
|
import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNativeCommands';
|
|
21
21
|
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
|
12
|
-
import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
|
|
13
12
|
import type {ProcessedColorValue} from '../../../../Libraries/StyleSheet/processColor';
|
|
13
|
+
import type {HostComponent} from '../../types/HostComponent';
|
|
14
14
|
|
|
15
15
|
import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNativeCommands';
|
|
16
16
|
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
|
12
|
-
import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
|
|
13
12
|
import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheet';
|
|
14
13
|
import type {
|
|
15
14
|
Double,
|
|
16
15
|
WithDefault,
|
|
17
16
|
} from '../../../../Libraries/Types/CodegenTypes';
|
|
17
|
+
import type {HostComponent} from '../../types/HostComponent';
|
|
18
18
|
|
|
19
19
|
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
|
20
20
|
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
|
12
|
-
import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
|
|
13
12
|
import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheet';
|
|
14
13
|
import type {
|
|
15
14
|
DirectEventHandler,
|
|
16
15
|
Float,
|
|
17
16
|
WithDefault,
|
|
18
17
|
} from '../../../../Libraries/Types/CodegenTypes';
|
|
18
|
+
import type {HostComponent} from '../../types/HostComponent';
|
|
19
19
|
|
|
20
20
|
import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNativeCommands';
|
|
21
21
|
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
|
12
|
-
import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
|
|
13
12
|
import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheet';
|
|
13
|
+
import type {HostComponent} from '../../types/HostComponent';
|
|
14
14
|
|
|
15
15
|
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
|
16
16
|
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
|
12
|
-
import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
|
|
13
12
|
import type {
|
|
14
13
|
DirectEventHandler,
|
|
15
14
|
Int32,
|
|
16
15
|
WithDefault,
|
|
17
16
|
} from '../../../../Libraries/Types/CodegenTypes';
|
|
17
|
+
import type {HostComponent} from '../../types/HostComponent';
|
|
18
18
|
|
|
19
19
|
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
|
20
20
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
|
12
|
-
import type {HostComponent} from '
|
|
12
|
+
import type {HostComponent} from '../../types/HostComponent';
|
|
13
13
|
|
|
14
14
|
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
|
15
15
|
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
|
12
|
-
import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
|
|
13
12
|
import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheet';
|
|
14
13
|
import type {
|
|
15
14
|
BubblingEventHandler,
|
|
16
15
|
Int32,
|
|
17
16
|
WithDefault,
|
|
18
17
|
} from '../../../../Libraries/Types/CodegenTypes';
|
|
18
|
+
import type {HostComponent} from '../../types/HostComponent';
|
|
19
19
|
|
|
20
20
|
import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNativeCommands';
|
|
21
21
|
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
|
12
|
-
import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
|
|
13
12
|
import type {WithDefault} from '../../../../Libraries/Types/CodegenTypes';
|
|
13
|
+
import type {HostComponent} from '../../types/HostComponent';
|
|
14
14
|
|
|
15
15
|
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
|
16
16
|
|
|
@@ -0,0 +1,16 @@
|
|
|
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 type {HostInstance} from './HostInstance';
|
|
12
|
+
|
|
13
|
+
export type HostComponent<Config: {...}> = component(
|
|
14
|
+
ref: React.RefSetter<HostInstance>,
|
|
15
|
+
...Config
|
|
16
|
+
);
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
* @flow strict
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export type MeasureOnSuccessCallback = (
|
|
12
|
+
x: number,
|
|
13
|
+
y: number,
|
|
14
|
+
width: number,
|
|
15
|
+
height: number,
|
|
16
|
+
pageX: number,
|
|
17
|
+
pageY: number,
|
|
18
|
+
) => void;
|
|
19
|
+
|
|
20
|
+
export type MeasureInWindowOnSuccessCallback = (
|
|
21
|
+
x: number,
|
|
22
|
+
y: number,
|
|
23
|
+
width: number,
|
|
24
|
+
height: number,
|
|
25
|
+
) => void;
|
|
26
|
+
|
|
27
|
+
export type MeasureLayoutOnSuccessCallback = (
|
|
28
|
+
left: number,
|
|
29
|
+
top: number,
|
|
30
|
+
width: number,
|
|
31
|
+
height: number,
|
|
32
|
+
) => void;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Current usages should migrate to this definition
|
|
36
|
+
*/
|
|
37
|
+
export interface LegacyHostInstanceMethods {
|
|
38
|
+
blur(): void;
|
|
39
|
+
focus(): void;
|
|
40
|
+
measure(callback: MeasureOnSuccessCallback): void;
|
|
41
|
+
measureInWindow(callback: MeasureInWindowOnSuccessCallback): void;
|
|
42
|
+
measureLayout(
|
|
43
|
+
relativeToNativeNode: number | HostInstance,
|
|
44
|
+
onSuccess: MeasureLayoutOnSuccessCallback,
|
|
45
|
+
onFail?: () => void,
|
|
46
|
+
): void;
|
|
47
|
+
setNativeProps(nativeProps: {...}): void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type HostInstance = LegacyHostInstanceMethods;
|
|
@@ -71,6 +71,7 @@ export default class ReactNativeDocument extends ReadOnlyNode {
|
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
// $FlowExpectedError[incompatible-extend] This is defined as returning string in Node, but it's actually null in Document.
|
|
74
75
|
get textContent(): null {
|
|
75
76
|
return null;
|
|
76
77
|
}
|
|
@@ -11,15 +11,17 @@
|
|
|
11
11
|
// flowlint unsafe-getters-setters:off
|
|
12
12
|
|
|
13
13
|
import type {
|
|
14
|
-
HostInstance,
|
|
15
|
-
INativeMethods,
|
|
16
14
|
InternalInstanceHandle,
|
|
17
|
-
MeasureInWindowOnSuccessCallback,
|
|
18
|
-
MeasureLayoutOnSuccessCallback,
|
|
19
|
-
MeasureOnSuccessCallback,
|
|
20
15
|
Node as ShadowNode,
|
|
21
16
|
ViewConfig,
|
|
22
17
|
} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
|
|
18
|
+
import type {
|
|
19
|
+
HostInstance,
|
|
20
|
+
LegacyHostInstanceMethods,
|
|
21
|
+
MeasureInWindowOnSuccessCallback,
|
|
22
|
+
MeasureLayoutOnSuccessCallback,
|
|
23
|
+
MeasureOnSuccessCallback,
|
|
24
|
+
} from '../../../types/HostInstance';
|
|
23
25
|
import type {InstanceHandle} from './internals/NodeInternals';
|
|
24
26
|
import type ReactNativeDocument from './ReactNativeDocument';
|
|
25
27
|
|
|
@@ -58,9 +60,9 @@ const noop = () => {};
|
|
|
58
60
|
// was slower than this method because the engine has to create an object than
|
|
59
61
|
// we then discard to create a new one.
|
|
60
62
|
|
|
61
|
-
class
|
|
63
|
+
class ReactNativeElement
|
|
62
64
|
extends ReadOnlyElement
|
|
63
|
-
implements
|
|
65
|
+
implements LegacyHostInstanceMethods
|
|
64
66
|
{
|
|
65
67
|
// These need to be accessible from `ReactFabricPublicInstanceUtils`.
|
|
66
68
|
__nativeTag: number;
|
|
@@ -144,12 +146,10 @@ class ReactNativeElementMethods
|
|
|
144
146
|
*/
|
|
145
147
|
|
|
146
148
|
blur(): void {
|
|
147
|
-
// $FlowFixMe[incompatible-exact] Migrate all usages of `NativeMethods` to an interface to fix this.
|
|
148
149
|
TextInputState.blurTextInput(this);
|
|
149
150
|
}
|
|
150
151
|
|
|
151
152
|
focus() {
|
|
152
|
-
// $FlowFixMe[incompatible-exact] Migrate all usages of `NativeMethods` to an interface to fix this.
|
|
153
153
|
TextInputState.focusTextInput(this);
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -227,28 +227,36 @@ class ReactNativeElementMethods
|
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
|
|
231
|
-
// calling super() in the original class.
|
|
232
|
-
function ReactNativeElement(
|
|
233
|
-
this: ReactNativeElementMethods,
|
|
234
|
-
tag: number,
|
|
235
|
-
viewConfig: ViewConfig,
|
|
236
|
-
internalInstanceHandle: InternalInstanceHandle,
|
|
237
|
-
ownerDocument: ReactNativeDocument,
|
|
238
|
-
) {
|
|
239
|
-
// Inlined from `ReadOnlyNode`
|
|
240
|
-
setOwnerDocument(this, ownerDocument);
|
|
241
|
-
setInstanceHandle(this, internalInstanceHandle);
|
|
242
|
-
|
|
243
|
-
this.__nativeTag = tag;
|
|
244
|
-
this.__internalInstanceHandle = internalInstanceHandle;
|
|
245
|
-
this.__viewConfig = viewConfig;
|
|
246
|
-
}
|
|
230
|
+
type ReactNativeElementT = ReactNativeElement;
|
|
247
231
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
)
|
|
232
|
+
function replaceConstructorWithoutSuper(
|
|
233
|
+
ReactNativeElementClass: Class<ReactNativeElementT>,
|
|
234
|
+
): Class<ReactNativeElementT> {
|
|
235
|
+
// Alternative constructor just implemented to provide a better performance than
|
|
236
|
+
// calling super() in the original class.
|
|
237
|
+
// eslint-disable-next-line no-shadow
|
|
238
|
+
function ReactNativeElement(
|
|
239
|
+
this: ReactNativeElementT,
|
|
240
|
+
tag: number,
|
|
241
|
+
viewConfig: ViewConfig,
|
|
242
|
+
internalInstanceHandle: InternalInstanceHandle,
|
|
243
|
+
ownerDocument: ReactNativeDocument,
|
|
244
|
+
) {
|
|
245
|
+
// Inlined from `ReadOnlyNode`
|
|
246
|
+
setOwnerDocument(this, ownerDocument);
|
|
247
|
+
setInstanceHandle(this, internalInstanceHandle);
|
|
248
|
+
|
|
249
|
+
this.__nativeTag = tag;
|
|
250
|
+
this.__internalInstanceHandle = internalInstanceHandle;
|
|
251
|
+
this.__viewConfig = viewConfig;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
ReactNativeElement.prototype = ReactNativeElementClass.prototype;
|
|
255
|
+
|
|
256
|
+
// $FlowExpectedError[incompatible-return]
|
|
257
|
+
return ReactNativeElement;
|
|
258
|
+
}
|
|
251
259
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
260
|
+
export default replaceConstructorWithoutSuper(
|
|
261
|
+
ReactNativeElement,
|
|
262
|
+
) as typeof ReactNativeElement;
|
|
@@ -155,7 +155,7 @@ export default class ReadOnlyNode {
|
|
|
155
155
|
/**
|
|
156
156
|
* @abstract
|
|
157
157
|
*/
|
|
158
|
-
get textContent(): string
|
|
158
|
+
get textContent(): string {
|
|
159
159
|
throw new TypeError(
|
|
160
160
|
'`textContent` is abstract and must be implemented in a subclass of `ReadOnlyNode`',
|
|
161
161
|
);
|
|
@@ -21,10 +21,10 @@ export type IntersectionObserverCallback = (
|
|
|
21
21
|
observer: IntersectionObserver,
|
|
22
22
|
) => mixed;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
export interface IntersectionObserverInit {
|
|
25
25
|
// root?: ReactNativeElement, // This option exists on the Web but it's not currently supported in React Native.
|
|
26
26
|
// rootMargin?: string, // This option exists on the Web but it's not currently supported in React Native.
|
|
27
|
-
threshold?: number | $ReadOnlyArray<number
|
|
27
|
+
threshold?: number | $ReadOnlyArray<number>;
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* This is a React Native specific option (not spec compliant) that specifies
|
|
@@ -36,8 +36,8 @@ type IntersectionObserverInit = {
|
|
|
36
36
|
* Note: If `rnRootThreshold` is set, and `threshold` is not set,
|
|
37
37
|
* `threshold` will not default to [0] (as per spec)
|
|
38
38
|
*/
|
|
39
|
-
rnRootThreshold?: number | $ReadOnlyArray<number
|
|
40
|
-
}
|
|
39
|
+
rnRootThreshold?: number | $ReadOnlyArray<number>;
|
|
40
|
+
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* The [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API)
|
|
@@ -21,18 +21,18 @@ export type MutationObserverCallback = (
|
|
|
21
21
|
observer: MutationObserver,
|
|
22
22
|
) => mixed;
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
subtree?: boolean
|
|
24
|
+
export interface MutationObserverInit {
|
|
25
|
+
+subtree?: boolean;
|
|
26
26
|
// This is the only supported option so it's required to be `true`.
|
|
27
|
-
childList: true
|
|
27
|
+
+childList: true;
|
|
28
28
|
|
|
29
29
|
// Unsupported:
|
|
30
|
-
attributes?: boolean
|
|
31
|
-
attributeFilter?: $ReadOnlyArray<string
|
|
32
|
-
attributeOldValue?: boolean
|
|
33
|
-
characterData?: boolean
|
|
34
|
-
characterDataOldValue?: boolean
|
|
35
|
-
}
|
|
30
|
+
+attributes?: boolean;
|
|
31
|
+
+attributeFilter?: $ReadOnlyArray<string>;
|
|
32
|
+
+attributeOldValue?: boolean;
|
|
33
|
+
+characterData?: boolean;
|
|
34
|
+
+characterDataOldValue?: boolean;
|
|
35
|
+
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* This is a React Native implementation for the `MutationObserver` API
|
|
@@ -66,12 +66,12 @@ export type PerformanceObserverCallback = (
|
|
|
66
66
|
options?: PerformanceObserverCallbackOptions,
|
|
67
67
|
) => void;
|
|
68
68
|
|
|
69
|
-
export
|
|
70
|
-
entryTypes?: Array<PerformanceEntryType
|
|
71
|
-
type?: PerformanceEntryType
|
|
72
|
-
buffered?: boolean
|
|
73
|
-
durationThreshold?: DOMHighResTimeStamp
|
|
74
|
-
}
|
|
69
|
+
export interface PerformanceObserverInit {
|
|
70
|
+
+entryTypes?: Array<PerformanceEntryType>;
|
|
71
|
+
+type?: PerformanceEntryType;
|
|
72
|
+
+buffered?: boolean;
|
|
73
|
+
+durationThreshold?: DOMHighResTimeStamp;
|
|
74
|
+
}
|
|
75
75
|
|
|
76
76
|
function getSupportedPerformanceEntryTypes(): $ReadOnlyArray<PerformanceEntryType> {
|
|
77
77
|
if (!NativePerformance) {
|