react-native-macos 0.64.3 → 0.64.4

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,5 +1,5 @@
1
1
  # TODO :: ANDROID patch to stay consistant with the npm version.
2
- VERSION_NAME=0.64.3
2
+ VERSION_NAME=0.64.4
3
3
  GROUP=com.facebook.react
4
4
 
5
5
  POM_NAME=ReactNative
@@ -7,7 +7,9 @@
7
7
 
8
8
  #include <../instrumentation/HermesMemoryDumper.h>
9
9
  #include <HermesExecutorFactory.h>
10
+ #include <android/log.h>
10
11
  #include <fbjni/fbjni.h>
12
+ #include <glog/logging.h>
11
13
  #include <hermes/Public/GCConfig.h>
12
14
  #include <hermes/Public/RuntimeConfig.h>
13
15
  #include <jni.h>
@@ -21,6 +23,13 @@
21
23
  namespace facebook {
22
24
  namespace react {
23
25
 
26
+ static void hermesFatalHandler(const std::string &reason) {
27
+ LOG(ERROR) << "Hermes Fatal: " << reason << "\n";
28
+ __android_log_assert(nullptr, "Hermes", "%s", reason.c_str());
29
+ }
30
+
31
+ static std::once_flag flag;
32
+
24
33
  static ::hermes::vm::RuntimeConfig makeRuntimeConfig(jlong heapSizeMB) {
25
34
  namespace vm = ::hermes::vm;
26
35
  auto gcConfigBuilder =
@@ -62,6 +71,9 @@ class HermesExecutorHolder
62
71
  jni::alias_ref<jclass>) {
63
72
  JReactMarker::setLogPerfMarkerIfNeeded();
64
73
 
74
+ std::call_once(flag, []() {
75
+ facebook::hermes::HermesRuntime::setFatalHandler(hermesFatalHandler);
76
+ });
65
77
  return makeCxxInstance(
66
78
  std::make_unique<HermesExecutorFactory>(installBindings));
67
79
  }
@@ -71,6 +83,9 @@ class HermesExecutorHolder
71
83
  jlong heapSizeMB) {
72
84
  JReactMarker::setLogPerfMarkerIfNeeded();
73
85
  auto runtimeConfig = makeRuntimeConfig(heapSizeMB);
86
+ std::call_once(flag, []() {
87
+ facebook::hermes::HermesRuntime::setFatalHandler(hermesFatalHandler);
88
+ });
74
89
  return makeCxxInstance(std::make_unique<HermesExecutorFactory>(
75
90
  installBindings, JSIExecutor::defaultTimeoutInvoker, runtimeConfig));
76
91
  }
@@ -756,6 +756,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
756
756
  return;
757
757
  }
758
758
  mDeviceRotation = rotation;
759
+ DisplayMetricsHolder.initDisplayMetrics(getContext().getApplicationContext());
759
760
  emitOrientationChanged(rotation);
760
761
  }
761
762
 
@@ -17,6 +17,6 @@ public class ReactNativeVersion {
17
17
  public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
18
18
  "major", 0,
19
19
  "minor", 64,
20
- "patch", 3,
20
+ "patch", 4,
21
21
  "prerelease", null);
22
22
  }
@@ -86,9 +86,18 @@ public class UIManagerHelper {
86
86
  }
87
87
  }
88
88
  CatalystInstance catalystInstance = context.getCatalystInstance();
89
- return uiManagerType == FABRIC
90
- ? (UIManager) catalystInstance.getJSIModule(JSIModuleType.UIManager)
91
- : catalystInstance.getNativeModule(UIManagerModule.class);
89
+ try {
90
+ return uiManagerType == FABRIC
91
+ ? (UIManager) catalystInstance.getJSIModule(JSIModuleType.UIManager)
92
+ : catalystInstance.getNativeModule(UIManagerModule.class);
93
+ } catch (IllegalArgumentException ex) {
94
+ // TODO T67518514 Clean this up once we migrate everything over to bridgeless mode
95
+ ReactSoftException.logSoftException(
96
+ "UIManagerHelper",
97
+ new ReactNoCrashSoftException(
98
+ "Cannot get UIManager for UIManagerType: " + uiManagerType));
99
+ return catalystInstance.getNativeModule(UIManagerModule.class);
100
+ }
92
101
  }
93
102
 
94
103
  /**
@@ -419,11 +419,10 @@ public class ReactEditText extends AppCompatEditText
419
419
  @Override
420
420
  public void setInputType(int type) {
421
421
  Typeface tf = super.getTypeface();
422
- // Input type password defaults to monospace font, so we need to re-apply the font
423
- super.setTypeface(tf);
424
-
425
422
  super.setInputType(type);
426
423
  mStagedInputType = type;
424
+ // Input type password defaults to monospace font, so we need to re-apply the font
425
+ super.setTypeface(tf);
427
426
 
428
427
  /**
429
428
  * If set forces multiline on input, because of a restriction on Android source that enables
@@ -17,7 +17,7 @@ namespace facebook::react {
17
17
  constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 64;
20
- int32_t Patch = 3;
20
+ int32_t Patch = 4;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-macos",
3
- "version": "0.64.3",
3
+ "version": "0.64.4",
4
4
  "bin": "./cli.js",
5
5
  "description": "[Microsoft Fork] A framework for building native apps using React",
6
6
  "license": "MIT",
@@ -90,9 +90,9 @@
90
90
  },
91
91
  "dependencies": {
92
92
  "@jest/create-cache-key-function": "^26.5.0",
93
- "@react-native-community/cli": "^5.0.1-alpha.0",
94
- "@react-native-community/cli-platform-android": "^5.0.1-alpha.0",
95
- "@react-native-community/cli-platform-ios": "^5.0.1-alpha.0",
93
+ "@react-native-community/cli": "^5.0.1-alpha.1",
94
+ "@react-native-community/cli-platform-android": "^5.0.1-alpha.1",
95
+ "@react-native-community/cli-platform-ios": "^5.0.1-alpha.1",
96
96
  "@react-native/assets": "1.0.0",
97
97
  "@react-native/normalize-color": "1.0.0",
98
98
  "@react-native/polyfills": "1.0.0",
package/react.gradle CHANGED
@@ -28,17 +28,11 @@ def detectCliPath(config) {
28
28
  if (config.cliPath) {
29
29
  return config.cliPath
30
30
  }
31
-
32
- def cliPath = ["node", "-e", "console.log(require('react-native/cli').bin);"].execute([], projectDir).text.trim()
33
-
34
- if (cliPath) {
35
- return cliPath
36
- } else if (new File("${projectDir}/../../node_modules/react-native/cli.js").exists()) {
31
+ if (new File("${projectDir}/../../node_modules/react-native/cli.js").exists()) {
37
32
  return "${projectDir}/../../node_modules/react-native/cli.js"
38
- } else {
39
- throw new Exception("Couldn't determine CLI location. " +
40
- "Please set `project.ext.react.cliPath` to the path of the react-native cli.js");
41
33
  }
34
+ throw new Exception("Couldn't determine CLI location. " +
35
+ "Please set `project.ext.react.cliPath` to the path of the react-native cli.js");
42
36
  }
43
37
 
44
38
  def composeSourceMapsPath = config.composeSourceMapsPath ?: "node_modules/react-native/scripts/compose-source-maps.js"
@@ -28,4 +28,10 @@ if [[ ! -x node && -d ${HOME}/.anyenv/bin ]]; then
28
28
  if [[ "$(anyenv envs | grep -c ndenv )" -eq 1 ]]; then
29
29
  eval "$(anyenv init -)"
30
30
  fi
31
- fi
31
+ fi
32
+
33
+ # Support Homebrew on M1
34
+ HOMEBREW_M1_BIN=/opt/homebrew/bin
35
+ if [[ -d $HOMEBREW_M1_BIN && ! $PATH =~ $HOMEBREW_M1_BIN ]]; then
36
+ export PATH="$HOMEBREW_M1_BIN:$PATH"
37
+ fi
@@ -74,7 +74,7 @@ end
74
74
  def use_flipper!(versions = {}, configurations: ['Debug'])
75
75
  versions['Flipper'] ||= '~> 0.75.1'
76
76
  versions['Flipper-DoubleConversion'] ||= '1.1.7'
77
- versions['Flipper-Folly'] ||= '~> 2.5'
77
+ versions['Flipper-Folly'] ||= '~> 2.5.3'
78
78
  versions['Flipper-Glog'] ||= '0.3.6'
79
79
  versions['Flipper-PeerTalk'] ||= '~> 0.0.4'
80
80
  versions['Flipper-RSocket'] ||= '~> 1.3'
@@ -141,10 +141,26 @@ def exclude_architectures(installer)
141
141
  end
142
142
 
143
143
  def react_native_post_install(installer)
144
+ pods_prefix = File.dirname(installer.pods_project.path)
145
+
144
146
  if has_pod(installer, 'Flipper')
145
147
  flipper_post_install(installer)
146
148
  end
147
149
 
150
+ ## Fix for RTC-Folly on iOS 14.5 - makes Hermes work again
151
+ find_and_replace(
152
+ "#{pods_prefix}/RCT-Folly/folly/synchronization/DistributedMutex-inl.h",
153
+ 'atomic_notify_one(state)',
154
+ 'folly::atomic_notify_one(state)'
155
+ )
156
+
157
+ find_and_replace(
158
+ "#{pods_prefix}Pods/RCT-Folly/folly/synchronization/DistributedMutex-inl.h",
159
+ 'atomic_wait_until(&state, previous | data, deadline)',
160
+ 'folly::atomic_wait_until(&state, previous | data, deadline)'
161
+ )
162
+
163
+ ## Exclude `i386` from valid architectures when building with Hermes on iOS
148
164
  exclude_architectures(installer)
149
165
  end
150
166
 
@@ -202,3 +218,18 @@ def use_react_native_codegen!(spec, options={})
202
218
 
203
219
  spec.prepare_command = "#{mkdir_command} && touch #{generated_files.reduce() { |str, file| str + " " + file }}"
204
220
  end
221
+
222
+ # Local method for the Xcode 12.5 fix
223
+ def find_and_replace(dir, findstr, replacestr)
224
+ Dir[dir].each do |name|
225
+ text = File.read(name)
226
+ replace = text.gsub(findstr, replacestr)
227
+ replaced = text.index(replacestr)
228
+ next if !replaced.nil? || text == replace
229
+
230
+ puts "Patching #{name}"
231
+ File.open(name, 'w') { |file| file.puts replace }
232
+ $stdout.flush
233
+ end
234
+ Dir["#{dir}*/"].each(&method(:find_and_replace))
235
+ end
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "react": "17.0.1",
14
- "react-native": "0.64.3"
14
+ "react-native": "0.64.4"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@babel/core": "^7.12.9",