Embed WaveMaker React Native apps into Native Apps
From WaveMaker 11.3 onwards, React Native apps can be embeded into the native application. By using the CLI command and inital changes to Native App, WaveMaker is adding React Native project code to Native code.
Requirements
- JDK 11
- Apache Maven 3.8.2
- Node 18.16.1
- npm 9.5.1
- wm-reactnative-cli and its requirements
When using this feature, you can add WaveMaker app to an existing native application, such as a small component or an SPA, or even a micro application.
How it works
Once the code is converted to a native app, by running the CLI commands, React Native code inside the Embedded Application can be updated. However, for the first time, you must implement the following setup.
WaveMaker Embed Command
To embed React native apps into native apps, changes are required in both React Native project and the Native project. @wavemaker/wm-reactnative-cli will handle the react native project requirements. In order for changes in the Native project, follow the steps below.
Android
- Download the React Native Project zip from Export as ReactNative Zip Dialog and execute the command below.
After the command is executed, embed should get generated in the following path dest_path/android-embed.
Add the following line in project-level build.gradle.
- Add the below line in project-level settings.gradle.
- Add rnApp as a dependency in the app module build.gradle.
Make the MainApplication class inherit React Native Application Class.
Add the below code to start React native app.
- Fix dependency issues.
iOS
For changes in the Native project, follow the steps below:
Extract rnApp.zip, provided by WaveMaker. Copy the rnApp folder to the iOS project.
Open the Native project in Xcode.
Add the rnApp folder to the project in a new group.
- Add main.jsbundle and assets folder files to the project folder.
The rnApp folder acts a placeholder and gets replaced with the actual content during the embed process.
In project info.list, set
UIViewControllerBasedStatusBarAppearance
as false.In the project bridge header, add
#import "ReactNativeView.h"
.Pod file changes required to React Native app are given by WaveMaker.
Resolve dependencies.
Using ReactNativePageView or ReactNativeHostingController, React Native app can be launched.
Example
Android
Download the React Native Project zip from Export as ReactNative Zip Dialog and execute the command below.
Create a New Android project with Basic Activity.


execute the
wm-reactnative-cli
command by passing both Path values of android project and Native Zip.once the Embed is done, make the following changes in the
android-embed
folder.
build.gradle Project Level
build.gradle App Level
Add implementation (project(':rnApp'))
to dependencies
settings.gradle
AndroidManifest.xml
Add android:name=".MainApplication"
to application
tag in rnApp/src/main/AndroidManifest.xml
file.
Activity Main Xml
Add button to app/src/main/res/layout/activity_main.xml
Native App MainActivity
- After these changes Build and run the Application.
IOS
Podfile
ViewController
Preview

Communicate from React Native JS to Native Layer
Implementing Actions in Android Project
- Include the following as a dependency into the module.
- Import package
- Implement action
Implementing actions in iOS project
- Import package
- Implement action