-
Notifications
You must be signed in to change notification settings - Fork 238
Expand file tree
/
Copy pathMainActivity.kt
More file actions
34 lines (29 loc) · 1.36 KB
/
Copy pathMainActivity.kt
File metadata and controls
34 lines (29 loc) · 1.36 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
package com.auth0example
import android.os.Bundle
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 = "Auth0Example"
/**
* react-native-screens requires that fragment state is never restored, otherwise the app
* crashes with "Screen fragments should never be restored" when the OS recreates the
* Activity (e.g. after the Auth0 redirect or process death). Passing null discards the
* saved fragment hierarchy so React Native rebuilds it fresh.
* See https://github.com/software-mansion/react-native-screens/issues/17
*/
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(null)
}
/**
* 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)
}