• Stars
    star
    1,540
  • Rank 30,382 (Top 0.6 %)
  • Language
    Elm
  • License
    BSD 3-Clause "New...
  • Created about 9 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[CLOSED] Experiment: mobile apps in Elm using React Native.

Elm Native UI Build Status

THIS PROJECT IS NOT MAINTAINED. If you want to become the maintainer, see issue #90. The code is from 2017 and the facilities used here are not applicable to current versions of Elm.

Experimental support for writing native iOS and Android applications in the beautiful functional Elm language. This project builds on Facebook's React Native, using it as the JavaScript environment for Elm.

Frequently Asked Questions

Is This Production Ready?

No. This is really just an experiment, and it is not under active development. People have used it for applications despite this.

Why React Native?

Mobile applications are expected to look and feel at home on the device and the OS it is running. This goal cannot really be achieved with a WebView-based solution (such as Cordova). React Native applications use the same pieces of UI as an app built with Objective-C or Java, choosing the platform-specific native variant of the UI feature for you.

Will it always be React Native?

In the long term, not necessarily. The ultimate goal would be for Elm Native UI to be a standalone project, complete with the mobile platform groundwork that has been put into React Native already. It has not been fully assessed how much work this would in reality entail.

Addendum 2017-10-17: elm-ios was a Google Summer of Code project that explored this idea for iOS.

Get it running

Caution: Experimental software!

Elm Native UI may get breaking changes at any time, and it might only work with an older version of React Native.

Actually getting it running

Install React Native following their guide. Check that you can create a new project:

$ react-native init MyAppName --version 0.44.3

and try running it on a real or virtual device.

Once that works, clone this repository in the same directory where you ran react-native init in. You should have a directory structure similar to this:

│
├── elm-native-ui
└── MyAppName

Go ahead and copy the files from the examples/Counter folder into your React Native app directory now.

Now try to compile the Elm code with

$ npm run compile

This will create the elm-package.json and elm-stuff for you, even though it won't compile yet.

Edit the index.*.js files' last lines in case your React Native app is not called 'MyAppName' at this point. You may also need to rename the project in the package.json file.

You can then use e.g. elm_self_publish to publish the Elm Native UI package into our project.

Assuming we're in the parent directory where elm-native-ui reside:

$ python path/to/elm_self_publish.py ./elm-native-ui ./MyAppName

Now we are ready to rock! 🤘🎸

Just to list out the basics:

# install dependencies
$ npm install
# compile Elm with
$ npm run compile
# run app on iOS
$ react-native run-ios
# or run on Android
$ react-native run-android

When you make changes to the code, you only need to recompile Elm and press Cmd-R on the Simulator (iOS) or refresh the emulator (Android).

If you wish, you can also start a file watcher for *.elm files, which will recompile whenever you make a change:

$ npm start

React native versions

If you use the package.json files from the example projects, you'll get the react native version that has been tested and known to be working with the examples.

That is currently react-native 0.44.3

Later versions of react native may work, however, specifically in the subsequent react native 0.45.x release the "Navigation Experimental" module was depricated and moved to an external library, so the Navigation Example will not work. The intention is to port this to "React Navigation", which is now the accepted approach for react apps. The counter app still works, so if you don't use navigation your app should work with more recent versions.

How it works

This section was outdated, but for an overview of the older structure, read this blog post: Elm Native UI: Writing a React Native app in Elm

You can also watch this ElmCast Live episode, where @ohanhi explains some of the differences between the old and the new versions. (You can safely skip the first 5 minutes, as we had technical issues in the beginning.)

Screenshots

iOS Android

To Do

  • Basic PoC
    • Show something from Elm
    • Make basic VTree work
    • Add some kind of event handlers
  • Library
  • Styles
    • Basic types for styles
    • Support object type styles - transform styles and shadowOffset
    • Make enum type styles safer
    • Allow the StyleSheet.create method for styles
  • Props
    • Improved event handlers
    • Support props besides styles and event handlers
    • Unify syntax for styles, handlers and other props
  • Core features
    • Navigation (NavigationExperimental)
    • Tasks (HTTP calls, storage)
    • UIExplorer / Component examples

License

BSD (3-clause)

More Repositories

1

hyperscript-helpers

Terse syntax for hyperscript.
JavaScript
628
star
2

elm-shared-state

Example app on managing shared state in large Elm SPAs. (ex elm-taco)
Elm
302
star
3

elm-style-guide

Opinionated best practices for Elm code style, comments and contributions welcome!
75
star
4

elm-ement

The "Hello world" of Elm + Web Components.
JavaScript
50
star
5

keyboard-extra

Nice handling for keyboard inputs in Elm
Elm
49
star
6

elm-quicks

Tiny lessons gradually teaching Elm
Elm
44
star
7

elm-game-base

Example base for a game in Elm 0.19
Elm
31
star
8

elm-chronographify

Elm
25
star
9

trains

Elm SPA for live station schedules for Helsinki region commuter trains
Elm
25
star
10

keyboard

Nice handling for keyboard inputs in Elm
Elm
23
star
11

remotedata-http

A collection of helper functions for server communication using RemoteData
Elm
23
star
12

svg-css-backgrounds

Multicolor SVGs as CSS backgrounds
CSS
22
star
13

fish-elm-completions

Elm related completions for the friendly interactive shell
Shell
21
star
14

polymer-in-elm

Experimenting with using Polymer elements in Elm applications
JavaScript
16
star
15

autoexpand

Autoexpanding textarea in Elm
Elm
15
star
16

elm-web-data

Elm
11
star
17

bike-wars

Two-player local multiplayer game with light bikes
Elm
9
star
18

lorem

Placeholder text for your Elm apps
Elm
9
star
19

minimoka-gnome-shell

Minimalistic Gnome Shell Theme
CSS
7
star
20

decoder-examples

Some examples of decoding JSON in Elm
Elm
5
star
21

declarative-polymer

Experiments on making purely declarative Polymer apps
HTML
5
star
22

elm-native-ui-stopwatch

Elm
4
star
23

brunch-with-cycle

JavaScript
3
star
24

elmvaders

Simple Space Invaders clone in Elm
Elm
3
star
25

showroom-3d

Polymer element for easy display of your 3D models. Uses Three.js WebGL rendering.
JavaScript
3
star
26

chartist-elements

Polymer elements for Chartist
HTML
3
star
27

ohanhi.com

My website's source code
JavaScript
2
star
28

elm-html-drag-and-drop

Elm
2
star
29

chilicorn-friendly-time

JavaScript
2
star
30

elm-tasks-example

Simple example app utilizing Tasks
HTML
2
star
31

elm-child-parent

Super simple StartApp demo of child component using parent's action
HTML
2
star
32

remotedata-talk-examples

Elm
2
star
33

secret-message

Elm
2
star
34

find-princess

Elm
1
star
35

fp-in-haskell-course

Code related to the Functional Programming in Haskell MOOC
Haskell
1
star
36

advent-of-code-2017

Elm solutions for adventofcode.com/2017/
Elm
1
star
37

ohanhi.github.io

DEPRECATED, see `ohanhi/ohanhi.com` instead!
JavaScript
1
star