#2819·cli

Add ```react-native-screens``` native configs in Android during new app initialization

Author: I-am-Pritam-20Created Jul 8, 2026Updated Jul 8, 2026
Labelsfeature request

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/cli apps , 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.

Source: react-native-community/cli