Reputation: 7398
I'm migrating my project from React Native 0.59.9 to 0.61.0 (not advisable, but I have my own reasons). In my existing project I have the following code in MainApplication.java
:
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
RollbarReactNative.getPackage(),
new VectorIconsPackage(),
new RNTextInputMaskPackage(),
new SplashScreenReactPackage(),
new RNSensitiveInfoPackage(),
new ReactNativeRestartPackage(),
new PickerViewPackage(),
new LinearGradientPackage(),
new ImagePickerPackage(),
new RNGestureHandlerPackage(),
new RNDeviceInfo(),
new A0Auth0Package(),
new AsyncStoragePackage()
);
}
In MainApplication.java
in v0.61.0 the following code is auto-generated (corresponds to the code above):
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
Does it make sense that I would add the packages from the first part of the code to the second like:
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
packages.add(new MainReactPackage())
packages.add(RollbarReactNative.getPackage())
packages.add(new VectorIconsPackage())
packages.add(new RNTextInputMaskPackage())
packages.add(new SplashScreenReactPackage())
packages.add(new RNSensitiveInfoPackage())
packages.add(new ReactNativeRestartPackage())
packages.add(new PickerViewPackage())
packages.add(new LinearGradientPackage())
packages.add(new ImagePickerPackage())
packages.add(new RNGestureHandlerPackage())
packages.add(new RNDeviceInfo())
packages.add(new A0Auth0Package())
packages.add(new AsyncStoragePackage())
return packages;
}
Does this make sense?
Upvotes: 7
Views: 5197
Reputation: 685
if you are using RN > 0.60 , it's no longer needed to add packages manually in your MainApplication.java file as they are auto-linked
Upvotes: 0
Reputation: 1290
You don't need to add the packages anymore. RN0.60 and above supports auto-linking. I commented out my packages because they are no longer needed.
You will definitely get a similar warning as the image below if you add them.
Upvotes: 11