Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete ReactInstancePackage #41095

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
* LICENSE file in the root directory of this source tree.
*/

package com.facebook.react;

package com.facebook.react
/**
* An enum that specifies the algorithm to use when loading theJS Engine. {@link #JSC} will load
* JavaScriptCore first and fail if it is not available. {@link #HERMES} will load Hermes first and
* fail if it is not available.
* An enum that specifies the algorithm to use when loading theJS Engine. [.JSC] will load
* JavaScriptCore first and fail if it is not available. [.HERMES] will load Hermes first and fail
* if it is not available.
*/
public enum JSEngineResolutionAlgorithm {
enum class JSEngineResolutionAlgorithm {
JSC,
HERMES
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,10 @@
import java.util.List;
import java.util.Map;

/**
* React package supporting lazy creation of native modules.
*
* <p>TODO(t11394819): Make this default and deprecate ReactPackage
*/
/** React package supporting lazy creation of native modules. */
@Deprecated(since = "This class is deprecated, please use BaseReactPackage instead.")
public abstract class LazyReactPackage implements ReactPackage {

@Deprecated
public static ReactModuleInfoProvider getReactModuleInfoProviderViaReflection(
LazyReactPackage lazyReactPackage) {
return Collections::emptyMap;
}

/**
* We return an iterable
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,15 @@
* LICENSE file in the root directory of this source tree.
*/

package com.facebook.react;
package com.facebook.react

import com.facebook.react.bridge.ReactContext;

/**
* New Listener interface for react instance events. {@Link
* ReactInstanceManager.ReactInstanceEventListener will be deprecated.}
*/
public interface ReactInstanceEventListener {
import com.facebook.react.bridge.ReactContext

/** Interface to subscribe for react instance events */
interface ReactInstanceEventListener {
/**
* Called when the react context is initialized (all modules registered). Always called on the UI
* thread.
*/
void onReactContextInitialized(ReactContext context);
fun onReactContextInitialized(context: ReactContext)
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
import com.facebook.react.common.LifecycleState;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.common.SurfaceDelegateFactory;
import com.facebook.react.common.annotations.StableReactNativeAPI;
import com.facebook.react.common.annotations.VisibleForTesting;
import com.facebook.react.config.ReactFeatureFlags;
import com.facebook.react.devsupport.DevSupportManagerFactory;
Expand Down Expand Up @@ -133,6 +134,7 @@
* <p>To instantiate an instance of this class use {@link #builder}.
*/
@ThreadSafe
@StableReactNativeAPI
public class ReactInstanceManager {

private static final String TAG = ReactInstanceManager.class.getSimpleName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.facebook.react.bridge.NotThreadSafeBridgeIdleDebugListener;
import com.facebook.react.common.LifecycleState;
import com.facebook.react.common.SurfaceDelegateFactory;
import com.facebook.react.common.annotations.StableReactNativeAPI;
import com.facebook.react.devsupport.DefaultDevSupportManagerFactory;
import com.facebook.react.devsupport.DevSupportManagerFactory;
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
Expand All @@ -40,6 +41,7 @@
import java.util.Map;

/** Builder class for {@link ReactInstanceManager} */
@StableReactNativeAPI
public class ReactInstanceManagerBuilder {

private static final String TAG = ReactInstanceManagerBuilder.class.getSimpleName();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,8 @@ static Iterable<ModuleHolder> getNativeModuleIterator(
ReactConstants.TAG,
reactPackage.getClass().getSimpleName()
+ " is not a LazyReactPackage, falling back to old version.");
final List<NativeModule> nativeModules;
if (reactPackage instanceof ReactInstancePackage) {
ReactInstancePackage reactInstancePackage = (ReactInstancePackage) reactPackage;
nativeModules =
reactInstancePackage.createNativeModules(reactApplicationContext, reactInstanceManager);
} else {
nativeModules = reactPackage.createNativeModules(reactApplicationContext);
}
final List<NativeModule> nativeModules =
reactPackage.createNativeModules(reactApplicationContext);
return () ->
new Iterator<ModuleHolder>() {
int position = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ protected ReactPackageTurboModuleManagerDelegate(
continue;
}

if (shouldSupportLegacyPackages() && reactPackage instanceof ReactInstancePackage) {
// TODO(T145105887): Output error that ReactPackage was used
continue;
}

if (shouldSupportLegacyPackages()) {
// TODO(T145105887): Output warnings that ReactPackage was used
final List<NativeModule> nativeModules =
Expand Down