@office-iss/react-native-win32 0.77.0 → 0.78.0-preview.2
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 -1
- package/CHANGELOG.json +114 -27
- package/CHANGELOG.md +46 -15
- package/Libraries/Animated/animations/Animation.js +22 -1
- package/Libraries/Animated/animations/DecayAnimation.js +1 -0
- package/Libraries/Animated/animations/SpringAnimation.js +1 -0
- package/Libraries/Animated/animations/TimingAnimation.js +1 -0
- package/Libraries/Animated/nodes/AnimatedAddition.js +9 -2
- package/Libraries/Animated/nodes/AnimatedColor.js +4 -1
- package/Libraries/Animated/nodes/AnimatedDiffClamp.js +10 -2
- package/Libraries/Animated/nodes/AnimatedDivision.js +9 -2
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +5 -1
- package/Libraries/Animated/nodes/AnimatedModulo.js +5 -2
- package/Libraries/Animated/nodes/AnimatedMultiplication.js +9 -2
- package/Libraries/Animated/nodes/AnimatedNode.js +25 -46
- package/Libraries/Animated/nodes/AnimatedObject.js +9 -2
- package/Libraries/Animated/nodes/AnimatedProps.js +5 -1
- package/Libraries/Animated/nodes/AnimatedStyle.js +5 -1
- package/Libraries/Animated/nodes/AnimatedSubtraction.js +9 -2
- package/Libraries/Animated/nodes/AnimatedTracking.js +5 -1
- package/Libraries/Animated/nodes/AnimatedTransform.js +5 -1
- package/Libraries/Animated/nodes/AnimatedValue.js +63 -4
- package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
- package/Libraries/Animated/useAnimatedProps.js +14 -56
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +1 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +4 -1
- package/Libraries/Components/LayoutConformance/LayoutConformance.d.ts +21 -0
- package/Libraries/Components/LayoutConformance/LayoutConformance.js +59 -0
- package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +29 -0
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
- package/Libraries/Components/TextInput/TextInput.d.ts +5 -0
- package/Libraries/Components/TextInput/TextInput.flow.js +6 -0
- package/Libraries/Components/TextInput/TextInput.js +6 -0
- package/Libraries/Components/TextInput/TextInput.win32.js +6 -0
- package/Libraries/Components/View/ViewPropTypes.d.ts +0 -7
- package/Libraries/Components/View/ViewPropTypes.js +0 -9
- package/Libraries/Components/View/ViewPropTypes.win32.js +0 -9
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/setUpBatchedBridge.js +1 -16
- package/Libraries/EventEmitter/RCTEventEmitter.js +2 -6
- package/Libraries/Image/AssetSourceResolver.js +11 -0
- package/Libraries/Inspector/BorderBox.js +26 -14
- package/Libraries/Inspector/BoxInspector.js +60 -42
- package/Libraries/Inspector/ElementBox.js +55 -48
- package/Libraries/Inspector/StyleInspector.js +36 -30
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
- package/Libraries/Lists/FlatList.d.ts +1 -1
- package/Libraries/Modal/Modal.js +2 -0
- package/Libraries/NativeComponent/BaseViewConfig.android.js +0 -2
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +0 -2
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +0 -2
- package/Libraries/Network/RCTNetworking.android.js +24 -16
- package/Libraries/Network/RCTNetworking.ios.js +1 -46
- package/Libraries/Network/RCTNetworking.win32.js +1 -46
- package/Libraries/Network/RCTNetworkingEventDefinitions.flow.js +57 -0
- package/Libraries/PersonaCoin/PersonaCoin.js +1 -0
- package/Libraries/PersonaCoin/PersonaCoin.js.map +1 -1
- package/Libraries/ReactNative/UIManagerProperties.js +3 -1
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +15828 -26461
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +3907 -2560
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4399 -2878
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +16102 -26908
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +4034 -2695
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4535 -3045
- package/Libraries/Renderer/shims/ReactNativeTypes.js +5 -6
- package/Libraries/StyleSheet/processTransform.js +6 -0
- package/Libraries/Text/Text.d.ts +6 -1
- package/Libraries/Text/TextProps.js +2 -2
- package/Libraries/Text/TextProps.win32.js +2 -2
- package/Libraries/Utilities/BackHandler.android.js +5 -4
- package/Libraries/Utilities/BackHandler.ios.js +4 -5
- package/Libraries/Utilities/BackHandler.win32.js +5 -4
- package/index.js +5 -0
- package/index.win32.js +5 -0
- package/overrides.json +14 -14
- package/package.json +22 -23
- package/src/private/animated/NativeAnimatedValidation.js +1 -1
- package/src/private/featureflags/ReactNativeFeatureFlags.js +33 -27
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -5
- package/src/private/renderer/errorhandling/ErrorHandlers.js +12 -55
- package/src/private/specs/modules/{NativeJSCSamplingProfiler.js → NativeCPUTime.js} +7 -2
- package/src/private/specs/modules/NativeFantom.js +37 -0
- package/src/private/utilities/ensureInstance.js +21 -0
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +49 -6
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +17 -9
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +11 -11
- package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +1 -1
- package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -1
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
- package/src/private/webapis/performance/Performance.js +0 -12
- package/src/private/webapis/performance/specs/NativePerformance.js +0 -11
- package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +0 -7
- package/src-win/Libraries/PersonaCoin/PersonaCoin.tsx +1 -0
- package/src-win/Libraries/Text/Text.d.ts +6 -1
- package/types/index.d.ts +1 -0
- package/Libraries/HeapCapture/HeapCapture.js +0 -29
- package/Libraries/HeapCapture/NativeJSCHeapCapture.js +0 -13
- package/Libraries/Performance/NativeJSCSamplingProfiler.js +0 -13
- package/Libraries/Performance/SamplingProfiler.js +0 -39
- package/Libraries/ReactNative/__mocks__/FabricUIManager.js +0 -334
- package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +0 -413
- package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +0 -181
- package/src/private/webapis/mutationobserver/specs/__mocks__/NativeMutationObserver.js +0 -327
|
@@ -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
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<37e95652ef5d824bb05e78ebdb051e43>>
|
|
8
8
|
* @flow strict
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -28,8 +28,7 @@ export interface Spec extends TurboModule {
|
|
|
28
28
|
+completeReactInstanceCreationOnBgThreadOnAndroid?: () => boolean;
|
|
29
29
|
+disableEventLoopOnBridgeless?: () => boolean;
|
|
30
30
|
+disableMountItemReorderingAndroid?: () => boolean;
|
|
31
|
-
+
|
|
32
|
-
+enableAndroidLineHeightCentering?: () => boolean;
|
|
31
|
+
+enableAccumulatedUpdatesInRawPropsAndroid?: () => boolean;
|
|
33
32
|
+enableBridgelessArchitecture?: () => boolean;
|
|
34
33
|
+enableCppPropsIteratorSetter?: () => boolean;
|
|
35
34
|
+enableDeletionOfUnmountedViews?: () => boolean;
|
|
@@ -37,10 +36,10 @@ export interface Spec extends TurboModule {
|
|
|
37
36
|
+enableEventEmitterRetentionDuringGesturesOnAndroid?: () => boolean;
|
|
38
37
|
+enableFabricLogs?: () => boolean;
|
|
39
38
|
+enableFabricRenderer?: () => boolean;
|
|
40
|
-
+enableFabricRendererExclusively?: () => boolean;
|
|
41
39
|
+enableFixForViewCommandRace?: () => boolean;
|
|
42
40
|
+enableGranularShadowTreeStateReconciliation?: () => boolean;
|
|
43
41
|
+enableIOSViewClipToPaddingBox?: () => boolean;
|
|
42
|
+
+enableImagePrefetchingAndroid?: () => boolean;
|
|
44
43
|
+enableLayoutAnimationsOnAndroid?: () => boolean;
|
|
45
44
|
+enableLayoutAnimationsOnIOS?: () => boolean;
|
|
46
45
|
+enableLongTaskAPI?: () => boolean;
|
|
@@ -52,9 +51,9 @@ export interface Spec extends TurboModule {
|
|
|
52
51
|
+enableUIConsistency?: () => boolean;
|
|
53
52
|
+enableViewRecycling?: () => boolean;
|
|
54
53
|
+excludeYogaFromRawProps?: () => boolean;
|
|
54
|
+
+fixDifferentiatorEmittingUpdatesWithWrongParentTag?: () => boolean;
|
|
55
55
|
+fixMappingOfEventPrioritiesBetweenFabricAndReact?: () => boolean;
|
|
56
56
|
+fixMountingCoordinatorReportedPendingTransactionsOnAndroid?: () => boolean;
|
|
57
|
-
+fuseboxEnabledDebug?: () => boolean;
|
|
58
57
|
+fuseboxEnabledRelease?: () => boolean;
|
|
59
58
|
+initEagerTurboModulesOnNativeModulesQueueAndroid?: () => boolean;
|
|
60
59
|
+lazyAnimationCallbacks?: () => boolean;
|
|
@@ -66,6 +65,7 @@ export interface Spec extends TurboModule {
|
|
|
66
65
|
+useNativeViewConfigsInBridgelessMode?: () => boolean;
|
|
67
66
|
+useOptimisedViewPreallocationOnAndroid?: () => boolean;
|
|
68
67
|
+useOptimizedEventBatchingOnAndroid?: () => boolean;
|
|
68
|
+
+useRawPropsJsiValue?: () => boolean;
|
|
69
69
|
+useRuntimeShadowNodeReferenceUpdate?: () => boolean;
|
|
70
70
|
+useTurboModuleInterop?: () => boolean;
|
|
71
71
|
+useTurboModules?: () => boolean;
|
|
@@ -21,7 +21,10 @@ type ErrorInfo = {
|
|
|
21
21
|
+errorBoundary?: ?React$Component<any, any>,
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
function getExtendedError(
|
|
25
|
+
errorValue: mixed,
|
|
26
|
+
errorInfo: ErrorInfo,
|
|
27
|
+
): ExtendedError {
|
|
25
28
|
let error;
|
|
26
29
|
|
|
27
30
|
// Typically, `errorValue` should be an error. However, other values such as
|
|
@@ -50,38 +53,18 @@ export function onUncaughtError(errorValue: mixed, errorInfo: ErrorInfo): void {
|
|
|
50
53
|
// Ignored.
|
|
51
54
|
}
|
|
52
55
|
|
|
56
|
+
return error;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function onUncaughtError(errorValue: mixed, errorInfo: ErrorInfo): void {
|
|
60
|
+
const error = getExtendedError(errorValue, errorInfo);
|
|
61
|
+
|
|
53
62
|
// Uncaught errors are fatal.
|
|
54
63
|
handleException(error, true);
|
|
55
64
|
}
|
|
56
65
|
|
|
57
66
|
export function onCaughtError(errorValue: mixed, errorInfo: ErrorInfo): void {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
// Typically, `errorValue` should be an error. However, other values such as
|
|
61
|
-
// strings (or even null) are sometimes thrown.
|
|
62
|
-
if (errorValue instanceof Error) {
|
|
63
|
-
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
64
|
-
* this parameters */
|
|
65
|
-
// $FlowFixMe[incompatible-cast]
|
|
66
|
-
error = (errorValue: ExtendedError);
|
|
67
|
-
} else if (typeof errorValue === 'string') {
|
|
68
|
-
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
69
|
-
* this parameters */
|
|
70
|
-
// $FlowFixMe[incompatible-cast]
|
|
71
|
-
error = (new SyntheticError(errorValue): ExtendedError);
|
|
72
|
-
} else {
|
|
73
|
-
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
74
|
-
* this parameters */
|
|
75
|
-
// $FlowFixMe[incompatible-cast]
|
|
76
|
-
error = (new SyntheticError('Unspecified error'): ExtendedError);
|
|
77
|
-
}
|
|
78
|
-
try {
|
|
79
|
-
// $FlowFixMe[incompatible-use] this is in try/catch.
|
|
80
|
-
error.componentStack = errorInfo.componentStack;
|
|
81
|
-
error.isComponentError = true;
|
|
82
|
-
} catch {
|
|
83
|
-
// Ignored.
|
|
84
|
-
}
|
|
67
|
+
const error = getExtendedError(errorValue, errorInfo);
|
|
85
68
|
|
|
86
69
|
// Caught errors are not fatal.
|
|
87
70
|
handleException(error, false);
|
|
@@ -91,33 +74,7 @@ export function onRecoverableError(
|
|
|
91
74
|
errorValue: mixed,
|
|
92
75
|
errorInfo: ErrorInfo,
|
|
93
76
|
): void {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
// Typically, `errorValue` should be an error. However, other values such as
|
|
97
|
-
// strings (or even null) are sometimes thrown.
|
|
98
|
-
if (errorValue instanceof Error) {
|
|
99
|
-
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
100
|
-
* this parameters */
|
|
101
|
-
// $FlowFixMe[incompatible-cast]
|
|
102
|
-
error = (errorValue: ExtendedError);
|
|
103
|
-
} else if (typeof errorValue === 'string') {
|
|
104
|
-
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
105
|
-
* this parameters */
|
|
106
|
-
// $FlowFixMe[incompatible-cast]
|
|
107
|
-
error = (new SyntheticError(errorValue): ExtendedError);
|
|
108
|
-
} else {
|
|
109
|
-
/* $FlowFixMe[class-object-subtyping] added when improving typing for
|
|
110
|
-
* this parameters */
|
|
111
|
-
// $FlowFixMe[incompatible-cast]
|
|
112
|
-
error = (new SyntheticError('Unspecified error'): ExtendedError);
|
|
113
|
-
}
|
|
114
|
-
try {
|
|
115
|
-
// $FlowFixMe[incompatible-use] this is in try/catch.
|
|
116
|
-
error.componentStack = errorInfo.componentStack;
|
|
117
|
-
error.isComponentError = true;
|
|
118
|
-
} catch {
|
|
119
|
-
// Ignored.
|
|
120
|
-
}
|
|
77
|
+
const error = getExtendedError(errorValue, errorInfo);
|
|
121
78
|
|
|
122
79
|
// Recoverable errors should only be warnings.
|
|
123
80
|
// This will make it a soft error in LogBox.
|
|
@@ -12,8 +12,13 @@ import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
|
|
|
12
12
|
|
|
13
13
|
import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* This is an internal native module meant to be used for performance
|
|
17
|
+
* measurements and benchmarks. It is not meant to be used in production.
|
|
18
|
+
*/
|
|
15
19
|
export interface Spec extends TurboModule {
|
|
16
|
-
+
|
|
20
|
+
+getCPUTimeNanos: () => number;
|
|
21
|
+
+hasAccurateCPUTimeNanosForBenchmarks: () => boolean;
|
|
17
22
|
}
|
|
18
23
|
|
|
19
|
-
export default (TurboModuleRegistry.
|
|
24
|
+
export default (TurboModuleRegistry.getEnforcing<Spec>('CPUTimeCxx'): Spec);
|
|
@@ -0,0 +1,37 @@
|
|
|
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 {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
|
|
12
|
+
|
|
13
|
+
import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';
|
|
14
|
+
|
|
15
|
+
// match RenderFormatOptions.h
|
|
16
|
+
export type RenderFormatOptions = {
|
|
17
|
+
includeRoot: boolean,
|
|
18
|
+
includeLayoutMetrics: boolean,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
interface Spec extends TurboModule {
|
|
22
|
+
startSurface: (
|
|
23
|
+
surfaceId: number,
|
|
24
|
+
viewportWidth: number,
|
|
25
|
+
viewportHeight: number,
|
|
26
|
+
devicePixelRatio: number,
|
|
27
|
+
) => void;
|
|
28
|
+
stopSurface: (surfaceId: number) => void;
|
|
29
|
+
getMountingManagerLogs: (surfaceId: number) => Array<string>;
|
|
30
|
+
flushMessageQueue: () => void;
|
|
31
|
+
getRenderedOutput: (surfaceId: number, config: RenderFormatOptions) => string;
|
|
32
|
+
reportTestSuiteResultsJSON: (results: string) => void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default TurboModuleRegistry.getEnforcing<Spec>(
|
|
36
|
+
'NativeFantomCxx',
|
|
37
|
+
) as Spec;
|
|
@@ -0,0 +1,21 @@
|
|
|
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 default function ensureInstance<T>(value: mixed, Class: Class<T>): T {
|
|
12
|
+
if (!(value instanceof Class)) {
|
|
13
|
+
// $FlowIssue[incompatible-use]
|
|
14
|
+
const className = Class.name;
|
|
15
|
+
throw new Error(
|
|
16
|
+
`Expected instance of ${className} but got ${String(value)}`,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
@@ -25,7 +25,7 @@ import {getFabricUIManager} from '../../../../../Libraries/ReactNative/FabricUIM
|
|
|
25
25
|
import {create as createAttributePayload} from '../../../../../Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload';
|
|
26
26
|
import warnForStyleProps from '../../../../../Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps';
|
|
27
27
|
import ReadOnlyElement, {getBoundingClientRect} from './ReadOnlyElement';
|
|
28
|
-
import ReadOnlyNode from './ReadOnlyNode';
|
|
28
|
+
import ReadOnlyNode, {setInstanceHandle} from './ReadOnlyNode';
|
|
29
29
|
import {
|
|
30
30
|
getPublicInstanceFromInternalInstanceHandle,
|
|
31
31
|
getShadowNode,
|
|
@@ -35,7 +35,26 @@ import nullthrows from 'nullthrows';
|
|
|
35
35
|
|
|
36
36
|
const noop = () => {};
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
// Ideally, this class would be exported as-is, but this implementation is
|
|
39
|
+
// significantly slower than the existing `ReactFabricHostComponent`.
|
|
40
|
+
// This is a very hot code path (this class is instantiated once per rendered
|
|
41
|
+
// host component in the tree) and we can't regress performance here.
|
|
42
|
+
//
|
|
43
|
+
// This implementation is slower because this is a subclass and we have to call
|
|
44
|
+
// super(), which is a very slow operation the way that Babel transforms it at
|
|
45
|
+
// the moment.
|
|
46
|
+
//
|
|
47
|
+
// The optimization we're doing is using an old-style function constructor,
|
|
48
|
+
// where we're not required to use `super()`, and we make that constructor
|
|
49
|
+
// extend this class so it inherits all the methods and it sets the class
|
|
50
|
+
// hierarchy correctly.
|
|
51
|
+
//
|
|
52
|
+
// An alternative implementation was to implement the constructor as a function
|
|
53
|
+
// returning a manually constructed instance using `Object.create()` but that
|
|
54
|
+
// was slower than this method because the engine has to create an object than
|
|
55
|
+
// we then discard to create a new one.
|
|
56
|
+
|
|
57
|
+
class ReactNativeElementMethods
|
|
39
58
|
extends ReadOnlyElement
|
|
40
59
|
implements INativeMethods
|
|
41
60
|
{
|
|
@@ -43,8 +62,10 @@ export default class ReactNativeElement
|
|
|
43
62
|
__nativeTag: number;
|
|
44
63
|
__internalInstanceHandle: InternalInstanceHandle;
|
|
45
64
|
|
|
46
|
-
|
|
65
|
+
__viewConfig: ViewConfig;
|
|
47
66
|
|
|
67
|
+
// This constructor isn't really used. See the `ReactNativeElement` function
|
|
68
|
+
// below.
|
|
48
69
|
constructor(
|
|
49
70
|
tag: number,
|
|
50
71
|
viewConfig: ViewConfig,
|
|
@@ -54,7 +75,7 @@ export default class ReactNativeElement
|
|
|
54
75
|
|
|
55
76
|
this.__nativeTag = tag;
|
|
56
77
|
this.__internalInstanceHandle = internalInstanceHandle;
|
|
57
|
-
this
|
|
78
|
+
this.__viewConfig = viewConfig;
|
|
58
79
|
}
|
|
59
80
|
|
|
60
81
|
get offsetHeight(): number {
|
|
@@ -171,12 +192,12 @@ export default class ReactNativeElement
|
|
|
171
192
|
|
|
172
193
|
setNativeProps(nativeProps: {...}): void {
|
|
173
194
|
if (__DEV__) {
|
|
174
|
-
warnForStyleProps(nativeProps, this
|
|
195
|
+
warnForStyleProps(nativeProps, this.__viewConfig.validAttributes);
|
|
175
196
|
}
|
|
176
197
|
|
|
177
198
|
const updatePayload = createAttributePayload(
|
|
178
199
|
nativeProps,
|
|
179
|
-
this
|
|
200
|
+
this.__viewConfig.validAttributes,
|
|
180
201
|
);
|
|
181
202
|
|
|
182
203
|
const node = getShadowNode(this);
|
|
@@ -186,3 +207,25 @@ export default class ReactNativeElement
|
|
|
186
207
|
}
|
|
187
208
|
}
|
|
188
209
|
}
|
|
210
|
+
|
|
211
|
+
// Alternative constructor just implemented to provide a better performance than
|
|
212
|
+
// calling super() in the original class.
|
|
213
|
+
function ReactNativeElement(
|
|
214
|
+
this: ReactNativeElementMethods,
|
|
215
|
+
tag: number,
|
|
216
|
+
viewConfig: ViewConfig,
|
|
217
|
+
internalInstanceHandle: InternalInstanceHandle,
|
|
218
|
+
) {
|
|
219
|
+
this.__nativeTag = tag;
|
|
220
|
+
this.__internalInstanceHandle = internalInstanceHandle;
|
|
221
|
+
this.__viewConfig = viewConfig;
|
|
222
|
+
setInstanceHandle(this, internalInstanceHandle);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
ReactNativeElement.prototype = Object.create(
|
|
226
|
+
ReactNativeElementMethods.prototype,
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
// $FlowExpectedError[prop-missing]
|
|
230
|
+
// $FlowFixMe[incompatible-cast]
|
|
231
|
+
export default ReactNativeElement as typeof ReactNativeElementMethods;
|
|
@@ -26,6 +26,8 @@ let ReadOnlyElementClass: Class<ReadOnlyElement>;
|
|
|
26
26
|
|
|
27
27
|
export default class ReadOnlyNode {
|
|
28
28
|
constructor(internalInstanceHandle: InternalInstanceHandle) {
|
|
29
|
+
// This constructor is inlined in `ReactNativeElement` so if you modify
|
|
30
|
+
// this make sure that their implementation stays in sync.
|
|
29
31
|
setInstanceHandle(this, internalInstanceHandle);
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -293,7 +295,7 @@ export function getInstanceHandle(node: ReadOnlyNode): InternalInstanceHandle {
|
|
|
293
295
|
return node[INSTANCE_HANDLE_KEY];
|
|
294
296
|
}
|
|
295
297
|
|
|
296
|
-
function setInstanceHandle(
|
|
298
|
+
export function setInstanceHandle(
|
|
297
299
|
node: ReadOnlyNode,
|
|
298
300
|
instanceHandle: InternalInstanceHandle,
|
|
299
301
|
): void {
|
|
@@ -301,11 +303,18 @@ function setInstanceHandle(
|
|
|
301
303
|
node[INSTANCE_HANDLE_KEY] = instanceHandle;
|
|
302
304
|
}
|
|
303
305
|
|
|
306
|
+
let RendererProxy;
|
|
307
|
+
function getRendererProxy() {
|
|
308
|
+
if (RendererProxy == null) {
|
|
309
|
+
// Lazy import Fabric here to avoid DOM Node APIs classes from having side-effects.
|
|
310
|
+
// With a static import we can't use these classes for Paper-only variants.
|
|
311
|
+
RendererProxy = require('../../../../../Libraries/ReactNative/RendererProxy');
|
|
312
|
+
}
|
|
313
|
+
return RendererProxy;
|
|
314
|
+
}
|
|
315
|
+
|
|
304
316
|
export function getShadowNode(node: ReadOnlyNode): ?ShadowNode {
|
|
305
|
-
|
|
306
|
-
// With a static import we can't use these classes for Paper-only variants.
|
|
307
|
-
const RendererProxy = require('../../../../../Libraries/ReactNative/RendererProxy');
|
|
308
|
-
return RendererProxy.getNodeFromInternalInstanceHandle(
|
|
317
|
+
return getRendererProxy().getNodeFromInternalInstanceHandle(
|
|
309
318
|
getInstanceHandle(node),
|
|
310
319
|
);
|
|
311
320
|
}
|
|
@@ -349,11 +358,10 @@ function getNodeSiblingsAndPosition(
|
|
|
349
358
|
export function getPublicInstanceFromInternalInstanceHandle(
|
|
350
359
|
instanceHandle: InternalInstanceHandle,
|
|
351
360
|
): ?ReadOnlyNode {
|
|
352
|
-
// Lazy import Fabric here to avoid DOM Node APIs classes from having side-effects.
|
|
353
|
-
// With a static import we can't use these classes for Paper-only variants.
|
|
354
|
-
const RendererProxy = require('../../../../../Libraries/ReactNative/RendererProxy');
|
|
355
361
|
const mixedPublicInstance =
|
|
356
|
-
|
|
362
|
+
getRendererProxy().getPublicInstanceFromInternalInstanceHandle(
|
|
363
|
+
instanceHandle,
|
|
364
|
+
);
|
|
357
365
|
// $FlowExpectedError[incompatible-return] React defines public instances as "mixed" because it can't access the definition from React Native.
|
|
358
366
|
return mixedPublicInstance;
|
|
359
367
|
}
|
|
@@ -33,10 +33,10 @@ type IntersectionObserverInit = {
|
|
|
33
33
|
* If set, it will either be a singular ratio value between 0-1 (inclusive)
|
|
34
34
|
* or an array of such ratios.
|
|
35
35
|
*
|
|
36
|
-
* Note: If `
|
|
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
|
-
|
|
39
|
+
rnRootThreshold?: number | $ReadOnlyArray<number>,
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
/**
|
|
@@ -57,7 +57,7 @@ type IntersectionObserverInit = {
|
|
|
57
57
|
*
|
|
58
58
|
* This implementation only supports the `threshold` option at the moment
|
|
59
59
|
* (`root` and `rootMargin` are not supported) and provides a React Native specific
|
|
60
|
-
* option `
|
|
60
|
+
* option `rnRootThreshold`.
|
|
61
61
|
*
|
|
62
62
|
*/
|
|
63
63
|
export default class IntersectionObserver {
|
|
@@ -99,7 +99,7 @@ export default class IntersectionObserver {
|
|
|
99
99
|
|
|
100
100
|
this._callback = callback;
|
|
101
101
|
|
|
102
|
-
this._rootThresholds = normalizeRootThreshold(options?.
|
|
102
|
+
this._rootThresholds = normalizeRootThreshold(options?.rnRootThreshold);
|
|
103
103
|
this._thresholds = normalizeThreshold(
|
|
104
104
|
options?.threshold,
|
|
105
105
|
this._rootThresholds != null, // only provide default if no rootThreshold
|
|
@@ -136,9 +136,9 @@ export default class IntersectionObserver {
|
|
|
136
136
|
* threshold is a ratio of intersection area to bounding box area of an
|
|
137
137
|
* observed target.
|
|
138
138
|
* Notifications for a target are generated when any of the thresholds specified
|
|
139
|
-
* in `
|
|
139
|
+
* in `rnRootThreshold` or `threshold` are crossed for that target.
|
|
140
140
|
*
|
|
141
|
-
* If no value was passed to the constructor, and no `
|
|
141
|
+
* If no value was passed to the constructor, and no `rnRootThreshold`
|
|
142
142
|
* is set, `0` is used.
|
|
143
143
|
*/
|
|
144
144
|
get thresholds(): $ReadOnlyArray<number> {
|
|
@@ -150,9 +150,9 @@ export default class IntersectionObserver {
|
|
|
150
150
|
* threshold is a ratio of intersection area to bounding box area of the specified
|
|
151
151
|
* root view, which defaults to the viewport.
|
|
152
152
|
* Notifications for a target are generated when any of the thresholds specified
|
|
153
|
-
* in `
|
|
153
|
+
* in `rnRootThreshold` or `threshold` are crossed for that target.
|
|
154
154
|
*/
|
|
155
|
-
get
|
|
155
|
+
get rnRootThresholds(): $ReadOnlyArray<number> | null {
|
|
156
156
|
return this._rootThresholds;
|
|
157
157
|
}
|
|
158
158
|
|
|
@@ -293,7 +293,7 @@ function normalizeThreshold(
|
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
/**
|
|
296
|
-
* Converts the user defined `
|
|
296
|
+
* Converts the user defined `rnRootThreshold` value into an array of sorted valid
|
|
297
297
|
* threshold options for `IntersectionObserver` (double ∈ [0, 1]).
|
|
298
298
|
*
|
|
299
299
|
* If invalid array or null, returns null.
|
|
@@ -310,13 +310,13 @@ function normalizeRootThreshold(
|
|
|
310
310
|
): null | $ReadOnlyArray<number> {
|
|
311
311
|
if (Array.isArray(rootThreshold)) {
|
|
312
312
|
const normalizedArr = rootThreshold
|
|
313
|
-
.map(rt => normalizeThresholdValue(rt, '
|
|
313
|
+
.map(rt => normalizeThresholdValue(rt, 'rnRootThreshold'))
|
|
314
314
|
.filter((rt): rt is number => rt != null)
|
|
315
315
|
.sort();
|
|
316
316
|
return normalizedArr.length === 0 ? null : normalizedArr;
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
const normalized = normalizeThresholdValue(rootThreshold, '
|
|
319
|
+
const normalized = normalizeThresholdValue(rootThreshold, 'rnRootThreshold');
|
|
320
320
|
return normalized == null ? null : [normalized];
|
|
321
321
|
}
|
|
322
322
|
|
|
@@ -77,7 +77,7 @@ export default class IntersectionObserverEntry {
|
|
|
77
77
|
/**
|
|
78
78
|
* Returns the ratio of the `intersectionRect` to the `boundingRootRect`.
|
|
79
79
|
*/
|
|
80
|
-
get
|
|
80
|
+
get rnRootIntersectionRatio(): number {
|
|
81
81
|
const intersectionRect = this.intersectionRect;
|
|
82
82
|
|
|
83
83
|
const rootRect = this._nativeEntry.rootRect;
|
|
@@ -162,7 +162,7 @@ export function observe({
|
|
|
162
162
|
intersectionObserverId,
|
|
163
163
|
targetShadowNode,
|
|
164
164
|
thresholds: registeredObserver.observer.thresholds,
|
|
165
|
-
rootThresholds: registeredObserver.observer.
|
|
165
|
+
rootThresholds: registeredObserver.observer.rnRootThresholds,
|
|
166
166
|
});
|
|
167
167
|
|
|
168
168
|
return true;
|
|
@@ -17,6 +17,7 @@ export type NativeIntersectionObserverEntry = {
|
|
|
17
17
|
targetInstanceHandle: mixed,
|
|
18
18
|
targetRect: $ReadOnlyArray<number>, // It's actually a tuple with x, y, width and height
|
|
19
19
|
rootRect: $ReadOnlyArray<number>, // It's actually a tuple with x, y, width and height
|
|
20
|
+
// TODO(T209328432) - Remove optionality of intersectionRect when native changes are released
|
|
20
21
|
intersectionRect: ?$ReadOnlyArray<number>, // It's actually a tuple with x, y, width and height
|
|
21
22
|
isIntersectingAboveThresholds: boolean,
|
|
22
23
|
time: number,
|
|
@@ -115,9 +115,6 @@ export default class Performance {
|
|
|
115
115
|
markName,
|
|
116
116
|
markOptions?.startTime,
|
|
117
117
|
);
|
|
118
|
-
} else if (NativePerformance?.mark) {
|
|
119
|
-
computedStartTime = markOptions?.startTime ?? performance.now();
|
|
120
|
-
NativePerformance?.mark?.(markName, computedStartTime);
|
|
121
118
|
} else {
|
|
122
119
|
warnNoNativePerformance();
|
|
123
120
|
computedStartTime = performance.now();
|
|
@@ -203,15 +200,6 @@ export default class Performance {
|
|
|
203
200
|
startMarkName,
|
|
204
201
|
endMarkName,
|
|
205
202
|
);
|
|
206
|
-
} else if (NativePerformance?.measure) {
|
|
207
|
-
NativePerformance.measure(
|
|
208
|
-
measureName,
|
|
209
|
-
startTime,
|
|
210
|
-
endTime,
|
|
211
|
-
duration,
|
|
212
|
-
startMarkName,
|
|
213
|
-
endMarkName,
|
|
214
|
-
);
|
|
215
203
|
} else {
|
|
216
204
|
warnNoNativePerformance();
|
|
217
205
|
}
|
|
@@ -45,17 +45,6 @@ export type PerformanceObserverInit = {
|
|
|
45
45
|
|
|
46
46
|
export interface Spec extends TurboModule {
|
|
47
47
|
+now?: () => number;
|
|
48
|
-
// TODO: remove when `markWithResult` is fully rolled out.
|
|
49
|
-
+mark?: (name: string, startTime: number) => void;
|
|
50
|
-
// TODO: remove when `measureWithResult` is fully rolled out.
|
|
51
|
-
+measure?: (
|
|
52
|
-
name: string,
|
|
53
|
-
startTime: number,
|
|
54
|
-
endTime: number,
|
|
55
|
-
duration?: number,
|
|
56
|
-
startMark?: string,
|
|
57
|
-
endMark?: string,
|
|
58
|
-
) => void;
|
|
59
48
|
+markWithResult?: (
|
|
60
49
|
name: string,
|
|
61
50
|
startTime?: number,
|
|
@@ -343,13 +343,6 @@ export interface ViewProps
|
|
|
343
343
|
* Used to reference react managed views from native code.
|
|
344
344
|
*/
|
|
345
345
|
nativeID?: string | undefined;
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
* Contols whether this view, and its transitive children, are laid in a way
|
|
349
|
-
* consistent with web browsers ('strict'), or consistent with existing
|
|
350
|
-
* React Native code which may rely on incorrect behavior ('classic').
|
|
351
|
-
*/
|
|
352
|
-
experimental_layoutConformance?: 'strict' | 'classic' | undefined;
|
|
353
346
|
}
|
|
354
347
|
|
|
355
348
|
// For backwards compat.... // Win32
|
|
@@ -8,5 +8,6 @@ import { PersonaCoinDefaultProps } from './PersonaCoinPropTypes';
|
|
|
8
8
|
const RCTPersonaCoin = requireNativeComponent('RCTPersonaCoin');
|
|
9
9
|
|
|
10
10
|
export const PersonaCoin: React.FunctionComponent<IPersonaCoinProps> = (props: IPersonaCoinProps) => <RCTPersonaCoin {...props} />;
|
|
11
|
+
// @ts-ignore
|
|
11
12
|
PersonaCoin.defaultProps = PersonaCoinDefaultProps;
|
|
12
13
|
PersonaCoin.displayName = 'PersonaCoin';
|
|
@@ -12,7 +12,7 @@ import {Constructor} from '../../types/private/Utilities';
|
|
|
12
12
|
import {AccessibilityProps} from '../Components/View/ViewAccessibility';
|
|
13
13
|
import {NativeMethods} from '../../types/public/ReactNativeTypes';
|
|
14
14
|
import {ColorValue, StyleProp} from '../StyleSheet/StyleSheet';
|
|
15
|
-
import {TextStyle} from '../StyleSheet/StyleSheetTypes';
|
|
15
|
+
import {TextStyle, ViewStyle} from '../StyleSheet/StyleSheetTypes';
|
|
16
16
|
import {
|
|
17
17
|
GestureResponderEvent,
|
|
18
18
|
LayoutChangeEvent,
|
|
@@ -294,6 +294,11 @@ export interface TextProps
|
|
|
294
294
|
* Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0).
|
|
295
295
|
*/
|
|
296
296
|
minimumFontScale?: number | undefined;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Controls how touch events are handled. Similar to `View`'s `pointerEvents`.
|
|
300
|
+
*/
|
|
301
|
+
pointerEvents?: ViewStyle['pointerEvents'] | undefined;
|
|
297
302
|
}
|
|
298
303
|
|
|
299
304
|
/**
|
package/types/index.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ export * from '../Libraries/Components/Clipboard/Clipboard';
|
|
|
84
84
|
export * from '../Libraries/Components/DrawerAndroid/DrawerLayoutAndroid';
|
|
85
85
|
export * from '../Libraries/Components/Keyboard/Keyboard';
|
|
86
86
|
export * from '../Libraries/Components/Keyboard/KeyboardAvoidingView';
|
|
87
|
+
export * from '../Libraries/Components/LayoutConformance/LayoutConformance';
|
|
87
88
|
export * from '../Libraries/Components/Pressable/Pressable';
|
|
88
89
|
export * from '../Libraries/Components/ProgressBarAndroid/ProgressBarAndroid';
|
|
89
90
|
export * from '../Libraries/Components/RefreshControl/RefreshControl';
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
import NativeJSCHeapCapture from './NativeJSCHeapCapture';
|
|
12
|
-
|
|
13
|
-
const HeapCapture = {
|
|
14
|
-
captureHeap: function (path: string) {
|
|
15
|
-
let error = null;
|
|
16
|
-
try {
|
|
17
|
-
global.nativeCaptureHeap(path);
|
|
18
|
-
console.log('HeapCapture.captureHeap succeeded: ' + path);
|
|
19
|
-
} catch (e) {
|
|
20
|
-
console.log('HeapCapture.captureHeap error: ' + e.toString());
|
|
21
|
-
error = e.toString();
|
|
22
|
-
}
|
|
23
|
-
if (NativeJSCHeapCapture) {
|
|
24
|
-
NativeJSCHeapCapture.captureComplete(path, error);
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
module.exports = HeapCapture;
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
export * from '../../src/private/specs/modules/NativeJSCHeapCapture';
|
|
12
|
-
import NativeJSCHeapCapture from '../../src/private/specs/modules/NativeJSCHeapCapture';
|
|
13
|
-
export default NativeJSCHeapCapture;
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
export * from '../../src/private/specs/modules/NativeJSCSamplingProfiler';
|
|
12
|
-
import NativeJSCSamplingProfiler from '../../src/private/specs/modules/NativeJSCSamplingProfiler';
|
|
13
|
-
export default NativeJSCSamplingProfiler;
|