mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Revert D48588377: EZ cleanup of TurboReactPackage
Differential Revision: D48588377 Original commit changeset: 5645acad938a Original Phabricator Diff: D48588377 fbshipit-source-id: e0da38e5b721d6bfc7fd6b4607c7712301330a8f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c46858ab46
commit
e7168c4a2e
+13
-6
@@ -7,6 +7,7 @@
|
||||
|
||||
package com.facebook.react;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.react.bridge.ModuleHolder;
|
||||
import com.facebook.react.bridge.ModuleSpec;
|
||||
@@ -38,8 +39,9 @@ public abstract class TurboReactPackage implements ReactPackage {
|
||||
* The API needed for TurboModules. Given a module name, it returns an instance of {@link
|
||||
* NativeModule} for the name
|
||||
*
|
||||
* @param name name of the Native Module
|
||||
* @param reactContext {@link ReactApplicationContext} context for this
|
||||
* @param name
|
||||
* @param reactContext
|
||||
* @return
|
||||
*/
|
||||
public abstract @Nullable NativeModule getModule(
|
||||
String name, final ReactApplicationContext reactContext);
|
||||
@@ -58,10 +60,13 @@ public abstract class TurboReactPackage implements ReactPackage {
|
||||
final Set<Map.Entry<String, ReactModuleInfo>> entrySet =
|
||||
getReactModuleInfoProvider().getReactModuleInfos().entrySet();
|
||||
final Iterator<Map.Entry<String, ReactModuleInfo>> entrySetIterator = entrySet.iterator();
|
||||
// This should ideally be an IteratorConvertor, but we don't have any internal library for it
|
||||
return () ->
|
||||
new Iterator<ModuleHolder>() {
|
||||
@Nullable Map.Entry<String, ReactModuleInfo> nextEntry = null;
|
||||
return new Iterable<ModuleHolder>() {
|
||||
@NonNull
|
||||
@Override
|
||||
// This should ideally be an IteratorConvertor, but we don't have any internal library for it
|
||||
public Iterator<ModuleHolder> iterator() {
|
||||
return new Iterator<ModuleHolder>() {
|
||||
Map.Entry<String, ReactModuleInfo> nextEntry = null;
|
||||
|
||||
private void findNext() {
|
||||
while (entrySetIterator.hasNext()) {
|
||||
@@ -113,6 +118,8 @@ public abstract class TurboReactPackage implements ReactPackage {
|
||||
throw new UnsupportedOperationException("Cannot remove native modules from the list");
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user