Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Support React Native? #1136

Closed
L1lith opened this issue Sep 28, 2022 · 7 comments
Closed

[Feature request] Support React Native? #1136

L1lith opened this issue Sep 28, 2022 · 7 comments
Labels

Comments

@L1lith
Copy link
Contributor

L1lith commented Sep 28, 2022

Is your feature request related to a problem? Please describe.
Johannes Stein describes the architecture differences between React Native and Cordova

Cordova

On mobile devices, Cordova is running a single-page application inside the integrated mobile web browser, called WebView, and then wrapping that as a native application. While it looks like a native application from the outside, our web code is running inside the mobile browser engine.

React Native

React Native has its own packager. It bundles all the JavaScript files into one giant file, which is then consumed and executed by JavaScriptCore, Apple’s JavaScript engine. JavaScriptCore is being used on iOS and Android, while ChakraCore is powering React Native UWP applications.

I think the advantage here is that we only need to run the JS engine, rather than run the entire browser (which has a lot of feature bloat)

Describe the solution you'd like
We could build some kind of component system for making MelonJS games in React native (especially since we've already done the work to implement modules)

Describe alternatives you've considered
I'm not sure I'm not an expert in mobile dev

Additional context
I haven't yet tested the Cordova version, it would be good to do performance measurements

@obiot
Copy link
Member

obiot commented Sep 29, 2022

I haven't use react native as a bundler, but one of the advantage of Cordova is (or was maybe since it's not being updated anymore) is all the monetisation plugins. Capacitor can use the Cordova plugins (assuming they have been updated), but I'm not sure about react native ?

@L1lith
Copy link
Contributor Author

L1lith commented Sep 29, 2022

I haven't use react native as a bundler, but one of the advantage of Cordova is (or was maybe since it's not being updated anymore) is all the monetisation plugins. Capacitor can use the Cordova plugins (assuming they have been updated), but I'm not sure about react native ?

Here's one way someone did it, react native targets native device APIs (see the Android Native Modules and iOS native modules) so I think you should be able to use not only ad/monetization libraries made for your target platform, but you can also port any other features/libraries specific to your platform of choice.

@obiot
Copy link
Member

obiot commented Sep 30, 2022

oh super interesting, I really need to look into it, thanks for sharing that !

@obiot
Copy link
Member

obiot commented Sep 30, 2022

to come back on the original request on supporting react native, it seems that it could just about adding https://www.npmjs.com/package/@flyskywhy/react-native-gcanvas as part of the project boilerplate dependencies ?

we really need to try :)

@obiot
Copy link
Member

obiot commented Sep 30, 2022

@obiot
Copy link
Member

obiot commented Sep 30, 2022

I'm really still favouring more capacitor though, to be honest :
https://capacitorjs.com/blog/native-react-apps-without-react-native

@obiot
Copy link
Member

obiot commented Jan 30, 2023

FYI, this project uses React and other framework/components with melonJS:
https://github.com/l3wi/gearbox-ninja

point being that It does not seems like we need anything particular to be changed in melonJS, beside for the user to be bundling it with melonJS, so until/unless someone comes up with what (else) specifically we would be missing I will close this ticket.

also, as a reminder, in a previous version we added the possibility to provide a custom renderer:
#1139

@obiot obiot closed this as completed Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants