mirror of
https://github.com/status-im/react-native.git
synced 2025-02-26 08:05:34 +00:00
Summary: Utilizes the build time annotation processor ReactModuleSpecProcessor that creates ReactModuleInfos for modules annotated with ReactModule and listed in the ReactModuleList annotation of LazyReactPackages. This way we don't have to instantiate the native modules to get the name, canOverrideExistingModule, and supportsWebWorkers values of the native modules. In the NativeModuleRegistry, we either store these ReactModuleInfos inside of a ModuleHolder or if we can't get the ReactModuleInfo for a specific module we instantiate that module to get the values (as we previously did) to store in a LegacyModuleInfo. Reviewed By: astreet Differential Revision: D3796561 fbshipit-source-id: f8fb9b4993f59b51ce595eb2f2c3425129b28ce5
25 lines
496 B
Java
25 lines
496 B
Java
// Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
package com.facebook.react;
|
|
|
|
import javax.inject.Provider;
|
|
|
|
import com.facebook.react.bridge.NativeModule;
|
|
|
|
/**
|
|
* Provider for an already initialized and non-lazy NativeModule.
|
|
*/
|
|
public class EagerModuleProvider implements Provider<NativeModule> {
|
|
|
|
private final NativeModule mModule;
|
|
|
|
public EagerModuleProvider(NativeModule module) {
|
|
mModule = module;
|
|
}
|
|
|
|
@Override
|
|
public NativeModule get() {
|
|
return mModule;
|
|
}
|
|
}
|