Skip to main content

Upgrade to 1.0.x Guide


Requirements

Node: >=18.0.0 Xcode: >=15.0 Ruby: >=3.0.0 Java: >=17.0.0

Dependencies

Start by updating all the renative dependencies in your project package.json:

"devDependencies": {
"@rnv/template-starter": "1.0.0",
"@rnv/engine-rn": "1.0.0",
"@rnv/engine-rn-tvos": "1.0.0",
"@rnv/engine-rn-next": "1.0.0",
"@rnv/engine-rn-web": "1.0.0",
"@rnv/engine-rn-electron": "1.0.0",
},
"dependencies": {
"@rnv/renative": "1.0.0",
}

and run yarn to update the packages.

Make sure any renative versions referenced in your renative.json are updated to 1.0.0 as well.

"templates": {
"@rnv/template-starter": {
"version": "1.0.0"
}
},

Hooks

Update your hooks to use the new imports. Imports have been moved to @rnv/core package. For more information you can reffer to Core's Node API Documentation. For example, change

import { Logger, executeAsync } from 'rnv';
...
Logger.logTask('Hello World');

to

import { logTask, executeAsync } from '@rnv/core';
logTask('Hello World');

renative.json

If your project renative.json extends a template (for example @rnv/template-starter), make sure the plugins section does not contain any overrides that might impede the upgrade. For example, if you have a plugin override like this:

"plugins": {
"@react-native-community/cli-platform-ios": "source:rnv",
"@react-native-community/cli": "source:rnv",
"react-native-tvos": "source:rnv",
"react-native-web": "source:rnv",
"next": "source:rnv"
}

you should remove it, as the new versions of the plugins will be inherited from the template. If you have added any custom plugins now is a good time to see if you can update these as well but that is something outside the scope of this guide.

Plugins

Plugin definition structure has changed in 1.0.0. If you have plugins defined in your renative.json you should update the structure to the new format. For example, if you have a plugin defined like this:

"plugins": {
"@mapbox/react-native-mapbox-gl": {
"android": {
"implementation": " implementation (project(':mapbox-react-native-mapbox-gl')) {\n implementation ('com.squareup.okhttp3:okhttp:3.6.0') {\n force = true\n }\n }",
"package": "com.mapbox.rctmgl.RCTMGLPackage",
"path": "{{PLUGIN_ROOT}}/android/rctmgl",
"projectName": "mapbox-react-native-mapbox-gl"
},
"ios": {
"appDelegateImports": ["RNCPushNotificationIOS"],
"appDelegateMethods": {
"application": {
"didFailToRegisterForRemoteNotificationsWithError": [
"RNCPushNotificationIOS.didFailToRegisterForRemoteNotificationsWithError(error)"
],
"didReceive": null,
"didReceive": ["RNCPushNotificationIOS.didReceive(notification)"],
"didReceiveRemoteNotification": [
"RNCPushNotificationIOS.didReceiveRemoteNotification(userInfo, fetchCompletionHandler: completionHandler)"
],
"didRegister": ["RNCPushNotificationIOS.didRegister(notificationSettings)"],
"didRegisterForRemoteNotificationsWithDeviceToken": [
"RNCPushNotificationIOS.didRegisterForRemoteNotifications(withDeviceToken: deviceToken)"
]
},
"userNotificationCenter": {
"willPresent": ["completionHandler([.alert, .badge, .sound])"]
}
},
"path": "{{PLUGIN_ROOT}}",
"podName": "RNCPushNotificationIOS"
},
}
}

Both ios and android platforms have suffered some changes to the structure. Most properties are now nested under templateAndroid or templateXcode. For example, the above plugin definition should be updated to:

"plugins": {
"@mapbox/react-native-mapbox-gl": {
"android": {
"templateAndroid": {
"implementation": " implementation (project(':mapbox-react-native-mapbox-gl')) {\n implementation ('com.squareup.okhttp3:okhttp:3.6.0') {\n force = true\n }\n }",
},
"package": "com.mapbox.rctmgl.RCTMGLPackage",
"path": "{{PLUGIN_ROOT}}/android/rctmgl",
"projectName": "mapbox-react-native-mapbox-gl"
},
"ios": {
"templateXcode": {
"appDelegateImports": ["RNCPushNotificationIOS"],
"appDelegateMethods": {
"application": {
"didFailToRegisterForRemoteNotificationsWithError": [
"RNCPushNotificationIOS.didFailToRegisterForRemoteNotificationsWithError(error)"
],
"didReceive": null,
"didReceive": ["RNCPushNotificationIOS.didReceive(notification)"],
"didReceiveRemoteNotification": [
"RNCPushNotificationIOS.didReceiveRemoteNotification(userInfo, fetchCompletionHandler: completionHandler)"
],
"didRegister": ["RNCPushNotificationIOS.didRegister(notificationSettings)"],
"didRegisterForRemoteNotificationsWithDeviceToken": [
"RNCPushNotificationIOS.didRegisterForRemoteNotifications(withDeviceToken: deviceToken)"
]
},
"userNotificationCenter": {
"willPresent": ["completionHandler([.alert, .badge, .sound])"]
}
},
},
"path": "{{PLUGIN_ROOT}}",
"podName": "RNCPushNotificationIOS"
},
}
}

For a full overview of the new plugin definition structure, you can refer to the Plugin Definition Documentation.

Important For iOS and tvOS platforms we migrated from Swift to Objective-C. If you have any Swift code injections in your project you should migrate it to Objective-C.

Overrides

Make sure you doublecheck your overrides to make sure you still need them. For example if you override the whole Podfile from appConfigs/{config}/builds/{platform}/Podfile from version 0.37 it will break the build. A better approach would be to remove the override (rename it for backup) and see if the build still works. If it does, you can remove the override. If it doesn't, you can check the new Podfile from platformBuilds and use that as a baseline for overriding.

Engine tasks

Some of the engine tasks have been removed. Previously there were tasks on certain engines that were more or less aliases for another task. For example, export was an alias for build on the @rnv/engine-rn-web engine. These aliases have been removed and you should use the tasks from the engine directly. For more information on the tasks available for each engine you can refer to the RNV CLI Documentation.

Common Errors

[ info ] could not find suitable task for {task}. GETTING OPTIONS...

see Engine tasks

error Cannot find module 'metro-runtime/src/modules/empty-module.js'

You most likely have some old dependencies that force your project to use an older version of metro or metro-config. These dependencies can be react-native-tvos, react-native. Make sure you are not forcing any resolutions in your package.json and that you are using the versions that RNV comes with. In order for you to get more information on what is causing the issue you can run yarn why metro-runtime and yarn why metro-config to see which dependencies are forcing the older versions.

General error during semantic analysis: Unsupported class file major version 61

Check your renative.json files for gradleWrapperVersion and kotlinVersion and make sure they are set to 8.3 and 1.8.0 respectively or greater.

Dependency 'XXXXXX' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs.

Check your renative.json files for targetSdkVersion and compileSdkVersion and make sure they are set to the correct version.