Skip to content

Commit

Permalink
Revert D48588377: EZ cleanup of TurboReactPackage
Browse files Browse the repository at this point in the history
Differential Revision:
D48588377

Original commit changeset: 5645acad938a

Original Phabricator Diff: D48588377

fbshipit-source-id: e0da38e5b721d6bfc7fd6b4607c7712301330a8f
  • Loading branch information
Ergul Azizler authored and facebook-github-bot committed Aug 25, 2023
1 parent c46858a commit e7168c4
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -38,8 +39,9 @@ public List<NativeModule> createNativeModules(ReactApplicationContext reactConte
* 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);
Expand All @@ -58,10 +60,13 @@ Iterable<ModuleHolder> getNativeModuleIterator(final ReactApplicationContext rea
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()) {
Expand Down Expand Up @@ -113,6 +118,8 @@ public void remove() {
throw new UnsupportedOperationException("Cannot remove native modules from the list");
}
};
}
};
}

/**
Expand Down

0 comments on commit e7168c4

Please sign in to comment.