react-native-windows 0.67.10 → 0.67.13
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 +138 -0
- package/CHANGELOG.md +64 -8
- package/Microsoft.ReactNative.Cxx/JSI/JsiApiContext.cpp +17 -5
- package/Microsoft.ReactNative.Cxx/JSI/JsiApiContext.h +36 -7
- package/Microsoft.ReactNative.Cxx/JSValueWriter.h +1 -1
- package/Microsoft.ReactNative.Cxx/ReactPromise.cpp +21 -1
- package/Microsoft.ReactNative.Cxx/ReactPromise.h +27 -0
- package/Microsoft.ReactNative.Cxx/TurboModuleProvider.h +1 -1
- package/PropertySheets/Generated/PackageVersion.g.props +2 -2
- package/ReactCommon/ReactCommon.vcxproj +0 -4
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/CompactValue.h +204 -0
- package/Shared/Networking/WinRTHttpResource.cpp +1 -1
- package/Shared/OInstance.cpp +13 -10
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,144 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-windows",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"date": "Mon, 11 Jul 2022 15:10:53 GMT",
|
|
6
|
+
"tag": "react-native-windows_v0.67.13",
|
|
7
|
+
"version": "0.67.13",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "jthysell@microsoft.com",
|
|
12
|
+
"package": "react-native-windows",
|
|
13
|
+
"commit": "9d7ecd90a63f0707fc85fadde8ea31e4ebdb2557",
|
|
14
|
+
"comment": "[0.67] CG updates for 6/28/22"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Mon, 27 Jun 2022 15:07:52 GMT",
|
|
21
|
+
"tag": "react-native-windows_v0.67.12",
|
|
22
|
+
"version": "0.67.12",
|
|
23
|
+
"comments": {
|
|
24
|
+
"patch": [
|
|
25
|
+
{
|
|
26
|
+
"author": "julio.rocha@microsoft.com",
|
|
27
|
+
"package": "react-native-windows",
|
|
28
|
+
"commit": "not available",
|
|
29
|
+
"comment": "Enable Blob module with runtime option"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"author": "hpratt@microsoft.com",
|
|
33
|
+
"package": "react-native-windows",
|
|
34
|
+
"commit": "not available",
|
|
35
|
+
"comment": "Stop compiling yoga.cpp with /fp:strict. Doing so caused layout issues if Yoga code ran with the processor's rounding mode set to round down, due to NAN being defined in math.h as: ``` (float)(INFINITY * 0.0f) ``` Which macro-expands to: ``` (float)(((float)(1e+300 * 1e+300)) * 0.0f) ``` Which evaluates as follows: ``` (float)(((float)(inf.double)) * 0.0f) (float)(FLT_MAX * 0.0f) // Casting an infinite double to a float yields // FLT_MAX! (float)0.0f ```"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"date": "Mon, 27 Jun 2022 15:07:38 GMT",
|
|
42
|
+
"tag": "react-native-windows_v0.67.12",
|
|
43
|
+
"version": "0.67.12",
|
|
44
|
+
"comments": {
|
|
45
|
+
"patch": [
|
|
46
|
+
{
|
|
47
|
+
"author": "julio.rocha@microsoft.com",
|
|
48
|
+
"package": "react-native-windows",
|
|
49
|
+
"commit": "d5a8dff5f3fbb23b01338e22cbe313bc6f0fa2b8",
|
|
50
|
+
"comment": "Enable Blob module with runtime option"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"author": "hpratt@microsoft.com",
|
|
54
|
+
"package": "react-native-windows",
|
|
55
|
+
"commit": "d676dce0d3681fac1cdbd5e75a78be7667704193",
|
|
56
|
+
"comment": "Stop compiling yoga.cpp with /fp:strict. Doing so caused layout issues if Yoga code ran with the processor's rounding mode set to round down, due to NAN being defined in math.h as: ``` (float)(INFINITY * 0.0f) ``` Which macro-expands to: ``` (float)(((float)(1e+300 * 1e+300)) * 0.0f) ``` Which evaluates as follows: ``` (float)(((float)(inf.double)) * 0.0f) (float)(FLT_MAX * 0.0f) // Casting an infinite double to a float yields // FLT_MAX! (float)0.0f ```"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"date": "Mon, 20 Jun 2022 15:08:18 GMT",
|
|
63
|
+
"tag": "react-native-windows_v0.67.11",
|
|
64
|
+
"version": "0.67.11",
|
|
65
|
+
"comments": {
|
|
66
|
+
"patch": [
|
|
67
|
+
{
|
|
68
|
+
"author": "vmorozov@microsoft.com",
|
|
69
|
+
"package": "react-native-windows",
|
|
70
|
+
"commit": "not available",
|
|
71
|
+
"comment": "Fix use of [[maybe_unused]] attribute"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"author": "vmorozov@microsoft.com",
|
|
75
|
+
"package": "react-native-windows",
|
|
76
|
+
"commit": "not available",
|
|
77
|
+
"comment": "Fix ExecuteJsi on instance shutdown"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"date": "Mon, 20 Jun 2022 15:08:04 GMT",
|
|
84
|
+
"tag": "react-native-windows_v0.67.11",
|
|
85
|
+
"version": "0.67.11",
|
|
86
|
+
"comments": {
|
|
87
|
+
"patch": [
|
|
88
|
+
{
|
|
89
|
+
"author": "vmorozov@microsoft.com",
|
|
90
|
+
"package": "react-native-windows",
|
|
91
|
+
"commit": "247fa688a24a58c3b22411babbcd3b6396744895",
|
|
92
|
+
"comment": "Fix use of [[maybe_unused]] attribute"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"author": "vmorozov@microsoft.com",
|
|
96
|
+
"package": "react-native-windows",
|
|
97
|
+
"commit": "2b74c16a6d631ff7ba65ae28a81de5b26906bd40",
|
|
98
|
+
"comment": "Fix ExecuteJsi on instance shutdown"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"date": "Mon, 30 May 2022 15:09:46 GMT",
|
|
105
|
+
"tag": "react-native-windows_v0.67.10",
|
|
106
|
+
"version": "0.67.10",
|
|
107
|
+
"comments": {
|
|
108
|
+
"patch": [
|
|
109
|
+
{
|
|
110
|
+
"author": "acoates@microsoft.com",
|
|
111
|
+
"package": "react-native-windows",
|
|
112
|
+
"commit": "not available",
|
|
113
|
+
"comment": "Expose LoadingState on ReactContext"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"author": "vmorozov@microsoft.com",
|
|
117
|
+
"package": "react-native-windows",
|
|
118
|
+
"commit": "not available",
|
|
119
|
+
"comment": "Support PreparedScriptStore for V8 Node-API."
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"author": "julio@rochsquadron.net",
|
|
123
|
+
"package": "react-native-windows",
|
|
124
|
+
"commit": "not available",
|
|
125
|
+
"comment": "Implement Blob module (#9352)"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"author": "vmorozov@microsoft.com",
|
|
129
|
+
"package": "react-native-windows",
|
|
130
|
+
"commit": "not available",
|
|
131
|
+
"comment": "Fix RuntimeOptions for RNW Desktop"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"author": "jthysell@microsoft.com",
|
|
135
|
+
"package": "react-native-windows",
|
|
136
|
+
"commit": "not available",
|
|
137
|
+
"comment": "[0.67] Change CG registration for folly and fmt from `other` to `git`"
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
},
|
|
4
142
|
{
|
|
5
143
|
"date": "Mon, 30 May 2022 15:09:33 GMT",
|
|
6
144
|
"tag": "react-native-windows_v0.67.10",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,21 +1,77 @@
|
|
|
1
1
|
# Change Log - react-native-windows
|
|
2
2
|
|
|
3
|
-
This log was last generated on Mon,
|
|
3
|
+
This log was last generated on Mon, 11 Jul 2022 15:10:53 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## 0.67.
|
|
7
|
+
## 0.67.13
|
|
8
8
|
|
|
9
|
-
Mon,
|
|
9
|
+
Mon, 11 Jul 2022 15:10:53 GMT
|
|
10
10
|
|
|
11
11
|
### Patches
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
- Support PreparedScriptStore for V8 Node-API. (vmorozov@microsoft.com)
|
|
15
|
-
- Implement Blob module (#9352) (julio@rochsquadron.net)
|
|
16
|
-
- Fix RuntimeOptions for RNW Desktop (vmorozov@microsoft.com)
|
|
17
|
-
- [0.67] Change CG registration for folly and fmt from `other` to `git` (jthysell@microsoft.com)
|
|
13
|
+
- [0.67] CG updates for 6/28/22 (jthysell@microsoft.com)
|
|
18
14
|
|
|
15
|
+
## 0.67.12
|
|
16
|
+
|
|
17
|
+
Mon, 27 Jun 2022 15:07:52 GMT
|
|
18
|
+
|
|
19
|
+
### Patches
|
|
20
|
+
|
|
21
|
+
- Enable Blob module with runtime option (julio.rocha@microsoft.com)
|
|
22
|
+
- Stop compiling yoga.cpp with /fp:strict. Doing so caused layout issues if Yoga code ran with the processor's rounding mode set to round down, due to NAN being defined in math.h as: ``` (float)(INFINITY * 0.0f) ``` Which macro-expands to: ``` (float)(((float)(1e+300 * 1e+300)) * 0.0f) ``` Which evaluates as follows: ``` (float)(((float)(inf.double)) * 0.0f) (float)(FLT_MAX * 0.0f) // Casting an infinite double to a float yields // FLT_MAX! (float)0.0f ``` (hpratt@microsoft.com)
|
|
23
|
+
|
|
24
|
+
## 0.67.12
|
|
25
|
+
|
|
26
|
+
Mon, 27 Jun 2022 15:07:38 GMT
|
|
27
|
+
|
|
28
|
+
### Patches
|
|
29
|
+
|
|
30
|
+
- Enable Blob module with runtime option (julio.rocha@microsoft.com)
|
|
31
|
+
- Stop compiling yoga.cpp with /fp:strict. Doing so caused layout issues if Yoga code ran with the processor's rounding mode set to round down, due to NAN being defined in math.h as: ``` (float)(INFINITY * 0.0f) ``` Which macro-expands to: ``` (float)(((float)(1e+300 * 1e+300)) * 0.0f) ``` Which evaluates as follows: ``` (float)(((float)(inf.double)) * 0.0f) (float)(FLT_MAX * 0.0f) // Casting an infinite double to a float yields // FLT_MAX! (float)0.0f ``` (hpratt@microsoft.com)
|
|
32
|
+
|
|
33
|
+
## 0.67.11
|
|
34
|
+
|
|
35
|
+
Mon, 20 Jun 2022 15:08:18 GMT
|
|
36
|
+
|
|
37
|
+
### Patches
|
|
38
|
+
|
|
39
|
+
- Fix use of [[maybe_unused]] attribute (vmorozov@microsoft.com)
|
|
40
|
+
- Fix ExecuteJsi on instance shutdown (vmorozov@microsoft.com)
|
|
41
|
+
|
|
42
|
+
## 0.67.11
|
|
43
|
+
|
|
44
|
+
Mon, 20 Jun 2022 15:08:04 GMT
|
|
45
|
+
|
|
46
|
+
### Patches
|
|
47
|
+
|
|
48
|
+
- Fix use of [[maybe_unused]] attribute (vmorozov@microsoft.com)
|
|
49
|
+
- Fix ExecuteJsi on instance shutdown (vmorozov@microsoft.com)
|
|
50
|
+
|
|
51
|
+
## 0.67.10
|
|
52
|
+
|
|
53
|
+
Mon, 30 May 2022 15:09:46 GMT
|
|
54
|
+
|
|
55
|
+
### Patches
|
|
56
|
+
|
|
57
|
+
- Expose LoadingState on ReactContext (acoates@microsoft.com)
|
|
58
|
+
- Support PreparedScriptStore for V8 Node-API. (vmorozov@microsoft.com)
|
|
59
|
+
- Implement Blob module (#9352) (julio@rochsquadron.net)
|
|
60
|
+
- Fix RuntimeOptions for RNW Desktop (vmorozov@microsoft.com)
|
|
61
|
+
- [0.67] Change CG registration for folly and fmt from `other` to `git` (jthysell@microsoft.com)
|
|
62
|
+
|
|
63
|
+
## 0.67.10
|
|
64
|
+
|
|
65
|
+
Mon, 30 May 2022 15:09:33 GMT
|
|
66
|
+
|
|
67
|
+
### Patches
|
|
68
|
+
|
|
69
|
+
- Expose LoadingState on ReactContext (acoates@microsoft.com)
|
|
70
|
+
- Support PreparedScriptStore for V8 Node-API. (vmorozov@microsoft.com)
|
|
71
|
+
- Implement Blob module (#9352) (julio@rochsquadron.net)
|
|
72
|
+
- Fix RuntimeOptions for RNW Desktop (vmorozov@microsoft.com)
|
|
73
|
+
- [0.67] Change CG registration for folly and fmt from `other` to `git` (jthysell@microsoft.com)
|
|
74
|
+
|
|
19
75
|
## 0.67.9
|
|
20
76
|
|
|
21
77
|
Mon, 02 May 2022 15:10:57 GMT
|
|
@@ -10,16 +10,19 @@ extern "C" IMAGE_DOS_HEADER __ImageBase;
|
|
|
10
10
|
|
|
11
11
|
namespace winrt::Microsoft::ReactNative {
|
|
12
12
|
|
|
13
|
-
//
|
|
14
|
-
// If it is not found, then create it and store it in the context.Properties().
|
|
15
|
-
//
|
|
16
|
-
|
|
13
|
+
// Try to get JSI Runtime for the current JS dispatcher thread.
|
|
14
|
+
// If it is not found, then create it based on context JSI runtime and store it in the context.Properties().
|
|
15
|
+
// The function returns nullptr if the current context does not have JSI runtime.
|
|
16
|
+
// It makes sure that the JSI runtime holder is removed when the instance is unloaded.
|
|
17
|
+
facebook::jsi::Runtime *TryGetOrCreateContextRuntime(ReactContext const &context) noexcept {
|
|
17
18
|
ReactDispatcher jsDispatcher = context.JSDispatcher();
|
|
18
19
|
VerifyElseCrashSz(jsDispatcher.HasThreadAccess(), "Must be in JS thread");
|
|
19
20
|
|
|
20
21
|
// The JSI runtime is not available if we do Web debugging when JS is running in web browser.
|
|
21
22
|
JsiRuntime abiJsiRuntime = context.Handle().JSRuntime().as<JsiRuntime>();
|
|
22
|
-
|
|
23
|
+
if (!abiJsiRuntime) {
|
|
24
|
+
return nullptr;
|
|
25
|
+
}
|
|
23
26
|
|
|
24
27
|
// See if the JSI runtime was previously created.
|
|
25
28
|
JsiAbiRuntime *runtime = JsiAbiRuntime::GetFromJsiRuntime(abiJsiRuntime);
|
|
@@ -51,6 +54,15 @@ facebook::jsi::Runtime &GetOrCreateContextRuntime(ReactContext const &context) n
|
|
|
51
54
|
});
|
|
52
55
|
}
|
|
53
56
|
|
|
57
|
+
return runtime;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Calls TryGetOrCreateContextRuntime to get JSI runtime.
|
|
61
|
+
// It crashes when TryGetOrCreateContextRuntime returns null.
|
|
62
|
+
// Note: deprecated in favor of TryGetOrCreateContextRuntime.
|
|
63
|
+
[[deprecated]] facebook::jsi::Runtime &GetOrCreateContextRuntime(ReactContext const &context) noexcept {
|
|
64
|
+
facebook::jsi::Runtime *runtime = TryGetOrCreateContextRuntime(context);
|
|
65
|
+
VerifyElseCrashSz(runtime, "JSI runtime is not available");
|
|
54
66
|
return *runtime;
|
|
55
67
|
}
|
|
56
68
|
|
|
@@ -7,26 +7,55 @@
|
|
|
7
7
|
|
|
8
8
|
#include "../ReactContext.h"
|
|
9
9
|
#include "JsiAbiApi.h"
|
|
10
|
+
#include "ReactPromise.h"
|
|
10
11
|
|
|
11
12
|
namespace winrt::Microsoft::ReactNative {
|
|
12
13
|
|
|
13
|
-
//
|
|
14
|
-
// If it is not found, then create it and store it in the context.Properties().
|
|
15
|
-
//
|
|
16
|
-
|
|
14
|
+
// Try to get JSI Runtime for the current JS dispatcher thread.
|
|
15
|
+
// If it is not found, then create it based on context JSI runtime and store it in the context.Properties().
|
|
16
|
+
// The function returns nullptr if the current context does not have JSI runtime.
|
|
17
|
+
// It makes sure that the JSI runtime holder is removed when the instance is unloaded.
|
|
18
|
+
facebook::jsi::Runtime *TryGetOrCreateContextRuntime(ReactContext const &context) noexcept;
|
|
19
|
+
|
|
20
|
+
// Calls TryGetOrCreateContextRuntime to get JSI runtime.
|
|
21
|
+
// It crashes when TryGetOrCreateContextRuntime returns null.
|
|
22
|
+
// Note: deprecated in favor of TryGetOrCreateContextRuntime.
|
|
23
|
+
[[deprecated]] facebook::jsi::Runtime &GetOrCreateContextRuntime(ReactContext const &context) noexcept;
|
|
17
24
|
|
|
18
25
|
// Call provided lambda with the facebook::jsi::Runtime& parameter.
|
|
19
26
|
// For example: ExecuteJsi(context, [](facebook::jsi::Runtime& runtime){...})
|
|
20
27
|
// The code is executed synchronously if it is already in JSDispatcher, or asynchronously otherwise.
|
|
21
28
|
template <class TCodeWithRuntime>
|
|
22
|
-
void ExecuteJsi(ReactContext const &context, TCodeWithRuntime const &code) {
|
|
29
|
+
void ExecuteJsi(ReactContext const &context, TCodeWithRuntime const &code, ReactPromise<void> *callStatus = nullptr) {
|
|
23
30
|
ReactDispatcher jsDispatcher = context.JSDispatcher();
|
|
31
|
+
auto callCode = [](ReactContext const &context, TCodeWithRuntime const &code, ReactPromise<void> *callStatus) {
|
|
32
|
+
facebook::jsi::Runtime *runtime = TryGetOrCreateContextRuntime(context);
|
|
33
|
+
if (runtime) {
|
|
34
|
+
code(*runtime);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Report status of the call
|
|
38
|
+
if (callStatus) {
|
|
39
|
+
if (runtime) {
|
|
40
|
+
callStatus->Resolve();
|
|
41
|
+
} else {
|
|
42
|
+
callStatus->Reject("No JSI runtime");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
24
47
|
if (jsDispatcher.HasThreadAccess()) {
|
|
25
48
|
// Execute immediately if we are in JS thread.
|
|
26
|
-
|
|
49
|
+
callCode(context, code, callStatus);
|
|
27
50
|
} else {
|
|
28
51
|
// Otherwise, schedule work in JS thread.
|
|
29
|
-
jsDispatcher.Post([
|
|
52
|
+
jsDispatcher.Post([callCode,
|
|
53
|
+
context,
|
|
54
|
+
code,
|
|
55
|
+
callStatus = callStatus ? std::make_unique<ReactPromise<void>>(*callStatus)
|
|
56
|
+
: std::unique_ptr<ReactPromise<void>>(nullptr)]() noexcept {
|
|
57
|
+
callCode(context, code, callStatus.get());
|
|
58
|
+
});
|
|
30
59
|
}
|
|
31
60
|
}
|
|
32
61
|
|
|
@@ -287,7 +287,7 @@ inline JSValueArgWriter MakeJSValueWriter(T &&argWriter) noexcept {
|
|
|
287
287
|
|
|
288
288
|
template <class... TArgs>
|
|
289
289
|
inline JSValueArgWriter MakeJSValueWriter(TArgs &&... args) noexcept {
|
|
290
|
-
return [&args...](
|
|
290
|
+
return [&args...]([[maybe_unused]] IJSValueWriter const &writer) noexcept { (WriteValue(writer, args), ...); };
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
} // namespace winrt::Microsoft::ReactNative
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
#include "pch.h"
|
|
8
8
|
#include "ReactPromise.h"
|
|
9
|
-
#include "JSValueWriter.h"
|
|
10
9
|
|
|
11
10
|
namespace winrt::Microsoft::ReactNative {
|
|
12
11
|
|
|
@@ -105,6 +104,27 @@ bool ReactPromiseBase::TrySetState(State newState) const noexcept {
|
|
|
105
104
|
return false;
|
|
106
105
|
}
|
|
107
106
|
|
|
107
|
+
/*static*/ MethodResultCallback ReactPromiseBase::GetRejectResultCallback(
|
|
108
|
+
std::function<void(ReactError const &)> const &reject) noexcept {
|
|
109
|
+
return [reject](IJSValueWriter const &outputWriter) noexcept {
|
|
110
|
+
winrt::com_ptr<JSValueTreeWriter> writer = outputWriter.as<JSValueTreeWriter>();
|
|
111
|
+
JSValue jsValue = writer->TakeValue();
|
|
112
|
+
ReactError err{};
|
|
113
|
+
err.Code = jsValue.AsArray()[0].AsObject()[ErrorMapKeyCode].AsString();
|
|
114
|
+
err.Message = jsValue.AsArray()[0].AsObject()[ErrorMapKeyMessage].AsString();
|
|
115
|
+
err.UserInfo = jsValue.AsArray()[0].AsObject()[ErrorMapKeyUserInfo].AsObject().Copy();
|
|
116
|
+
reject(err);
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
ReactPromise<void>::ReactPromise(
|
|
121
|
+
std::function<void()> const &resolve,
|
|
122
|
+
std::function<void(ReactError const &)> const &reject) noexcept
|
|
123
|
+
: ReactPromiseBase(
|
|
124
|
+
winrt::make<JSValueTreeWriter>(),
|
|
125
|
+
[resolve](IJSValueWriter const & /*outputWriter*/) noexcept { resolve(); },
|
|
126
|
+
GetRejectResultCallback(reject)) {}
|
|
127
|
+
|
|
108
128
|
// Successfully resolve the ReactPromise<void>.
|
|
109
129
|
void ReactPromise<void>::Resolve() const noexcept {
|
|
110
130
|
if (TrySetState(State::Resolved) && m_resolve) {
|
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
// vnext/Microsoft.ReactNative.Cxx/README.md
|
|
6
6
|
|
|
7
7
|
#pragma once
|
|
8
|
+
#include <functional>
|
|
9
|
+
#include "JSValueReader.h"
|
|
10
|
+
#include "JSValueTreeReader.h"
|
|
11
|
+
#include "JSValueTreeWriter.h"
|
|
12
|
+
#include "JSValueWriter.h"
|
|
8
13
|
#include "ReactError.h"
|
|
9
14
|
#include "winrt/Microsoft.ReactNative.h"
|
|
10
15
|
|
|
@@ -35,6 +40,7 @@ struct ReactPromiseBase {
|
|
|
35
40
|
|
|
36
41
|
protected:
|
|
37
42
|
bool TrySetState(State newState) const noexcept;
|
|
43
|
+
static MethodResultCallback GetRejectResultCallback(std::function<void(ReactError const &)> const &reject) noexcept;
|
|
38
44
|
|
|
39
45
|
protected:
|
|
40
46
|
const std::shared_ptr<std::atomic<State>> m_state;
|
|
@@ -47,6 +53,10 @@ template <class T>
|
|
|
47
53
|
struct ReactPromise : ReactPromiseBase {
|
|
48
54
|
using ReactPromiseBase::ReactPromiseBase;
|
|
49
55
|
|
|
56
|
+
ReactPromise(
|
|
57
|
+
std::function<void(T const &)> const &resolve,
|
|
58
|
+
std::function<void(ReactError const &)> const &reject) noexcept;
|
|
59
|
+
|
|
50
60
|
// Successfully resolve the IReactPromise with an optional value.
|
|
51
61
|
void Resolve(T const &value) const noexcept;
|
|
52
62
|
};
|
|
@@ -55,10 +65,27 @@ template <>
|
|
|
55
65
|
struct ReactPromise<void> : ReactPromiseBase {
|
|
56
66
|
using ReactPromiseBase::ReactPromiseBase;
|
|
57
67
|
|
|
68
|
+
ReactPromise(std::function<void()> const &resolve, std::function<void(ReactError const &)> const &reject) noexcept;
|
|
69
|
+
|
|
58
70
|
// Successfully resolve the IReactPromise with an optional value.
|
|
59
71
|
void Resolve() const noexcept;
|
|
60
72
|
};
|
|
61
73
|
|
|
74
|
+
template <class T>
|
|
75
|
+
ReactPromise<T>::ReactPromise(
|
|
76
|
+
std::function<void(T const &)> const &resolve,
|
|
77
|
+
std::function<void(ReactError const &)> const &reject) noexcept
|
|
78
|
+
: ReactPromiseBase(
|
|
79
|
+
winrt::make<JSValueTreeWriter>(),
|
|
80
|
+
[resolve](IJSValueWriter const &outputWriter) noexcept {
|
|
81
|
+
winrt::com_ptr<JSValueTreeWriter> writer = outputWriter.as<JSValueTreeWriter>();
|
|
82
|
+
auto reader = winrt::make<JSValueTreeReader>(writer->TakeValue());
|
|
83
|
+
T result{};
|
|
84
|
+
ReadArgs(reader, result);
|
|
85
|
+
resolve(result);
|
|
86
|
+
},
|
|
87
|
+
GetRejectResultCallback(reject)) {}
|
|
88
|
+
|
|
62
89
|
// Successfully resolve the ReactPromise with an optional value.
|
|
63
90
|
template <class T>
|
|
64
91
|
void ReactPromise<T>::Resolve(T const &value) const noexcept {
|
|
@@ -23,7 +23,7 @@ void AddTurboModuleProvider(IReactPackageBuilder const &packageBuilder, std::wst
|
|
|
23
23
|
IJsiHostObject abiTurboModule{nullptr};
|
|
24
24
|
// We expect the initializer to be called immediately for TurboModules
|
|
25
25
|
moduleBuilder.AddInitializer([&abiTurboModule](IReactContext const &context) mutable {
|
|
26
|
-
|
|
26
|
+
TryGetOrCreateContextRuntime(ReactContext{context}); // Ensure the JSI runtime is created.
|
|
27
27
|
auto callInvoker = MakeAbiCallInvoker(context.JSDispatcher());
|
|
28
28
|
auto turboModule = std::make_shared<TTurboModule>(callInvoker);
|
|
29
29
|
abiTurboModule = winrt::make<JsiHostObjectWrapper>(std::move(turboModule));
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.67.
|
|
13
|
+
<ReactNativeWindowsVersion>0.67.13</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>67</ReactNativeWindowsMinor>
|
|
16
|
-
<ReactNativeWindowsPatch>
|
|
16
|
+
<ReactNativeWindowsPatch>13</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
18
|
</PropertyGroup>
|
|
19
19
|
</Project>
|
|
@@ -72,10 +72,6 @@
|
|
|
72
72
|
<DisableSpecificWarnings>4715;4251;4800;4804;4305;4722;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
|
73
73
|
<PreprocessToFile>false</PreprocessToFile>
|
|
74
74
|
<ForcedIncludeFiles>pch.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
|
|
75
|
-
<!--
|
|
76
|
-
Using Strict FloatingPointModel on x64 to workaround a compiler issue, See https://github.com/microsoft/react-native-windows/issues/4122
|
|
77
|
-
-->
|
|
78
|
-
<FloatingPointModel Condition="'$(Platform)' == 'x64'">Strict</FloatingPointModel>
|
|
79
75
|
</ClCompile>
|
|
80
76
|
<Link>
|
|
81
77
|
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
|
@@ -0,0 +1,204 @@
|
|
|
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
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#ifdef __cplusplus
|
|
11
|
+
|
|
12
|
+
#ifdef __cpp_lib_bit_cast
|
|
13
|
+
#include <bit>
|
|
14
|
+
#endif
|
|
15
|
+
#include "YGValue.h"
|
|
16
|
+
#include "YGMacros.h"
|
|
17
|
+
#include <cmath>
|
|
18
|
+
#include <cstdint>
|
|
19
|
+
#include <limits>
|
|
20
|
+
|
|
21
|
+
static_assert(
|
|
22
|
+
std::numeric_limits<float>::is_iec559,
|
|
23
|
+
"facebook::yoga::detail::CompactValue only works with IEEE754 floats");
|
|
24
|
+
|
|
25
|
+
#ifdef YOGA_COMPACT_VALUE_TEST
|
|
26
|
+
#define VISIBLE_FOR_TESTING public:
|
|
27
|
+
#else
|
|
28
|
+
#define VISIBLE_FOR_TESTING private:
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
namespace facebook {
|
|
32
|
+
namespace yoga {
|
|
33
|
+
namespace detail {
|
|
34
|
+
|
|
35
|
+
// This class stores YGValue in 32 bits.
|
|
36
|
+
// - The value does not matter for Undefined and Auto. NaNs are used for their
|
|
37
|
+
// representation.
|
|
38
|
+
// - To differentiate between Point and Percent, one exponent bit is used.
|
|
39
|
+
// Supported the range [0x40, 0xbf] (0xbf is inclusive for point, but
|
|
40
|
+
// exclusive for percent).
|
|
41
|
+
// - Value ranges:
|
|
42
|
+
// points: 1.08420217e-19f to 36893485948395847680
|
|
43
|
+
// 0x00000000 0x3fffffff
|
|
44
|
+
// percent: 1.08420217e-19f to 18446742974197923840
|
|
45
|
+
// 0x40000000 0x7f7fffff
|
|
46
|
+
// - Zero is supported, negative zero is not
|
|
47
|
+
// - values outside of the representable range are clamped
|
|
48
|
+
class YOGA_EXPORT CompactValue {
|
|
49
|
+
friend constexpr bool operator==(CompactValue, CompactValue) noexcept;
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
static constexpr auto LOWER_BOUND = 1.08420217e-19f;
|
|
53
|
+
static constexpr auto UPPER_BOUND_POINT = 36893485948395847680.0f;
|
|
54
|
+
static constexpr auto UPPER_BOUND_PERCENT = 18446742974197923840.0f;
|
|
55
|
+
|
|
56
|
+
template <YGUnit Unit>
|
|
57
|
+
static CompactValue of(float value) noexcept {
|
|
58
|
+
if (value == 0.0f || (value < LOWER_BOUND && value > -LOWER_BOUND)) {
|
|
59
|
+
constexpr auto zero =
|
|
60
|
+
Unit == YGUnitPercent ? ZERO_BITS_PERCENT : ZERO_BITS_POINT;
|
|
61
|
+
return {zero};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
constexpr auto upperBound = Unit == YGUnitPercent ? UPPER_BOUND_PERCENT : UPPER_BOUND_POINT;
|
|
65
|
+
if (value > upperBound || value < -upperBound) {
|
|
66
|
+
value = copysignf(upperBound, value);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
uint32_t unitBit = Unit == YGUnitPercent ? PERCENT_BIT : 0;
|
|
70
|
+
auto data = asU32(value);
|
|
71
|
+
data -= BIAS;
|
|
72
|
+
data |= unitBit;
|
|
73
|
+
return {data};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
template <YGUnit Unit>
|
|
77
|
+
static CompactValue ofMaybe(float value) noexcept {
|
|
78
|
+
return std::isnan(value) || std::isinf(value) ? ofUndefined() : of<Unit>(value);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
static constexpr CompactValue ofZero() noexcept {
|
|
82
|
+
return CompactValue{ZERO_BITS_POINT};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
static constexpr CompactValue ofUndefined() noexcept {
|
|
86
|
+
return CompactValue{};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static constexpr CompactValue ofAuto() noexcept {
|
|
90
|
+
return CompactValue{AUTO_BITS};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
constexpr CompactValue() noexcept : repr_(0x7FC00000) {}
|
|
94
|
+
|
|
95
|
+
CompactValue(const YGValue &x) noexcept : repr_(uint32_t{0}) {
|
|
96
|
+
switch (x.unit) {
|
|
97
|
+
case YGUnitUndefined:
|
|
98
|
+
*this = ofUndefined();
|
|
99
|
+
break;
|
|
100
|
+
case YGUnitAuto:
|
|
101
|
+
*this = ofAuto();
|
|
102
|
+
break;
|
|
103
|
+
case YGUnitPoint:
|
|
104
|
+
*this = of<YGUnitPoint>(x.value);
|
|
105
|
+
break;
|
|
106
|
+
case YGUnitPercent:
|
|
107
|
+
*this = of<YGUnitPercent>(x.value);
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
operator YGValue() const noexcept {
|
|
113
|
+
switch (repr_) {
|
|
114
|
+
case AUTO_BITS:
|
|
115
|
+
return YGValueAuto;
|
|
116
|
+
case ZERO_BITS_POINT:
|
|
117
|
+
return YGValue{0.0f, YGUnitPoint};
|
|
118
|
+
case ZERO_BITS_PERCENT:
|
|
119
|
+
return YGValue{0.0f, YGUnitPercent};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (std::isnan(asFloat(repr_))) {
|
|
123
|
+
return YGValueUndefined;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
auto data = repr_;
|
|
127
|
+
data &= ~PERCENT_BIT;
|
|
128
|
+
data += BIAS;
|
|
129
|
+
|
|
130
|
+
return YGValue{asFloat(data), repr_ & 0x40000000 ? YGUnitPercent : YGUnitPoint};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
bool isUndefined() const noexcept {
|
|
134
|
+
return (repr_ != AUTO_BITS && repr_ != ZERO_BITS_POINT && repr_ != ZERO_BITS_PERCENT && std::isnan(asFloat(repr_)));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
bool isAuto() const noexcept {
|
|
138
|
+
return repr_ == AUTO_BITS;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private:
|
|
142
|
+
uint32_t repr_;
|
|
143
|
+
|
|
144
|
+
static constexpr uint32_t BIAS = 0x20000000;
|
|
145
|
+
static constexpr uint32_t PERCENT_BIT = 0x40000000;
|
|
146
|
+
|
|
147
|
+
// these are signaling NaNs with specific bit pattern as payload they will be
|
|
148
|
+
// silenced whenever going through an FPU operation on ARM + x86
|
|
149
|
+
static constexpr uint32_t AUTO_BITS = 0x7faaaaaa;
|
|
150
|
+
static constexpr uint32_t ZERO_BITS_POINT = 0x7f8f0f0f;
|
|
151
|
+
static constexpr uint32_t ZERO_BITS_PERCENT = 0x7f80f0f0;
|
|
152
|
+
|
|
153
|
+
constexpr CompactValue(uint32_t data) noexcept : repr_(data) {}
|
|
154
|
+
|
|
155
|
+
VISIBLE_FOR_TESTING uint32_t repr() {
|
|
156
|
+
return repr_;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
static uint32_t asU32(float f) {
|
|
160
|
+
#ifdef __cpp_lib_bit_cast
|
|
161
|
+
return std::bit_cast<uint32_t>(f);
|
|
162
|
+
#else
|
|
163
|
+
uint32_t u;
|
|
164
|
+
static_assert(sizeof(u) == sizeof(f));
|
|
165
|
+
std::memcpy(&u, &f, sizeof(f));
|
|
166
|
+
return u;
|
|
167
|
+
#endif
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
static float asFloat(uint32_t u) {
|
|
171
|
+
#ifdef __cpp_lib_bit_cast
|
|
172
|
+
return std::bit_cast<float>(data);
|
|
173
|
+
#else
|
|
174
|
+
float f;
|
|
175
|
+
static_assert(sizeof(f) == sizeof(u));
|
|
176
|
+
std::memcpy(&f, &u, sizeof(u));
|
|
177
|
+
return f;
|
|
178
|
+
#endif
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
template <>
|
|
184
|
+
CompactValue CompactValue::of<YGUnitUndefined>(float) noexcept = delete;
|
|
185
|
+
template <>
|
|
186
|
+
CompactValue CompactValue::of<YGUnitAuto>(float) noexcept = delete;
|
|
187
|
+
template <>
|
|
188
|
+
CompactValue CompactValue::ofMaybe<YGUnitUndefined>(float) noexcept = delete;
|
|
189
|
+
template <>
|
|
190
|
+
CompactValue CompactValue::ofMaybe<YGUnitAuto>(float) noexcept = delete;
|
|
191
|
+
|
|
192
|
+
constexpr bool operator==(CompactValue a, CompactValue b) noexcept {
|
|
193
|
+
return a.repr_ == b.repr_;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
constexpr bool operator!=(CompactValue a, CompactValue b) noexcept {
|
|
197
|
+
return !(a == b);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
} // namespace detail
|
|
201
|
+
} // namespace yoga
|
|
202
|
+
} // namespace facebook
|
|
203
|
+
|
|
204
|
+
#endif
|
|
@@ -68,7 +68,7 @@ void WinRTHttpResource::SendRequest(
|
|
|
68
68
|
bool withCredentials,
|
|
69
69
|
std::function<void(int64_t)> &&callback) noexcept /*override*/ {
|
|
70
70
|
// Enforce supported args
|
|
71
|
-
assert(responseType == "text" || responseType == "base64"
|
|
71
|
+
assert(responseType == "text" || responseType == "base64" || responseType == "blob");
|
|
72
72
|
|
|
73
73
|
if (callback) {
|
|
74
74
|
callback(requestId);
|
package/Shared/OInstance.cpp
CHANGED
|
@@ -702,17 +702,20 @@ std::vector<std::unique_ptr<NativeModule>> InstanceImpl::GetDefaultNativeModules
|
|
|
702
702
|
[]() { return std::make_unique<StatusBarManagerModule>(); },
|
|
703
703
|
nativeQueue));
|
|
704
704
|
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
705
|
+
// #10036 - Blob module not supported in UWP. Need to define property bag lifetime and onwership.
|
|
706
|
+
if (Microsoft::React::GetRuntimeOptionBool("Blob.EnableModule")) {
|
|
707
|
+
modules.push_back(std::make_unique<CxxNativeModule>(
|
|
708
|
+
m_innerInstance,
|
|
709
|
+
Microsoft::React::GetBlobModuleName(),
|
|
710
|
+
[transitionalProps]() { return Microsoft::React::CreateBlobModule(transitionalProps); },
|
|
711
|
+
nativeQueue));
|
|
710
712
|
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
713
|
+
modules.push_back(std::make_unique<CxxNativeModule>(
|
|
714
|
+
m_innerInstance,
|
|
715
|
+
Microsoft::React::GetFileReaderModuleName(),
|
|
716
|
+
[transitionalProps]() { return Microsoft::React::CreateFileReaderModule(transitionalProps); },
|
|
717
|
+
nativeQueue));
|
|
718
|
+
}
|
|
716
719
|
|
|
717
720
|
return modules;
|
|
718
721
|
}
|