Relax the requirement that lazy module cannot be initialized on the main thread

Summary:
[RN] Relax the requirement that lazy module cannot be initialized on the main thread
I tried to understand the D5364734 that intoduced this, and I am not sure, but belive that asserting here is too strict. If you have a module that you want to lazily initialize, and module does not demand the main queue, it should be just a warning if you run on the main queue, not necessarily an error.

Reviewed By: mmmulani

Differential Revision: D10429880

fbshipit-source-id: 018c211d45b98dd8c552bf0289fe517d05e56d47
This commit is contained in:
Slobodan Predolac 2018-10-18 15:21:27 -07:00 committed by Facebook Github Bot
parent 44217d48ff
commit dbc864c9cd
1 changed files with 0 additions and 2 deletions

View File

@ -603,8 +603,6 @@ struct RCTInstanceCallback : public InstanceCallback {
withDispatchGroup:(dispatch_group_t)dispatchGroup withDispatchGroup:(dispatch_group_t)dispatchGroup
lazilyDiscovered:(BOOL)lazilyDiscovered lazilyDiscovered:(BOOL)lazilyDiscovered
{ {
RCTAssert(!(RCTIsMainQueue() && lazilyDiscovered), @"Lazy discovery can only happen off the Main Queue");
// Set up moduleData for automatically-exported modules // Set up moduleData for automatically-exported modules
NSArray<RCTModuleData *> *moduleDataById = [self registerModulesForClasses:modules]; NSArray<RCTModuleData *> *moduleDataById = [self registerModulesForClasses:modules];