react-native-macos 0.63.34 → 0.63.38

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.
@@ -88,11 +88,6 @@
88
88
  return _selectable;
89
89
  }
90
90
 
91
- - (BOOL)enableFocusRing
92
- {
93
- return _selectable;
94
- }
95
-
96
91
  - (void)drawFocusRingMask {
97
92
  if ([self enableFocusRing]) {
98
93
  NSRectFill([self bounds]);
@@ -236,7 +236,7 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
236
236
  if (self != nil) {
237
237
  self.wantsLayer = YES;
238
238
  self->_userInteractionEnabled = YES;
239
-
239
+ self->_enableFocusRing = YES;
240
240
  }
241
241
  return self;
242
242
  }
@@ -594,9 +594,7 @@ struct RCTInstanceCallback : public InstanceCallback {
594
594
  // This can only be false if the bridge was invalidated before startup completed
595
595
  if (_reactInstance) {
596
596
  #if RCT_DEV
597
- if ([[self devSettings] isDevModeEnabled]) { // TODO(OSS Candidate ISS#2710739)
598
597
  executorFactory = std::make_shared<GetDescAdapter>(self, executorFactory);
599
- } // TODO(OSS Candidate ISS#2710739)
600
598
  #endif
601
599
 
602
600
  [self _initializeBridgeLocked:executorFactory];
@@ -1370,7 +1368,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithBundleURL
1370
1368
  } else if (reactInstance) {
1371
1369
  reactInstance->loadScriptFromString(std::make_unique<NSDataBigString>(script), sourceUrlStr.UTF8String, !async);
1372
1370
  } else {
1373
- std::string methodName = async ? "loadApplicationScript" : "loadApplicationScriptSync";
1371
+ std::string methodName = async ? "loadBundle" : "loadBundleSync";
1374
1372
  throw std::logic_error("Attempt to call " + methodName + ": on uninitialized bridge");
1375
1373
  }
1376
1374
  }];
@@ -67,7 +67,12 @@ class RCTObjcExecutor : public JSExecutor {
67
67
  setGlobalVariable("__fbBatchedBridgeConfig", std::make_unique<JSBigStdString>(folly::toJson(config)));
68
68
  }
69
69
 
70
- void loadApplicationScript(std::unique_ptr<const JSBigString> script, std::string sourceURL) override
70
+ void initializeRuntime() override
71
+ {
72
+ // We do nothing here since initialization is done in the constructor
73
+ }
74
+
75
+ void loadBundle(std::unique_ptr<const JSBigString> script, std::string sourceURL) override
71
76
  {
72
77
  RCTProfileBeginFlowEvent();
73
78
  [m_jse executeApplicationScript:[NSData dataWithBytes:script->c_str() length:script->size()]
@@ -38,7 +38,7 @@ public interface JavaJSExecutor {
38
38
  * @param sourceURL url or file location from which script content was loaded
39
39
  */
40
40
  @DoNotStrip
41
- void loadApplicationScript(String sourceURL) throws ProxyExecutorException;
41
+ void loadBundle(String sourceURL) throws ProxyExecutorException;
42
42
 
43
43
  /**
44
44
  * Execute javascript method within js context
@@ -81,7 +81,7 @@ public class JSDebuggerWebSocketClient extends WebSocketListener {
81
81
  }
82
82
  }
83
83
 
84
- public void loadApplicationScript(
84
+ public void loadBundle(
85
85
  String sourceURL, HashMap<String, String> injectedObjects, JSDebuggerCallback callback) {
86
86
  int requestID = mRequestID.getAndIncrement();
87
87
  mCallbacks.put(requestID, callback);
@@ -153,10 +153,9 @@ public class WebsocketJavaScriptExecutor implements JavaJSExecutor {
153
153
  }
154
154
 
155
155
  @Override
156
- public void loadApplicationScript(String sourceURL) throws JavaJSExecutor.ProxyExecutorException {
156
+ public void loadBundle(String sourceURL) throws JavaJSExecutor.ProxyExecutorException {
157
157
  JSExecutorCallbackFuture callback = new JSExecutorCallbackFuture();
158
- Assertions.assertNotNull(mWebSocketClient)
159
- .loadApplicationScript(sourceURL, mInjectedObjects, callback);
158
+ Assertions.assertNotNull(mWebSocketClient).loadBundle(sourceURL, mInjectedObjects, callback);
160
159
  try {
161
160
  callback.get();
162
161
  } catch (Throwable cause) {
@@ -178,7 +177,7 @@ public class WebsocketJavaScriptExecutor implements JavaJSExecutor {
178
177
 
179
178
  @Override
180
179
  public void setGlobalVariable(String propertyName, String jsonEncodedValue) {
181
- // Store and use in the next loadApplicationScript() call.
180
+ // Store and use in the next loadBundle() call.
182
181
  mInjectedObjects.put(propertyName, jsonEncodedValue);
183
182
  }
184
183
  }
@@ -53,9 +53,7 @@ ProxyExecutor::~ProxyExecutor() {
53
53
  m_executor.reset();
54
54
  }
55
55
 
56
- void ProxyExecutor::loadApplicationScript(
57
- std::unique_ptr<const JSBigString>,
58
- std::string sourceURL) {
56
+ void ProxyExecutor::initializeRuntime() {
59
57
  folly::dynamic nativeModuleConfig = folly::dynamic::array;
60
58
 
61
59
  {
@@ -76,14 +74,17 @@ void ProxyExecutor::loadApplicationScript(
76
74
  "__fbBatchedBridgeConfig",
77
75
  std::make_unique<JSBigStdString>(folly::toJson(config)));
78
76
  }
77
+ }
79
78
 
80
- static auto loadApplicationScript =
81
- jni::findClassStatic(EXECUTOR_BASECLASS)
82
- ->getMethod<void(jstring)>("loadApplicationScript");
79
+ void ProxyExecutor::loadBundle(
80
+ std::unique_ptr<const JSBigString>,
81
+ std::string sourceURL) {
82
+ static auto loadBundle = jni::findClassStatic(EXECUTOR_BASECLASS)
83
+ ->getMethod<void(jstring)>("loadBundle");
83
84
 
84
85
  // The proxy ignores the script data passed in.
85
86
 
86
- loadApplicationScript(m_executor.get(), jni::make_jstring(sourceURL).get());
87
+ loadBundle(m_executor.get(), jni::make_jstring(sourceURL).get());
87
88
  // We can get pending calls here to native but the queue will be drained when
88
89
  // we launch the application.
89
90
  }
@@ -37,7 +37,8 @@ class ProxyExecutor : public JSExecutor {
37
37
  jni::global_ref<jobject> &&executorInstance,
38
38
  std::shared_ptr<ExecutorDelegate> delegate);
39
39
  virtual ~ProxyExecutor() override;
40
- virtual void loadApplicationScript(
40
+ virtual void initializeRuntime() override;
41
+ virtual void loadBundle(
41
42
  std::unique_ptr<const JSBigString> script,
42
43
  std::string sourceURL) override;
43
44
  virtual void setBundleRegistry(
@@ -40,7 +40,7 @@ public class JSDebuggerWebSocketClientTest {
40
40
  }
41
41
 
42
42
  @Test
43
- public void test_loadApplicationScript_ShouldSendCorrectMessage() throws Exception {
43
+ public void test_loadBundle_ShouldSendCorrectMessage() throws Exception {
44
44
  final JSDebuggerWebSocketClient.JSDebuggerCallback cb =
45
45
  PowerMockito.mock(JSDebuggerWebSocketClient.JSDebuggerCallback.class);
46
46
 
@@ -49,7 +49,7 @@ public class JSDebuggerWebSocketClientTest {
49
49
  injectedObjects.put("key1", "value1");
50
50
  injectedObjects.put("key2", "value2");
51
51
 
52
- client.loadApplicationScript("http://localhost:8080/index.js", injectedObjects, cb);
52
+ client.loadBundle("http://localhost:8080/index.js", injectedObjects, cb);
53
53
  PowerMockito.verifyPrivate(client)
54
54
  .invoke(
55
55
  "sendMessage",
@@ -50,6 +50,8 @@ void Instance::initializeBridge(
50
50
  nativeToJsBridge_ = std::make_shared<NativeToJsBridge>(
51
51
  jsef.get(), moduleRegistry_, jsQueue, callback_);
52
52
 
53
+ nativeToJsBridge_->initializeRuntime();
54
+
53
55
  /**
54
56
  * After NativeToJsBridge is created, the jsi::Runtime should exist.
55
57
  * Also, the JS message queue thread exists. So, it's safe to
@@ -65,25 +67,25 @@ void Instance::initializeBridge(
65
67
  CHECK(nativeToJsBridge_);
66
68
  }
67
69
 
68
- void Instance::loadApplication(
70
+ void Instance::loadBundle(
69
71
  std::unique_ptr<RAMBundleRegistry> bundleRegistry,
70
72
  std::unique_ptr<const JSBigString> string,
71
73
  std::string sourceURL) {
72
74
  callback_->incrementPendingJSCalls();
73
- SystraceSection s("Instance::loadApplication", "sourceURL", sourceURL);
74
- nativeToJsBridge_->loadApplication(
75
+ SystraceSection s("Instance::loadBundle", "sourceURL", sourceURL);
76
+ nativeToJsBridge_->loadBundle(
75
77
  std::move(bundleRegistry), std::move(string), std::move(sourceURL));
76
78
  }
77
79
 
78
- void Instance::loadApplicationSync(
80
+ void Instance::loadBundleSync(
79
81
  std::unique_ptr<RAMBundleRegistry> bundleRegistry,
80
82
  std::unique_ptr<const JSBigString> string,
81
83
  std::string sourceURL) {
82
84
  std::unique_lock<std::mutex> lock(m_syncMutex);
83
85
  m_syncCV.wait(lock, [this] { return m_syncReady; });
84
86
 
85
- SystraceSection s("Instance::loadApplicationSync", "sourceURL", sourceURL);
86
- nativeToJsBridge_->loadApplicationSync(
87
+ SystraceSection s("Instance::loadBundleSync", "sourceURL", sourceURL);
88
+ nativeToJsBridge_->loadBundleSync(
87
89
  std::move(bundleRegistry), std::move(string), std::move(sourceURL));
88
90
  }
89
91
 
@@ -91,7 +93,7 @@ void Instance::setSourceURL(std::string sourceURL) {
91
93
  callback_->incrementPendingJSCalls();
92
94
  SystraceSection s("Instance::setSourceURL", "sourceURL", sourceURL);
93
95
 
94
- nativeToJsBridge_->loadApplication(nullptr, nullptr, std::move(sourceURL));
96
+ nativeToJsBridge_->loadBundle(nullptr, nullptr, std::move(sourceURL));
95
97
  }
96
98
 
97
99
  void Instance::loadScriptFromString(
@@ -100,9 +102,9 @@ void Instance::loadScriptFromString(
100
102
  bool loadSynchronously) {
101
103
  SystraceSection s("Instance::loadScriptFromString", "sourceURL", sourceURL);
102
104
  if (loadSynchronously) {
103
- loadApplicationSync(nullptr, std::move(string), std::move(sourceURL));
105
+ loadBundleSync(nullptr, std::move(string), std::move(sourceURL));
104
106
  } else {
105
- loadApplication(nullptr, std::move(string), std::move(sourceURL));
107
+ loadBundle(nullptr, std::move(string), std::move(sourceURL));
106
108
  }
107
109
  }
108
110
 
@@ -158,12 +160,12 @@ void Instance::loadRAMBundle(
158
160
  std::string startupScriptSourceURL,
159
161
  bool loadSynchronously) {
160
162
  if (loadSynchronously) {
161
- loadApplicationSync(
163
+ loadBundleSync(
162
164
  std::move(bundleRegistry),
163
165
  std::move(startupScript),
164
166
  std::move(startupScriptSourceURL));
165
167
  } else {
166
- loadApplication(
168
+ loadBundle(
167
169
  std::move(bundleRegistry),
168
170
  std::move(startupScript),
169
171
  std::move(startupScriptSourceURL));
@@ -47,6 +47,8 @@ class RN_EXPORT Instance {
47
47
  std::shared_ptr<MessageQueueThread> jsQueue,
48
48
  std::shared_ptr<ModuleRegistry> moduleRegistry);
49
49
 
50
+ void initializeRuntime();
51
+
50
52
  void setSourceURL(std::string sourceURL);
51
53
 
52
54
  void loadScriptFromString(
@@ -129,11 +131,11 @@ class RN_EXPORT Instance {
129
131
 
130
132
  private:
131
133
  void callNativeModules(folly::dynamic &&calls, bool isEndOfBatch);
132
- void loadApplication(
134
+ void loadBundle(
133
135
  std::unique_ptr<RAMBundleRegistry> bundleRegistry,
134
136
  std::unique_ptr<const JSBigString> startupScript,
135
137
  std::string startupScriptSourceURL);
136
- void loadApplicationSync(
138
+ void loadBundleSync(
137
139
  std::unique_ptr<RAMBundleRegistry> bundleRegistry,
138
140
  std::unique_ptr<const JSBigString> startupScript,
139
141
  std::string startupScriptSourceURL);
@@ -59,10 +59,15 @@ class JSExecutorFactory {
59
59
 
60
60
  class RN_EXPORT JSExecutor {
61
61
  public:
62
+ /**
63
+ * Prepares the JS runtime for React Native by installing global variables.
64
+ * Called once before any JS is evaluated.
65
+ */
66
+ virtual void initializeRuntime() = 0;
62
67
  /**
63
68
  * Execute an application script bundle in the JS context.
64
69
  */
65
- virtual void loadApplicationScript(
70
+ virtual void loadBundle(
66
71
  std::unique_ptr<const JSBigString> script,
67
72
  std::string sourceURL) = 0;
68
73
 
@@ -114,7 +114,12 @@ NativeToJsBridge::~NativeToJsBridge() {
114
114
  << "NativeToJsBridge::destroy() must be called before deallocating the NativeToJsBridge!";
115
115
  }
116
116
 
117
- void NativeToJsBridge::loadApplication(
117
+ void NativeToJsBridge::initializeRuntime() {
118
+ runOnExecutorQueue(
119
+ [](JSExecutor *executor) mutable { executor->initializeRuntime(); });
120
+ }
121
+
122
+ void NativeToJsBridge::loadBundle(
118
123
  std::unique_ptr<RAMBundleRegistry> bundleRegistry,
119
124
  std::unique_ptr<const JSBigString> startupScript,
120
125
  std::string startupScriptSourceURL) {
@@ -129,7 +134,7 @@ void NativeToJsBridge::loadApplication(
129
134
  executor->setBundleRegistry(std::move(bundleRegistry));
130
135
  }
131
136
  try {
132
- executor->loadApplicationScript(
137
+ executor->loadBundle(
133
138
  std::move(*startupScript), std::move(startupScriptSourceURL));
134
139
  } catch (...) {
135
140
  m_applicationScriptHasFailure = true;
@@ -138,7 +143,7 @@ void NativeToJsBridge::loadApplication(
138
143
  });
139
144
  }
140
145
 
141
- void NativeToJsBridge::loadApplicationSync(
146
+ void NativeToJsBridge::loadBundleSync(
142
147
  std::unique_ptr<RAMBundleRegistry> bundleRegistry,
143
148
  std::unique_ptr<const JSBigString> startupScript,
144
149
  std::string startupScriptSourceURL) {
@@ -146,7 +151,7 @@ void NativeToJsBridge::loadApplicationSync(
146
151
  m_executor->setBundleRegistry(std::move(bundleRegistry));
147
152
  }
148
153
  try {
149
- m_executor->loadApplicationScript(
154
+ m_executor->loadBundle(
150
155
  std::move(startupScript), std::move(startupScriptSourceURL));
151
156
  } catch (...) {
152
157
  m_applicationScriptHasFailure = true;
@@ -32,7 +32,7 @@ class RAMBundleRegistry;
32
32
  // executors and their threads. All functions here can be called from
33
33
  // any thread.
34
34
  //
35
- // Except for loadApplicationScriptSync(), all void methods will queue
35
+ // Except for loadBundleSync(), all void methods will queue
36
36
  // work to run on the jsQueue passed to the ctor, and return
37
37
  // immediately.
38
38
  class NativeToJsBridge {
@@ -63,16 +63,21 @@ class NativeToJsBridge {
63
63
  */
64
64
  void invokeCallback(double callbackId, folly::dynamic &&args);
65
65
 
66
+ /**
67
+ * Sets global variables in the JS Context.
68
+ */
69
+ void initializeRuntime();
70
+
66
71
  /**
67
72
  * Starts the JS application. If bundleRegistry is non-null, then it is
68
73
  * used to fetch JavaScript modules as individual scripts.
69
74
  * Otherwise, the script is assumed to include all the modules.
70
75
  */
71
- void loadApplication(
76
+ void loadBundle(
72
77
  std::unique_ptr<RAMBundleRegistry> bundleRegistry,
73
78
  std::unique_ptr<const JSBigString> startupCode,
74
79
  std::string sourceURL);
75
- void loadApplicationSync(
80
+ void loadBundleSync(
76
81
  std::unique_ptr<RAMBundleRegistry> bundleRegistry,
77
82
  std::unique_ptr<const JSBigString> startupCode,
78
83
  std::string sourceURL);
@@ -29,7 +29,7 @@ Pod::Spec.new do |s|
29
29
  s.author = "Facebook, Inc. and its affiliates"
30
30
  s.platforms = { :ios => "10.0", :tvos => "10.0", :osx => "10.13" } # TODO(macOS GH#214)
31
31
  s.source = source
32
- s.source_files = "jsireact/*.{cpp,h,m}"
32
+ s.source_files = "jsireact/*.{cpp,h}"
33
33
  s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
34
34
  s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\"" }
35
35
  s.header_dir = "jsireact"
@@ -6,7 +6,6 @@
6
6
  */
7
7
 
8
8
  #include "jsireact/JSIExecutor.h"
9
- #include "JSIRuntimeInitializeStateNotifier-C-Interface.h"
10
9
 
11
10
  #include <cxxreact/JSBigString.h>
12
11
  #include <cxxreact/ModuleRegistry.h>
@@ -78,13 +77,8 @@ JSIExecutor::JSIExecutor(
78
77
  *runtime, "__jsiExecutorDescription", runtime->description());
79
78
  }
80
79
 
81
- void JSIExecutor::loadApplicationScript(
82
- std::unique_ptr<const JSBigString> script,
83
- std::string sourceURL) {
84
- SystraceSection s("JSIExecutor::loadApplicationScript");
85
-
86
- // TODO: check for and use precompiled HBC
87
-
80
+ void JSIExecutor::initializeRuntime() {
81
+ SystraceSection s("JSIExecutor::initializeRuntime");
88
82
  runtime_->global().setProperty(
89
83
  *runtime_,
90
84
  "nativeModuleProxy",
@@ -142,11 +136,18 @@ void JSIExecutor::loadApplicationScript(
142
136
  if (runtimeInstaller_) {
143
137
  runtimeInstaller_(*runtime_);
144
138
  }
139
+ bool hasLogger(ReactMarker::logTaggedMarker);
140
+ if (hasLogger) {
141
+ ReactMarker::logMarker(ReactMarker::CREATE_REACT_CONTEXT_STOP);
142
+ }
143
+ }
145
144
 
146
- // TODO(OSS Candidate ISS#2710739)- send a notification that the global variables are set so we can then proceed with bundle loading (which depends on these and will crash if that thread finishes before they are set)
147
- #if TARGET_OS_MAC // includes iOS and osx, excludes Android
148
- NotifyRuntimeInitializationEnd();
149
- #endif // TARGET_OS_MAC
145
+ void JSIExecutor::loadBundle(
146
+ std::unique_ptr<const JSBigString> script,
147
+ std::string sourceURL) {
148
+ SystraceSection s("JSIExecutor::loadBundle");
149
+
150
+ // TODO: check for and use precompiled HBC
150
151
 
151
152
  bool hasLogger(ReactMarker::logTaggedMarker);
152
153
  std::string scriptName = simpleBasename(sourceURL);
@@ -158,7 +159,6 @@ void JSIExecutor::loadApplicationScript(
158
159
  std::make_unique<BigStringBuffer>(std::move(script)), sourceURL);
159
160
  flush();
160
161
  if (hasLogger) {
161
- ReactMarker::logMarker(ReactMarker::CREATE_REACT_CONTEXT_STOP);
162
162
  ReactMarker::logTaggedMarker(
163
163
  ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str());
164
164
  }
@@ -77,7 +77,8 @@ class JSIExecutor : public JSExecutor {
77
77
  std::shared_ptr<ExecutorDelegate> delegate,
78
78
  const JSIScopedTimeoutInvoker &timeoutInvoker,
79
79
  RuntimeInstaller runtimeInstaller);
80
- void loadApplicationScript(
80
+ void initializeRuntime() override;
81
+ void loadBundle(
81
82
  std::unique_ptr<const JSBigString> script,
82
83
  std::string sourceURL) override;
83
84
  void setBundleRegistry(std::unique_ptr<RAMBundleRegistry>) override;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-macos",
3
- "version": "0.63.34",
3
+ "version": "0.63.38",
4
4
  "bin": "./cli.js",
5
5
  "description": "[Microsoft Fork] A framework for building native apps using React",
6
6
  "license": "MIT",
@@ -1,10 +0,0 @@
1
- //
2
- // JSIRuntimeInitializeStateNotifier-C-Interface.h
3
- //
4
- // TODO(OSS Candidate ISS#2710739)
5
-
6
- // This is the C function that will be used to invoke the Objctive-C notification posting method from C++
7
- #ifdef __cplusplus
8
- extern "C"
9
- #endif
10
- void NotifyRuntimeInitializationEnd(void);
@@ -1,13 +0,0 @@
1
- //
2
- // JSIRuntimeInitializeStateNotifier.h
3
- //
4
- // TODO(OSS Candidate ISS#2710739)
5
-
6
- #define JSIRuntimeInitializationEndNotificationName @"JSIRuntimeInitializationEndNotificationName"
7
-
8
- /*
9
- * When the globabl JS runtime is set up, post a notification that can be used to trigger JS bundle loads.
10
- */
11
- @interface JSIRuntimeInitializeStateNotifier : NSObject
12
- + (void)notifyRuntimeInitializationEnd;
13
- @end
@@ -1,20 +0,0 @@
1
- //
2
- // JSIRuntimeInitializeStateNotifier.m
3
- //
4
- // TODO(OSS Candidate ISS#2710739)
5
-
6
- #import "JSIRuntimeInitializeStateNotifier-C-Interface.h"
7
- #import "JSIRuntimeInitializeStateNotifier.h"
8
-
9
- @implementation JSIRuntimeInitializeStateNotifier
10
-
11
- void NotifyRuntimeInitializationEnd() {
12
- [JSIRuntimeInitializeStateNotifier notifyRuntimeInitializationEnd];
13
- }
14
-
15
- + (void)notifyRuntimeInitializationEnd {
16
- NSNotification *runtimeNotification = [[NSNotification alloc] initWithName:(NSString*)JSIRuntimeInitializationEndNotificationName object:nil userInfo:nil];
17
- [[NSNotificationCenter defaultCenter] postNotification:runtimeNotification];
18
- }
19
-
20
- @end