-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathNavigationPackage.kt
More file actions
41 lines (36 loc) · 1.51 KB
/
NavigationPackage.kt
File metadata and controls
41 lines (36 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.reactnativenavigation.react
import com.facebook.react.BaseReactPackage
import com.facebook.react.ReactApplication
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.module.model.ReactModuleInfo
import com.facebook.react.module.model.ReactModuleInfoProvider
import com.facebook.react.uimanager.ViewManager
import com.reactnativenavigation.options.LayoutFactory
import com.reactnativenavigation.react.modal.ModalViewManager
class NavigationPackage() : BaseReactPackage() {
override fun getModule(name: String, context: ReactApplicationContext): NativeModule? {
val reactApp = context.applicationContext as ReactApplication
return when (name) {
NavigationTurboModule.NAME -> {
NavigationTurboModule(context, LayoutFactory(reactApp.reactHost))
}
else -> {
null
}
}
}
override fun getReactModuleInfoProvider() = ReactModuleInfoProvider {
mapOf(NavigationTurboModule.NAME to ReactModuleInfo(
_name = NavigationTurboModule.NAME,
_className = NavigationTurboModule.NAME,
_canOverrideExistingModule = false,
_needsEagerInit = false,
isCxxModule = false,
isTurboModule = true
))
}
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
return mutableListOf(ModalViewManager(reactContext))
}
}