Files
react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultComponentsRegistry.kt
T
Nicola Corti 1069841837 Make it easier for user to toggle only Fabric or TurboModules in New Architecture (#35091)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35091

This diff refines the DefaultNewArchitectureEntryPoint to make it easier for user to
either turn on Fabric, TurboModules or both.

Changelog:
[Internal] [Changed] - Make it easier for user to toggle only Fabric or TurboModules in New Architecture

Reviewed By: cipolleschi

Differential Revision: D40710596

fbshipit-source-id: 236060b2ebccb1bf25e7f5c0fc15f54c5ce5f608
2022-10-26 13:03:33 -07:00

36 lines
1.1 KiB
Kotlin

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.defaults
import com.facebook.jni.HybridData
import com.facebook.proguard.annotations.DoNotStrip
import com.facebook.react.fabric.ComponentFactory
/**
* A utility class that provides users a ComponentRegistry they can customize with a C++
* implementation of its native methods.
*
* This class works together with the [DefaultNewArchitectureEntryPoint] and it's C++ implementation
* is hosted inside the React Native framework
*/
@DoNotStrip
class DefaultComponentsRegistry
@DoNotStrip
private constructor(componentFactory: ComponentFactory) {
@DoNotStrip private val hybridData: HybridData = initHybrid(componentFactory)
@DoNotStrip private external fun initHybrid(componentFactory: ComponentFactory): HybridData
companion object {
@JvmStatic
@DoNotStrip
fun register(componentFactory: ComponentFactory) = DefaultComponentsRegistry(componentFactory)
}
}