I worked on a similar project where I needed to run other React Native projects within a React Native application, similar to the WeChat app. After extensive research and development, I succeeded with the following method:
1. Main Application: I developed the main application using React Native CLI.
2. Modular Applications: I developed the projects to be added as modules using Expo.
3. Expo Build: I built the applications developed with Expo using the expo build:web command and uploaded them to my server.
4. Module List: In the main application, I retrieved the list of modules from the server in JSON format and listed them.
5. WebView: I used WebView to run the selected application from the list within the main application.
Additionally, I even developed a module application that lists, connects to, and sends data to Bluetooth devices using this method. In the main application, I prepared a BLE (Bluetooth Low Energy) library to facilitate communication between the two applications as follows:
function sendDataToWebView(messageType: string, messageContent: any) {
var data = {
messageType: messageType,
messageContent: messageContent,
};
webviewRef.current.postMessage(JSON.stringify(data));
}
With this method, I was able to seamlessly exchange data between the main application and the modular applications.
I hope this gives you an idea. If you have any questions regarding this method, I would be happy to answer them.