-
Notifications
You must be signed in to change notification settings - Fork 25
/
API.purs
25 lines (18 loc) · 788 Bytes
/
API.purs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module ReactNative.API (
alert, ALERT
, keyboardDismiss
, registerComponent, REGISTER
) where
import Control.Monad.Eff (kind Effect, Eff)
import Data.Function.Uncurried (Fn4, runFn4)
import Data.Maybe (Maybe)
import Data.Nullable (Nullable, toNullable)
import Data.Unit (Unit)
import React (ReactClass)
foreign import data ALERT :: Effect
foreign import alertImpl :: forall e b o. Fn4 String (Nullable String) b o (Eff (alert::ALERT|e) Unit)
alert :: forall e. String -> Maybe String -> Eff (alert::ALERT|e) Unit
alert s ms = runFn4 alertImpl s (toNullable ms) [] {}
foreign import keyboardDismiss :: forall eff. Eff eff Unit
foreign import data REGISTER :: Effect
foreign import registerComponent :: forall e props. String -> ReactClass props -> Eff (register::REGISTER|e) Unit