package com.swmansion.gesturehandler 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 com.swmansion.gesturehandler.BuildConfig import com.swmansion.gesturehandler.react.RNGestureHandlerModule import com.swmansion.gesturehandler.react.RNGestureHandlerRootViewManager import com.swmansion.gesturehandler.react.RNGestureHandlerButtonViewManager class RNGestureHandlerPackage : ReactPackage { override fun createNativeModules(reactContext: ReactApplicationContext): List { 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(RNGestureHandlerModule(reactContext)) } override fun createViewManagers(reactContext: ReactApplicationContext) = listOf>( RNGestureHandlerRootViewManager(), RNGestureHandlerButtonViewManager()) }