ohanhi / elm-native-ui

[CLOSED] Experiment: mobile apps in Elm using React Native.
BSD 3-Clause "New" or "Revised" License
1.54k stars 76 forks source link

Porting an Elm web app (using Html) to elm-native #97

Closed llaisdy closed 6 years ago

llaisdy commented 6 years ago

Dear All

Not really an issue, more a query. We have a working Elm web app, embedded in a html page, using css files. I've been using phonegap to create an Android-installable version of this app. With phonegap I've been basically bundling up all the html, css and js files more-or-less unchanged into the Android app.

We would like to use elm-native-ui instead of phonegap. I have run the Counter example & installed on an Android device.

Is it possible to use elm-native-ui with Elm's Html, embedding the Elm app in a html page?

Would it be necessary (easier, better) to use elm-native-ui's NativeUi modules (as with the examples)?

One of our app's functions is to open remote web pages: html links in the app open up the device's web browser. Would similar functionality be available in elm-native-ui?

With thanks and best wishes

Ivan

ps I saw the thread about maintainers. If we can use this library I would be interested in helping maintain, document and improve.

maxkwallace commented 6 years ago

@llaisdy this is my understanding, though it may be incorrect:

Because elm-native-ui delegates rendering the actual Native UI to React Native under the hood, the UI components elm-native-ui gives you delegate to React Native Native UI components.

In code, these native components are a totally different "tree" of elements than the one Elm's Html gives you, though there are some similarities. I'm not totally sure I understand your question (it's a bit unclear to me), but no, you won't be able to use elm-native-ui with Elm's Html-- unless you wrote a function to take an Elm Html tree as an argument, and return a tree of elm-native-ui components.

So it is necessary, in the end, to use elm-native-ui's NativeUi components. Because otherwise you are trying to render native UI using HTML.... which is exactly what a web browser does. You have to return native UI components eventually, but there's nothing stopping you from using Elm Html objects as an intermediate representation.

Re:

One of our app's functions is to open remote web pages: html links in the app open up the device's web browser. Would similar functionality be available in elm-native-ui?

If that functionality is available in React Native (it should be), then it should be available in elm-native-ui.

llaisdy commented 6 years ago

Thanks, I thought as much. Writing a function to convert the Elm Html components into native ui components is not a bad idea.