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

NativeApi.Platform.os to check OS #62

Closed iancanderson closed 7 years ago

iancanderson commented 7 years ago

This adds a NativeApi.Platform module, which exposes an os function. It returns a NativeApi.Platform.OS union type, which is either Android or IOS.

So in your app, you can now check for the platform:

import NativeApi.Platform as Platform exposing (OS(..))

topMargin : Float
topMargin =
    case Platform.os of
        Android ->
            10

        IOS ->
            20
ohanhi commented 7 years ago

Sweet, thanks!