Skip to content

多线程 参考wroklets 支持两种方案 #12

@nawbc

Description

@nawbc

react-native-reanimated & react-native-multithreading
https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/worklets

react-native-thread与上面不同 参考

catalystInstance.getReactQueueConfiguration().getJSQueueThread().callOnQueue(
  new Callable<Object>() {
      @Override
      public Object call() throws Exception {
          try {
              reactContext.initializeWithInstance(catalystInstance);
              catalystInstance.runJSBundle();
          } catch (Exception e) {
              e.printStackTrace();
              devSupportManager.handleException(e);
          }

          return null;
      }
  }
).get();

catalystInstance.getReactQueueConfiguration().getUIQueueThread().callOnQueue(new Callable<Object>() {
  @Override
  public Object call() throws Exception {
      try {
          catalystInstance.initialize();
          reactContext.onHostResume(null);
      } catch (Exception e) {
          e.printStackTrace();
          devSupportManager.handleException(e);
      }

      return null;
  }
}).get();

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions