react-native-windows 0.69.8 → 0.69.10

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.
@@ -1 +1,117 @@
1
- module.exports = require('./RCTNetworkingWinShared');
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * @flow strict-local
6
+ * @format
7
+ */
8
+
9
+ 'use strict';
10
+
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';
17
+
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
+ }>;
63
+
64
+ let _requestId = 1;
65
+ function generateRequestId(): number {
66
+ return _requestId++;
67
+ }
68
+
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
+ },
77
+
78
+ sendRequest(
79
+ method: string,
80
+ trackingName: string,
81
+ url: string,
82
+ headers: {...},
83
+ data: RequestBody,
84
+ responseType: NativeResponseType,
85
+ incrementalUpdates: boolean,
86
+ timeout: number,
87
+ callback: (requestId: number) => void,
88
+ withCredentials: boolean,
89
+ ) {
90
+ const requestId = generateRequestId();
91
+ const body = convertRequestBody(data);
92
+ RCTNetworkingNative.sendRequest(
93
+ {
94
+ method,
95
+ url,
96
+ requestId,
97
+ data: {...body, trackingName},
98
+ headers,
99
+ responseType,
100
+ incrementalUpdates,
101
+ timeout,
102
+ withCredentials,
103
+ },
104
+ callback,
105
+ );
106
+ },
107
+
108
+ abortRequest(requestId: number) {
109
+ RCTNetworkingNative.abortRequest(requestId);
110
+ },
111
+
112
+ clearCookies(callback: (result: boolean) => void) {
113
+ RCTNetworkingNative.clearCookies(callback);
114
+ },
115
+ };
116
+
117
+ module.exports = RCTNetworking;
@@ -25,9 +25,6 @@
25
25
  <NoWarn>$(NoWarn);1591</NoWarn>
26
26
  <!-- Missing XML comment for publicly visible type or member -->
27
27
  </PropertyGroup>
28
- <PropertyGroup Label="NuGet">
29
- <AssetTargetFallback>$(AssetTargetFallback);native</AssetTargetFallback>
30
- </PropertyGroup>
31
28
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
32
29
  <PlatformTarget>x86</PlatformTarget>
33
30
  <DebugSymbols>true</DebugSymbols>
@@ -80,6 +77,7 @@
80
77
  <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
81
78
  <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
82
79
  </PropertyGroup>
80
+ <Import Project="..\PropertySheets\NuGet.CSharp.props" />
83
81
  <Import Project="..\PropertySheets\WinUI.props" />
84
82
  <ItemGroup>
85
83
  <Compile Include="AttributedViewManager.cs" />
@@ -37,14 +37,5 @@
37
37
  <HermesNoDLLCopy Condition="'$(UseHermes)' != 'true'">true</HermesNoDLLCopy>
38
38
  </PropertyGroup>
39
39
 
40
- <!-- Should match entry in $(ReactNativeWindowsDir)vnext\Directory.Build.props -->
41
- <PropertyGroup Label="NuGet" Condition="'$(MSBuildProjectExtension)' == '.vcxproj'">
42
- <!--See https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target-->
43
- <RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true'">true</RestoreUseStaticGraphEvaluation>
44
-
45
- <!-- Ensure PackageReference compatibility for any consuming projects/apps -->
46
- <ResolveNuGetPackages>false</ResolveNuGetPackages>
47
- </PropertyGroup>
48
-
49
40
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\Generated\PackageVersion.g.props" />
50
41
  </Project>
@@ -20,5 +20,6 @@
20
20
  <Import Project="$(MSBuildThisFileDirectory)Microsoft.ReactNative.Uwp.Common.props" />
21
21
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\Appx.props" />
22
22
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\Autolink.props" />
23
+ <Import Project="$(ReactNativeWindowsDir)\PropertySheets\NuGet.CSharp.props" />
23
24
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\WinUI.props" />
24
25
  </Project>
@@ -13,4 +13,5 @@
13
13
  </PropertyGroup>
14
14
 
15
15
  <Import Project="$(MSBuildThisFileDirectory)Microsoft.ReactNative.Uwp.Common.props" />
16
+ <Import Project="$(ReactNativeWindowsDir)\PropertySheets\NuGet.CSharp.props" />
16
17
  </Project>
@@ -16,6 +16,7 @@
16
16
  <Import Project="$(MSBuildThisFileDirectory)Microsoft.ReactNative.Uwp.Common.props" />
17
17
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\Appx.props" />
18
18
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\Autolink.props" />
19
+ <Import Project="$(ReactNativeWindowsDir)\PropertySheets\NuGet.Cpp.props" />
19
20
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\WinUI.props" />
20
21
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\CppAppConsumeCSharpModule.props" />
21
22
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\PackageVersionDefinitions.props" />
@@ -17,6 +17,7 @@
17
17
  <GenerateLibraryLayout>false</GenerateLibraryLayout>
18
18
  </PropertyGroup>
19
19
  <Import Project="$(MSBuildThisFileDirectory)Microsoft.ReactNative.Uwp.Common.props" />
20
+ <Import Project="$(ReactNativeWindowsDir)\PropertySheets\NuGet.Cpp.props" />
20
21
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\WinUI.props" />
21
22
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\PackageVersionDefinitions.props" />
22
23
  </Project>
@@ -22,5 +22,6 @@
22
22
  <Import Project="$(MSBuildThisFileDirectory)Microsoft.ReactNative.WinAppSDK.Common.props" />
23
23
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\Appx.props" />
24
24
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\Autolink.props" />
25
+ <Import Project="$(ReactNativeWindowsDir)\PropertySheets\NuGet.CSharp.props" />
25
26
  <Import Project="$(ReactNativeWindowsDir)\PropertySheets\WinUI.props" />
26
27
  </Project>
@@ -10,10 +10,10 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.69.8</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.69.10</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>69</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>8</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>10</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
18
  </PropertyGroup>
19
19
  </Project>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+ Licensed under the MIT License.
5
+
6
+ Defines NuGet-related properties for C# projects using PackageReference.
7
+ -->
8
+ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
9
+
10
+ <PropertyGroup Label="NuGet">
11
+ <!-- https://github.com/NuGet/Home/issues/10511#issuecomment-778400668 -->
12
+ <AssetTargetFallback>$(AssetTargetFallback);native</AssetTargetFallback>
13
+ </PropertyGroup>
14
+
15
+ </Project>
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!--
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+ Licensed under the MIT License.
5
+
6
+ Defines NuGet-related properties for C++ projects using PackageReference.
7
+ -->
8
+ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
9
+
10
+ <PropertyGroup Label="NuGet">
11
+ <!-- Should match entry in $(ReactNativeWindowsDir)vnext\Directory.Build.props -->
12
+ <!--See https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target-->
13
+ <RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true'">true</RestoreUseStaticGraphEvaluation>
14
+
15
+ <!-- Ensure PackageReference compatibility for any consuming projects/apps -->
16
+ <ResolveNuGetPackages>false</ResolveNuGetPackages>
17
+
18
+ <!-- https://github.com/NuGet/Home/issues/10511#issuecomment-778400668 -->
19
+ <AssetTargetFallback>$(AssetTargetFallback);uap10.0.16299</AssetTargetFallback>
20
+
21
+ <!--
22
+ Avoid Visual Studio error message:
23
+ "The project '$(MSBuildProjectName)' ran into a problem during the last operation: The value of the
24
+ 'TargetFrameworkMoniker' and 'NuGetTargetMoniker' properties in the '$(Configuration)|$(Platform)' configuration are both
25
+ empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors. You may
26
+ need to reload the solution after fixing the problem."
27
+ -->
28
+ <TargetFrameworkMoniker>native,Version=v0.0</TargetFrameworkMoniker>
29
+ </PropertyGroup>
30
+
31
+ </Project>
@@ -17,21 +17,7 @@
17
17
  <EnableWinRtLeanAndMean Condition="'$(EnableWinRtLeanAndMean)' == ''">true</EnableWinRtLeanAndMean>
18
18
  </PropertyGroup>
19
19
 
20
- <PropertyGroup Label="NuGet">
21
- <ResolveNuGetPackages>false</ResolveNuGetPackages>
22
-
23
- <!-- https://github.com/NuGet/Home/issues/10511#issuecomment-778400668 -->
24
- <AssetTargetFallback>$(AssetTargetFallback);native</AssetTargetFallback>
25
-
26
- <!--
27
- Avoid Visual Studio error message:
28
- "The project '$(MSBuildProjectName)' ran into a problem during the last operation: The value of the
29
- 'TargetFrameworkMoniker' and 'NuGetTargetMoniker' properties in the '$(Configuration)|$(Platform)' configuration are both
30
- empty. This configuration will not contribute to NuGet restore, which may result in restore and build errors. You may
31
- need to reload the solution after fixing the problem."
32
- -->
33
- <TargetFrameworkMoniker>native,Version=v0.0</TargetFrameworkMoniker>
34
- </PropertyGroup>
20
+ <Import Project="$(MSBuildThisFileDirectory)NuGet.Cpp.props" />
35
21
 
36
22
  <PropertyGroup Label="Desktop">
37
23
  <!-- See https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt -->
@@ -56,6 +56,7 @@
56
56
  <file src="$nugetroot$\inc\Shared\Modules\I18nModule.h" target="inc"/>
57
57
  <file src="$nugetroot$\inc\Shared\NativeModuleProvider.h" target="inc"/>
58
58
  <file src="$nugetroot$\inc\Shared\Networking\IWebSocketResource.h" target="inc"/>
59
+ <file src="$nugetroot$\inc\Shared\Networking\OriginPolicy.h" target="inc"/>
59
60
  <file src="$nugetroot$\inc\Shared\RuntimeOptions.h" target="inc"/>
60
61
  <file src="$nugetroot$\inc\Shared\Tracing.h" target="inc"/>
61
62
 
@@ -15,7 +15,7 @@ namespace Microsoft::React {
15
15
 
16
16
  ///
17
17
  /// Realizes <c>NativeModules</c> projection.
18
- /// <remarks>See src\Libraries\Network\RCTNetworkingWinShared.js</remarks>
18
+ /// <remarks>See src\Libraries\Network\RCTNetworking.windows.js</remarks>
19
19
  ///
20
20
  class HttpModule : public facebook::xplat::module::CxxModule {
21
21
  public:
@@ -9,7 +9,7 @@ enum class OriginPolicy : size_t {
9
9
  None = 0,
10
10
  SameOrigin = 1,
11
11
  SimpleCrossOriginResourceSharing = 2,
12
- CrossOriginResourceSharing = 3, // TODO: Rename as FullCrossOriginResourceSharing?
12
+ CrossOriginResourceSharing = 3,
13
13
  };
14
14
 
15
15
  } // namespace Microsoft::React::Networking
@@ -640,8 +640,6 @@ void OriginPolicyHttpFilter::ValidateResponse(HttpResponseMessage const &respons
640
640
  }
641
641
 
642
642
  ResponseOperation OriginPolicyHttpFilter::SendPreflightAsync(HttpRequestMessage const &request) const {
643
- // TODO: Inject user agent?
644
-
645
643
  auto coRequest = request;
646
644
 
647
645
  HttpRequestMessage preflightRequest;
@@ -756,6 +754,11 @@ ResponseOperation OriginPolicyHttpFilter::SendRequestAsync(HttpRequestMessage co
756
754
  ValidatePreflightResponse(coRequest, preflightResponse);
757
755
  }
758
756
 
757
+ if (originPolicy == OriginPolicy::SimpleCrossOriginResourceSharing ||
758
+ originPolicy == OriginPolicy::CrossOriginResourceSharing) {
759
+ coRequest.Headers().Insert(L"Origin", s_origin.AbsoluteCanonicalUri());
760
+ }
761
+
759
762
  auto response = co_await m_innerFilter.SendRequestAsync(coRequest);
760
763
 
761
764
  ValidateResponse(response, originPolicy);
@@ -5,6 +5,8 @@
5
5
 
6
6
  #include "RedirectHttpFilter.h"
7
7
 
8
+ // React Native Windows
9
+ #include <CppRuntimeOptions.h>
8
10
  #include "WinRTTypes.h"
9
11
 
10
12
  // Windows API
@@ -211,6 +213,13 @@ ResponseOperation RedirectHttpFilter::SendRequestAsync(HttpRequestMessage const
211
213
  method = coRequest.Method();
212
214
 
213
215
  do {
216
+ // Set User-Agent
217
+ // See https://fetch.spec.whatwg.org/#http-network-or-cache-fetch
218
+ auto userAgent = GetRuntimeOptionString("Http.UserAgent");
219
+ if (userAgent.size() > 0) {
220
+ coRequest.Headers().Append(L"User-Agent", winrt::to_hstring(userAgent));
221
+ }
222
+
214
223
  // Send subsequent requests through the filter that doesn't have the credentials included in the first request
215
224
  response =
216
225
  co_await (redirectCount > 0 ? m_innerFilterWithNoCredentials : m_innerFilter).SendRequestAsync(coRequest);
@@ -155,6 +155,9 @@
155
155
  <ClCompile Include="$(MSBuildThisFileDirectory)Networking\RedirectHttpFilter.cpp">
156
156
  <Filter>Source Files\Networking</Filter>
157
157
  </ClCompile>
158
+ <ClCompile Include="$(MSBuildThisFileDirectory)Modules\BlobModule.cpp">
159
+ <Filter>Source Files\Modules</Filter>
160
+ </ClCompile>
158
161
  </ItemGroup>
159
162
  <ItemGroup>
160
163
  <Filter Include="Source Files">
@@ -469,6 +472,15 @@
469
472
  <ClInclude Include="$(MSBuildThisFileDirectory)Networking\IRedirectEventSource.h">
470
473
  <Filter>Header Files\Networking</Filter>
471
474
  </ClInclude>
475
+ <ClInclude Include="$(MSBuildThisFileDirectory)Modules\BlobModule.h">
476
+ <Filter>Header Files\Modules</Filter>
477
+ </ClInclude>
478
+ <ClInclude Include="$(MSBuildThisFileDirectory)Modules\IWebSocketModuleProxy.h">
479
+ <Filter>Header Files\Modules</Filter>
480
+ </ClInclude>
481
+ <ClInclude Include="$(MSBuildThisFileDirectory)Modules\IWebSocketModuleContentHandler.h">
482
+ <Filter>Header Files\Modules</Filter>
483
+ </ClInclude>
472
484
  </ItemGroup>
473
485
  <ItemGroup>
474
486
  <None Include="$(MSBuildThisFileDirectory)tracing\rnw.wprp">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.69.8",
3
+ "version": "0.69.10",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,9 +15,6 @@
15
15
  <ApplicationType>Windows Store</ApplicationType>
16
16
  <ApplicationTypeRevision>10.0</ApplicationTypeRevision>
17
17
  </PropertyGroup>
18
- <PropertyGroup Label="NuGet">
19
- <ResolveNuGetPackages>false</ResolveNuGetPackages>
20
- </PropertyGroup>
21
18
  <PropertyGroup Label="ReactNativeWindowsProps">
22
19
  <ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'node_modules\react-native-windows\package.json'))\node_modules\react-native-windows\</ReactNativeWindowsDir>
23
20
  </PropertyGroup>
@@ -15,9 +15,6 @@
15
15
  <ApplicationType>Windows Store</ApplicationType>
16
16
  <ApplicationTypeRevision>10.0</ApplicationTypeRevision>
17
17
  </PropertyGroup>
18
- <PropertyGroup Label="NuGet">
19
- <ResolveNuGetPackages>false</ResolveNuGetPackages>
20
- </PropertyGroup>
21
18
  <PropertyGroup Label="ReactNativeWindowsProps">
22
19
  <ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(SolutionDir), 'node_modules\react-native-windows\package.json'))\node_modules\react-native-windows\</ReactNativeWindowsDir>
23
20
  </PropertyGroup>
@@ -25,9 +25,6 @@
25
25
  <AppxGeneratePrisForPortableLibrariesEnabled>false</AppxGeneratePrisForPortableLibrariesEnabled>
26
26
  <LangVersion>7.3</LangVersion>
27
27
  </PropertyGroup>
28
- <PropertyGroup Label="NuGet">
29
- <AssetTargetFallback>$(AssetTargetFallback);native</AssetTargetFallback>
30
- </PropertyGroup>
31
28
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
32
29
  <DebugSymbols>true</DebugSymbols>
33
30
  <OutputPath>bin\x86\Debug\</OutputPath>
@@ -24,9 +24,6 @@
24
24
  <WindowsXamlEnableOverview>true</WindowsXamlEnableOverview>
25
25
  <LangVersion>7.3</LangVersion>
26
26
  </PropertyGroup>
27
- <PropertyGroup Label="NuGet">
28
- <AssetTargetFallback>$(AssetTargetFallback);native</AssetTargetFallback>
29
- </PropertyGroup>
30
27
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
31
28
  <DebugSymbols>true</DebugSymbols>
32
29
  <OutputPath>bin\x86\Debug\</OutputPath>
@@ -1,117 +0,0 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- *
5
- * @flow strict-local
6
- * @format
7
- */
8
-
9
- 'use strict';
10
-
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';
17
-
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
- }>;
63
-
64
- let _requestId = 1;
65
- function generateRequestId(): number {
66
- return _requestId++;
67
- }
68
-
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
- },
77
-
78
- sendRequest(
79
- method: string,
80
- trackingName: string,
81
- url: string,
82
- headers: {...},
83
- data: RequestBody,
84
- responseType: NativeResponseType,
85
- incrementalUpdates: boolean,
86
- timeout: number,
87
- callback: (requestId: number) => void,
88
- withCredentials: boolean,
89
- ) {
90
- const requestId = generateRequestId();
91
- const body = convertRequestBody(data);
92
- RCTNetworkingNative.sendRequest(
93
- {
94
- method,
95
- url,
96
- requestId,
97
- data: {...body, trackingName},
98
- headers,
99
- responseType,
100
- incrementalUpdates,
101
- timeout,
102
- withCredentials,
103
- },
104
- callback,
105
- );
106
- },
107
-
108
- abortRequest(requestId: number) {
109
- RCTNetworkingNative.abortRequest(requestId);
110
- },
111
-
112
- clearCookies(callback: (result: boolean) => void) {
113
- RCTNetworkingNative.clearCookies(callback);
114
- },
115
- };
116
-
117
- module.exports = RCTNetworking;