1.0.4 • Published 4 years ago
react-native-template-joyjet v1.0.4
Installation
- To install and use this template the process is very simple, just create a new project using the command:
react-native init AwesomeExample --template react-native-template-joyjet
- After the project is created, you can delete the
App.js
file from the root, as theindex.js
file now points to the src folder.
With this the project will be created with all the template dependencies properly installed and linked, as well as the configuration files that are copied to the project.
Additional Step on Android
For gestures to be enabled on Android, one more step is needed, which is very simple, open the file android/app/src/main/java/<project_package>/MainActivity.java
, and start importing the packages as below:
// ...
import com.facebook.react.ReactActivity;
// Imports added
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
After importing, let's create a new method, just below getMainComponentName()
, getting:
public class MainActivity extends ReactActivity {
@Override
protected String getMainComponentName() { ... }
// Method added
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
}
}