-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Piotr Trocki
committed
Jan 31, 2024
1 parent
84571c1
commit 4f04d38
Showing
4 changed files
with
40 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 27 additions & 9 deletions
36
packages/repack/android/src/main/java/com/callstack/repack/ChunkManagerPackage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,35 @@ | ||
package com.callstack.repack | ||
|
||
import com.facebook.react.ReactPackage | ||
import com.facebook.react.bridge.NativeModule | ||
import com.facebook.react.TurboReactPackage | ||
import com.facebook.react.bridge.ReactApplicationContext | ||
import com.facebook.react.uimanager.ViewManager | ||
|
||
import com.facebook.react.bridge.NativeModule | ||
import com.facebook.react.module.model.ReactModuleInfoProvider | ||
import com.facebook.react.module.model.ReactModuleInfo | ||
import java.util.HashMap | ||
|
||
class ScriptManagerPackage : ReactPackage { | ||
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> { | ||
return listOf(ScriptManagerModule(reactContext)) | ||
class ScriptManagerPackage : TurboReactPackage() { | ||
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? { | ||
return if (name == ScriptManagerModule.NAME) { | ||
ScriptManagerModule(reactContext) | ||
} else { | ||
null | ||
} | ||
} | ||
|
||
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> { | ||
return emptyList() | ||
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider { | ||
return ReactModuleInfoProvider { | ||
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap() | ||
val isTurboModule: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED | ||
moduleInfos[ScriptManagerModule.NAME] = ReactModuleInfo( | ||
ScriptManagerModule.NAME, | ||
ScriptManagerModule.NAME, | ||
false, // canOverrideExistingModule | ||
false, // needsEagerInit | ||
true, // hasConstants | ||
false, // isCxxModule | ||
isTurboModule // isTurboModule | ||
) | ||
moduleInfos | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package com.callstack.repack | ||
|
||
import com.facebook.fbreact.specs.NativeScriptManagerSpec | ||
import com.facebook.react.bridge.ReactApplicationContext | ||
|
||
abstract class ScriptManagerSpec internal constructor(context: ReactApplicationContext) : | ||
NativeRepackSpec(context) { | ||
abstract class ScriptManagerSpec internal constructor(context: ReactApplicationContext): NativeScriptManagerSpec(context) { | ||
} |