@office-iss/react-native-win32 0.70.1 → 0.70.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/CHANGELOG.json CHANGED
@@ -2,7 +2,22 @@
2
2
  "name": "@office-iss/react-native-win32",
3
3
  "entries": [
4
4
  {
5
- "date": "Mon, 19 Sep 2022 15:09:35 GMT",
5
+ "date": "Mon, 26 Sep 2022 15:09:39 GMT",
6
+ "tag": "@office-iss/react-native-win32_v0.70.2",
7
+ "version": "0.70.2",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "julio.rocha@microsoft.com",
12
+ "package": "@office-iss/react-native-win32",
13
+ "commit": "ecd361d52e6efeeb66bb9d1404997d6b06027a0f",
14
+ "comment": "Consolidate JavaScript HTTP module specifications"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Mon, 19 Sep 2022 15:10:14 GMT",
6
21
  "tag": "@office-iss/react-native-win32_v0.70.1",
7
22
  "version": "0.70.1",
8
23
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,18 +1,26 @@
1
1
  # Change Log - @office-iss/react-native-win32
2
2
 
3
- This log was last generated on Mon, 19 Sep 2022 15:09:35 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 26 Sep 2022 15:09:39 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 0.70.1
7
+ ## 0.70.2
8
8
 
9
- Mon, 19 Sep 2022 15:09:35 GMT
9
+ Mon, 26 Sep 2022 15:09:39 GMT
10
10
 
11
11
  ### Patches
12
12
 
13
- - Add Dimensions.win32 implementation to support text scale factor (patboyd@microsoft.com)
14
- - Add `accessibilityAccessKey` prop to ViewWin32 (#10527) (ruaraki@microsoft.com)
13
+ - Consolidate JavaScript HTTP module specifications (julio.rocha@microsoft.com)
15
14
 
15
+ ## 0.70.1
16
+
17
+ Mon, 19 Sep 2022 15:10:14 GMT
18
+
19
+ ### Patches
20
+
21
+ - Add Dimensions.win32 implementation to support text scale factor (patboyd@microsoft.com)
22
+ - Add `accessibilityAccessKey` prop to ViewWin32 (#10527) (ruaraki@microsoft.com)
23
+
16
24
  ## 0.70.0
17
25
 
18
26
  Mon, 12 Sep 2022 17:54:20 GMT
@@ -1,93 +1,117 @@
1
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.
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
6
4
  *
5
+ * @flow strict-local
7
6
  * @format
8
- * @flow
9
7
  */
10
8
 
11
- // Do not require the native RCTNetworking module directly! Use this wrapper module instead.
12
- // It will add the necessary requestId, so that you don't have to generate it yourself.
13
- import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';
14
- import convertRequestBody from './convertRequestBody';
15
-
16
- // [Win32
17
- import type {RequestBody} from './convertRequestBody';
18
- const NativeModules = require('../BatchedBridge/NativeModules');
19
- const RCTNetworkingNative = NativeModules.Networking;
20
- // Win32]
9
+ 'use strict';
21
10
 
22
- type Header = [string, string];
11
+ import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter';
12
+ const RCTNetworkingNative =
13
+ require('../BatchedBridge/NativeModules').Networking; // [Windows]
14
+ import {type NativeResponseType} from './XMLHttpRequest';
15
+ import convertRequestBody, {type RequestBody} from './convertRequestBody';
16
+ import {type EventSubscription} from '../vendor/emitter/EventEmitter';
23
17
 
24
- // Convert FormData headers to arrays, which are easier to consume in
25
- // native on Android.
26
- function convertHeadersMapToArray(headers: Object): Array<Header> {
27
- const headerArray = [];
28
- for (const name in headers) {
29
- headerArray.push([name, headers[name]]);
30
- }
31
- return headerArray;
32
- }
18
+ type RCTNetworkingEventDefinitions = $ReadOnly<{
19
+ didSendNetworkData: [
20
+ [
21
+ number, // requestId
22
+ number, // progress
23
+ number, // total
24
+ ],
25
+ ],
26
+ didReceiveNetworkResponse: [
27
+ [
28
+ number, // requestId
29
+ number, // status
30
+ ?{[string]: string}, // responseHeaders
31
+ ?string, // responseURL
32
+ ],
33
+ ],
34
+ didReceiveNetworkData: [
35
+ [
36
+ number, // requestId
37
+ string, // response
38
+ ],
39
+ ],
40
+ didReceiveNetworkIncrementalData: [
41
+ [
42
+ number, // requestId
43
+ string, // responseText
44
+ number, // progress
45
+ number, // total
46
+ ],
47
+ ],
48
+ didReceiveNetworkDataProgress: [
49
+ [
50
+ number, // requestId
51
+ number, // loaded
52
+ number, // total
53
+ ],
54
+ ],
55
+ didCompleteNetworkResponse: [
56
+ [
57
+ number, // requestId
58
+ string, // error
59
+ boolean, // timeOutError
60
+ ],
61
+ ],
62
+ }>;
33
63
 
34
64
  let _requestId = 1;
35
65
  function generateRequestId(): number {
36
66
  return _requestId++;
37
67
  }
38
68
 
39
- /**
40
- * This class is a wrapper around the native RCTNetworking module. It adds a necessary unique
41
- * requestId to each network request that can be used to abort that request later on.
42
- */
43
- // FIXME: use typed events
44
- class RCTNetworking extends NativeEventEmitter<$FlowFixMe> {
45
- constructor() {
46
- super(RCTNetworkingNative); // [Win32] Use RCTNetworkingNative
47
- }
69
+ const RCTNetworking = {
70
+ addListener<K: $Keys<RCTNetworkingEventDefinitions>>(
71
+ eventType: K,
72
+ listener: (...$ElementType<RCTNetworkingEventDefinitions, K>) => mixed,
73
+ context?: mixed,
74
+ ): EventSubscription {
75
+ return RCTDeviceEventEmitter.addListener(eventType, listener, context);
76
+ },
48
77
 
49
78
  sendRequest(
50
79
  method: string,
51
80
  trackingName: string,
52
81
  url: string,
53
- headers: Object,
82
+ headers: {...},
54
83
  data: RequestBody,
55
- responseType: 'text' | 'base64',
84
+ responseType: NativeResponseType,
56
85
  incrementalUpdates: boolean,
57
86
  timeout: number,
58
- callback: (requestId: number) => mixed,
87
+ callback: (requestId: number) => void,
59
88
  withCredentials: boolean,
60
89
  ) {
61
- const body = convertRequestBody(data);
62
- if (body && body.formData) {
63
- body.formData = body.formData.map(part => ({
64
- ...part,
65
- headers: convertHeadersMapToArray(part.headers),
66
- }));
67
- }
68
90
  const requestId = generateRequestId();
91
+ const body = convertRequestBody(data);
69
92
  RCTNetworkingNative.sendRequest(
70
- // [Win32] Use RCTNetworkingNative
71
- method,
72
- url,
73
- requestId,
74
- convertHeadersMapToArray(headers),
75
- {...body, trackingName},
76
- responseType,
77
- incrementalUpdates,
78
- timeout,
79
- withCredentials,
93
+ {
94
+ method,
95
+ url,
96
+ requestId,
97
+ data: {...body, trackingName},
98
+ headers,
99
+ responseType,
100
+ incrementalUpdates,
101
+ timeout,
102
+ withCredentials,
103
+ },
104
+ callback,
80
105
  );
81
- callback(requestId);
82
- }
106
+ },
83
107
 
84
108
  abortRequest(requestId: number) {
85
- RCTNetworkingNative.abortRequest(requestId); // [Win32] Use RCTNetworkingNative
86
- }
109
+ RCTNetworkingNative.abortRequest(requestId);
110
+ },
87
111
 
88
- clearCookies(callback: (result: boolean) => any) {
89
- RCTNetworkingNative.clearCookies(callback); // [Win32] Use RCTNetworkingNative
90
- }
91
- }
112
+ clearCookies(callback: (result: boolean) => void) {
113
+ RCTNetworkingNative.clearCookies(callback);
114
+ },
115
+ };
92
116
 
93
- module.exports = (new RCTNetworking(): RCTNetworking);
117
+ module.exports = RCTNetworking;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@office-iss/react-native-win32",
3
- "version": "0.70.1",
3
+ "version": "0.70.2",
4
4
  "description": "Implementation of react native on top of Office's Win32 platform.",
5
5
  "license": "MIT",
6
6
  "main": "./index.win32.js",