Created
July 5, 2018 11:19
-
-
Save krizzu/89587291993b1271d8aa47d2275da337 to your computer and use it in GitHub Desktop.
[Article] Kotlin version of standard RN android code
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
import com.facebook.react.ReactActivity | |
class MainActivity : ReactActivity() { | |
override fun getMainComponentName(): String? { | |
return "kotlin_app" | |
} | |
} |
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
import android.app.Application | |
import com.facebook.react.ReactApplication | |
import com.facebook.react.ReactNativeHost | |
import com.facebook.react.ReactPackage | |
import com.facebook.react.shell.MainReactPackage | |
import com.facebook.soloader.SoLoader | |
import java.util.* | |
class MainApplication : Application(), ReactApplication { | |
private val mReactNativeHost = object : ReactNativeHost(this) { | |
override fun getUseDeveloperSupport(): Boolean { | |
return BuildConfig.DEBUG | |
} | |
override fun getPackages(): List<ReactPackage> { | |
return Arrays.asList<ReactPackage>( | |
MainReactPackage() | |
) | |
} | |
override fun getJSMainModuleName(): String { | |
return "index" | |
} | |
} | |
override fun getReactNativeHost(): ReactNativeHost { | |
return mReactNativeHost | |
} | |
override fun onCreate() { | |
super.onCreate() | |
SoLoader.init(this, /* native exopackage */ false) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment