@office-iss/react-native-win32 0.0.0-canary.277 → 0.0.0-canary.279
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.flowconfig +1 -2
- package/CHANGELOG.json +55 -1
- package/CHANGELOG.md +24 -4
- package/Libraries/Animated/NativeAnimatedAllowlist.js +4 -4
- package/Libraries/Animated/animations/Animation.js +23 -2
- 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 +8 -2
- package/Libraries/Animated/nodes/AnimatedColor.js +4 -1
- package/Libraries/Animated/nodes/AnimatedDiffClamp.js +9 -2
- package/Libraries/Animated/nodes/AnimatedDivision.js +8 -2
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +4 -1
- package/Libraries/Animated/nodes/AnimatedModulo.js +4 -2
- package/Libraries/Animated/nodes/AnimatedMultiplication.js +8 -2
- package/Libraries/Animated/nodes/AnimatedNode.js +25 -0
- package/Libraries/Animated/nodes/AnimatedObject.js +8 -2
- package/Libraries/Animated/nodes/AnimatedProps.js +13 -2
- package/Libraries/Animated/nodes/AnimatedStyle.js +13 -2
- package/Libraries/Animated/nodes/AnimatedSubtraction.js +8 -2
- package/Libraries/Animated/nodes/AnimatedTracking.js +4 -1
- package/Libraries/Animated/nodes/AnimatedTransform.js +4 -1
- package/Libraries/Animated/nodes/AnimatedValue.js +4 -1
- package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +1 -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/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 +1 -1
- package/Libraries/Core/setUpBatchedBridge.js +1 -16
- package/Libraries/EventEmitter/RCTEventEmitter.js +2 -6
- 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/FormData.js +11 -3
- 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/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/index.js +5 -0
- package/index.win32.js +5 -0
- package/overrides.json +9 -9
- package/package.json +19 -20
- package/src/private/animated/NativeAnimatedValidation.js +1 -1
- package/src/private/animated/useAnimatedPropsMemo.js +12 -4
- package/src/private/featureflags/ReactNativeFeatureFlags.js +22 -12
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +4 -2
- 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/specs/modules/NativeJSCSamplingProfiler.js +0 -19
- 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
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
13
|
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
|
14
|
+
import type {AnimatedNodeConfig} from './AnimatedNode';
|
|
14
15
|
|
|
15
16
|
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
|
|
16
17
|
import {validateTransform} from '../../../src/private/animated/NativeAnimatedValidation';
|
|
@@ -70,8 +71,9 @@ export default class AnimatedTransform extends AnimatedWithChildren {
|
|
|
70
71
|
constructor(
|
|
71
72
|
nodes: $ReadOnlyArray<AnimatedNode>,
|
|
72
73
|
transforms: $ReadOnlyArray<Transform<>>,
|
|
74
|
+
config?: ?AnimatedNodeConfig,
|
|
73
75
|
) {
|
|
74
|
-
super();
|
|
76
|
+
super(config);
|
|
75
77
|
this.#nodes = nodes;
|
|
76
78
|
this._transforms = transforms;
|
|
77
79
|
}
|
|
@@ -160,6 +162,7 @@ export default class AnimatedTransform extends AnimatedWithChildren {
|
|
|
160
162
|
return {
|
|
161
163
|
type: 'transform',
|
|
162
164
|
transforms: transformsConfig,
|
|
165
|
+
debugID: this.__getDebugID(),
|
|
163
166
|
};
|
|
164
167
|
}
|
|
165
168
|
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import type Animation, {EndCallback} from '../animations/Animation';
|
|
14
14
|
import type {InterpolationConfigType} from './AnimatedInterpolation';
|
|
15
15
|
import type AnimatedNode from './AnimatedNode';
|
|
16
|
+
import type {AnimatedNodeConfig} from './AnimatedNode';
|
|
16
17
|
import type AnimatedTracking from './AnimatedTracking';
|
|
17
18
|
|
|
18
19
|
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
|
|
@@ -21,6 +22,7 @@ import AnimatedInterpolation from './AnimatedInterpolation';
|
|
|
21
22
|
import AnimatedWithChildren from './AnimatedWithChildren';
|
|
22
23
|
|
|
23
24
|
export type AnimatedValueConfig = $ReadOnly<{
|
|
25
|
+
...AnimatedNodeConfig,
|
|
24
26
|
useNativeDriver: boolean,
|
|
25
27
|
}>;
|
|
26
28
|
|
|
@@ -90,7 +92,7 @@ export default class AnimatedValue extends AnimatedWithChildren {
|
|
|
90
92
|
_tracking: ?AnimatedTracking;
|
|
91
93
|
|
|
92
94
|
constructor(value: number, config?: ?AnimatedValueConfig) {
|
|
93
|
-
super();
|
|
95
|
+
super(config);
|
|
94
96
|
if (typeof value !== 'number') {
|
|
95
97
|
throw new Error('AnimatedValue: Attempting to set value to undefined');
|
|
96
98
|
}
|
|
@@ -298,6 +300,7 @@ export default class AnimatedValue extends AnimatedWithChildren {
|
|
|
298
300
|
type: 'value',
|
|
299
301
|
value: this._value,
|
|
300
302
|
offset: this._offset,
|
|
303
|
+
debugID: this.__getDebugID(),
|
|
301
304
|
};
|
|
302
305
|
}
|
|
303
306
|
}
|
|
@@ -11,12 +11,14 @@
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
13
|
import type {PlatformConfig} from '../AnimatedPlatformConfig';
|
|
14
|
+
import type {AnimatedNodeConfig} from './AnimatedNode';
|
|
14
15
|
|
|
15
16
|
import AnimatedValue from './AnimatedValue';
|
|
16
17
|
import AnimatedWithChildren from './AnimatedWithChildren';
|
|
17
18
|
import invariant from 'invariant';
|
|
18
19
|
|
|
19
20
|
export type AnimatedValueXYConfig = $ReadOnly<{
|
|
21
|
+
...AnimatedNodeConfig,
|
|
20
22
|
useNativeDriver: boolean,
|
|
21
23
|
}>;
|
|
22
24
|
type ValueXYListenerCallback = (value: {x: number, y: number, ...}) => mixed;
|
|
@@ -49,7 +51,7 @@ export default class AnimatedValueXY extends AnimatedWithChildren {
|
|
|
49
51
|
},
|
|
50
52
|
config?: ?AnimatedValueXYConfig,
|
|
51
53
|
) {
|
|
52
|
-
super();
|
|
54
|
+
super(config);
|
|
53
55
|
const value: any = valueIn || {x: 0, y: 0}; // @flowfixme: shouldn't need `: any`
|
|
54
56
|
if (typeof value.x === 'number' && typeof value.y === 'number') {
|
|
55
57
|
this.x = new AnimatedValue(value.x);
|
|
@@ -105,7 +105,7 @@ export interface DrawerLayoutAndroidProps extends ViewProps {
|
|
|
105
105
|
* The navigation view that will be rendered to the side of the
|
|
106
106
|
* screen and can be pulled in.
|
|
107
107
|
*/
|
|
108
|
-
renderNavigationView: () => JSX.Element;
|
|
108
|
+
renderNavigationView: () => React.JSX.Element;
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
111
|
* Make the drawer take the entire screen and draw the background of
|
|
@@ -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
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type * as React from 'react';
|
|
11
|
+
|
|
12
|
+
type LayoutConformanceProps = {
|
|
13
|
+
/**
|
|
14
|
+
* strict: Layout in accordance with W3C spec, even when breaking
|
|
15
|
+
* compatibility: Layout with the same behavior as previous versions of React Native
|
|
16
|
+
*/
|
|
17
|
+
mode: 'strict' | 'compatibility';
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const experimental_LayoutConformance: React.ComponentType<LayoutConformanceProps>;
|
|
@@ -0,0 +1,59 @@
|
|
|
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-local
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall react_native
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import StyleSheet from '../../StyleSheet/StyleSheet';
|
|
13
|
+
import LayoutConformanceNativeComponent from './LayoutConformanceNativeComponent';
|
|
14
|
+
import * as React from 'react';
|
|
15
|
+
|
|
16
|
+
type Props = $ReadOnly<{
|
|
17
|
+
/**
|
|
18
|
+
* strict: Layout in accordance with W3C spec, even when breaking
|
|
19
|
+
* compatibility: Layout with the same behavior as previous versions of React Native
|
|
20
|
+
*/
|
|
21
|
+
mode: 'strict' | 'compatibility',
|
|
22
|
+
|
|
23
|
+
children: React.Node,
|
|
24
|
+
}>;
|
|
25
|
+
|
|
26
|
+
// We want a graceful fallback for apps using legacy arch, but need to know
|
|
27
|
+
// ahead of time whether the component is available, so we test for global.
|
|
28
|
+
// This does not correctly handle mixed arch apps (which is okay, since we just
|
|
29
|
+
// degrade the error experience).
|
|
30
|
+
const isFabricUIManagerInstalled = global?.nativeFabricUIManager != null;
|
|
31
|
+
|
|
32
|
+
function LayoutConformance(props: Props): React.Node {
|
|
33
|
+
return (
|
|
34
|
+
<LayoutConformanceNativeComponent {...props} style={styles.container} />
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function UnimplementedLayoutConformance(props: Props): React.Node {
|
|
39
|
+
if (__DEV__) {
|
|
40
|
+
const warnOnce = require('../../Utilities/warnOnce');
|
|
41
|
+
|
|
42
|
+
warnOnce(
|
|
43
|
+
'layoutconformance-unsupported',
|
|
44
|
+
'"LayoutConformance" is only supported in the New Architecture',
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return props.children;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default (isFabricUIManagerInstalled
|
|
52
|
+
? LayoutConformance
|
|
53
|
+
: UnimplementedLayoutConformance) as component(...Props);
|
|
54
|
+
|
|
55
|
+
const styles = StyleSheet.create({
|
|
56
|
+
container: {
|
|
57
|
+
display: 'contents',
|
|
58
|
+
},
|
|
59
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
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-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
|
|
12
|
+
import type {ViewProps} from '../View/ViewPropTypes';
|
|
13
|
+
|
|
14
|
+
import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry';
|
|
15
|
+
|
|
16
|
+
type Props = $ReadOnly<{
|
|
17
|
+
mode: 'strict' | 'compatibility',
|
|
18
|
+
...ViewProps,
|
|
19
|
+
}>;
|
|
20
|
+
|
|
21
|
+
const LayoutConformanceNativeComponent: HostComponent<Props> =
|
|
22
|
+
NativeComponentRegistry.get<Props>('LayoutConformance', () => ({
|
|
23
|
+
uiViewClassName: 'LayoutConformance',
|
|
24
|
+
validAttributes: {
|
|
25
|
+
mode: true,
|
|
26
|
+
},
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
export default LayoutConformanceNativeComponent;
|
|
@@ -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
|
|
@@ -578,15 +578,6 @@ export type ViewProps = $ReadOnly<{|
|
|
|
578
578
|
*/
|
|
579
579
|
collapsableChildren?: ?boolean,
|
|
580
580
|
|
|
581
|
-
/**
|
|
582
|
-
* Contols whether this view, and its transitive children, are laid in a way
|
|
583
|
-
* consistent with web browsers ('strict'), or consistent with existing
|
|
584
|
-
* React Native code which may rely on incorrect behavior ('classic').
|
|
585
|
-
*
|
|
586
|
-
* This prop only works when using Fabric.
|
|
587
|
-
*/
|
|
588
|
-
experimental_layoutConformance?: ?('strict' | 'classic'),
|
|
589
|
-
|
|
590
581
|
/**
|
|
591
582
|
* Used to locate this view from native classes. Has precedence over `nativeID` prop.
|
|
592
583
|
*
|
|
@@ -639,15 +639,6 @@ export type ViewProps = $ReadOnly<{|
|
|
|
639
639
|
*/
|
|
640
640
|
collapsableChildren?: ?boolean,
|
|
641
641
|
|
|
642
|
-
/**
|
|
643
|
-
* Contols whether this view, and its transitive children, are laid in a way
|
|
644
|
-
* consistent with web browsers ('strict'), or consistent with existing
|
|
645
|
-
* React Native code which may rely on incorrect behavior ('classic').
|
|
646
|
-
*
|
|
647
|
-
* This prop only works when using Fabric.
|
|
648
|
-
*/
|
|
649
|
-
experimental_layoutConformance?: ?('strict' | 'classic'),
|
|
650
|
-
|
|
651
642
|
/**
|
|
652
643
|
* Used to locate this view from native classes. Has precedence over `nativeID` prop.
|
|
653
644
|
*
|
|
@@ -10,27 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
if (global.RN$Bridgeless === true && global.RN$registerCallableModule) {
|
|
15
|
-
registerModule = global.RN$registerCallableModule;
|
|
16
|
-
} else {
|
|
17
|
-
const BatchedBridge = require('../BatchedBridge/BatchedBridge');
|
|
18
|
-
registerModule = (
|
|
19
|
-
moduleName: string,
|
|
20
|
-
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by
|
|
21
|
-
* Flow's LTI update could not be added via codemod */
|
|
22
|
-
factory,
|
|
23
|
-
) => BatchedBridge.registerLazyCallableModule(moduleName, factory);
|
|
24
|
-
}
|
|
13
|
+
import registerModule from './registerCallableModule';
|
|
25
14
|
|
|
26
15
|
registerModule('Systrace', () => require('../Performance/Systrace'));
|
|
27
16
|
if (!(global.RN$Bridgeless === true)) {
|
|
28
17
|
registerModule('JSTimers', () => require('./Timers/JSTimers'));
|
|
29
18
|
}
|
|
30
|
-
registerModule('HeapCapture', () => require('../HeapCapture/HeapCapture'));
|
|
31
|
-
registerModule('SamplingProfiler', () =>
|
|
32
|
-
require('../Performance/SamplingProfiler'),
|
|
33
|
-
);
|
|
34
19
|
registerModule('RCTLog', () => require('../Utilities/RCTLog'));
|
|
35
20
|
registerModule(
|
|
36
21
|
'RCTDeviceEventEmitter',
|
|
@@ -10,15 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
import registerCallableModule from '../Core/registerCallableModule';
|
|
14
14
|
|
|
15
15
|
const RCTEventEmitter = {
|
|
16
16
|
register(eventEmitter: any) {
|
|
17
|
-
|
|
18
|
-
global.RN$registerCallableModule('RCTEventEmitter', () => eventEmitter);
|
|
19
|
-
} else {
|
|
20
|
-
BatchedBridge.registerCallableModule('RCTEventEmitter', eventEmitter);
|
|
21
|
-
}
|
|
17
|
+
registerCallableModule('RCTEventEmitter', eventEmitter);
|
|
22
18
|
},
|
|
23
19
|
};
|
|
24
20
|
|
|
@@ -222,7 +222,7 @@ export abstract class FlatListComponent<
|
|
|
222
222
|
/**
|
|
223
223
|
* Provides a handle to the underlying scroll responder.
|
|
224
224
|
*/
|
|
225
|
-
getScrollResponder: () => JSX.Element | null | undefined;
|
|
225
|
+
getScrollResponder: () => React.JSX.Element | null | undefined;
|
|
226
226
|
|
|
227
227
|
/**
|
|
228
228
|
* Provides a reference to the underlying host component
|
package/Libraries/Modal/Modal.js
CHANGED
|
@@ -328,6 +328,7 @@ class Modal extends React.Component<Props, State> {
|
|
|
328
328
|
<VirtualizedListContextResetter>
|
|
329
329
|
<ScrollView.Context.Provider value={null}>
|
|
330
330
|
<View
|
|
331
|
+
// $FlowFixMe[incompatible-type]
|
|
331
332
|
style={[styles.container, containerStyles]}
|
|
332
333
|
collapsable={false}>
|
|
333
334
|
{innerChildren}
|
|
@@ -353,6 +354,7 @@ const styles = StyleSheet.create({
|
|
|
353
354
|
/* $FlowFixMe[invalid-computed-prop] (>=0.111.0 site=react_native_fb) This
|
|
354
355
|
* comment suppresses an error found when Flow v0.111 was deployed. To see
|
|
355
356
|
* the error, delete this comment and run Flow. */
|
|
357
|
+
// $FlowFixMe[incompatible-call]
|
|
356
358
|
[side]: 0,
|
|
357
359
|
top: 0,
|
|
358
360
|
flex: 1,
|
|
@@ -28,6 +28,15 @@ type FormDataPart =
|
|
|
28
28
|
...
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Encode a FormData filename compliant with RFC 2183
|
|
33
|
+
*
|
|
34
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#directives
|
|
35
|
+
*/
|
|
36
|
+
function encodeFilename(filename: string): string {
|
|
37
|
+
return encodeURIComponent(filename.replace(/\//g, '_'));
|
|
38
|
+
}
|
|
39
|
+
|
|
31
40
|
/**
|
|
32
41
|
* Polyfill for XMLHttpRequest2 FormData API, allowing multipart POST requests
|
|
33
42
|
* with mixed data (string, native files) to be submitted via XMLHttpRequest.
|
|
@@ -82,9 +91,8 @@ class FormData {
|
|
|
82
91
|
// content type (cf. web Blob interface.)
|
|
83
92
|
if (typeof value === 'object' && !Array.isArray(value) && value) {
|
|
84
93
|
if (typeof value.name === 'string') {
|
|
85
|
-
headers['content-disposition'] +=
|
|
86
|
-
value.name
|
|
87
|
-
}"; filename*=utf-8''${encodeURI(value.name)}`;
|
|
94
|
+
headers['content-disposition'] +=
|
|
95
|
+
`; filename="${encodeFilename(value.name)}"`;
|
|
88
96
|
}
|
|
89
97
|
if (typeof value.type === 'string') {
|
|
90
98
|
headers['content-type'] = value.type;
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
* @flow
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import type {EventSubscription} from '../vendor/emitter/EventEmitter';
|
|
11
12
|
import type {RequestBody} from './convertRequestBody';
|
|
13
|
+
import type {RCTNetworkingEventDefinitions} from './RCTNetworkingEventDefinitions.flow';
|
|
12
14
|
import type {NativeResponseType} from './XMLHttpRequest';
|
|
13
15
|
|
|
14
16
|
// Do not require the native RCTNetworking module directly! Use this wrapper module instead.
|
|
@@ -35,19 +37,25 @@ function generateRequestId(): number {
|
|
|
35
37
|
return _requestId++;
|
|
36
38
|
}
|
|
37
39
|
|
|
40
|
+
const emitter = new NativeEventEmitter<$FlowFixMe>(
|
|
41
|
+
// T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior
|
|
42
|
+
// If you want to use the native module on other platforms, please remove this condition and test its behavior
|
|
43
|
+
Platform.OS !== 'ios' ? null : NativeNetworkingAndroid,
|
|
44
|
+
);
|
|
45
|
+
|
|
38
46
|
/**
|
|
39
|
-
* This
|
|
47
|
+
* This object is a wrapper around the native RCTNetworking module. It adds a necessary unique
|
|
40
48
|
* requestId to each network request that can be used to abort that request later on.
|
|
41
49
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
);
|
|
50
|
-
}
|
|
50
|
+
const RCTNetworking = {
|
|
51
|
+
addListener<K: $Keys<RCTNetworkingEventDefinitions>>(
|
|
52
|
+
eventType: K,
|
|
53
|
+
listener: (...$ElementType<RCTNetworkingEventDefinitions, K>) => mixed,
|
|
54
|
+
context?: mixed,
|
|
55
|
+
): EventSubscription {
|
|
56
|
+
// $FlowFixMe[incompatible-call]
|
|
57
|
+
return emitter.addListener(eventType, listener, context);
|
|
58
|
+
},
|
|
51
59
|
|
|
52
60
|
sendRequest(
|
|
53
61
|
method: string,
|
|
@@ -81,15 +89,15 @@ class RCTNetworking extends NativeEventEmitter<$FlowFixMe> {
|
|
|
81
89
|
withCredentials,
|
|
82
90
|
);
|
|
83
91
|
callback(requestId);
|
|
84
|
-
}
|
|
92
|
+
},
|
|
85
93
|
|
|
86
94
|
abortRequest(requestId: number) {
|
|
87
95
|
NativeNetworkingAndroid.abortRequest(requestId);
|
|
88
|
-
}
|
|
96
|
+
},
|
|
89
97
|
|
|
90
|
-
clearCookies(callback: (result: boolean) =>
|
|
98
|
+
clearCookies(callback: (result: boolean) => void) {
|
|
91
99
|
NativeNetworkingAndroid.clearCookies(callback);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
100
|
+
},
|
|
101
|
+
};
|
|
94
102
|
|
|
95
|
-
export default
|
|
103
|
+
export default RCTNetworking;
|
|
@@ -14,54 +14,9 @@ import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter';
|
|
|
14
14
|
import {type EventSubscription} from '../vendor/emitter/EventEmitter';
|
|
15
15
|
import convertRequestBody, {type RequestBody} from './convertRequestBody';
|
|
16
16
|
import NativeNetworkingIOS from './NativeNetworkingIOS';
|
|
17
|
+
import {type RCTNetworkingEventDefinitions} from './RCTNetworkingEventDefinitions.flow';
|
|
17
18
|
import {type NativeResponseType} from './XMLHttpRequest';
|
|
18
19
|
|
|
19
|
-
type RCTNetworkingEventDefinitions = $ReadOnly<{
|
|
20
|
-
didSendNetworkData: [
|
|
21
|
-
[
|
|
22
|
-
number, // requestId
|
|
23
|
-
number, // progress
|
|
24
|
-
number, // total
|
|
25
|
-
],
|
|
26
|
-
],
|
|
27
|
-
didReceiveNetworkResponse: [
|
|
28
|
-
[
|
|
29
|
-
number, // requestId
|
|
30
|
-
number, // status
|
|
31
|
-
?{[string]: string}, // responseHeaders
|
|
32
|
-
?string, // responseURL
|
|
33
|
-
],
|
|
34
|
-
],
|
|
35
|
-
didReceiveNetworkData: [
|
|
36
|
-
[
|
|
37
|
-
number, // requestId
|
|
38
|
-
string, // response
|
|
39
|
-
],
|
|
40
|
-
],
|
|
41
|
-
didReceiveNetworkIncrementalData: [
|
|
42
|
-
[
|
|
43
|
-
number, // requestId
|
|
44
|
-
string, // responseText
|
|
45
|
-
number, // progress
|
|
46
|
-
number, // total
|
|
47
|
-
],
|
|
48
|
-
],
|
|
49
|
-
didReceiveNetworkDataProgress: [
|
|
50
|
-
[
|
|
51
|
-
number, // requestId
|
|
52
|
-
number, // loaded
|
|
53
|
-
number, // total
|
|
54
|
-
],
|
|
55
|
-
],
|
|
56
|
-
didCompleteNetworkResponse: [
|
|
57
|
-
[
|
|
58
|
-
number, // requestId
|
|
59
|
-
string, // error
|
|
60
|
-
boolean, // timeOutError
|
|
61
|
-
],
|
|
62
|
-
],
|
|
63
|
-
}>;
|
|
64
|
-
|
|
65
20
|
const RCTNetworking = {
|
|
66
21
|
addListener<K: $Keys<RCTNetworkingEventDefinitions>>(
|
|
67
22
|
eventType: K,
|
|
@@ -14,54 +14,9 @@ import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter';
|
|
|
14
14
|
import {type EventSubscription} from '../vendor/emitter/EventEmitter';
|
|
15
15
|
import convertRequestBody, {type RequestBody} from './convertRequestBody';
|
|
16
16
|
import NativeNetworkingIOS from './NativeNetworkingIOS';
|
|
17
|
+
import {type RCTNetworkingEventDefinitions} from './RCTNetworkingEventDefinitions.flow';
|
|
17
18
|
import {type NativeResponseType} from './XMLHttpRequest';
|
|
18
19
|
|
|
19
|
-
type RCTNetworkingEventDefinitions = $ReadOnly<{
|
|
20
|
-
didSendNetworkData: [
|
|
21
|
-
[
|
|
22
|
-
number, // requestId
|
|
23
|
-
number, // progress
|
|
24
|
-
number, // total
|
|
25
|
-
],
|
|
26
|
-
],
|
|
27
|
-
didReceiveNetworkResponse: [
|
|
28
|
-
[
|
|
29
|
-
number, // requestId
|
|
30
|
-
number, // status
|
|
31
|
-
?{[string]: string}, // responseHeaders
|
|
32
|
-
?string, // responseURL
|
|
33
|
-
],
|
|
34
|
-
],
|
|
35
|
-
didReceiveNetworkData: [
|
|
36
|
-
[
|
|
37
|
-
number, // requestId
|
|
38
|
-
string, // response
|
|
39
|
-
],
|
|
40
|
-
],
|
|
41
|
-
didReceiveNetworkIncrementalData: [
|
|
42
|
-
[
|
|
43
|
-
number, // requestId
|
|
44
|
-
string, // responseText
|
|
45
|
-
number, // progress
|
|
46
|
-
number, // total
|
|
47
|
-
],
|
|
48
|
-
],
|
|
49
|
-
didReceiveNetworkDataProgress: [
|
|
50
|
-
[
|
|
51
|
-
number, // requestId
|
|
52
|
-
number, // loaded
|
|
53
|
-
number, // total
|
|
54
|
-
],
|
|
55
|
-
],
|
|
56
|
-
didCompleteNetworkResponse: [
|
|
57
|
-
[
|
|
58
|
-
number, // requestId
|
|
59
|
-
string, // error
|
|
60
|
-
boolean, // timeOutError
|
|
61
|
-
],
|
|
62
|
-
],
|
|
63
|
-
}>;
|
|
64
|
-
|
|
65
20
|
const RCTNetworking = {
|
|
66
21
|
addListener<K: $Keys<RCTNetworkingEventDefinitions>>(
|
|
67
22
|
eventType: K,
|
|
@@ -0,0 +1,57 @@
|
|
|
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-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
export type RCTNetworkingEventDefinitions = $ReadOnly<{
|
|
14
|
+
didSendNetworkData: [
|
|
15
|
+
[
|
|
16
|
+
number, // requestId
|
|
17
|
+
number, // progress
|
|
18
|
+
number, // total
|
|
19
|
+
],
|
|
20
|
+
],
|
|
21
|
+
didReceiveNetworkResponse: [
|
|
22
|
+
[
|
|
23
|
+
number, // requestId
|
|
24
|
+
number, // status
|
|
25
|
+
?{[string]: string}, // responseHeaders
|
|
26
|
+
?string, // responseURL
|
|
27
|
+
],
|
|
28
|
+
],
|
|
29
|
+
didReceiveNetworkData: [
|
|
30
|
+
[
|
|
31
|
+
number, // requestId
|
|
32
|
+
string, // response
|
|
33
|
+
],
|
|
34
|
+
],
|
|
35
|
+
didReceiveNetworkIncrementalData: [
|
|
36
|
+
[
|
|
37
|
+
number, // requestId
|
|
38
|
+
string, // responseText
|
|
39
|
+
number, // progress
|
|
40
|
+
number, // total
|
|
41
|
+
],
|
|
42
|
+
],
|
|
43
|
+
didReceiveNetworkDataProgress: [
|
|
44
|
+
[
|
|
45
|
+
number, // requestId
|
|
46
|
+
number, // loaded
|
|
47
|
+
number, // total
|
|
48
|
+
],
|
|
49
|
+
],
|
|
50
|
+
didCompleteNetworkResponse: [
|
|
51
|
+
[
|
|
52
|
+
number, // requestId
|
|
53
|
+
string, // error
|
|
54
|
+
boolean, // timeOutError
|
|
55
|
+
],
|
|
56
|
+
],
|
|
57
|
+
}>;
|
|
@@ -10,6 +10,7 @@ const PersonaCoinPropTypes_1 = require("./PersonaCoinPropTypes");
|
|
|
10
10
|
const RCTPersonaCoin = (0, react_native_1.requireNativeComponent)('RCTPersonaCoin');
|
|
11
11
|
const PersonaCoin = (props) => react_1.default.createElement(RCTPersonaCoin, { ...props });
|
|
12
12
|
exports.PersonaCoin = PersonaCoin;
|
|
13
|
+
// @ts-ignore
|
|
13
14
|
exports.PersonaCoin.defaultProps = PersonaCoinPropTypes_1.PersonaCoinDefaultProps;
|
|
14
15
|
exports.PersonaCoin.displayName = 'PersonaCoin';
|
|
15
16
|
//# sourceMappingURL=PersonaCoin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersonaCoin.js","sourceRoot":"","sources":["../../src-win/Libraries/PersonaCoin/PersonaCoin.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AACb,kDAAyB;AAEzB,+CAAsD;AAEtD,iEAAiE;AAEjE,MAAM,cAAc,GAAG,IAAA,qCAAsB,EAAC,gBAAgB,CAAC,CAAC;AAEzD,MAAM,WAAW,GAA+C,CAAC,KAAwB,EAAE,EAAE,CAAC,8BAAC,cAAc,OAAK,KAAK,GAAI,CAAC;AAAtH,QAAA,WAAW,eAA2G;AACnI,mBAAW,CAAC,YAAY,GAAG,8CAAuB,CAAC;AACnD,mBAAW,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["'use strict';\nimport React from 'react'\n\nimport { requireNativeComponent } from 'react-native';\nimport { IPersonaCoinProps } from './PersonaCoinTypes';\nimport { PersonaCoinDefaultProps } from './PersonaCoinPropTypes';\n\nconst RCTPersonaCoin = requireNativeComponent('RCTPersonaCoin');\n\nexport const PersonaCoin: React.FunctionComponent<IPersonaCoinProps> = (props: IPersonaCoinProps) => <RCTPersonaCoin {...props} />;\nPersonaCoin.defaultProps = PersonaCoinDefaultProps;\nPersonaCoin.displayName = 'PersonaCoin';\n"]}
|
|
1
|
+
{"version":3,"file":"PersonaCoin.js","sourceRoot":"","sources":["../../src-win/Libraries/PersonaCoin/PersonaCoin.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AACb,kDAAyB;AAEzB,+CAAsD;AAEtD,iEAAiE;AAEjE,MAAM,cAAc,GAAG,IAAA,qCAAsB,EAAC,gBAAgB,CAAC,CAAC;AAEzD,MAAM,WAAW,GAA+C,CAAC,KAAwB,EAAE,EAAE,CAAC,8BAAC,cAAc,OAAK,KAAK,GAAI,CAAC;AAAtH,QAAA,WAAW,eAA2G;AACnI,aAAa;AACb,mBAAW,CAAC,YAAY,GAAG,8CAAuB,CAAC;AACnD,mBAAW,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["'use strict';\nimport React from 'react'\n\nimport { requireNativeComponent } from 'react-native';\nimport { IPersonaCoinProps } from './PersonaCoinTypes';\nimport { PersonaCoinDefaultProps } from './PersonaCoinPropTypes';\n\nconst RCTPersonaCoin = requireNativeComponent('RCTPersonaCoin');\n\nexport const PersonaCoin: React.FunctionComponent<IPersonaCoinProps> = (props: IPersonaCoinProps) => <RCTPersonaCoin {...props} />;\n// @ts-ignore\nPersonaCoin.defaultProps = PersonaCoinDefaultProps;\nPersonaCoin.displayName = 'PersonaCoin';\n"]}
|