react-native-windows 0.81.22 → 0.81.24

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.
@@ -19,13 +19,23 @@ CallInvoker::CallInvoker(
19
19
  : m_callInvoker(callInvoker), m_context(&reactContext) {}
20
20
 
21
21
  void CallInvoker::InvokeAsync(CallFunc func) noexcept {
22
- m_callInvoker->invokeAsync(
23
- [reactContext = m_context, func](facebook::jsi::Runtime & /*runtime*/) { func(reactContext->JsiRuntime()); });
22
+ m_callInvoker->invokeAsync([reactContext = m_context, func](facebook::jsi::Runtime & /*runtime*/) {
23
+ auto runtime = reactContext->JsiRuntime();
24
+ if (!runtime)
25
+ return;
26
+
27
+ func(runtime);
28
+ });
24
29
  }
25
30
 
26
31
  void CallInvoker::InvokeSync(CallFunc func) noexcept {
27
- m_callInvoker->invokeSync(
28
- [reactContext = m_context, func](facebook::jsi::Runtime & /*runtime*/) { func(reactContext->JsiRuntime()); });
32
+ m_callInvoker->invokeSync([reactContext = m_context, func](facebook::jsi::Runtime & /*runtime*/) {
33
+ auto runtime = reactContext->JsiRuntime();
34
+ if (!runtime)
35
+ return;
36
+
37
+ func(runtime);
38
+ });
29
39
  }
30
40
 
31
41
  winrt::Microsoft::ReactNative::CallInvoker CallInvoker::FromProperties(
@@ -149,11 +149,13 @@ facebook::react::SharedViewEventEmitter ParagraphComponentView::eventEmitterAtPo
149
149
  uint32_t textPosition = metrics.textPosition;
150
150
 
151
151
  for (auto fragment : m_attributedStringBox.getValue().getFragments()) {
152
- if (textPosition < fragment.string.length()) {
152
+ uint32_t utf16Length =
153
+ static_cast<uint32_t>(::Microsoft::Common::Unicode::Utf8ToUtf16(fragment.string).length());
154
+ if (textPosition < utf16Length) {
153
155
  return std::static_pointer_cast<const facebook::react::ViewEventEmitter>(
154
156
  fragment.parentShadowView.eventEmitter);
155
157
  }
156
- textPosition -= static_cast<uint32_t>(fragment.string.length());
158
+ textPosition -= utf16Length;
157
159
  }
158
160
  }
159
161
  }
@@ -206,10 +208,12 @@ bool ParagraphComponentView::IsTextSelectableAtPoint(facebook::react::Point pt)
206
208
 
207
209
  // Finds which fragment contains this text position
208
210
  for (auto fragment : m_attributedStringBox.getValue().getFragments()) {
209
- if (textPosition < fragment.string.length()) {
211
+ uint32_t utf16Length =
212
+ static_cast<uint32_t>(::Microsoft::Common::Unicode::Utf8ToUtf16(fragment.string).length());
213
+ if (textPosition < utf16Length) {
210
214
  return true;
211
215
  }
212
- textPosition -= static_cast<uint32_t>(fragment.string.length());
216
+ textPosition -= utf16Length;
213
217
  }
214
218
  }
215
219
  }
@@ -66,7 +66,7 @@ void RenderText(
66
66
  unsigned int position = 0;
67
67
  unsigned int length = 0;
68
68
  for (auto fragment : attributedString.getFragments()) {
69
- length = static_cast<UINT32>(fragment.string.length());
69
+ length = static_cast<UINT32>(::Microsoft::Common::Unicode::Utf8ToUtf16(fragment.string).length());
70
70
  DWRITE_TEXT_RANGE range = {position, length};
71
71
  if (fragment.textAttributes.foregroundColor &&
72
72
  (fragment.textAttributes.foregroundColor != textAttributes.foregroundColor) ||
@@ -262,7 +262,7 @@ void WindowsTextLayoutManager::GetTextLayout(
262
262
  attachments.push_back(attachment);
263
263
  position += 1;
264
264
  } else {
265
- unsigned int length = static_cast<UINT32>(fragment.string.length());
265
+ unsigned int length = static_cast<UINT32>(Microsoft::Common::Unicode::Utf8ToUtf16(fragment.string).length());
266
266
  DWRITE_TEXT_RANGE range = {position, length};
267
267
  TextAttributes attributes = fragment.textAttributes;
268
268
  DWRITE_FONT_STYLE fragmentStyle = DWRITE_FONT_STYLE_NORMAL;
@@ -10,11 +10,11 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.81.22</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.81.24</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>81</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>22</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>24</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>aaa05f5c3491ec4f2d62cb630b7ae51cd6a0f750</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>4e9017a484c3cba57081dfef12c4d96edae2ebe4</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.81.22",
3
+ "version": "0.81.24",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,18 +40,21 @@ _Use_decl_annotations_ int CALLBACK WinMain(HINSTANCE instance, HINSTANCE, PSTR
40
40
  // Register any native modules defined within this app project
41
41
  settings.PackageProviders().Append(winrt::make<CompReactPackageProvider>());
42
42
 
43
- #if BUNDLE
44
- // Load the JS bundle from a file (not Metro):
43
+ // When loading the JS bundle from a file (not Metro):
45
44
  // Set the path (on disk) where the .bundle file is located
46
45
  settings.BundleRootPath(std::wstring(L"file://").append(appDirectory).append(L"\\Bundle\\").c_str());
46
+
47
47
  // Set the name of the bundle file (without the .bundle extension)
48
48
  settings.JavaScriptBundleFile(L"index.windows");
49
- // Disable hot reload
49
+
50
+ // JS Entry file to use when loading from Metro:
51
+ settings.DebugBundlePath(L"index");
52
+
53
+ #if BUNDLE
54
+ // Disable hot reload - bundle will be loaded from prebuilt bundle file.
50
55
  settings.UseFastRefresh(false);
51
56
  #else
52
- // Load the JS bundle from Metro
53
- settings.JavaScriptBundleFile(L"index");
54
- // Enable hot reload
57
+ // Enable hot reload - load the JS bundle from Metro
55
58
  settings.UseFastRefresh(true);
56
59
  #endif
57
60
  #if _DEBUG