react-native-community / react-native-community/cli
Add ```react-native-screens``` native configs in Android during new app initialization
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 949
- PR merge metrics
- No merged PRs in 30d
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Android initialization templates used when a new React Native app is created, including the Java and Kotlin MainActivity variants. Compare them with the react-native-screens setup described in the linked React Navigation documentation. Done means newly generated Android apps include the required native configuration without manual changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kotlin, react-native
- Domain
- cli, mobile
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100