-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
RNGestureHandlerPackage.kt
30 lines (26 loc) · 1.48 KB
/
RNGestureHandlerPackage.kt
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
package versioned.host.exp.exponent.modules.api.components.gesturehandler
import host.exp.expoview.BuildConfig
import com.facebook.react.ReactPackage
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.uimanager.ViewManager
import com.facebook.soloader.SoLoader
import versioned.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerModule
import versioned.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerRootViewManager
import versioned.host.exp.exponent.modules.api.components.gesturehandler.react.RNGestureHandlerButtonViewManager
class RNGestureHandlerPackage : ReactPackage {
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// For Fabric, we load c++ native library here, this triggers gesture handler's
// Fabric component registration which is necessary in order to avoid asking users
// to manually add init calls in their application code.
// This should no longer be needed if RN's autolink mechanism has Fabric support
SoLoader.loadLibrary("rngesturehandler_modules")
}
return listOf<NativeModule>(RNGestureHandlerModule(reactContext))
}
override fun createViewManagers(reactContext: ReactApplicationContext) =
listOf<ViewManager<*, *>>(
RNGestureHandlerRootViewManager(),
RNGestureHandlerButtonViewManager())
}