mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-26 05:15:49 +08:00
Added explicit init to observer modules
Summary: Modules which call JS methods directly, or use `sendDeviceEventWithName:`, can trigger effects in JS without ever being referenced from the JS code. This breaks some assumptions in my earlier diff about when modules can be lazily loaded. Pending a better solution, I've put explicit `init` methods in these modules to ensure they are eagerly initialized (the downside to this is that they'll still be initialized even if they are never used). Reviewed By: javache Differential Revision: D3258232 fb-gh-sync-id: f925bc2e5339c1fbfcc244d4613062c5ab848fc2 fbshipit-source-id: f925bc2e5339c1fbfcc244d4613062c5ab848fc2
This commit is contained in:
committed by
Facebook Github Bot 7
parent
a9a90aa2f0
commit
e72163f0f2
@@ -128,7 +128,7 @@ RCT_EXPORT_MODULE()
|
||||
- (instancetype)init
|
||||
{
|
||||
// We're only overriding this to ensure the module gets created at startup
|
||||
// TODO (D3175632): Remove once we have more declarative control over module setup.
|
||||
// TODO (t11106126): Remove once we have more declarative control over module setup.
|
||||
return [super init];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user