コード例 #1
0
 @Override
 protected Result<ReactApplicationContext> doInBackground(ReactContextInitParams... params) {
   Assertions.assertCondition(params != null && params.length > 0 && params[0] != null);
   try {
     JavaScriptExecutor jsExecutor = params[0].getJsExecutorFactory().create();
     return Result.of(createReactContext(jsExecutor, params[0].getJsBundleLoader()));
   } catch (Exception e) {
     // Pass exception to onPostExecute() so it can be handled on the main thread
     return Result.of(e);
   }
 }
コード例 #2
0
 @Override
 protected void onCancelled(Result<ReactApplicationContext> reactApplicationContextResult) {
   try {
     mMemoryPressureRouter.destroy(reactApplicationContextResult.get());
   } catch (Exception e) {
     FLog.w(ReactConstants.TAG, "Caught exception after cancelling react context init", e);
   } finally {
     mReactContextInitAsyncTask = null;
   }
 }
コード例 #3
0
    @Override
    protected void onPostExecute(Result<ReactApplicationContext> result) {
      try {
        setupReactContext(result.get());
      } catch (Exception e) {
        mDevSupportManager.handleException(e);
      } finally {
        mReactContextInitAsyncTask = null;
      }

      // Handle enqueued request to re-initialize react context.
      if (mPendingReactContextInitParams != null) {
        recreateReactContextInBackground(
            mPendingReactContextInitParams.getJsExecutorFactory(),
            mPendingReactContextInitParams.getJsBundleLoader());
        mPendingReactContextInitParams = null;
      }
    }