From de52f51a0ad59500ac24992d63a45f0972ee38fe Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Sat, 9 Dec 2023 17:22:38 +0100 Subject: Initial commit Generated by react-native@0.73.0 --- .../java/com/cyberbadge_mobile/MainActivity.kt | 22 +++++++++++ .../java/com/cyberbadge_mobile/MainApplication.kt | 45 ++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 android/app/src/main/java/com/cyberbadge_mobile/MainActivity.kt create mode 100644 android/app/src/main/java/com/cyberbadge_mobile/MainApplication.kt (limited to 'android/app/src/main/java') diff --git a/android/app/src/main/java/com/cyberbadge_mobile/MainActivity.kt b/android/app/src/main/java/com/cyberbadge_mobile/MainActivity.kt new file mode 100644 index 0000000..1417a4e --- /dev/null +++ b/android/app/src/main/java/com/cyberbadge_mobile/MainActivity.kt @@ -0,0 +1,22 @@ +package com.cyberbadge_mobile + +import com.facebook.react.ReactActivity +import com.facebook.react.ReactActivityDelegate +import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled +import com.facebook.react.defaults.DefaultReactActivityDelegate + +class MainActivity : ReactActivity() { + + /** + * Returns the name of the main component registered from JavaScript. This is used to schedule + * rendering of the component. + */ + override fun getMainComponentName(): String = "cyberbadge_mobile" + + /** + * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] + * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] + */ + override fun createReactActivityDelegate(): ReactActivityDelegate = + DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) +} diff --git a/android/app/src/main/java/com/cyberbadge_mobile/MainApplication.kt b/android/app/src/main/java/com/cyberbadge_mobile/MainApplication.kt new file mode 100644 index 0000000..3fc08cf --- /dev/null +++ b/android/app/src/main/java/com/cyberbadge_mobile/MainApplication.kt @@ -0,0 +1,45 @@ +package com.cyberbadge_mobile + +import android.app.Application +import com.facebook.react.PackageList +import com.facebook.react.ReactApplication +import com.facebook.react.ReactHost +import com.facebook.react.ReactNativeHost +import com.facebook.react.ReactPackage +import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load +import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost +import com.facebook.react.defaults.DefaultReactNativeHost +import com.facebook.react.flipper.ReactNativeFlipper +import com.facebook.soloader.SoLoader + +class MainApplication : Application(), ReactApplication { + + override val reactNativeHost: ReactNativeHost = + object : DefaultReactNativeHost(this) { + override fun getPackages(): List { + // Packages that cannot be autolinked yet can be added manually here, for example: + // packages.add(new MyReactNativePackage()); + return PackageList(this).packages + } + + override fun getJSMainModuleName(): String = "index" + + override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG + + override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED + override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED + } + + override val reactHost: ReactHost + get() = getDefaultReactHost(this.applicationContext, reactNativeHost) + + override fun onCreate() { + super.onCreate() + SoLoader.init(this, false) + if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { + // If you opted-in for the New Architecture, we load the native entry point for this app. + load() + } + ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager) + } +} -- cgit v1.2.3