forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure C++ default tmmd can access the CxxReactPackage (facebook#41673)
Summary: Pull Request resolved: facebook#41673 ## The Problem The cxxReactPackage property isn't initialized by the time initHybrid was executed. So, initHybrid was being called with null as the cxxReactPackage. Why; 1. The default turbomodule manager delegate receives cxxReactPackage as a constructor param. 2. Java then executes all the constructors of the class hierarchy. This executes initHybrid. 3. Java finally initializes the properties of the derived class: default tmmd.cxxReactPackage (i.e: the parameter to initHybrid). **This is too late** ## The Fix Refactor the code such that hybrid data creation doesn't depend on property initialization: 1. Create a static initHybrid method in default tmmd. 2. Call this static method with the cxxReactPackage, and assign the resultant HybridData to mHybridData (in tmmd). Changelog: [Internal] Reviewed By: javache Differential Revision: D51550623 fbshipit-source-id: ed2b7587351cfca408cda3c8cef4dcf7547e5f1e
- Loading branch information
1 parent
4c1bdea
commit 129bd9d
Showing
5 changed files
with
40 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters