-
Notifications
You must be signed in to change notification settings - Fork 950
Add react-native-screens native configs in Android during new app initialization #2819
Open
Labels
Description
Describe the Feature
Add react-native-screens native configs in Android as per described here : https://reactnavigation.org/docs/getting-started?framework=community-cli#installing-dependencies
Possible Implementations
- The native codes can be added right when a new app is initialized.
- For better performance with
react-native-screens, as it is now a common part of all new@react-native-community/cliapps , so the native codes should already be there rather adding manually.
See the docs here : https://reactnavigation.org/docs/getting-started?framework=community-cli#installing-dependencies
Kotlin
import android.os.Bundle import com.swmansion.rnscreens.fragment.restoration.RNScreensFragmentFactory // ... class MainActivity: ReactActivity() { // ... override fun onCreate(savedInstanceState: Bundle?) { supportFragmentManager.fragmentFactory = RNScreensFragmentFactory() super.onCreate(savedInstanceState) } // ... }
Java
import android.os.Bundle;
import com.swmansion.rnscreens.fragment.restoration.RNScreensFragmentFactory;
// ...
public class MainActivity extends ReactActivity {
// ...
@Override
protected void onCreate(Bundle savedInstanceState) {
getSupportFragmentManager().setFragmentFactory(new RNScreensFragmentFactory());
super.onCreate(savedInstanceState);
}
// ...
}
Related Issues
Sometimes linking, unnecessary whitespaces, flickers may occur if the screen navigation animation does not render properly.