",
7 | "license": "MIT",
8 | "workspaces": [
9 | "packages/*"
10 | ],
11 | "scripts": {
12 | "format:most": "prettier --write \"**/*.{md,json,js,css}\"",
13 | "format:re": "find ./packages -iname '*.re' | xargs bsrefmt --in-place && find ./packages -iname '*.rei' | xargs bsrefmt -i true --in-place && find ./test -iname '*.re' | xargs bsrefmt --in-place && find ./template -iname '*.re' | xargs bsrefmt --in-place",
14 | "format": "yarn format:most && yarn format:re",
15 | "watch": "run-p watch:reason-expo watch:test",
16 | "watch:reason-expo": "cd packages/reason-expo && yarn watch",
17 | "watch:test": "cd packages/test && yarn watch",
18 | "start-test-app": "cd packages/test && yarn start",
19 | "re:clean-build": "bsb -clean-world -make-world",
20 | "test-build": "cd packages/test && bsb -clean-world -make-world",
21 | "dev": "run-p watch start-test-app"
22 | },
23 | "devDependencies": {
24 | "npm-run-all": "^4.1.5",
25 | "husky": "^1.3.1",
26 | "lint-staged": "^10.1.1",
27 | "prettier": "^1.16.4"
28 | },
29 | "prettier": {
30 | "trailingComma": "all",
31 | "proseWrap": "always"
32 | },
33 | "lint-staged": {
34 | "*.{md,json,js,css}": [
35 | "prettier --write"
36 | ],
37 | "*.{re,rei}": [
38 | "bsrefmt --in-place"
39 | ]
40 | },
41 | "husky": {
42 | "hooks": {
43 | "pre-commit": "lint-staged"
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/packages/reason-expo/src/VectorIcons.re:
--------------------------------------------------------------------------------
1 | module MaterialIcons = {
2 | [@bs.module "@expo/vector-icons"] [@react.component]
3 | external make: (~name: string, ~size: int, ~color: string) => React.element =
4 | "MaterialIcons";
5 | };
6 |
7 | module Ionicons = {
8 | [@bs.module "@expo/vector-icons"] [@react.component]
9 | external make: (~name: string, ~size: int, ~color: string) => React.element =
10 | "Ionicons";
11 | };
12 |
13 | module Entypo = {
14 | [@bs.module "@expo/vector-icons"] [@react.component]
15 | external make: (~name: string, ~size: int, ~color: string) => React.element =
16 | "Entypo";
17 | };
18 |
19 | module EvilIcons = {
20 | [@bs.module "@expo/vector-icons"] [@react.component]
21 | external make: (~name: string, ~size: int, ~color: string) => React.element =
22 | "EvilIcons";
23 | };
24 |
25 | module FontAwesome = {
26 | [@bs.module "@expo/vector-icons"] [@react.component]
27 | external make: (~name: string, ~size: int, ~color: string) => React.element =
28 | "FontAwesome";
29 | };
30 |
31 | module Foundation = {
32 | [@bs.module "@expo/vector-icons"] [@react.component]
33 | external make: (~name: string, ~size: int, ~color: string) => React.element =
34 | "Foundation";
35 | };
36 |
37 | module MaterialCommunityIcons = {
38 | [@bs.module "@expo/vector-icons"] [@react.component]
39 | external make: (~name: string, ~size: int, ~color: string) => React.element =
40 | "MaterialCommunityIcons";
41 | };
42 |
43 | module Octicons = {
44 | [@bs.module "@expo/vector-icons"] [@react.component]
45 | external make: (~name: string, ~size: int, ~color: string) => React.element =
46 | "Octicons";
47 | };
48 |
--------------------------------------------------------------------------------
/packages/reason-expo/src/Permissions.re:
--------------------------------------------------------------------------------
1 | type t =
2 | | Notifications
3 | | Location
4 | | Camera
5 | | AudioRecording
6 | | Contacts
7 | | CameraRoll
8 | | UserFacingNotifications
9 | | SystemBrightness
10 | | Calendar
11 | | Reminders;
12 |
13 | [@bs.module "expo-permissions"] external location: string = "LOCATION";
14 |
15 | [@bs.module "expo-permissions"] external camera: string = "CAMERA";
16 |
17 | [@bs.module "expo-permissions"]
18 | external audioRecording: string = "AUDIO_RECORDING";
19 |
20 | [@bs.module "expo-permissions"] external contacts: string = "CONTACTS";
21 |
22 | [@bs.module "expo-permissions"] external cameraRoll: string = "CAMERA_ROLL";
23 |
24 | [@bs.module "expo-permissions"] external calendar: string = "CALENDAR";
25 |
26 | [@bs.module "expo-permissions"] external reminders: string = "REMINDERS";
27 |
28 | [@bs.module "expo-permissions"]
29 | external userFacingNotifications: string = "USER_FACING_NOTIFICATIONS";
30 |
31 | [@bs.module "expo-permissions"]
32 | external notification: string = "NOTIFICATIONS";
33 |
34 | [@bs.module "expo-permissions"]
35 | external systemBrightness: string = "SYSTEM_BRIGHTNESS";
36 |
37 | let toString = p =>
38 | switch (p) {
39 | | Notifications => notification
40 | | Location => location
41 | | Camera => camera
42 | | AudioRecording => audioRecording
43 | | UserFacingNotifications => userFacingNotifications
44 | | Contacts => contacts
45 | | CameraRoll => cameraRoll
46 | | SystemBrightness => systemBrightness
47 | | Calendar => calendar
48 | | Reminders => reminders
49 | };
50 |
51 | [@bs.module "expo-permissions"]
52 | external _get: string => Js.Promise.t('b) = "getAsync";
53 |
54 | let getAsync = permission => _get(toString(permission));
55 |
56 | [@bs.module "expo-permissions"]
57 | external _ask: string => Js.Promise.t('b) = "askAsync";
58 |
59 | let askAsync = permission => _ask(toString(permission));
--------------------------------------------------------------------------------
/packages/reason-expo/src/ImagePicker.re:
--------------------------------------------------------------------------------
1 | module MediaTypeOptions = {
2 | [@bs.module "expo-image-picker"] [@bs.scope "MediaTypeOptions"]
3 | external images: string = "Images";
4 | [@bs.module "expo-image-picker"] [@bs.scope "MediaTypeOptions"]
5 | external videos: string = "Videos";
6 | [@bs.module "expo-image-picker"] [@bs.scope "MediaTypeOptions"]
7 | external all: string = "all";
8 | };
9 |
10 | [@bs.deriving abstract]
11 | type launchImageLibraryAsyncOptions = {
12 | mediaTypes: string,
13 | allowsEditing: bool,
14 | aspect: array(int),
15 | quality: float,
16 | base64: bool,
17 | exif: bool,
18 | };
19 |
20 | [@bs.deriving abstract]
21 | type launchImageLibraryAsyncResult = {
22 | cancelled: bool,
23 | [@bs.optional]
24 | uri: string,
25 | [@bs.optional]
26 | width: float,
27 | [@bs.optional]
28 | height: float,
29 | [@bs.optional] [@bs.as "type"]
30 | _type: string,
31 | [@bs.optional]
32 | duration: float,
33 | [@bs.optional]
34 | base64: string,
35 | [@bs.optional]
36 | exif: string,
37 | };
38 |
39 | [@bs.module "expo-image-picker"]
40 | external launchImageLibraryAsync:
41 | launchImageLibraryAsyncOptions => launchImageLibraryAsyncResult =
42 | "launchImageLibraryAsync";
43 |
44 | [@bs.deriving abstract]
45 | type launchCameraAsyncOptions = {
46 | allowsEditing: bool,
47 | aspect: array(int),
48 | quality: float,
49 | base64: bool,
50 | exif: bool,
51 | };
52 |
53 | [@bs.deriving abstract]
54 | type launchCameraAsyncResult = {
55 | cancelled: bool,
56 | [@bs.optional]
57 | uri: string,
58 | [@bs.optional]
59 | width: float,
60 | [@bs.optional]
61 | height: float,
62 | [@bs.optional]
63 | duration: float,
64 | [@bs.optional]
65 | base64: string,
66 | [@bs.optional]
67 | exif: string,
68 | };
69 |
70 | [@bs.module "expo-image-picker"]
71 | external launchCameraAsync: launchCameraAsyncOptions => launchCameraAsyncResult =
72 | "launchCameraAsync";
--------------------------------------------------------------------------------
/packages/reason-expo/src/SQLite.re:
--------------------------------------------------------------------------------
1 | /*
2 | Usage:
3 |
4 | let db = openDatabase("test");
5 |
6 | Database.transaction(
7 | db,
8 | t =>
9 | Transaction.(
10 | executeSql(
11 | t,
12 | "SELECT something FROM that_table",
13 | [`String("A string argument"), `Float(3.)],
14 | (_transaction, rs: resultSet({..})) => Js.log(rs),
15 | (_transaction, error) => Js.log(error),
16 | )
17 | )
18 | |> ignore,
19 | (_) => (),
20 | () => (),
21 | ); */
22 |
23 | module Transaction = {
24 | type t;
25 |
26 | [@bs.deriving abstract]
27 | type resultSetRows('row) = {
28 | length: string,
29 | item: int => 'row,
30 | _array: array('row),
31 | };
32 |
33 | [@bs.deriving abstract]
34 | type resultSet('row) = {
35 | insertId: int,
36 | rowsAffected: int,
37 | rows: resultSetRows('row),
38 | };
39 |
40 | type arguments = list([ | `String(string) | `Float(float)]);
41 |
42 | type rawArguments;
43 | external rawArguments: 'a => rawArguments = "%identity";
44 |
45 | let _encodeArguments = (args: arguments) =>
46 | Array.map(
47 | a =>
48 | switch (a) {
49 | | `String(s) => rawArguments(s)
50 | | `Float(f) => rawArguments(f)
51 | },
52 | Array.of_list(args),
53 | );
54 |
55 | [@bs.send]
56 | external _executeSql:
57 | (
58 | t,
59 | string,
60 | array(rawArguments),
61 | (t, resultSet('row)) => unit,
62 | (t, 'errorType) => unit
63 | ) =>
64 | Js.Promise.t(unit) =
65 | "executeSql";
66 |
67 | let executeSql = (transaction, sqlStatement, arguments, success, error) =>
68 | _executeSql(
69 | transaction,
70 | sqlStatement,
71 | _encodeArguments(arguments),
72 | success,
73 | error,
74 | );
75 | };
76 |
77 | module Database = {
78 | type t;
79 |
80 | [@bs.send]
81 | external transaction:
82 | (t, Transaction.t => unit, string => unit, unit => unit) =>
83 | Js.Promise.t(unit) =
84 | "transaction";
85 | };
86 |
87 | [@bs.module "expo-sqlite"]
88 | external openDatabase: string => Database.t = "openDatabase";
--------------------------------------------------------------------------------
/packages/reason-expo/src/WebBrowser.re:
--------------------------------------------------------------------------------
1 | [@bs.deriving abstract]
2 | type openBrowserAsyncResult = {
3 | [@bs.as "type"]
4 | _type: string,
5 | };
6 |
7 | [@bs.deriving abstract]
8 | type openBrowserAsyncOptions = {
9 | [@bs.optional]
10 | toolbarColor: string,
11 | [@bs.optional]
12 | collapseToolbar: bool,
13 | [@bs.optional]
14 | controlsColor: string,
15 | [@bs.optional]
16 | showTitle: bool,
17 | [@bs.optional]
18 | package: string,
19 | };
20 |
21 | [@bs.module "expo-web-browser"]
22 | external openBrowserAsync: string => Js.Promise.t(openBrowserAsyncResult) =
23 | "openBrowserAsync";
24 |
25 | [@bs.deriving abstract]
26 | type openAuthSessionAsyncResult = {
27 | [@bs.as "type"]
28 | _type: string,
29 | };
30 |
31 | [@bs.module "expo-web-browser"]
32 | external _openAuthSessionAsync:
33 | (string, string) => Js.Promise.t(openAuthSessionAsyncResult) =
34 | "openAuthSessionAsync";
35 |
36 | let openAuthSessionAsync = (~url, ~redirectUrl=Constants.linkingUrl, ()) =>
37 | _openAuthSessionAsync(url, redirectUrl);
38 |
39 | [@bs.deriving abstract]
40 | type warmUpAsyncResult = {package: string};
41 |
42 | [@bs.module "expo-web-browser"]
43 | external warmUpAsync: string => Js.Promise.t(warmUpAsyncResult) =
44 | "warmUpAsync";
45 |
46 | [@bs.deriving abstract]
47 | type mayInitWithUrlAsyncResult = {package: string};
48 |
49 | [@bs.module "expo-web-browser"]
50 | external mayInitWithUrlAsync:
51 | (string, string) => Js.Promise.t(mayInitWithUrlAsyncResult) =
52 | "mayInitWithUrlAsync";
53 |
54 | [@bs.deriving abstract]
55 | type coolDownAsyncResult = {package: string};
56 |
57 | [@bs.module "expo-web-browser"]
58 | external coolDownAsync: string => Js.Promise.t(coolDownAsyncResult) =
59 | "coolDownAsync";
60 |
61 | [@bs.deriving abstract]
62 | type dismissBrowserResult = {
63 | [@bs.as "type"]
64 | _type: string,
65 | };
66 |
67 | [@bs.module "expo-web-browser"]
68 | external dismissBrowser: unit => Js.Promise.t(dismissBrowserResult) =
69 | "dismissBrowser";
70 |
71 | [@bs.deriving abstract]
72 | type getCustomTabsSupportingBrowsersResult = {
73 | browserPackages: array(string),
74 | [@bs.optional]
75 | defaultBrowserPackage: string,
76 | servicePackages: array(string),
77 | [@bs.optional]
78 | preferredBrowserPackage: string,
79 | };
80 |
81 | [@bs.module "expo-web-browser"]
82 | external getCustomTabsSupportingBrowsers:
83 | unit => Js.Promise.t(getCustomTabsSupportingBrowsersResult) =
84 | "getCustomTabsSupportingBrowsers";
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | reason-expo
7 |
8 |
9 |
10 | ReasonML bindings for Expo
11 |
12 |
13 | ---
14 |
15 |
16 |
17 | [](https://www.npmjs.com/package/reason-expo)
18 |
19 |
20 |
21 | ## Versioning
22 |
23 | This library doesn't follow conventional semver. The version scheme is shown below, and you should track this library accordingly.
24 |
25 | `..`
26 |
27 | ## Getting started
28 |
29 | Use the Expo CLI to bootstrap a project with the ReasonExpo template.
30 |
31 | ```
32 | expo init --template expo-template-reason
33 | ```
34 |
35 | Already have an existing Expo Project? Go into your project root & then install the requirements:
36 |
37 | ```bash
38 | yarn add bs-platform --dev
39 | yarn add reason-react reason-react-native reason-expo
40 | ```
41 |
42 | Next, create a file named bsconfig.json at the same level at your package.json with the following content:
43 |
44 | ```json
45 | {
46 | "name": "my-reason-expo-app",
47 | "reason": {
48 | "react-jsx": 3
49 | },
50 | "bsc-flags": ["-bs-super-errors"],
51 | "bs-dependencies": ["reason-react", "reason-react-native", "reason-expo"],
52 | "sources": [
53 | {
54 | "dir": "src"
55 | }
56 | ],
57 | "suffix": ".bs.js",
58 | "refmt": 3,
59 | "package-specs": {
60 | "module": "es6",
61 | "in-source": true
62 | }
63 | }
64 | ```
65 |
66 | Next, add these scripts to your package.json:
67 |
68 | ```json
69 | "build-reason": "bsb -make-world",
70 | "watch-reason": "bsb -make-world -w",
71 | "build-reason-clean": "bsb -clean-world -make-world",
72 | ```
73 |
74 | Finally, make a folder named `src` and start writing your ReasonML code in there. `yarn build-reason` will compile the ReasonML code in that folder for you to import and use in your Expo app's JS/TS code.
75 |
76 | ## Contributing
77 |
78 | Fork this repo, clone it onto your machine, install run `yarn` in the root directory. Start the compiler and Expo test app with `yarn dev` in the root directory, and start hacking away at the files in `packages/reason-expo` and `packages/test`!
79 |
80 | _Credit: This project is based on the work started in [`bs-expo`](https://github.com/fxfactorial/bs-expo/)._
81 |
--------------------------------------------------------------------------------
/packages/reason-expo/src/FaceDetector.re:
--------------------------------------------------------------------------------
1 | module Constants = {
2 | module Mode = {
3 | type t;
4 |
5 | [@bs.module "expo-face-detector"] [@bs.scope ("Constants", "Mode")]
6 | external fast: t = "fast";
7 |
8 | [@bs.module "expo-face-detector"] [@bs.scope ("Constants", "Mode")]
9 | external accurate: t = "accurate";
10 | };
11 |
12 | module Landmarks = {
13 | type t;
14 |
15 | [@bs.module "expo-face-detector"] [@bs.scope ("Constants", "Landmarks")]
16 | external all: t = "all";
17 |
18 | [@bs.module "expo-face-detector"] [@bs.scope ("Constants", "Landmarks")]
19 | external none: t = "none";
20 | };
21 |
22 | module Classifications = {
23 | type t;
24 |
25 | [@bs.module "expo-face-detector"]
26 | [@bs.scope ("Constants", "Classifications")]
27 | external all: t = "all";
28 |
29 | [@bs.module "expo-face-detector"]
30 | [@bs.scope ("Constants", "Classifications")]
31 | external none: t = "none";
32 | };
33 | };
34 |
35 | // [@bs.deriving abstract]
36 | type point = {
37 | x: int,
38 | y: int,
39 | };
40 |
41 | // [@bs.deriving abstract]
42 | type faceFeature = {
43 | bounds,
44 | smilingProbability: Js.Nullable.t(float),
45 | leftEarPosition: Js.Nullable.t(point),
46 | rightEarPosition: Js.Nullable.t(point),
47 | leftEyePosition: Js.Nullable.t(point),
48 | leftEyeOpenProbability: Js.Nullable.t(float),
49 | rightEyePosition: Js.Nullable.t(point),
50 | rightEyeOpenProbability: Js.Nullable.t(float),
51 | leftCheekPosition: Js.Nullable.t(point),
52 | rightCheekPosition: Js.Nullable.t(point),
53 | leftMouthPosition: Js.Nullable.t(point),
54 | mouthPosition: Js.Nullable.t(point),
55 | rightMouthPosition: Js.Nullable.t(point),
56 | bottomMouthPosition: Js.Nullable.t(point),
57 | noseBasePosition: Js.Nullable.t(point),
58 | yawAngle: Js.Nullable.t(float),
59 | rollAngle: Js.Nullable.t(float),
60 | }
61 | and bounds = {
62 | size,
63 | origin: point,
64 | }
65 | and size = {
66 | width: int,
67 | height: int,
68 | };
69 |
70 | // [@bs.deriving abstract]
71 | type detectionOptions = {
72 | mode: Js.Nullable.t(Constants.Mode.t),
73 | detectLandmarks: Js.Nullable.t(Constants.Landmarks.t),
74 | runClassifications: Js.Nullable.t(Constants.Classifications.t),
75 | };
76 | type detectFacesAsyncResponse = {
77 | faces: array(faceFeature),
78 | image,
79 | }
80 | and image = {
81 | uri: string,
82 | width: float,
83 | height: float,
84 | orientation: int,
85 | };
86 | [@bs.module "expo-face-detector"]
87 | external detectFacesAsync:
88 | (string, detectionOptions) => Js.Promise.t(detectFacesAsyncResponse) =
89 | "detectFacesAsync";
--------------------------------------------------------------------------------
/packages/reason-expo/src/SecureStore.re:
--------------------------------------------------------------------------------
1 | type keychainAccessibilityType;
2 |
3 | [@bs.module "expo-secure-store"]
4 | external whenUnlocked: keychainAccessibilityType = "WHEN_UNLOCKED";
5 |
6 | [@bs.module "expo-secure-store"]
7 | external afterFirstUnlock: keychainAccessibilityType = "AFTER_FIRST_UNLOCK";
8 |
9 | [@bs.module "expo-secure-store"]
10 | external always: keychainAccessibilityType = "ALWAYS";
11 |
12 | [@bs.module "expo-secure-store"]
13 | external whenUnlockedThisDeviceOnly: keychainAccessibilityType =
14 | "WHEN_UNLOCKED_THIS_DEVICE_ONLY";
15 |
16 | [@bs.module "expo-secure-store"]
17 | external whenPasscodeSetThisDeviceOnly: keychainAccessibilityType =
18 | "WHEN_PASSCODE_SET_THIS_DEVICE_ONLY";
19 |
20 | [@bs.module "expo-secure-store"]
21 | external afterFirstUnlockThisDeviceOnly: keychainAccessibilityType =
22 | "AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY";
23 |
24 | [@bs.module "expo-secure-store"]
25 | external alwaysThisDeviceOnly: keychainAccessibilityType =
26 | "ALWAYS_THIS_DEVICE_ONLY";
27 |
28 | [@bs.deriving abstract]
29 | type setItemAsyncOptions = {
30 | keychainService: string,
31 | keychainAccessible: keychainAccessibilityType,
32 | };
33 |
34 | [@bs.module "expo-secure-store"]
35 | external _setItemAsyncWithOptions:
36 | (string, string, setItemAsyncOptions) => Js.Promise.t(unit) =
37 | "setItemAsync";
38 |
39 | [@bs.module "expo-secure-store"]
40 | external _setItemAsync: (string, string) => Js.Promise.t(unit) =
41 | "setItemAsync";
42 |
43 | let setItemAsync = (~key, ~value, ~options=?, ()) =>
44 | switch (options) {
45 | | Some(o) => _setItemAsyncWithOptions(key, value, o)
46 | | None => _setItemAsync(key, value)
47 | };
48 |
49 | [@bs.deriving abstract]
50 | type getItemAsyncOptions = {keychainService: string};
51 |
52 | [@bs.module "expo-secure-store"]
53 | external _getItemAsyncWithOptions:
54 | (string, getItemAsyncOptions) => Js.Promise.t(Js.nullable(string)) =
55 | "getItemAsync";
56 |
57 | [@bs.module "expo-secure-store"]
58 | external _getItemAsync: string => Js.Promise.t(Js.nullable(string)) =
59 | "getItemAsync";
60 |
61 | let getItemAsync = (~key, ~options=?, ()) =>
62 | switch (options) {
63 | | Some(o) => _getItemAsyncWithOptions(key, o)
64 | | None => _getItemAsync(key)
65 | };
66 |
67 | [@bs.deriving abstract]
68 | type deleteItemAsyncOptions = {keychainService: string};
69 |
70 | [@bs.module "expo-secure-store"]
71 | external _deleteItemAsync: string => Js.Promise.t(unit) = "deleteItemAsync";
72 |
73 | [@bs.module "expo-secure-store"]
74 | external _deleteItemAsyncWithOptions:
75 | (string, deleteItemAsyncOptions) => Js.Promise.t(unit) =
76 | "deleteItemAsync";
77 |
78 | let deleteItemAsync = (~key, ~options=?, ()) =>
79 | switch (options) {
80 | | Some(o) => _deleteItemAsyncWithOptions(key, o)
81 | | None => _deleteItemAsync(key)
82 | };
--------------------------------------------------------------------------------
/packages/reason-expo/src/FacebookAds.re:
--------------------------------------------------------------------------------
1 | module NativeAdsManager = {
2 | class type _adsManager =
3 | [@bs]
4 | {
5 | pub disableAutoRefresh: unit => unit;
6 | pub setMediaCachePolicy: string => unit;
7 | pub setMediaCachePolicy: string => unit;
8 | };
9 |
10 | type t = Js.t(_adsManager);
11 |
12 | [@bs.new] [@bs.module "expo-ads-facebook"]
13 | external make: (string, int) => t = "NativeAdsManager";
14 | };
15 |
16 | module InterstitialAdManager = {
17 | [@bs.module "expo-ads-facebook"] [@bs.scope "InterstitialAdManager"]
18 | external showAd: string => Js.Promise.t(unit) = "showAd";
19 | };
20 |
21 | module AdSettings = {
22 | [@bs.module "expo-ads-facebook"] [@bs.scope "AdSettings"]
23 | external currentDeviceHash: string = "currentDeviceHash";
24 |
25 | [@bs.module "expo-ads-facebook"] [@bs.scope "AdSettings"]
26 | external addTestDevice: string => unit = "addTestDevice";
27 |
28 | [@bs.module "expo-ads-facebook"] [@bs.scope "AdSettings"]
29 | external clearTestDevices: unit => unit = "clearTestDevices";
30 |
31 | [@bs.module "expo-ads-facebook"] [@bs.scope "AdSettings"]
32 | external setLogLevel: string => unit = "setLogLevel";
33 |
34 | [@bs.module "expo-ads-facebook"] [@bs.scope "AdSettings"]
35 | external setIsChildDirected: bool => unit = "setIsChildDirected";
36 |
37 | [@bs.module "expo-ads-facebook"] [@bs.scope "AdSettings"]
38 | external setMediationService: string => unit = "setMediationService";
39 |
40 | [@bs.module "expo-ads-facebook"] [@bs.scope "AdSettings"]
41 | external setUrlPrefix: string => unit = "setUrlPrefix";
42 | };
43 |
44 | [@bs.module "expo-ads-facebook"]
45 | external withNativeAd: React.element => React.element = "withNativeAd";
46 |
47 | module AdMediaView = {
48 | [@bs.module "expo-ads-facebook"] [@react.component]
49 | external make: (~children: React.element=?, ~key: string=?) => React.element =
50 | "AdMediaView";
51 | };
52 |
53 | module AdIconView = {
54 | [@bs.module "expo-ads-facebook"] [@react.component]
55 | external make: (~children: React.element=?, ~key: string=?) => React.element =
56 | "AdIconView";
57 | };
58 |
59 | module AdTriggerView = {
60 | [@bs.module "expo-ads-facebook"] [@react.component]
61 | external make:
62 | (
63 | ~renderInteractiveComponent: 'a => React.element=?,
64 | ~onPress: unit => unit=?,
65 | ~children: React.element=?,
66 | ~key: string=?
67 | ) =>
68 | React.element =
69 | "AdTriggerView";
70 | };
71 |
72 | module BannerAd = {
73 | [@bs.module "expo-ads-facebook"] [@react.component]
74 | external make:
75 | (
76 | ~placementId: string,
77 | ~type_: string,
78 | ~onPress: unit => unit=?,
79 | ~onError: Js.Exn.t => unit=?,
80 | ~style: ReactNative.Style.t=?,
81 | ~children: React.element=?
82 | ) =>
83 | React.element =
84 | "BannerAd";
85 | };
--------------------------------------------------------------------------------
/packages/reason-expo/src/Video.re:
--------------------------------------------------------------------------------
1 | module Source = {
2 | type t;
3 |
4 | [@bs.obj]
5 | external make:
6 | (
7 | ~uri: string,
8 | ~headers: Js.t('a)=?,
9 | ~overrideFileExtensionAndroid: string=?,
10 | unit
11 | ) =>
12 | t;
13 |
14 | external fromRequired: ReactNative.Packager.required => t = "%identity";
15 | external fromAsset: Asset.t => t = "%identity";
16 | };
17 |
18 | module PosterSource = {
19 | type t;
20 |
21 | [@bs.obj] external make: (~uri: string, unit) => t;
22 |
23 | external fromRequired: ReactNative.Packager.required => t = "%identity";
24 | };
25 |
26 | [@bs.deriving abstract]
27 | type playbackStatus = {
28 | isLoaded: bool,
29 | [@bs.optional]
30 | error: string,
31 | [@bs.optional]
32 | uri: string,
33 | [@bs.optional]
34 | progressUpdateIntervalMillis: int,
35 | [@bs.optional]
36 | durationMillis: int,
37 | [@bs.optional]
38 | positionMillis: int,
39 | [@bs.optional]
40 | playableDurationMillis: int,
41 | [@bs.optional]
42 | shouldPlay: bool,
43 | [@bs.optional]
44 | isPlaying: bool,
45 | [@bs.optional]
46 | isBuffering: bool,
47 | [@bs.optional]
48 | rate: float,
49 | [@bs.optional]
50 | shouldCorrectPitch: bool,
51 | [@bs.optional]
52 | volume: float,
53 | [@bs.optional]
54 | isMuted: bool,
55 | [@bs.optional]
56 | isLooping: bool,
57 | [@bs.optional]
58 | didJustFinish: bool,
59 | };
60 |
61 | [@bs.deriving abstract]
62 | type onReadyForDisplayParam = {
63 | naturalSize: {
64 | .
65 | "width": float,
66 | "height": float,
67 | "orientation": string,
68 | },
69 | status: playbackStatus,
70 | };
71 |
72 | [@bs.deriving abstract]
73 | type onFullscreenUpdateParam = {
74 | fullscreenUpdate: int,
75 | status: playbackStatus,
76 | };
77 |
78 | /**
79 | * Usage
80 | *
87 | */
88 | [@react.component] [@bs.module "expo-av"]
89 | external make:
90 | (
91 | ~source: Source.t=?,
92 | ~posterSource: PosterSource.t=?,
93 | ~rate: float=?,
94 | ~isMuted: bool=?,
95 | ~useNativeControls: bool=?,
96 | ~usePoster: bool=?,
97 | ~resizeMode: [@bs.string] [ | `stretch | `contain | `cover]=?,
98 | ~isLooping: bool=?,
99 | ~shouldPlay: bool=?,
100 | ~volume: float=?,
101 | ~onPlaybackStatusUpdate: playbackStatus => unit=?,
102 | ~onReadyForDisplay: onReadyForDisplayParam => unit=?,
103 | ~onFullscreenUpdate: onFullscreenUpdateParam => unit=?,
104 | ~onLoadStart: unit => unit=?,
105 | ~onLoad: playbackStatus => unit=?,
106 | ~onError: string => unit=?,
107 | ~style: ReactNative.Style.t=?
108 | ) =>
109 | React.element =
110 | "Video";
111 |
--------------------------------------------------------------------------------
/packages/reason-expo/src/Constants.re:
--------------------------------------------------------------------------------
1 | type platforms = array(string);
2 |
3 | [@bs.deriving {abstract: light}]
4 | type ios = {supportsTablet: bool};
5 |
6 | [@bs.deriving {abstract: light}]
7 | type developer = {
8 | projectRoot: string,
9 | tool: string,
10 | };
11 |
12 | [@bs.deriving {abstract: light}]
13 | type packagerOpts = {
14 | dev: bool,
15 | hostType: string,
16 | lanType: string,
17 | minify: bool,
18 | urlRandomness: string,
19 | };
20 |
21 | [@bs.deriving {abstract: light}]
22 | type splash = {
23 | backgroundColor: string,
24 | image: string,
25 | imageUrl: string,
26 | resizeMode: string,
27 | };
28 |
29 | [@bs.deriving {abstract: light}]
30 | type updates = {fallbackToCacheTimeout: int};
31 |
32 | [@bs.deriving {abstract: light}]
33 | type manifest = {
34 | assetBundlePatterns: array(string),
35 | bundleUrl: string,
36 | debuggerHost: string,
37 | developer,
38 | env: Js.t({.}),
39 | hostUri: string,
40 | icon: string,
41 | iconUrl: string,
42 | id: string,
43 | ios,
44 | isVerified: bool,
45 | loadedFromCache: bool,
46 | logUrl: string,
47 | mainModuleName: string,
48 | name: string,
49 | orientation: string,
50 | packagerOpts,
51 | platforms,
52 | privacy: string,
53 | sdkVersion: string,
54 | slug: string,
55 | splash,
56 | updates,
57 | version: string,
58 | xde: bool,
59 | };
60 |
61 | [@bs.deriving {abstract: light}]
62 | type platformIOS = {
63 | buildNumber: string,
64 | platform: string,
65 | model: string,
66 | userInterfaceIdiom: string,
67 | systemVersion: string,
68 | };
69 |
70 | [@bs.deriving {abstract: light}]
71 | type platformAndroid = {versionCode: int};
72 |
73 | [@bs.deriving {abstract: light}]
74 | type platform = {
75 | ios: platformIOS,
76 | android: platformAndroid,
77 | };
78 |
79 | [@bs.deriving {abstract: light}]
80 | type t = {
81 | appOwnership: string,
82 | debugMode: bool,
83 | deviceId: string,
84 | deviceName: string,
85 | deviceYearClass: int,
86 | experienceUrl: string,
87 | expoRuntimeVersion: string,
88 | expoVersion: string,
89 | getWebViewUserAgentAsync: unit => Js.Promise.t(string),
90 | installationId: string,
91 | isDetached: bool,
92 | isDevice: bool,
93 | isHeadless: bool,
94 | linkingUri: string,
95 | linkingUrl: string,
96 | manifest,
97 | nativeAppVersion: string,
98 | nativeBuildVersion: string,
99 | platform,
100 | sessionId: string,
101 | statusBarHeight: int,
102 | supportedExpoSdks: array(string),
103 | systemFonts: array(string),
104 | };
105 |
106 | [@bs.module "expo-constants"] external constants: t = "default";
107 |
108 | let deviceId = constants->deviceId;
109 | let deviceName = constants->deviceName;
110 | let deviceYearClass = constants->deviceYearClass;
111 | let linkingUrl = constants->linkingUrl;
112 | let statusBarHeight = constants->statusBarHeight;
113 | let appOwnership = constants->appOwnership;
114 | let expoVersion = constants->expoVersion;
115 | let installationId = constants->installationId;
116 | let isDevice = constants->isDevice;
117 | let getWebViewUserAgentAsync = constants->getWebViewUserAgentAsync;
118 | let systemFonts = constants->systemFonts;
119 | let platform = constants->platform;
120 | let sessionId = constants->sessionId;
121 | let manifest = constants->manifest;
122 |
--------------------------------------------------------------------------------
/packages/reason-expo/src/Notifications.re:
--------------------------------------------------------------------------------
1 | type eventSubscription;
2 |
3 | [@bs.send] external remove: (eventSubscription, unit) => unit = "remove";
4 |
5 | [@bs.module "expo"] [@bs.scope "Notifications"]
6 | external addListener:
7 | (
8 | {
9 | .
10 | origin: string,
11 | data: Js.t({..}),
12 | remote: bool,
13 | } =>
14 | unit
15 | ) =>
16 | eventSubscription =
17 | "addListener";
18 |
19 | [@bs.module "expo"] [@bs.scope "Notifications"]
20 | external getExpoPushTokenAsync: unit => Js.Promise.t(string) =
21 | "getExpoPushTokenAsync";
22 |
23 | [@bs.module "expo"] [@bs.scope "Notifications"]
24 | external presentLocalNotificationAsync: Js.t({..}) => Js.Promise.t(string) =
25 | "presentLocalNotificationAsync";
26 |
27 | [@bs.module "expo"] [@bs.scope "Notifications"]
28 | external scheduleLocalNotificationAsync:
29 | (Js.t({..}), Js.t({..})) => Js.Promise.t(string) =
30 | "scheduleLocalNotificationAsync";
31 |
32 | [@bs.module "expo"] [@bs.scope "Notifications"]
33 | external dismissNotificationAsync: string => Js.Promise.t(unit) =
34 | "dismissNotificationAsync";
35 |
36 | [@bs.module "expo"] [@bs.scope "Notifications"]
37 | external dismissAllNotificationsAsync: unit => Js.Promise.t(unit) =
38 | "dismissAllNotificationsAsync";
39 |
40 | [@bs.module "expo"] [@bs.scope "Notifications"]
41 | external cancelScheduledNotificationAsync: string => Js.Promise.t(unit) =
42 | "cancelScheduledNotificationAsync";
43 |
44 | [@bs.module "expo"] [@bs.scope "Notifications"]
45 | external cancelAllScheduledNotificationsAsync: unit => Js.Promise.t(unit) =
46 | "cancelAllScheduledNotificationsAsync";
47 |
48 | [@bs.module "expo"] [@bs.scope "Notifications"]
49 | external getBadgeNumberAsync: unit => Js.Promise.t(int) =
50 | "getBadgeNumberAsync";
51 |
52 | [@bs.module "expo"] [@bs.scope "Notifications"]
53 | external setBadgeNumberAsync: int => Js.Promise.t(unit) =
54 | "setBadgeNumberAsync";
55 |
56 | type gcmSenderId = string;
57 | type getDevicePushTokenAsyncResponse = {
58 | [@bs.as "type"]
59 | _type: string,
60 | data: string,
61 | };
62 | [@bs.module "expo"] [@bs.scope "Notifications"]
63 | external getDevicePushTokenAsync:
64 | gcmSenderId =>
65 | Js.Promise.t(getDevicePushTokenAsyncResponse) =
66 | "getDevicePushTokenAsync";
67 | type createCategoryAsyncProps = {
68 | actionId: string,
69 | buttonTitle: string,
70 | textInput:
71 | Js.Undefined.t({
72 | .
73 | submitButtonTitle: string,
74 | placeholder: string,
75 | }),
76 | isDestructive: bool,
77 | isAuthenticationRequired: bool,
78 | };
79 | [@bs.module "expo"] [@bs.scope "Notifications"]
80 | external createCategoryAsync:
81 | (string, array(createCategoryAsyncProps)) => Js.Promise.t(unit) =
82 | "createCategoryAsync";
83 |
84 | [@bs.module "expo"] [@bs.scope "Notifications"]
85 | external deleteCategoryAsync: string => Js.Promise.t(unit) =
86 | "deleteCategoryAsync";
87 |
88 | type channelAndroid = {
89 | name: string,
90 | description: option(string),
91 | sound: option(bool),
92 | priority: option(string),
93 | vibrate: option(array(int)),
94 | badge: option(bool),
95 | };
96 |
97 | [@bs.module "expo"] [@bs.scope "Notifications"]
98 | external createChannelAndroidAsync:
99 | (string, channelAndroid) => Js.Promise.t(unit) =
100 | "createChannelAndroidAsync";
101 | [@bs.module "expo"] [@bs.scope "Notifications"]
102 | external deleteChannelAndroidAsync: string => Js.Promise.t(unit) =
103 | "deleteChannelAndroidAsync";
--------------------------------------------------------------------------------
/packages/reason-expo/src/AdMob.re:
--------------------------------------------------------------------------------
1 | type bannerSize =
2 | | Banner
3 | | LargeBanner
4 | | MediumRectangle
5 | | FullBanner
6 | | Leaderboard
7 | | SmartBannerPortrait
8 | | SmartBannerLandscape;
9 |
10 | module AdMobBanner = {
11 | type props = {
12 | // [@bs.optional]
13 | bannerSize: option(string),
14 | // [@bs.optional]
15 | onAdViewDidReceiveAd: option(unit => unit),
16 | // [@bs.optional]
17 | onDidFailToReceiveAdWithError: option(string => unit),
18 | // [@bs.optional]
19 | onAdViewWillPresentScreen: option(unit => unit),
20 | // [@bs.optional]
21 | onAdViewWillDismissScreen: option(unit => unit),
22 | // [@bs.optional]
23 | onAdViewDidDismissScreen: option(unit => unit),
24 | // [@bs.optional]
25 | onAdViewWillLeaveApplication: option(unit => unit),
26 | // [@bs.optional]
27 | children: option(React.element),
28 | };
29 |
30 | let props =
31 | (
32 | ~bannerSize=Banner,
33 | ~onAdViewDidReceiveAd=() => (),
34 | ~onDidFailToReceiveAdWithError=_e => (),
35 | ~onAdViewWillPresentScreen=() => (),
36 | ~onAdViewWillDismissScreen=() => (),
37 | ~onAdViewDidDismissScreen=() => (),
38 | ~onAdViewWillLeaveApplication=() => (),
39 | ~children,
40 | ) => {
41 | bannerSize:
42 | switch (bannerSize) {
43 | | Banner => Some("banner")
44 | | LargeBanner => Some("largeBanner")
45 | | MediumRectangle => Some("mediumRectangle")
46 | | FullBanner => Some("fullBanner")
47 | | Leaderboard => Some("leaderboard")
48 | | SmartBannerPortrait => Some("smartBannerPortrait")
49 | | SmartBannerLandscape => Some("smartBannerLandscape")
50 | },
51 | onAdViewDidReceiveAd: Some(onAdViewDidReceiveAd),
52 | onDidFailToReceiveAdWithError: Some(onDidFailToReceiveAdWithError),
53 | onAdViewWillPresentScreen: Some(onAdViewWillPresentScreen),
54 | onAdViewWillDismissScreen: Some(onAdViewWillDismissScreen),
55 | onAdViewDidDismissScreen: Some(onAdViewDidDismissScreen),
56 | onAdViewWillLeaveApplication: Some(onAdViewWillLeaveApplication),
57 | children: Some(children),
58 | };
59 |
60 | [@bs.module "expo-ads-admob"] [@react.component]
61 | external make: props => React.element = "AdMobBanner";
62 | };
63 |
64 | module AdMobInterstitial = {
65 | [@bs.module "expo-ads-admob"] [@bs.scope "AdMobInterstitial"]
66 | external setAdUnitID: string => unit = "setAdUnitID";
67 | [@bs.module "expo-ads-admob"] [@bs.scope "AdMobInterstitial"]
68 | external setTestDeviceID: string => unit = "setTestDeviceID";
69 | [@bs.module "expo-ads-admob"] [@bs.scope "AdMobInterstitial"]
70 | external requestAdAsync: unit => Js.Promise.t(unit) = "requestAdAsync";
71 | [@bs.module "expo-ads-admob"] [@bs.scope "AdMobInterstitial"]
72 | external showAdAsync: unit => Js.Promise.t(unit) = "showAdAsync";
73 | [@bs.module "expo-ads-admob"] [@bs.scope "AdMobInterstitial"]
74 | external getIsReadyAsync: unit => Js.Promise.t(bool) = "getIsReadyAsync";
75 | };
76 |
77 | module AdMobRewarded = {
78 | [@bs.module "expo-ads-admob"] [@bs.scope "AdMobRewarded"]
79 | external setAdUnitID: string => unit = "setAdUnitID";
80 | [@bs.module "expo-ads-admob"] [@bs.scope "AdMobRewarded"]
81 | external setTestDeviceID: string => unit = "setTestDeviceID";
82 | [@bs.module "expo-ads-admob"] [@bs.scope "AdMobRewarded"]
83 | external requestAdAsync: unit => Js.Promise.t(unit) = "requestAdAsync";
84 | [@bs.module "expo-ads-admob"] [@bs.scope "AdMobRewarded"]
85 | external showAdAsync: unit => Js.Promise.t(unit) = "showAdAsync";
86 | };
--------------------------------------------------------------------------------
/packages/reason-expo/src/Audio.re:
--------------------------------------------------------------------------------
1 | [@bs.module "expo-av"] [@bs.scope "Audio"]
2 | external setIsEnabledAsync: bool => Js.Promise.t(unit) = "setIsEnabledAsync";
3 |
4 | module InterruptionMode = {
5 | module IOS = {
6 | type t;
7 |
8 | [@bs.module "expo-av"] [@bs.scope "Audio"]
9 | external mixWithOthers: t = "INTERRUPTION_MODE_IOS_MIX_WITH_OTHERS";
10 |
11 | [@bs.module "expo-av"] [@bs.scope "Audio"]
12 | external doNotMix: t = "INTERRUPTION_MODE_IOS_DO_NOT_MIX";
13 |
14 | [@bs.module "expo-av"] [@bs.scope "Audio"]
15 | external duckOthers: t = "INTERRUPTION_MODE_IOS_DUCK_OTHERS";
16 | };
17 |
18 | module Android = {
19 | type t;
20 |
21 | [@bs.module "expo-av"] [@bs.scope "Audio"]
22 | external doNotMix: t = "INTERRUPTION_MODE_ANDROID_DO_NOT_MIX";
23 |
24 | [@bs.module "expo-av"] [@bs.scope "Audio"]
25 | external duckOthers: t = "INTERRUPTION_MODE_ANDROID_DUCK_OTHERS";
26 | };
27 | };
28 |
29 | type audioMode = {
30 | playsInSilentModeIOS: bool,
31 | allowsRecordingIOS: bool,
32 | interruptionModeIOS: InterruptionMode.IOS.t,
33 | shouldDuckAndroid: bool,
34 | interruptionModeAndroid: InterruptionMode.Android.t,
35 | playThroughEarpieceAndroid: bool,
36 | };
37 |
38 | [@bs.module "expo-av"] [@bs.scope "Audio"]
39 | external setAudioModeAsync: audioMode => Js.Promise.t(unit) =
40 | "setAudioModeAsync";
41 |
42 | module Source = {
43 | type t = [
44 | | `URI(string)
45 | | `Required(ReactNative.Packager.required)
46 | | `Asset(Asset.t)
47 | | `NullSource
48 | ];
49 |
50 | type rawSourceJS;
51 | external rawSourceJS: 'a => rawSourceJS = "%identity";
52 |
53 | let encodeSource = (src: t) =>
54 | switch (src) {
55 | | `URI(uri) => rawSourceJS({"uri": uri})
56 | | `Required(package) => rawSourceJS(package)
57 | | `Asset(asset) => rawSourceJS(asset)
58 | | `NullSource => rawSourceJS(Js.null)
59 | };
60 | };
61 |
62 | module Sound = {
63 | class type _sound =
64 | [@bs]
65 | {
66 | pub unloadAsync: unit => Js.Promise.t(unit);
67 | pub getStatusAsync: unit => Js.Promise.t('a);
68 | pub setOnPlaybackStatusUpdate: ('a => unit) => unit;
69 | pub setStatusAsync: 'a => Js.Promise.t(unit);
70 | pub playAsync: unit => Js.Promise.t(unit);
71 | pub replayAsync: unit => Js.Promise.t(unit);
72 | pub pauseAsync: unit => Js.Promise.t(unit);
73 | pub stopAsync: unit => Js.Promise.t(unit);
74 | pub setPositionAsync: int => Js.Promise.t(unit);
75 | pub setRateAsync: (float, bool) => Js.Promise.t(unit);
76 | pub setVolumeAsync: float => Js.Promise.t(unit);
77 | pub setIsMutedAsync: bool => Js.Promise.t(unit);
78 | pub setIsLoopingAsync: bool => Js.Promise.t(unit);
79 | pub setProgressUpdateIntervalAsync: int => Js.Promise.t(unit);
80 | };
81 |
82 | type t = Js.t(_sound);
83 |
84 | [@bs.new] [@bs.module "expo-av"] [@bs.scope "Audio"]
85 | external make: unit => t = "Sound";
86 |
87 | [@bs.module "expo-av"] [@bs.scope ("Audio", "Sound")]
88 | external _createAsync:
89 | (Source.rawSourceJS, 'a, 'a => unit, bool) => Js.Promise.t(t) =
90 | "createAsync";
91 |
92 | let createAsync =
93 | (source, initialStatus, onPlaybackStatusUpdate, downloadFirst) =>
94 | _createAsync(
95 | Source.encodeSource(source),
96 | initialStatus,
97 | onPlaybackStatusUpdate,
98 | downloadFirst,
99 | );
100 | };
101 |
102 | module Recording = {
103 | type status = {
104 | canRecord: bool,
105 | isDoneRecording: bool,
106 | durationMillis: int,
107 | };
108 |
109 | class type _recording =
110 | [@bs]
111 | {
112 | pub getStatusAsync: unit => Js.Promise.t(status);
113 | pub setOnRecordingStatusUpdate: (status => unit) => unit;
114 | pub setProgressUpdateInterval: int => unit;
115 | pub prepareToRecordAsync: Js.t('a) => Js.Promise.t(unit);
116 | pub isPreparedToRecord: unit => bool;
117 | pub startAsync: unit => Js.Promise.t(status);
118 | pub pauseAsync: unit => Js.Promise.t(status);
119 | pub stopAndUnloadAsync: unit => Js.Promise.t(status);
120 | pub getURI: unit => Js.Nullable.t(string);
121 | pub createNewLoadedSound:
122 | ('a, 'a => unit) =>
123 | Js.Promise.t({
124 | .
125 | sound: Sound.t,
126 | status: 'a,
127 | });
128 | };
129 |
130 | type t = Js.t(_recording);
131 |
132 | [@bs.new] [@bs.module "expo-av"] [@bs.scope "Audio"]
133 | external make: unit => t = "Recording";
134 | };
135 |
--------------------------------------------------------------------------------
/packages/reason-expo/src/FileSystem.re:
--------------------------------------------------------------------------------
1 | [@bs.module "expo-file-system"]
2 | external documentDirectory: string = "documentDirectory";
3 |
4 | [@bs.module "expo-file-system"]
5 | external cacheDirectory: string = "cacheDirectory";
6 |
7 | module EncodingTypes = {
8 | type t = string;
9 |
10 | [@bs.module "expo-file-system"] [@bs.scope "EncodingTypes"]
11 | external utf8: t = "UTF8";
12 |
13 | [@bs.module "expo-file-system"] [@bs.scope "EncodingTypes"]
14 | external base64: t = "Base64";
15 | };
16 |
17 | [@bs.deriving abstract]
18 | type fileInfo = {
19 | exists: bool,
20 | [@bs.optional]
21 | isDirectory: bool,
22 | [@bs.optional]
23 | modificationTime: int,
24 | [@bs.optional]
25 | size: int,
26 | [@bs.optional]
27 | uri: string,
28 | [@bs.optional]
29 | md5: string,
30 | };
31 |
32 | [@bs.deriving abstract]
33 | type getInfoAsyncOptions = {
34 | [@bs.optional]
35 | md5: bool,
36 | [@bs.optional]
37 | size: bool,
38 | };
39 |
40 | [@bs.module "expo-file-system"]
41 | external getInfoAsync: (string, getInfoAsyncOptions) => Js.Promise.t(fileInfo) =
42 | "getInfoAsync";
43 |
44 | [@bs.deriving abstract]
45 | type readAsStringAsyncOptions = {
46 | encoding: EncodingTypes.t,
47 | length: int,
48 | position: int,
49 | };
50 |
51 | [@bs.module "expo-file-system"]
52 | external readAsStringAsync:
53 | (string, readAsStringAsyncOptions) => Js.Promise.t(string) =
54 | "readAsStringAsync";
55 |
56 | [@bs.deriving abstract]
57 | type writeAsStringAsyncOptions = {encoding: EncodingTypes.t};
58 |
59 | [@bs.module "expo-file-system"]
60 | external writeAsStringAsync: (string, string) => Js.Promise.t(unit) =
61 | "writeAsStringAsync";
62 |
63 | [@bs.deriving abstract]
64 | type deleteAsyncOptions = {
65 | [@bs.optional]
66 | idempotent: bool,
67 | };
68 |
69 | [@bs.module "expo-file-system"]
70 | external deleteAsync: (string, deleteAsyncOptions) => Js.Promise.t(unit) =
71 | "deleteAsync";
72 |
73 | [@bs.deriving abstract]
74 | type moveAsyncOptions = {
75 | from: string,
76 | [@bs.as "to"]
77 | to_: string,
78 | };
79 |
80 | [@bs.module "expo-file-system"]
81 | external moveAsync: (string, moveAsyncOptions) => Js.Promise.t(unit) =
82 | "moveAsync";
83 |
84 | [@bs.deriving abstract]
85 | type copyAsyncOptions = {
86 | from: string,
87 | [@bs.as "to"]
88 | to_: string,
89 | };
90 |
91 | [@bs.module "expo-file-system"]
92 | external copyAsync: (string, copyAsyncOptions) => Js.Promise.t(unit) =
93 | "copyAsync";
94 |
95 | [@bs.deriving abstract]
96 | type makeDirectoryAsyncOptions = {intermediates: bool};
97 |
98 | [@bs.module "expo-file-system"]
99 | external makeDirectoryAsync:
100 | (string, makeDirectoryAsyncOptions) => Js.Promise.t(unit) =
101 | "makeDirectoryAsync";
102 |
103 | [@bs.module "expo-file-system"]
104 | external readDirectoryAsync: string => Js.Promise.t(array(string)) =
105 | "readDirectoryAsync";
106 |
107 | [@bs.deriving abstract]
108 | type downloadAsyncOptions = {md5: bool};
109 |
110 | [@bs.deriving abstract]
111 | type downloadAsyncResult('headersType) = {
112 | uri: string,
113 | status: int,
114 | headers: 'headersType,
115 | md5: string,
116 | };
117 |
118 | [@bs.module "expo-file-system"]
119 | external downloadAsync:
120 | (string, string, downloadAsyncOptions) =>
121 | Js.Promise.t(downloadAsyncResult('headersType)) =
122 | "downloadAsync";
123 |
124 | module DownloadResumable = {
125 | type t = {.};
126 |
127 | [@bs.deriving abstract]
128 | type downloadAsyncResult('headersType) = {
129 | uri: string,
130 | status: int,
131 | headers: 'headersType,
132 | [@bs.optional]
133 | md5: string,
134 | };
135 |
136 | [@bs.send]
137 | external downloadAsync:
138 | (t, unit) => Js.Promise.t(downloadAsyncResult('headersType)) =
139 | "downloadAsync";
140 |
141 | [@bs.deriving abstract]
142 | type pauseAsyncResult = {
143 | uri: string,
144 | fileUri: string,
145 | options: {. md5: bool},
146 | resumeData: string,
147 | };
148 |
149 | [@bs.send]
150 | external pauseAsync: (t, unit) => Js.Promise.t(pauseAsyncResult) =
151 | "pauseAsync";
152 |
153 | [@bs.deriving abstract]
154 | type resumeAsyncResult('headersType) = {
155 | uri: string,
156 | status: int,
157 | headers: 'headersType,
158 | [@bs.optional]
159 | md5: string,
160 | };
161 |
162 | [@bs.send]
163 | external resumeAsync:
164 | (t, unit) => Js.Promise.t(resumeAsyncResult('headersType)) =
165 | "resumeAsync";
166 |
167 | [@bs.deriving abstract]
168 | type savableResult = {
169 | uri: string,
170 | fileUri: string,
171 | options: {. md5: bool},
172 | resumeData: string,
173 | };
174 |
175 | [@bs.send]
176 | external savable: (t, unit) => Js.Promise.t(savableResult) = "savable";
177 | };
178 |
179 | [@bs.deriving abstract]
180 | type createDownloadResumableOptions('headersType) = {
181 | md5: bool,
182 | headers: 'headersType,
183 | };
184 |
185 | [@bs.deriving abstract]
186 | type createDownloadResumableCallbackParam = {
187 | totalBytesWritten: int,
188 | totalBytesExpectedToWrite: int,
189 | };
190 |
191 | [@bs.deriving abstract]
192 | type createDownloadResumableResult('headersType) = {
193 | uri: string,
194 | status: int,
195 | headers: 'headersType,
196 | md5: string,
197 | };
198 |
199 | [@bs.module "expo-file-system"]
200 | external createDownloadResumable:
201 | (
202 | string,
203 | string,
204 | createDownloadResumableOptions('headersType),
205 | createDownloadResumableCallbackParam => unit,
206 | string
207 | ) =>
208 | DownloadResumable.t =
209 | "createDownloadResumable";
--------------------------------------------------------------------------------
/packages/reason-expo/src/Location.re:
--------------------------------------------------------------------------------
1 | [@bs.deriving abstract]
2 | type eventSubscription;
3 |
4 | [@bs.send] external remove: (eventSubscription, unit) => unit = "remove";
5 |
6 | [@bs.module "expo-location"]
7 | external hasServicesEnabledAsync: unit => Js.Promise.t(bool) = "hasServicesEnabledAsync";
8 |
9 | [@bs.module "expo-location"]
10 | external requestPermissionsAsync: unit => Js.Promise.t(unit) = "requestPermissionsAsync";
11 |
12 | module Accuracy = {
13 | type t = int;
14 | [@bs.module "expo-location"] [@bs.scope "Accuracy"]
15 | external lowest: t = "Lowest";
16 | [@bs.module "expo-location"] [@bs.scope "Accuracy"] external low: t = "Low";
17 | [@bs.module "expo-location"] [@bs.scope "Accuracy"]
18 | external balanced: t = "Balanced";
19 | [@bs.module "expo-location"] [@bs.scope "Accuracy"]
20 | external high: t = "High";
21 | [@bs.module "expo-location"] [@bs.scope "Accuracy"]
22 | external highest: t = "Highest";
23 | [@bs.module "expo-location"] [@bs.scope "Accuracy"]
24 | external bestForNavigation: t = "BestForNavigation";
25 | };
26 |
27 | module GeofencingEventType = {
28 | type t = int;
29 | [@bs.module "expo-location"] [@bs.scope "GeofencingEventType"]
30 | external enter: t = "Enter";
31 | [@bs.module "expo-location"] [@bs.scope "GeofencingEventType"]
32 | external exit: t = "Exit";
33 | };
34 |
35 | module GeofencingRegionState = {
36 | type t = int;
37 | [@bs.module "expo-location"] [@bs.scope "GeofencingRegionState"]
38 | external inside: t = "Inside";
39 | [@bs.module "expo-location"] [@bs.scope "GeofencingRegionState"]
40 | external outside: t = "Outside";
41 | };
42 |
43 | [@bs.deriving abstract]
44 | type region = {
45 | identifier: string,
46 | latitude: float,
47 | longitude: float,
48 | radius: float,
49 | state: GeofencingRegionState.t,
50 | };
51 |
52 | [@bs.deriving abstract]
53 | type coords = {
54 | latitude: float,
55 | longitude: float,
56 | altitude: float,
57 | accuracy: float,
58 | altitudeAccuracy: float,
59 | heading: float,
60 | speed: float,
61 | };
62 |
63 | [@bs.deriving abstract]
64 | type location = {
65 | coords,
66 | timestamp: int,
67 | };
68 |
69 | [@bs.deriving abstract]
70 | type getCurrentPositionAsyncOptions = {
71 | accuracy: Accuracy.t,
72 | maximumAge: int,
73 | };
74 |
75 | [@bs.module "expo-location"]
76 | external getCurrentPositionAsync:
77 | getCurrentPositionAsyncOptions => Js.Promise.t(location) =
78 | "getCurrentPositionAsync";
79 |
80 | [@bs.deriving abstract]
81 | type watchPositionAsyncOptions = {
82 | accuracy: Accuracy.t,
83 | timeInterval: int,
84 | distanceInterval: float,
85 | };
86 |
87 | [@bs.module "expo-location"]
88 | external watchPositionAsync:
89 | (watchPositionAsyncOptions, location => unit) =>
90 | Js.Promise.t(eventSubscription) =
91 | "watchPositionAsync";
92 |
93 | [@bs.deriving abstract]
94 | type getProviderStatusAsyncResult = {
95 | locationServicesEnabled: bool,
96 | gpsAvailable: bool,
97 | networkAvailable: bool,
98 | passiveAvailable: bool,
99 | };
100 |
101 | [@bs.module "expo-location"]
102 | external getProviderStatusAsync:
103 | unit => Js.Promise.t(getProviderStatusAsyncResult) =
104 | "getProviderStatusAsync";
105 |
106 | [@bs.deriving abstract]
107 | type getHeadingAsyncResult = {
108 | magHeading: float,
109 | trueHeading: float,
110 | accuracy: int,
111 | };
112 |
113 | [@bs.module "expo-location"]
114 | external getHeadingAsync: unit => Js.Promise.t(getHeadingAsyncResult) =
115 | "getHeadingAsync";
116 |
117 | [@bs.deriving abstract]
118 | type watchHeadingAsyncResult = {
119 | magHeading: float,
120 | trueHeading: float,
121 | accuracy: int,
122 | };
123 |
124 | [@bs.module "expo-location"]
125 | external watchHeadingAsync:
126 | (watchHeadingAsyncResult => unit) => Js.Promise.t(eventSubscription) =
127 | "watchHeadingAsync";
128 |
129 | [@bs.deriving abstract]
130 | type geocodeAsyncResult = {
131 | latitude: float,
132 | longitude: float,
133 | altitude: float,
134 | accuracy: float,
135 | };
136 |
137 | [@bs.module "expo-location"]
138 | external geocodeAsync: string => Js.Promise.t(geocodeAsyncResult) =
139 | "geocodeAsync";
140 |
141 | [@bs.deriving abstract]
142 | type reverseGeocodeAsyncOptions = {
143 | latitude: float,
144 | longitude: float,
145 | };
146 |
147 | [@bs.deriving abstract]
148 | type reverseGeocodeAsyncResult = {
149 | city: string,
150 | street: string,
151 | region: string,
152 | postalCode: string,
153 | country: string,
154 | name: string,
155 | };
156 |
157 | [@bs.module "expo-location"]
158 | external reverseGeocodeAsync:
159 | reverseGeocodeAsyncOptions =>
160 | Js.Promise.t(array(reverseGeocodeAsyncResult)) =
161 | "reverseGeocodeAsync";
162 |
163 | [@bs.module "expo-location"] external setApiKey: string => unit = "setApiKey";
164 |
165 | [@bs.module "expo-location"]
166 | external installWebGeolocationPolyfill: unit => unit = "installWebGeolocationPolyfill";
167 |
168 | [@bs.deriving abstract]
169 | type startLocationUpdatesAsyncOptions = {
170 | accuracy: Accuracy.t,
171 | timeInterval: int,
172 | distanceInterval: float,
173 | showsBackgroundLocationIndicator: bool,
174 | };
175 |
176 | [@bs.module "expo-location"]
177 | external startLocationUpdatesAsync:
178 | (string, startLocationUpdatesAsyncOptions) => Js.Promise.t(unit) =
179 | "startLocationUpdatesAsync";
180 |
181 | [@bs.module "expo-location"]
182 | external stopLocationUpdatesAsync: string => Js.Promise.t(unit) = "stopLocationUpdatesAsync";
183 |
184 | [@bs.module "expo-location"]
185 | external hasStartedLocationUpdatesAsync: string => Js.Promise.t(bool) = "hasStartedLocationUpdatesAsync";
186 |
187 | type geofencingRegion = {
188 | identifier: string,
189 | latitude: float,
190 | longitude: float,
191 | radius: float,
192 | notifyOnEnter: bool,
193 | notifyOnExit: bool,
194 | };
195 |
196 | [@bs.module "expo-location"]
197 | external startGeofencingAsync:
198 | (string, array(geofencingRegion)) => Js.Promise.t(unit) =
199 | "startGeofencingAsync";
200 |
201 | [@bs.module "expo-location"]
202 | external stopGeofencingAsync: string => Js.Promise.t(unit) = "stopGeofencingAsync";
203 | [@bs.module "expo-location"]
204 | external hasStartedGeofencingAsync: string => Js.Promise.t(bool) = "hasStartedGeofencingAsync";
--------------------------------------------------------------------------------
/packages/reason-expo/src/ScreenOrientation.re:
--------------------------------------------------------------------------------
1 | module Orientation = {
2 | type t = string;
3 |
4 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "Orientation")]
5 | external unknown: t = "UNKNOWN";
6 |
7 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "Orientation")]
8 | external portrait: t = "PORTRAIT";
9 |
10 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "Orientation")]
11 | external portraitUp: t = "PORTRAIT_UP";
12 |
13 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "Orientation")]
14 | external portraitDown: t = "PORTRAIT_DOWN";
15 |
16 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "Orientation")]
17 | external landscape: t = "LANDSCAPE";
18 |
19 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "Orientation")]
20 | external landscapeLeft: t = "LANDSCAPE_LEFT";
21 |
22 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "Orientation")]
23 | external landscapeRight: t = "LANDSCAPE_RIGHT";
24 | };
25 |
26 | module OrientationLock = {
27 | type t = string;
28 |
29 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "OrientationLock")]
30 | external default: t = "DEFAULT";
31 |
32 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "OrientationLock")]
33 | external all: t = "ALL";
34 |
35 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "OrientationLock")]
36 | external portrait: t = "PORTRAIT";
37 |
38 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "OrientationLock")]
39 | external portraitUp: t = "PORTRAIT_UP";
40 |
41 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "OrientationLock")]
42 | external portraitDown: t = "PORTRAIT_DOWN";
43 |
44 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "OrientationLock")]
45 | external landscape: t = "LANDSCAPE";
46 |
47 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "OrientationLock")]
48 | external landscapeLeft: t = "LANDSCAPE_LEFT";
49 |
50 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "OrientationLock")]
51 | external landscapeRight: t = "LANDSCAPE_RIGHT";
52 |
53 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "OrientationLock")]
54 | external other: t = "OTHER";
55 |
56 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "OrientationLock")]
57 | external unknown: t = "UNKNOWN";
58 | };
59 |
60 | module SizeClassIOS = {
61 | type t = string;
62 |
63 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "SizeClassIOS")]
64 | external regular: t = "REGULAR";
65 |
66 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "SizeClassIOS")]
67 | external compact: t = "COMPACT";
68 |
69 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "SizeClassIOS")]
70 | external unknown: t = "UNKNOWN";
71 | };
72 |
73 | module WebOrientationLock = {
74 | type t = string;
75 |
76 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "WebOrientationLock")]
77 | external portraitPrimary: t = "PORTRAIT_PRIMARY";
78 |
79 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "WebOrientationLock")]
80 | external portraitSecondary: t = "PORTRAIT_SECONDARY";
81 |
82 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "WebOrientationLock")]
83 | external portrait: t = "PORTRAIT";
84 |
85 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "WebOrientationLock")]
86 | external landscapePrimary: t = "LANDSCAPE_PRIMARY";
87 |
88 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "WebOrientationLock")]
89 | external landscapeSecondary: t = "LANDSCAPE_SECONDARY";
90 |
91 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "WebOrientationLock")]
92 | external landscape: t = "LANDSCAPE";
93 |
94 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "WebOrientationLock")]
95 | external any: t = "ANY";
96 |
97 | [@bs.module "expo"] [@bs.scope ("ScreenOrientation", "WebOrientationLock")]
98 | external unknown: t = "UNKNOWN";
99 | };
100 |
101 | type platformOrientationInfo = {
102 | screenOrientationConstantAndroid: int,
103 | screenOrientationArrayIOS: array(Orientation.t),
104 | screenOrientationLockWebOrientation: WebOrientationLock.t,
105 | };
106 |
107 | type orientationInfo = {
108 | orientation: Orientation.t,
109 | verticalSizeClass: SizeClassIOS.t,
110 | horizontalSizeClass: SizeClassIOS.t,
111 | };
112 |
113 | type orientationChangeEvent = {
114 | orientationLock: OrientationLock.t,
115 | orientationInfo,
116 | };
117 |
118 | module Subscription = {
119 |
120 | type t;
121 |
122 | [@bs.send] external remove: (t, unit) => unit = "remove";
123 | };
124 |
125 | type orientationChangeListener = orientationChangeEvent => unit;
126 |
127 | [@bs.module "expo"] [@bs.scope "ScreenOrientation"]
128 | external allowAsync: OrientationLock.t => Js.Promise.t(unit) = "allowAsync";
129 |
130 | [@bs.module "expo"] [@bs.scope "ScreenOrientation"]
131 | external lockAsync: OrientationLock.t => Js.Promise.t(unit) = "lockAsync";
132 |
133 | [@bs.module "expo"] [@bs.scope "ScreenOrientation"]
134 | external lockPlatformAsync: platformOrientationInfo => Js.Promise.t(unit) =
135 | "lockPlatformAsync";
136 |
137 | [@bs.module "expo"] [@bs.scope "ScreenOrientation"]
138 | external unlockAsync: unit => Js.Promise.t(unit) = "unlockAsync";
139 |
140 | [@bs.module "expo"] [@bs.scope "ScreenOrientation"]
141 | external getOrientationLockAsync: unit => Js.Promise.t(OrientationLock.t) =
142 | "getOrientationLockAsync";
143 |
144 | [@bs.module "expo"] [@bs.scope "ScreenOrientation"]
145 | external getPlatformOrientationLockAsync:
146 | unit => Js.Promise.t(platformOrientationInfo) =
147 | "getPlatformOrientationLockAsync";
148 |
149 | [@bs.module "expo"] [@bs.scope "ScreenOrientation"]
150 | external supportsOrientationLockAsync: OrientationLock.t => Js.Promise.t(bool) =
151 | "supportsOrientationLockAsync";
152 |
153 | [@bs.module "expo"] [@bs.scope "ScreenOrientation"]
154 | external addOrientationChangeListener:
155 | orientationChangeListener => Subscription.t =
156 | "addOrientationChangeListener";
157 |
158 | [@bs.module "expo"] [@bs.scope "ScreenOrientation"]
159 | external removeOrientationChangeListeners: unit => unit = "removeOrientationChangeListeners";
160 |
161 | [@bs.module "expo"] [@bs.scope "ScreenOrientation"]
162 | external removeOrientationChangeListener: Subscription.t => unit = "removeOrientationChangeListener";
--------------------------------------------------------------------------------
/packages/reason-expo/src/MediaLibrary.re:
--------------------------------------------------------------------------------
1 | module MediaType = {
2 | type t;
3 |
4 | [@bs.module "expo-media-library"] [@bs.scope "MediaType"]
5 | external photo: t = "photo";
6 |
7 | [@bs.module "expo-media-library"] [@bs.scope "MediaType"]
8 | external video: t = "video";
9 |
10 | [@bs.module "expo-media-library"] [@bs.scope "MediaType"]
11 | external audio: t = "audio";
12 |
13 | [@bs.module "expo-media-library"] [@bs.scope "MediaType"]
14 | external unknown: t = "unknown";
15 | };
16 |
17 | module SortBy = {
18 | type t;
19 |
20 | [@bs.module "expo-media-library"] [@bs.scope "SortBy"]
21 | external default: t = "default";
22 |
23 | [@bs.module "expo-media-library"] [@bs.scope "SortBy"] external id: t = "id";
24 |
25 | [@bs.module "expo-media-library"] [@bs.scope "SortBy"]
26 | external creationTime: t = "creationTime";
27 |
28 | [@bs.module "expo-media-library"] [@bs.scope "SortBy"]
29 | external modificationTime: t = "modificationTime";
30 |
31 | [@bs.module "expo-media-library"] [@bs.scope "SortBy"]
32 | external mediaType: t = "mediaType";
33 |
34 | [@bs.module "expo-media-library"] [@bs.scope "SortBy"]
35 | external width: t = "width";
36 |
37 | [@bs.module "expo-media-library"] [@bs.scope "SortBy"]
38 | external height: t = "height";
39 |
40 | [@bs.module "expo-media-library"] [@bs.scope "SortBy"]
41 | external duration: t = "duration";
42 | };
43 |
44 | // [@bs.deriving abstract]
45 | type asset('exif) = {
46 | id: string,
47 | filename: string,
48 | uri: string,
49 | mediaType: MediaType.t,
50 | width: float,
51 | height: float,
52 | creationTime: float,
53 | modificationTime: float,
54 | duration: float,
55 | mediaSubtypes: array(string),
56 | albumId: string,
57 | localUri: string,
58 | location: Js.Nullable.t(location),
59 | exif: 'exif,
60 | orientation: float,
61 | isFavorite: bool,
62 | }
63 | and location = {
64 | latitude: float,
65 | longitude: float,
66 | };
67 |
68 | // [@bs.deriving abstract]
69 | type album = {
70 | id: string,
71 | title: string,
72 | assetCount: int,
73 | [@bs.as "type"]
74 | type_: string,
75 | startTime: float,
76 | endTime: float,
77 | approximateLocation: Js.Nullable.t(approximateLocation),
78 | locationNames: array(string),
79 | }
80 | and approximateLocation = {
81 | latitude: float,
82 | longitude: float,
83 | };
84 |
85 | [@bs.module "expo-media-library"]
86 | external createAssetAsync: string => Js.Promise.t(asset('exif)) =
87 | "createAssetAsync";
88 |
89 | module AlbumOption = {
90 | type t = [ | `ID(string) | `Album(album)];
91 |
92 | type rawSourceJS;
93 | external rawSourceJS: 'a => rawSourceJS = "%identity";
94 |
95 | let encodeSource = (src: t) =>
96 | switch (src) {
97 | | `ID(id) => rawSourceJS(id)
98 | | `Album(album) => rawSourceJS(album)
99 | };
100 | };
101 | type getAssetsAsyncProps = {
102 | first: int,
103 | after: string,
104 | album: AlbumOption.rawSourceJS,
105 | sortBy: array(SortBy.t),
106 | mediaType: array(MediaType.t),
107 | };
108 | type getAssetsAsyncResponse('exif) = {
109 | assets: array(asset('exif)),
110 | endCursor: string,
111 | hasNextPage: bool,
112 | totalCount: int,
113 | };
114 | [@bs.module "expo-media-library"]
115 | external _getAssetsAsync:
116 | getAssetsAsyncProps => Js.Promise.t(getAssetsAsyncResponse('exif)) =
117 | "getAssetsAsync";
118 |
119 | let getAssetsAsync = (~first, ~after, ~album, ~sortBy, ~mediaType) =>
120 | _getAssetsAsync({
121 | first,
122 | after,
123 | album: AlbumOption.encodeSource(album),
124 | sortBy,
125 | mediaType,
126 | });
127 |
128 | module AssetOption = {
129 | type t = [ | `ID(string) | `Asset(asset({.}))];
130 |
131 | type rawSourceJS;
132 | external rawSourceJS: 'a => rawSourceJS = "%identity";
133 |
134 | let encodeSource = (src: t) =>
135 | switch (src) {
136 | | `ID(id) => rawSourceJS(id)
137 | | `Asset(asset) => rawSourceJS(asset)
138 | };
139 | };
140 |
141 | [@bs.module "expo-media-library"]
142 | external _getAssetInfoAsync:
143 | AssetOption.rawSourceJS => Js.Promise.t(asset('exif)) =
144 | "getAssetInfoAsync";
145 |
146 | let getAssetInfoAsync = asset =>
147 | _getAssetInfoAsync(AssetOption.encodeSource(asset));
148 |
149 | [@bs.module "expo-media-library"]
150 | external _deleteAssetsAsync:
151 | array(AssetOption.rawSourceJS) => Js.Promise.t(bool) =
152 | "deleteAssetsAsync";
153 |
154 | let deleteAssetsAsync = assets =>
155 | _deleteAssetsAsync(Array.map(a => AssetOption.encodeSource(a), assets));
156 |
157 | [@bs.module "expo-media-library"]
158 | external getAlbumsAsync: unit => Js.Promise.t(array(album)) =
159 | "getAlbumsAsync";
160 |
161 | [@bs.module "expo-media-library"]
162 | external getAlbumAsync: string => Js.Promise.t(Js.Nullable.t(album)) =
163 | "getAlbumAsync";
164 |
165 | [@bs.module "expo-media-library"]
166 | external _createAlbumAsync:
167 | (string, AlbumOption.rawSourceJS, bool) => Js.Promise.t(album) =
168 | "createAlbumAsync";
169 |
170 | let createAlbumAsync = (albumName, asset, copyAsset) =>
171 | _createAlbumAsync(albumName, AlbumOption.encodeSource(asset), copyAsset);
172 |
173 | [@bs.module "expo-media-library"]
174 | external _deleteAlbumsAsync:
175 | (array(AlbumOption.rawSourceJS), bool) => Js.Promise.t(bool) =
176 | "deleteAlbumsAsync";
177 |
178 | let deleteAlbumsAsync = (albums, deleteAssets) =>
179 | _deleteAlbumsAsync(
180 | Array.map(a => AlbumOption.encodeSource(a), albums),
181 | deleteAssets,
182 | );
183 |
184 | [@bs.module "expo-media-library"]
185 | external _addAssetsToAlbumAsync:
186 | (array(asset('exif)), array(AlbumOption.rawSourceJS), bool) =>
187 | Js.Promise.t(bool) =
188 | "addAssetsToAlbumAsync";
189 |
190 | let addAssetsToAlbumAsync = (assets, albums, deleteAssets) =>
191 | _addAssetsToAlbumAsync(
192 | assets,
193 | Array.map(a => AlbumOption.encodeSource(a), albums),
194 | deleteAssets,
195 | );
196 |
197 | [@bs.module "expo-media-library"]
198 | external _removeAssetsFromAlbumAsync:
199 | (array(asset('exif)), array(AlbumOption.rawSourceJS)) =>
200 | Js.Promise.t(bool) =
201 | "removeAssetsFromAlbumAsync";
202 |
203 | let removeAssetsFromAlbumAsync = (assets, albums) =>
204 | _removeAssetsFromAlbumAsync(
205 | assets,
206 | Array.map(a => AlbumOption.encodeSource(a), albums),
207 | );
208 |
209 | [@bs.module "expo-media-library"]
210 | external getMomentsAsync: unit => Js.Promise.t(array(album)) =
211 | "getMomentsAsync";
212 |
213 | class type eventSubscription =
214 | [@bs]
215 | {
216 | pub remove: unit => unit;
217 | };
218 |
219 | [@bs.module "expo-media-library"]
220 | external addListener:
221 | ((array(asset('a)), array(asset('a))) => unit) => eventSubscription =
222 | "addListener";
223 |
224 | [@bs.module "expo-media-library"]
225 | external removeAllListeners: unit => unit = "removeAllListeners";
--------------------------------------------------------------------------------
/packages/reason-expo/src/Svg.re:
--------------------------------------------------------------------------------
1 | [@bs.module "react-native-svg"] [@react.component]
2 | external make:
3 | (~height: string, ~width: string, ~children: React.element=?) =>
4 | React.element =
5 | "default";
6 |
7 | module Rect = {
8 | [@bs.module "react-native-svg"] [@react.component]
9 | external make:
10 | (
11 | ~x: string,
12 | ~y: string,
13 | ~width: string,
14 | ~height: string,
15 | ~fill: string=?,
16 | ~strokeWidth: string=?,
17 | ~stroke: string=?,
18 | ~children: React.element=?
19 | ) =>
20 | React.element =
21 | "Rect";
22 | };
23 |
24 | module Circle = {
25 | [@bs.module "react-native-svg"] [@react.component]
26 | external make:
27 | (
28 | ~cx: string,
29 | ~cy: string,
30 | ~r: string,
31 | ~fill: string=?,
32 | ~children: React.element=?
33 | ) =>
34 | React.element =
35 | "Circle";
36 | };
37 |
38 | module Ellipse = {
39 | [@bs.module "react-native-svg"] [@react.component]
40 | external make:
41 | (
42 | ~cx: string,
43 | ~cy: string,
44 | ~rx: string,
45 | ~ry: string,
46 | ~fill: string=?,
47 | ~stroke: string=?,
48 | ~strokeWidth: string=?,
49 | ~children: React.element=?
50 | ) =>
51 | React.element =
52 | "Ellipse";
53 | };
54 |
55 | module Line = {
56 | [@bs.module "react-native-svg"] [@react.component]
57 | external make:
58 | (
59 | ~x1: string,
60 | ~y1: string,
61 | ~x2: string,
62 | ~y2: string,
63 | ~stroke: string=?,
64 | ~strokeWidth: string=?,
65 | ~children: React.element=?
66 | ) =>
67 | React.element =
68 | "Line";
69 | };
70 |
71 | module Polygon = {
72 | [@bs.module "react-native-svg"] [@react.component]
73 | external make:
74 | (
75 | ~points: string,
76 | ~fill: string=?,
77 | ~stroke: string=?,
78 | ~strokeWidth: string=?,
79 | ~children: React.element=?
80 | ) =>
81 | React.element =
82 | "Polygon";
83 | };
84 |
85 | module Polyline = {
86 | [@bs.module "react-native-svg"] [@react.component]
87 | external make:
88 | (
89 | ~points: string,
90 | ~fill: string=?,
91 | ~stroke: string=?,
92 | ~strokeWidth: string=?,
93 | ~children: React.element=?
94 | ) =>
95 | React.element =
96 | "Polyline";
97 | };
98 |
99 | module Path = {
100 | [@bs.module "react-native-svg"] [@react.component]
101 | external make:
102 | (
103 | ~d: string,
104 | ~fill: string=?,
105 | ~opacity: string=?,
106 | ~stroke: string=?,
107 | ~strokeWidth: string=?,
108 | ~fillOpacity: string=?,
109 | ~strokeOpacity: string=?,
110 | ~children: React.element=?
111 | ) =>
112 | React.element =
113 | "Path";
114 | };
115 |
116 | module Text = {
117 | [@bs.module "react-native-svg"] [@react.component]
118 | external make:
119 | (
120 | ~x: string=?,
121 | ~y: string=?,
122 | ~fontSize: string=?,
123 | ~fontWeight: string=?,
124 | ~textAnchor: string=?,
125 | ~fill: string=?,
126 | ~stroke: string=?,
127 | ~strokeWidth: string=?,
128 | ~children: React.element=?
129 | ) =>
130 | React.element =
131 | "Text";
132 | };
133 |
134 | module TSpan = {
135 | [@bs.module "react-native-svg"] [@react.component]
136 | external make:
137 | (
138 | ~x: string=?,
139 | ~y: string=?,
140 | ~dx: string=?,
141 | ~dy: string=?,
142 | ~fontSize: string=?,
143 | ~fontWeight: string=?,
144 | ~textAnchor: string=?,
145 | ~fill: string=?,
146 | ~stroke: string=?,
147 | ~strokeWidth: string=?,
148 | ~children: React.element=?
149 | ) =>
150 | React.element =
151 | "TSpan";
152 | };
153 |
154 | module TextPath = {
155 | external make:
156 | (~href: string, ~startOffset: string=?, ~children: React.element=?) =>
157 | React.element =
158 | "TextPath";
159 | };
160 |
161 | module G = {
162 | [@bs.module "react-native-svg"] [@react.component]
163 | external make:
164 | (
165 | ~rotation: string=?,
166 | ~origin: string=?,
167 | ~fill: string=?,
168 | ~stroke: string=?,
169 | ~strokeWidth: string=?,
170 | ~transform: string=?,
171 | ~children: React.element=?
172 | ) =>
173 | React.element =
174 | "G";
175 | };
176 |
177 | module Use = {
178 | [@bs.module "react-native-svg"] [@react.component]
179 | external make:
180 | (
181 | ~href: string,
182 | ~x: string=?,
183 | ~y: string=?,
184 | ~fill: string=?,
185 | ~children: React.element=?
186 | ) =>
187 | React.element =
188 | "Use";
189 | };
190 |
191 | module Symbol = {
192 | [@bs.module "react-native-svg"] [@react.component]
193 | external make:
194 | (
195 | ~id: string,
196 | ~viewBox: string,
197 | ~width: string,
198 | ~height: string,
199 | ~children: React.element=?
200 | ) =>
201 | React.element =
202 | "Symbol";
203 | };
204 |
205 | module Defs = {
206 | [@bs.module "react-native-svg"] [@react.component]
207 | external make: (~children: React.element=?) => React.element = "Defs";
208 | };
209 |
210 | module Image = {
211 | [@bs.module "react-native-svg"] [@react.component]
212 | external make:
213 | (
214 | ~x: string=?,
215 | ~y: string=?,
216 | ~width: string,
217 | ~height: string,
218 | ~preserveAspectRatio: string=?,
219 | ~opacity: string=?,
220 | ~href: string,
221 | ~clipPath: string=?,
222 | ~children: React.element=?
223 | ) =>
224 | React.element =
225 | "Image";
226 | };
227 |
228 | module ClipPath = {
229 | [@bs.module "react-native-svg"] [@react.component]
230 | external make: (~id: string, ~children: React.element=?) => React.element =
231 | "ClipPath";
232 | };
233 |
234 | module LinearGradient = {
235 | [@bs.module "react-native-svg"] [@react.component]
236 | external make:
237 | (
238 | ~id: string,
239 | ~x1: string=?,
240 | ~y1: string=?,
241 | ~x2: string=?,
242 | ~y2: string=?,
243 | ~children: React.element=?
244 | ) =>
245 | React.element =
246 | "LinearGradient";
247 | };
248 |
249 | module RadialGradient = {
250 | [@bs.module "react-native-svg"] [@react.component]
251 | external make:
252 | (
253 | ~id: string,
254 | ~cx: string=?,
255 | ~cy: string=?,
256 | ~rx: string=?,
257 | ~ry: string=?,
258 | ~fx: string=?,
259 | ~fy: string=?,
260 | ~gradientUnits: string=?,
261 | ~children: React.element=?
262 | ) =>
263 | React.element =
264 | "RadialGradient";
265 | };
266 |
267 | module Stop = {
268 | [@bs.module "react-native-svg"] [@react.component]
269 | external make:
270 | (
271 | ~offset: string,
272 | ~stopColor: string=?,
273 | ~stopOpacity: string=?,
274 | ~children: React.element=?
275 | ) =>
276 | React.element =
277 | "Stop";
278 | };
279 |
280 | module Mask = {
281 | [@bs.module "react-native-svg"] [@react.component]
282 | external make:
283 | (
284 | ~id: string,
285 | ~x: string=?,
286 | ~y: string=?,
287 | ~height: string=?,
288 | ~width: string=?,
289 | ~maskUnits: string=?,
290 | ~children: React.element=?
291 | ) =>
292 | React.element =
293 | "Mask";
294 | };
295 |
296 | module Pattern = {
297 | [@bs.module "react-native-svg"] [@react.component]
298 | external make:
299 | (
300 | ~id: string,
301 | ~x: string=?,
302 | ~y: string=?,
303 | ~height: string,
304 | ~width: string,
305 | ~patternUnits: string=?,
306 | ~viewBox: string=?,
307 | ~children: React.element=?
308 | ) =>
309 | React.element =
310 | "Pattern";
311 | };
312 |
--------------------------------------------------------------------------------
/packages/reason-expo/src/Camera.re:
--------------------------------------------------------------------------------
1 | module Constants = {
2 | type t;
3 |
4 | module Type = {
5 | [@bs.module "expo-camera"] [@bs.scope ("Camera", "Constants", "Type")]
6 | external front: t = "front";
7 | [@bs.module "expo-camera"] [@bs.scope ("Camera", "Constants", "Type")]
8 | external back: t = "back";
9 | };
10 |
11 | module FlashMode = {
12 | [@bs.module "expo-camera"]
13 | [@bs.scope ("Camera", "Constants", "FlashMode")]
14 | external on: t = "on";
15 | [@bs.module "expo-camera"]
16 | [@bs.scope ("Camera", "Constants", "FlashMode")]
17 | external off: t = "off";
18 | [@bs.module "expo-camera"]
19 | [@bs.scope ("Camera", "Constants", "FlashMode")]
20 | external auto: t = "auto";
21 | [@bs.module "expo-camera"]
22 | [@bs.scope ("Camera", "Constants", "FlashMode")]
23 | external torch: t = "torch";
24 | };
25 |
26 | module AutoFocus = {
27 | [@bs.module "expo-camera"]
28 | [@bs.scope ("Camera", "Constants", "AutoFocus")]
29 | external on: t = "on";
30 | [@bs.module "expo-camera"]
31 | [@bs.scope ("Camera", "Constants", "AutoFocus")]
32 | external off: t = "off";
33 | };
34 |
35 | module WhiteBalance = {
36 | [@bs.module "expo-camera"]
37 | [@bs.scope ("Camera", "Constants", "WhiteBalance")]
38 | external auto: t = "auto";
39 | [@bs.module "expo-camera"]
40 | [@bs.scope ("Camera", "Constants", "WhiteBalance")]
41 | external sunny: t = "sunny";
42 | [@bs.module "expo-camera"]
43 | [@bs.scope ("Camera", "Constants", "WhiteBalance")]
44 | external cloudy: t = "cloudy";
45 | [@bs.module "expo-camera"]
46 | [@bs.scope ("Camera", "Constants", "WhiteBalance")]
47 | external shadow: t = "shadow";
48 | [@bs.module "expo-camera"]
49 | [@bs.scope ("Camera", "Constants", "WhiteBalance")]
50 | external fluorescent: t = "fluorescent";
51 | [@bs.module "expo-camera"]
52 | [@bs.scope ("Camera", "Constants", "WhiteBalance")]
53 | external incandescent: t = "incandescent";
54 | };
55 |
56 | module FaceDetection = {
57 | module Mode = {
58 | [@bs.module "expo-camera"]
59 | [@bs.scope ("FaceDetector", "Constants", "Mode")]
60 | external fast: t = "fast";
61 | [@bs.module "expo-camera"]
62 | [@bs.scope ("FaceDetector", "Constants", "Mode")]
63 | external accurate: t = "accurate";
64 | };
65 |
66 | module Landmarks = {
67 | [@bs.module "expo-camera"]
68 | [@bs.scope ("FaceDetector", "Constants", "Landmarks")]
69 | external all: t = "all";
70 | [@bs.module "expo-camera"]
71 | [@bs.scope ("FaceDetector", "Constants", "Landmarks")]
72 | external none: t = "none";
73 | };
74 |
75 | module Classifications = {
76 | [@bs.module "expo-camera"]
77 | [@bs.scope ("FaceDetector", "Constants", "Classifications")]
78 | external all: t = "all";
79 | [@bs.module "expo-camera"]
80 | [@bs.scope ("FaceDetector", "Constants", "Classifications")]
81 | external none: t = "none";
82 | };
83 | };
84 | };
85 |
86 | type cameraType =
87 | | Front
88 | | Back;
89 |
90 | type flashMode =
91 | | On
92 | | Off
93 | | Auto
94 | | Torch;
95 |
96 | type autoFocusType =
97 | | On
98 | | Off;
99 |
100 | type whiteBalanceType =
101 | | Auto
102 | | Sunny
103 | | Cloudy
104 | | Shadow
105 | | Fluorescent
106 | | Incandescent;
107 |
108 | type face = {
109 | faceID: int,
110 | bounds,
111 | }
112 | and bounds = {
113 | origin,
114 | size,
115 | rollAngle: float,
116 | yawAngle: float,
117 | smilingProbability: Js.nullable(float),
118 | leftEarPosition,
119 | rightEarPosition,
120 | leftEyePosition,
121 | leftEyeOpenProbability: Js.nullable(float),
122 | rightEyePosition,
123 | rightEyeOpenProbability: Js.nullable(float),
124 | leftCheekPosition,
125 | rightCheekPosition,
126 | mouthPosition,
127 | leftMouthPosition,
128 | rightMouthPosition,
129 | noseBasePosition,
130 | }
131 | and origin = {
132 | x: float,
133 | y: float,
134 | }
135 | and size = {
136 | width: float,
137 | height: float,
138 | }
139 | and leftEarPosition = {
140 | x: float,
141 | y: float,
142 | }
143 | and rightEarPosition = {
144 | x: float,
145 | y: float,
146 | }
147 | and leftEyePosition = {
148 | x: float,
149 | y: float,
150 | }
151 | and rightEyePosition = {
152 | x: float,
153 | y: float,
154 | }
155 | and leftCheekPosition = {
156 | x: float,
157 | y: float,
158 | }
159 | and rightCheekPosition = {
160 | x: float,
161 | y: float,
162 | }
163 | and mouthPosition = {
164 | x: float,
165 | y: float,
166 | }
167 | and leftMouthPosition = {
168 | x: float,
169 | y: float,
170 | }
171 | and rightMouthPosition = {
172 | x: float,
173 | y: float,
174 | }
175 | and noseBasePosition = {
176 | x: float,
177 | y: float,
178 | };
179 |
180 | type faceDetectionMode =
181 | | Fast
182 | | Accurate;
183 |
184 | type faceDetectionLandmarks =
185 | | All
186 | | None;
187 |
188 | type faceDetectionClassifications =
189 | | All
190 | | None;
191 |
192 | // [@bs.deriving abstract]
193 | type barCodeScannerSettings = {
194 | barCodeTypes: array(string),
195 | useCamera2Api: bool,
196 | };
197 | type onBarCodeScanned = {
198 | [@bs.as "type"]
199 | _type: string,
200 | data: string,
201 | };
202 | type onFacesDetected = {faces: array(face)};
203 | type message = string;
204 | let props =
205 | (
206 | ~type_: cameraType,
207 | ~flashMode: flashMode,
208 | ~autoFocus: autoFocusType,
209 | ~zoom: float,
210 | ~whiteBalance: whiteBalanceType,
211 | ~focusDepth: float,
212 | ~ratio: string,
213 | ~onCameraReady: unit => unit,
214 | ~onFacesDetected: onFacesDetected => unit,
215 | ~faceDetectionMode: faceDetectionMode,
216 | ~faceDetectionLandmarks: faceDetectionLandmarks,
217 | ~faceDetectionClassifications: faceDetectionClassifications,
218 | ~onMountError: message => unit,
219 | ~onBarCodeScanned: onBarCodeScanned => unit,
220 | ~barCodeScannerSettings=?,
221 | ~style=?,
222 | ~children,
223 | ) => {
224 | "type":
225 | switch (type_) {
226 | | Front => Constants.Type.front
227 | | Back => Constants.Type.back
228 | },
229 | "flashMode":
230 | switch (flashMode) {
231 | | On => Constants.FlashMode.on
232 | | Off => Constants.FlashMode.off
233 | | Auto => Constants.FlashMode.auto
234 | | Torch => Constants.FlashMode.torch
235 | },
236 | "autoFocus":
237 | switch (autoFocus) {
238 | | On => Constants.AutoFocus.on
239 | | Off => Constants.AutoFocus.off
240 | },
241 | "zoom": zoom,
242 | "whiteBalance":
243 | switch (whiteBalance) {
244 | | Auto => Constants.WhiteBalance.auto
245 | | Sunny => Constants.WhiteBalance.sunny
246 | | Cloudy => Constants.WhiteBalance.cloudy
247 | | Shadow => Constants.WhiteBalance.shadow
248 | | Fluorescent => Constants.WhiteBalance.fluorescent
249 | | Incandescent => Constants.WhiteBalance.incandescent
250 | },
251 | "focusDepth": focusDepth,
252 | "ratio": ratio,
253 | "onCameraReady": onCameraReady,
254 | "onFacesDetected": onFacesDetected,
255 | "faceDetectionMode":
256 | switch (faceDetectionMode) {
257 | | Fast => Constants.FaceDetection.Mode.fast
258 | | Accurate => Constants.FaceDetection.Mode.accurate
259 | },
260 | "faceDetectionLandmarks":
261 | switch (faceDetectionLandmarks) {
262 | | All => Constants.FaceDetection.Landmarks.all
263 | | None => Constants.FaceDetection.Landmarks.none
264 | },
265 | "faceDetectionClassifications":
266 | switch (faceDetectionClassifications) {
267 | | All => Constants.FaceDetection.Classifications.all
268 | | None => Constants.FaceDetection.Classifications.none
269 | },
270 | "onMountError": onMountError,
271 | "onBarCodeScanned": onBarCodeScanned,
272 | "barCodeScannerSettings": Js.Nullable.fromOption(barCodeScannerSettings),
273 | "style": Js.Undefined.fromOption(style),
274 | "children": children,
275 | };
276 |
277 | [@bs.module "expo-camera"] [@react.component]
278 | external make: props => React.element = "Camera" /* external make: 'a => React.element = "Camera"*/;
--------------------------------------------------------------------------------
/packages/reason-expo/src/Contacts.re:
--------------------------------------------------------------------------------
1 | module Fields = {
2 | type t = string;
3 |
4 | [@bs.module "expo-contacts"] [@bs.scope "Fields"] external id: t = "ID";
5 |
6 | [@bs.module "expo-contacts"] [@bs.scope "Fields"] external name: t = "Name";
7 |
8 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
9 | external firstName: t = "FirstName";
10 |
11 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
12 | external middleName: t = "MiddleName";
13 |
14 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
15 | external lastName: t = "LastName";
16 |
17 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
18 | external namePrefix: t = "NamePrefix";
19 |
20 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
21 | external nameSuffix: t = "NameSuffix";
22 |
23 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
24 | external phoneticFirstName: t = "PhoneticFirstName";
25 |
26 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
27 | external phoneticMiddleName: t = "PhoneticMiddleName";
28 |
29 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
30 | external phoneticLastName: t = "PhoneticLastName";
31 |
32 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
33 | external birthday: t = "Birthday";
34 |
35 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
36 | external emails: t = "Emails";
37 |
38 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
39 | external phoneNumbers: t = "PhoneNumbers";
40 |
41 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
42 | external addresses: t = "Addresses";
43 |
44 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
45 | external instantMessageAddresses: t = "InstantMessageAddresses";
46 |
47 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
48 | external urlAddresses: t = "UrlAddresses";
49 |
50 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
51 | external company: t = "Company";
52 |
53 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
54 | external jobTitle: t = "JobTitle";
55 |
56 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
57 | external department: t = "Department";
58 |
59 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
60 | external imageAvailable: t = "ImageAvailable";
61 |
62 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
63 | external image: t = "Image";
64 |
65 | [@bs.module "expo-contacts"] [@bs.scope "Fields"] external note: t = "Note";
66 |
67 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
68 | external dates: t = "Dates";
69 |
70 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
71 | external relationships: t = "Relationships";
72 |
73 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
74 | external nickname: t = "Nickname";
75 |
76 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
77 | external rawImage: t = "RawImage";
78 |
79 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
80 | external maidenName: t = "MaidenName";
81 |
82 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
83 | external contactType: t = "ContactType";
84 |
85 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
86 | external socialProfiles: t = "SocialProfiles";
87 |
88 | [@bs.module "expo-contacts"] [@bs.scope "Fields"]
89 | external nonGregorianBirthday: t = "NonGregorianBirthday";
90 |
91 | [@deprecated "Use `Fields.image` instead."]
92 | [@bs.module "expo-contacts"]
93 | [@bs.scope "Fields"]
94 | external thumbnail: t = "Thumbnail";
95 |
96 | [@deprecated "Use `Fields.maidenName` instead."]
97 | [@bs.module "expo-contacts"]
98 | [@bs.scope "Fields"]
99 | external previousLastName: t = "PreviousLastName";
100 | };
101 |
102 | module FormTypes = {
103 | type t = string;
104 |
105 | [@bs.module "expo-contacts"] [@bs.scope "FormTypes"]
106 | external new_: t = "New";
107 |
108 | [@bs.module "expo-contacts"] [@bs.scope "FormTypes"]
109 | external unknown: t = "Unknown";
110 |
111 | [@bs.module "expo-contacts"] [@bs.scope "FormTypes"]
112 | external default: t = "Default";
113 | };
114 |
115 | module ContactTypes = {
116 | type t = string;
117 |
118 | [@bs.module "expo-contacts"] [@bs.scope "ContactTypes"]
119 | external person: t = "Person";
120 |
121 | [@bs.module "expo-contacts"] [@bs.scope "ContactTypes"]
122 | external company: t = "Company";
123 | };
124 |
125 | module SortTypes = {
126 | type t = string;
127 |
128 | [@bs.module "expo-contacts"] [@bs.scope "SortTypes"]
129 | external firstName: t = "FirstName";
130 |
131 | [@bs.module "expo-contacts"] [@bs.scope "SortTypes"]
132 | external lastName: t = "LastName";
133 |
134 | [@bs.module "expo-contacts"] [@bs.scope "SortTypes"]
135 | external userDefault: t = "UserDefault";
136 | };
137 |
138 | module ContainerTypes = {
139 | type t = string;
140 |
141 | [@bs.module "expo-contacts"] [@bs.scope "ContainerTypes"]
142 | external local: t = "Local";
143 |
144 | [@bs.module "expo-contacts"] [@bs.scope "ContainerTypes"]
145 | external exchange: t = "Exchange";
146 |
147 | [@bs.module "expo-contacts"] [@bs.scope "ContainerTypes"]
148 | external cardDAV: t = "CardDAV";
149 |
150 | [@bs.module "expo-contacts"] [@bs.scope "ContainerTypes"]
151 | external unassigned: t = "Unassigned";
152 | };
153 |
154 | module CalendarFormats = {
155 | type t = string;
156 |
157 | [@bs.module "expo-contacts"] [@bs.scope "CalendarFormats"]
158 | external gregorian: t = "Gregorian";
159 |
160 | [@bs.module "expo-contacts"] [@bs.scope "CalendarFormats"]
161 | external chinese: t = "Chinese";
162 |
163 | [@bs.module "expo-contacts"] [@bs.scope "CalendarFormats"]
164 | external hebrew: t = "Hebrew";
165 |
166 | [@bs.module "expo-contacts"] [@bs.scope "CalendarFormats"]
167 | external islamic: t = "Islamic";
168 | };
169 |
170 | // [@bs.deriving abstract]
171 | type image = {
172 | uri: string,
173 | width: int,
174 | height: int,
175 | base64: string,
176 | };
177 |
178 | // [@bs.deriving abstract]
179 | type date = {
180 | day: int,
181 | month: int,
182 | year: int,
183 | format: CalendarFormats.t,
184 | id: string,
185 | label: string,
186 | };
187 |
188 | // [@bs.deriving abstract]
189 | type relationship = {
190 | name: string,
191 | id: string,
192 | label: string,
193 | };
194 |
195 | // [@bs.deriving abstract]
196 | type email = {
197 | email: string,
198 | isPrimary: bool,
199 | id: string,
200 | label: string,
201 | };
202 |
203 | // [@bs.deriving abstract]
204 | type phoneNumber = {
205 | number: string,
206 | isPrimary: bool,
207 | digits: string,
208 | countryCode: string,
209 | id: string,
210 | label: string,
211 | };
212 |
213 | // [@bs.deriving abstract]
214 | type address = {
215 | street: string,
216 | city: string,
217 | country: string,
218 | region: string,
219 | neneighborhood: string,
220 | postalCode: string,
221 | poBox: string,
222 | isoCountryCode: string,
223 | id: string,
224 | label: string,
225 | };
226 |
227 | // [@bs.deriving abstract]
228 | type group = {
229 | id: string,
230 | name: string,
231 | };
232 |
233 | // [@bs.deriving abstract]
234 | type container = {
235 | id: string,
236 | name: string,
237 | };
238 |
239 | // [@bs.deriving abstract]
240 | type socialProfile = {
241 | service: string,
242 | username: string,
243 | localizedProfile: string,
244 | url: string,
245 | userId: string,
246 | id: string,
247 | label: string,
248 | };
249 |
250 | // [@bs.deriving abstract]
251 | type instantMessageAddress = {
252 | service: string,
253 | username: string,
254 | localizedService: string,
255 | id: string,
256 | label: string,
257 | };
258 |
259 | // [@bs.deriving abstract]
260 | type urlAddress = {
261 | url: string,
262 | id: string,
263 | label: string,
264 | };
265 |
266 | // [@bs.deriving abstract]
267 | type formOptions = {
268 | displayedPropertyKeys: array(Fields.t),
269 | message: string,
270 | alternateName: string,
271 | cancelButtonTitle: string,
272 | groupId: string,
273 | allowsEditing: bool,
274 | allowsActions: bool,
275 | shouldShowLinkedContacts: bool,
276 | isNew: bool,
277 | preventAnimation: bool,
278 | };
279 |
280 | // [@bs.deriving abstract]
281 | type contactQuery = {
282 | fields: array(Fields.t),
283 | pageSize: int,
284 | pageOffset: int,
285 | id: string,
286 | sort: SortTypes.t,
287 | name: string,
288 | groupId: string,
289 | containerId: string,
290 | rawContacts: bool,
291 | };
292 |
293 | // [@bs.deriving abstract]
294 | type groupQuery = {
295 | groupName: string,
296 | groupId: string,
297 | containerId: string,
298 | };
299 |
300 | // [@bs.deriving abstract]
301 | type containerQuery = {
302 | contactId: string,
303 | groupId: string,
304 | containerId: string,
305 | };
306 |
307 | // [@bs.deriving abstract]
308 | type contact = {
309 | id: string,
310 | name: string,
311 | firstName: string,
312 | middleName: string,
313 | lastName: string,
314 | maidenName: string,
315 | namePrefix: string,
316 | nameSuffix: string,
317 | nickname: string,
318 | phoneticFirstName: string,
319 | phoneticMiddleName: string,
320 | phoneticLastName: string,
321 | company: string,
322 | jobTitle: string,
323 | department: string,
324 | note: string,
325 | imageAvailable: bool,
326 | image,
327 | rawImage: image,
328 | contactType: ContactTypes.t,
329 | birthday: date,
330 | dates: array(date),
331 | relationships: array(relationship),
332 | emails: array(email),
333 | phoneNumbers: array(phoneNumber),
334 | addresses: array(address),
335 | instantMessageAddresses: array(instantMessageAddress),
336 | urlAddresses: array(urlAddress),
337 | nonGregorianBirthday: date,
338 | socialProfiles: array(socialProfile),
339 | };
340 |
341 | // [@bs.deriving abstract]
342 | type contactResponse = {
343 | data: array(contact),
344 | hasNextPage: bool,
345 | hasPreviousPage: bool,
346 | };
347 |
348 | [@bs.module "expo-contacts"]
349 | external getContactsAsync: contactQuery => Js.Promise.t(contactResponse) =
350 | "getContactsAsync";
351 |
352 | [@bs.module "expo-contacts"]
353 | external getContactByIdAsync:
354 | (string, array(Fields.t)) => Js.Promise.t(contact) =
355 | "getContactByIdAsync";
356 |
357 | [@bs.module "expo-contacts"]
358 | external addContactAsync: (contact, string) => Js.Promise.t(string) =
359 | "getContactByIdAsync";
360 |
361 | [@bs.module "expo-contacts"]
362 | external updateContactAsync: contact => Js.Promise.t(string) =
363 | "updateContactAsync";
364 |
365 | [@bs.module "expo-contacts"]
366 | external removeContactAsync: string => Js.Promise.t(unit) =
367 | "removeContactAsync";
368 |
369 | [@bs.module "expo-contacts"]
370 | external writeContactToFileAsync: contactQuery => Js.Promise.t(string) =
371 | "writeContactToFileAsync";
372 |
373 | [@bs.module "expo-contacts"]
374 | external presentFormAsync:
375 | (string, contact, formOptions) => Js.Promise.t(unit) =
376 | "presentFormAsync";
377 |
378 | [@bs.module "expo-contacts"]
379 | external addExistingGroupToContainerAsync:
380 | (string, string) => Js.Promise.t(unit) =
381 | "addExistingGroupToContainerAsync";
382 |
383 | [@bs.module "expo-contacts"]
384 | external createGroupAsync:
385 | (string, Js.Nullable.t(string)) => Js.Promise.t(string) =
386 | "createGroupAsync";
387 |
388 | [@bs.module "expo-contacts"]
389 | external updateGroupNameAsync: (string, string) => Js.Promise.t(unit) =
390 | "updateGroupNameAsync";
391 |
392 | [@bs.module "expo-contacts"]
393 | external removeGroupAsync: string => Js.Promise.t(unit) = "removeGroupAsync";
394 |
395 | [@bs.module "expo-contacts"]
396 | external addExistingContactToGroupAsync:
397 | (string, string) => Js.Promise.t(unit) =
398 | "addExistingContactToGroupAsync";
399 |
400 | [@bs.module "expo-contacts"]
401 | external removeContactFromGroupAsync: (string, string) => Js.Promise.t(unit) =
402 | "removeContactFromGroupAsync";
403 |
404 | [@bs.module "expo-contacts"]
405 | external getGroupsAsync: groupQuery => Js.Promise.t(array(group)) =
406 | "getGroupsAsync";
407 |
408 | [@bs.module "expo-contacts"]
409 | external getDefaultContainerIdAsync: unit => Js.Promise.t(string) =
410 | "getDefaultContainerIdAsync";
411 |
412 | [@bs.module "expo-contacts"]
413 | external getContainersAsync: containerQuery => Js.Promise.t(array(container)) =
414 | "getContainersAsync";
--------------------------------------------------------------------------------
/packages/reason-expo/src/Calendar.re:
--------------------------------------------------------------------------------
1 | module AttendeeStatus = {
2 | type t = string;
3 |
4 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeStatus"]
5 | external accepted: t = "ACCEPTED";
6 |
7 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeStatus"]
8 | external declined: t = "DECLINED";
9 |
10 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeStatus"]
11 | external tentative: t = "TENTATIVE";
12 |
13 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeStatus"]
14 | external delegated: t = "DELEGATED";
15 |
16 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeStatus"]
17 | external completed: t = "COMPLETED";
18 |
19 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeStatus"]
20 | external inProcess: t = "IN_PROCESS";
21 |
22 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeStatus"]
23 | external unknown: t = "UNKNOWN";
24 |
25 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeStatus"]
26 | external pending: t = "PENDING";
27 |
28 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeStatus"]
29 | external invited: t = "INVITED";
30 |
31 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeStatus"]
32 | external none: t = "NONE";
33 | };
34 |
35 | module EventStatus = {
36 | type t = string;
37 |
38 | [@bs.module "expo-calendar"] [@bs.scope "EventStatus"]
39 | external none: t = "NONE";
40 |
41 | [@bs.module "expo-calendar"] [@bs.scope "EventStatus"]
42 | external confirmed: t = "CONFIRMED";
43 |
44 | [@bs.module "expo-calendar"] [@bs.scope "EventStatus"]
45 | external tentative: t = "TENTATIVE";
46 |
47 | [@bs.module "expo-calendar"] [@bs.scope "EventStatus"]
48 | external canceled: t = "CANCELED";
49 | };
50 |
51 | module Frequency = {
52 | type t = string;
53 |
54 | [@bs.module "expo-calendar"] [@bs.scope "Frequency"]
55 | external daily: t = "DAILY";
56 |
57 | [@bs.module "expo-calendar"] [@bs.scope "Frequency"]
58 | external weekly: t = "WEEKLY";
59 |
60 | [@bs.module "expo-calendar"] [@bs.scope "Frequency"]
61 | external monthly: t = "MONTHLY";
62 |
63 | [@bs.module "expo-calendar"] [@bs.scope "Frequency"]
64 | external yearly: t = "YEARLY";
65 | };
66 |
67 | module EventAccessLevel = {
68 | type t = string;
69 |
70 | [@bs.module "expo-calendar"] [@bs.scope "EventAccessLevel"]
71 | external confidential: t = "CONFIDENTIAL";
72 |
73 | [@bs.module "expo-calendar"] [@bs.scope "EventAccessLevel"]
74 | external priv: t = "PRIVATE";
75 |
76 | [@bs.module "expo-calendar"] [@bs.scope "EventAccessLevel"]
77 | external public: t = "PUBLIC";
78 | };
79 |
80 | module CalendarAccessLevel = {
81 | type t = string;
82 |
83 | [@bs.module "expo-calendar"] [@bs.scope "CalendarAccessLevel"]
84 | external contributor: t = "CONTRIBUTOR";
85 |
86 | [@bs.module "expo-calendar"] [@bs.scope "CalendarAccessLevel"]
87 | external editor: t = "EDITOR";
88 |
89 | [@bs.module "expo-calendar"] [@bs.scope "CalendarAccessLevel"]
90 | external freebusy: t = "FREEBUSY";
91 |
92 | [@bs.module "expo-calendar"] [@bs.scope "CalendarAccessLevel"]
93 | external override: t = "OVERRIDE";
94 |
95 | [@bs.module "expo-calendar"] [@bs.scope "CalendarAccessLevel"]
96 | external owner: t = "OWNER";
97 |
98 | [@bs.module "expo-calendar"] [@bs.scope "CalendarAccessLevel"]
99 | external read: t = "READ";
100 |
101 | [@bs.module "expo-calendar"] [@bs.scope "CalendarAccessLevel"]
102 | external respond: t = "RESPOND";
103 |
104 | [@bs.module "expo-calendar"] [@bs.scope "CalendarAccessLevel"]
105 | external root: t = "ROOT";
106 |
107 | [@bs.module "expo-calendar"] [@bs.scope "CalendarAccessLevel"]
108 | external none: t = "NONE";
109 | };
110 |
111 | module AttendeeType = {
112 | type t = string;
113 |
114 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeType"]
115 | external unknown: t = "UNKNOWN";
116 |
117 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeType"]
118 | external person: t = "PERSON";
119 |
120 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeType"]
121 | external room: t = "ROOM";
122 |
123 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeType"]
124 | external group: t = "GROUP";
125 |
126 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeType"]
127 | external resource: t = "RESOURCE";
128 |
129 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeType"]
130 | external optional: t = "OPTIONAL";
131 |
132 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeType"]
133 | external required: t = "REQUIRED";
134 |
135 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeType"]
136 | external none: t = "NONE";
137 | };
138 |
139 | module AttendeeRole = {
140 | type t = string;
141 |
142 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeRole"]
143 | external unknown: t = "UNKNOWN";
144 |
145 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeRole"]
146 | external required: t = "REQUIRED";
147 |
148 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeRole"]
149 | external optional: t = "OPTIONAL";
150 |
151 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeRole"]
152 | external nonParticipant: t = "NON_PARTICIPANT";
153 |
154 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeRole"]
155 | external attendee: t = "ATTENDEE";
156 |
157 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeRole"]
158 | external organizer: t = "ORGANIZER";
159 |
160 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeRole"]
161 | external performer: t = "PERFORMER";
162 |
163 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeRole"]
164 | external speaker: t = "SPEAKER";
165 |
166 | [@bs.module "expo-calendar"] [@bs.scope "AttendeeRole"]
167 | external none: t = "none";
168 | };
169 |
170 | module Availability = {
171 | type t = string;
172 |
173 | [@bs.module "expo-calendar"] [@bs.scope "Availability"]
174 | external busy: t = "BUSY";
175 |
176 | [@bs.module "expo-calendar"] [@bs.scope "Availability"]
177 | external free: t = "FREE";
178 |
179 | [@bs.module "expo-calendar"] [@bs.scope "Availability"]
180 | external tentative: t = "TENTATIVE";
181 |
182 | [@bs.module "expo-calendar"] [@bs.scope "Availability"]
183 | external unavailable: t = "UNAVAILABLE";
184 |
185 | [@bs.module "expo-calendar"] [@bs.scope "Availability"]
186 | external notSupported: t = "NOT_SUPPORTED";
187 | };
188 |
189 | module AlarmMethod = {
190 | type t = string;
191 |
192 | [@bs.module "expo-calendar"] [@bs.scope "AlarmMethod"]
193 | external alarm: t = "ALARM";
194 |
195 | [@bs.module "expo-calendar"] [@bs.scope "AlarmMethod"]
196 | external alert: t = "ALERT";
197 |
198 | [@bs.module "expo-calendar"] [@bs.scope "AlarmMethod"]
199 | external email: t = "EMAIL";
200 |
201 | [@bs.module "expo-calendar"] [@bs.scope "AlarmMethod"]
202 | external sms: t = "SMS";
203 | };
204 |
205 | module EntityType = {
206 | type t = string;
207 |
208 | [@bs.module "expo-calendar"] [@bs.scope "EntityTypes"]
209 | external event: t = "EVENT";
210 |
211 | [@bs.module "expo-calendar"] [@bs.scope "EntityTypes"]
212 | external reminder: t = "REMINDER";
213 | };
214 |
215 | module SourceType = {
216 | type t = string;
217 |
218 | [@bs.module "expo-calendar"] [@bs.scope "SourceType"]
219 | external local: t = "LOCAL";
220 |
221 | [@bs.module "expo-calendar"] [@bs.scope "SourceType"]
222 | external exchange: t = "EXCHANGE";
223 |
224 | [@bs.module "expo-calendar"] [@bs.scope "SourceType"]
225 | external caldav: t = "CALDAV";
226 |
227 | [@bs.module "expo-calendar"] [@bs.scope "SourceType"]
228 | external mobileme: t = "MOBILEME";
229 |
230 | [@bs.module "expo-calendar"] [@bs.scope "SourceType"]
231 | external subscribed: t = "SUBSCRIBED";
232 |
233 | [@bs.module "expo-calendar"] [@bs.scope "SourceType"]
234 | external birthdays: t = "BIRTHDAYS";
235 | };
236 |
237 | // [@bs.deriving abstract]
238 | type alarm = {
239 | absoluteDate: Js.Date.t,
240 | relativeOffset: int,
241 | method: AlarmMethod.t,
242 | };
243 |
244 | // [@bs.deriving abstract]
245 | type recurrenceRule = {
246 | frequency: Frequency.t,
247 | interval: int,
248 | endDate: Js.Date.t,
249 | occurrence: int,
250 | };
251 |
252 | // [@bs.deriving abstract]
253 | type attendee = {
254 | id: string,
255 | email: string,
256 | name: string,
257 | role: AttendeeRole.t,
258 | status: AttendeeStatus.t,
259 | [@bs.as "type"]
260 | _type: string,
261 | url: option(string),
262 | isCurrentUser: option(bool),
263 | };
264 | /* {
265 | .
266 | id: string,
267 | email: string,
268 | name: string,
269 | role: AttendeeRole.t,
270 | status: AttendeeStatus.t,
271 | _type: string,
272 | } */
273 |
274 | // [@bs.deriving abstract]
275 | type source = {
276 | id: string,
277 | name: string,
278 | [@bs.as "type"]
279 | _type: SourceType.t,
280 | isLocalAccount: bool,
281 | };
282 |
283 | // [@bs.deriving abstract]
284 | type calendar = {
285 | id: string,
286 | title: string,
287 | entityType: EntityType.t,
288 | source,
289 | color: string,
290 | allowsModifications: bool,
291 | [@bs.as "type"]
292 | _type: string,
293 | isPrimary: bool,
294 | name: string,
295 | ownerAccount: string,
296 | timeZone: string,
297 | allowedAvailabilities: array(Availability.t),
298 | allowedReminders: array(AlarmMethod.t),
299 | allowedAttendeeTypes: array(AttendeeType.t),
300 | isVisible: bool,
301 | isSynced: bool,
302 | accessLevel: CalendarAccessLevel.t,
303 | };
304 |
305 | // [@bs.deriving abstract]
306 | type event = {
307 | id: string,
308 | calendarId: string,
309 | title: string,
310 | startDate: Js.Date.t,
311 | endDate: Js.Date.t,
312 | allDay: bool,
313 | location: string,
314 | notes: string,
315 | alarms: array(alarm),
316 | recurrenceRule,
317 | availability: Availability.t,
318 | timeZone: string,
319 | endTimeZone: string,
320 | url: string,
321 | creationDate: string,
322 | ladtModifiedDate: string,
323 | originalStartDate: string,
324 | isDetached: bool,
325 | status: EventStatus.t,
326 | organizer: attendee,
327 | organizerEmail: string,
328 | accessLevel: EventAccessLevel.t,
329 | guestsCanModify: bool,
330 | guestsCanInviteOthers: bool,
331 | guestsCanSeeGuests: bool,
332 | originalId: string,
333 | instanceId: string,
334 | };
335 |
336 | // [@bs.deriving abstract]
337 | type reminder = {
338 | id: string,
339 | calendarId: string,
340 | title: string,
341 | startDate: Js.Date.t,
342 | dueDate: Js.Date.t,
343 | completed: bool,
344 | completionDate: Js.Date.t,
345 | location: string,
346 | notes: string,
347 | alarms: array(alarm),
348 | recurrenceRule,
349 | timeZone: string,
350 | url: string,
351 | creationDate: string,
352 | lastModifiedDate: string,
353 | };
354 |
355 | [@bs.module "expo-calendar"]
356 | external getCalendarsAsync: EntityType.t => Js.Promise.t(array(calendar)) =
357 | "getCalendarsAsync";
358 |
359 | // [@bs.deriving abstract]
360 | type createCalendarAsyncDetails = {
361 | title: string,
362 | color: string,
363 | entityType: EntityType.t,
364 | sourceId: string,
365 | source: {
366 | .
367 | isLocalAccount: bool,
368 | name: string,
369 | _type: string,
370 | },
371 | name: string,
372 | ownerAccount: string,
373 | // [@bs.optional]
374 | timeZone: option(string),
375 | // [@bs.optional]
376 | allowedAvailabilities: option(array(Availability.t)),
377 | // [@bs.optional]
378 | allowedReminders: option(array(AlarmMethod.t)),
379 | // [@bs.optional]
380 | allowedAttendeeTypes: option(array(AttendeeType.t)),
381 | // [@bs.optional]
382 | isVisible: option(bool),
383 | // [@bs.optional]
384 | isSynced: option(bool),
385 | // [@bs.optional]
386 | accessLevel: string,
387 | };
388 |
389 | [@bs.module "expo-calendar"]
390 | external createCalendarAsync:
391 | createCalendarAsyncDetails => Js.Promise.t(string) =
392 | "createCalendarAsync";
393 |
394 | // [@bs.deriving abstract]
395 | type updateCalendarAsyncDetails = {
396 | title: Js.Nullable.t(string),
397 | color: Js.Nullable.t(string),
398 | name: Js.Nullable.t(string),
399 | isVisible: Js.Nullable.t(bool),
400 | isSynced: Js.Nullable.t(bool),
401 | };
402 |
403 | [@bs.module "expo-calendar"]
404 | external updateCalendarAsync:
405 | (string, updateCalendarAsyncDetails) => Js.Promise.t(unit) =
406 | "updateCalendarAsync";
407 |
408 | [@bs.module "expo-calendar"]
409 | external getEventsAsync:
410 | (array(string), Js.Date.t, Js.Date.t) => Js.Promise.t(array(event)) =
411 | "updateCalendarAsync";
412 |
413 | [@bs.module "expo-calendar"]
414 | external getEventAsync:
415 | (string, {. instanceStartDate: Js.Date.t}) => Js.Promise.t(event) =
416 | "getEventAsync";
417 |
418 | // [@bs.deriving abstract]
419 | type createEventAsyncDetails = {
420 | title: string,
421 | startDate: Js.Date.t,
422 | endDate: Js.Date.t,
423 | allDay: bool,
424 | location: string,
425 | notes: string,
426 | alarms: array(alarm),
427 | recurrenceRule,
428 | availability: Availability.t,
429 | timeZone: string,
430 | endTimeZone: string,
431 | url: string,
432 | organizerEmail: string,
433 | accessLevel: string,
434 | guestsCanModify: bool,
435 | guestsCanInviteOthers: bool,
436 | guestsCanSeeGuests: bool,
437 | };
438 |
439 | [@bs.module "expo-calendar"]
440 | external createEventAsync:
441 | (string, createEventAsyncDetails) => Js.Promise.t(string) =
442 | "createEventAsync";
443 |
444 | // [@bs.deriving abstract]
445 | type updateEventAsyncDetails = {
446 | title: string,
447 | startDate: Js.Date.t,
448 | endDate: Js.Date.t,
449 | allDay: bool,
450 | location: string,
451 | notes: string,
452 | alarms: array(alarm),
453 | recurrenceRule,
454 | availability: Availability.t,
455 | timeZone: string,
456 | endTimeZone: string,
457 | url: string,
458 | organizerEmail: string,
459 | accessLevel: string,
460 | guestsCanModify: bool,
461 | guestsCanInviteOthers: bool,
462 | guestsCanSeeGuests: bool,
463 | };
464 | type instanceStartDate = Js.Date.t;
465 | type futureEvents = {
466 | instanceStartDate,
467 | futureEvents: bool,
468 | };
469 | type updateEventAsyncProps = {
470 | string,
471 | updateEventAsyncDetails,
472 | futureEvents,
473 | };
474 | type deleteEventAsyncProps = {
475 | string,
476 | futureEvents,
477 | };
478 |
479 | [@bs.module "expo-calendar"]
480 | external updateEventAsync: updateEventAsyncProps => Js.Promise.t(unit) =
481 | "updateEventAsync";
482 |
483 | [@bs.module "expo-calendar"]
484 | external deleteEventAsync: deleteEventAsyncProps => Js.Promise.t(unit) =
485 | "deleteEventAsync";
486 |
487 | [@bs.module "expo-calendar"]
488 | external getAttendeesForEventAsync:
489 | (string, instanceStartDate) =>
490 | Js.Promise.t(array(attendee)) =
491 | "getAttendeesForEventAsync";
492 |
493 | [@bs.module "expo-calendar"]
494 | external createAttendeeAsync:
495 | (
496 | string,
497 | attendee
498 | ) =>
499 | Js.Promise.t(string) =
500 | "createAttendeeAsync";
501 |
502 | [@bs.module "expo-calendar"]
503 | external updateAttendeeAsync:
504 | (
505 | string,
506 | {
507 | .
508 | id: string,
509 | email: string,
510 | name: string,
511 | role: AttendeeRole.t,
512 | status: AttendeeStatus.t,
513 | _type: string,
514 | }
515 | ) =>
516 | Js.Promise.t(unit) =
517 | "updateAttendeeAsync";
518 |
519 | [@bs.module "expo-calendar"]
520 | external deleteAttendeeAsync: string => Js.Promise.t(unit) =
521 | "deleteAttendeeAsync";
522 |
523 | [@bs.module "expo-calendar"]
524 | external getRemindersAsync:
525 | (array(string), string, Js.Date.t, Js.Date.t) =>
526 | Js.Promise.t(array(reminder)) =
527 | "getRemindersAsync";
528 |
529 | [@bs.module "expo-calendar"]
530 | external getReminderAsync: string => Js.Promise.t(reminder) =
531 | "getReminderAsync";
532 |
533 | [@bs.module "expo-calendar"]
534 | external createReminderAsync:
535 | (
536 | string,
537 | {
538 | .
539 | title: string,
540 | startDate: Js.Date.t,
541 | dueDate: Js.Date.t,
542 | completed: bool,
543 | completionDate: Js.Date.t,
544 | location: string,
545 | notes: string,
546 | alarms: array(alarm),
547 | recurrenceRule: recurrenceRule,
548 | timeZone: string,
549 | url: string,
550 | }
551 | ) =>
552 | Js.Promise.t(string) =
553 | "createReminderAsync";
554 |
555 | [@bs.module "expo-calendar"]
556 | external updateReminderAsync:
557 | (
558 | string,
559 | {
560 | .
561 | title: string,
562 | startDate: Js.Date.t,
563 | dueDate: Js.Date.t,
564 | completed: bool,
565 | completionDate: Js.Date.t,
566 | location: string,
567 | notes: string,
568 | alarms: array(alarm),
569 | recurrenceRule: recurrenceRule,
570 | timeZone: string,
571 | url: string,
572 | }
573 | ) =>
574 | Js.Promise.t(string) =
575 | "updateReminderAsync";
576 |
577 | [@bs.module "expo-calendar"]
578 | external deleteReminderAsync: string => Js.Promise.t(unit) =
579 | "deleteReminderAsync";
580 |
581 | [@bs.module "expo-calendar"]
582 | external getSourcesAsync: unit => Js.Promise.t(array(source)) =
583 | "getSourcesAsync";
584 |
585 | [@bs.module "expo-calendar"]
586 | external getSourceAsync: string => Js.Promise.t(source) = "getSourceAsync";
587 |
588 | [@bs.module "expo-calendar"]
589 | external openEventInCalendar: string => unit = "openEventInCalendar";
--------------------------------------------------------------------------------
/packages/reason-expo/src/AR.re:
--------------------------------------------------------------------------------
1 | module HitTestResultTypes = {
2 | type t = string;
3 |
4 | [@bs.module "expo"] [@bs.scope ("AR", "HitTestResultTypes")]
5 | external featurePoint: t = "FeaturePoint";
6 |
7 | [@bs.module "expo"] [@bs.scope ("AR", "HitTestResultTypes")]
8 | external horizontalPlane: t = "HorizontalPlane";
9 |
10 | [@bs.module "expo"] [@bs.scope ("AR", "HitTestResultTypes")]
11 | external verticalPlane: t = "VerticalPlane";
12 |
13 | [@bs.module "expo"] [@bs.scope ("AR", "HitTestResultTypes")]
14 | external existingPlane: t = "ExistingPlane";
15 |
16 | [@bs.module "expo"] [@bs.scope ("AR", "HitTestResultTypes")]
17 | external existingPlaneUsingExtent: t = "ExistingPlaneUsingExtent";
18 |
19 | [@bs.module "expo"] [@bs.scope ("AR", "HitTestResultTypes")]
20 | external existingPlaneUsingGeometry: t = "ExistingPlaneUsingGeometry";
21 | };
22 |
23 | module TrackingConfiguration = {
24 | type t = string;
25 |
26 | [@bs.module "expo"] [@bs.scope ("AR", "TrackingConfiguration")]
27 | external world: t = "World";
28 |
29 | [@bs.module "expo"] [@bs.scope ("AR", "TrackingConfiguration")]
30 | external orientation: t = "Orientation";
31 |
32 | [@bs.module "expo"] [@bs.scope ("AR", "TrackingConfiguration")]
33 | external face: t = "Face";
34 | };
35 |
36 | module DepthDataQuality = {
37 | type t = string;
38 |
39 | [@bs.module "expo"] [@bs.scope ("AR", "DepthDataQuality")]
40 | external low: t = "Low";
41 |
42 | [@bs.module "expo"] [@bs.scope ("AR", "DepthDataQuality")]
43 | external high: t = "High";
44 | };
45 |
46 | module DepthDataAccuracy = {
47 | type t = string;
48 |
49 | [@bs.module "expo"] [@bs.scope ("AR", "DepthDataAccuracy")]
50 | external absolute: t = "Absolute";
51 |
52 | [@bs.module "expo"] [@bs.scope ("AR", "DepthDataAccuracy")]
53 | external relative: t = "Relative";
54 | };
55 |
56 | module BlendShape = {
57 | type t = string;
58 |
59 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
60 | external browDownL: t = "BrowDownL";
61 |
62 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
63 | external browDownR: t = "BrowDownR";
64 |
65 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
66 | external browInnerUp: t = "BrowInnerUp";
67 |
68 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
69 | external browOuterUpL: t = "BrowOuterUpL";
70 |
71 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
72 | external browOuterUpR: t = "BrowOuterUpR";
73 |
74 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
75 | external cheekPuff: t = "CheekPuff";
76 |
77 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
78 | external cheekSquintL: t = "CheekSquintL";
79 |
80 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
81 | external cheekSquintR: t = "CheekSquintR";
82 |
83 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
84 | external eyeBlinkL: t = "EyeBlinkL";
85 |
86 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
87 | external eyeBlinkR: t = "EyeBlinkR";
88 |
89 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
90 | external eyeLookDownL: t = "EyeLookDownL";
91 |
92 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
93 | external eyeLookDownR: t = "EyeLookDownR";
94 |
95 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
96 | external eyeLookInL: t = "EyeLookInL";
97 |
98 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
99 | external eyeLookInR: t = "EyeLookInR";
100 |
101 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
102 | external eyeLookOutL: t = "EyeLookOutL";
103 |
104 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
105 | external eyeLookOutR: t = "EyeLookOutR";
106 |
107 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
108 | external eyeLookUpL: t = "EyeLookUpL";
109 |
110 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
111 | external eyeLookUpR: t = "EyeLookUpR";
112 |
113 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
114 | external eyeSquintL: t = "EyeSquintL";
115 |
116 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
117 | external eyeSquintR: t = "EyeSquintR";
118 |
119 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
120 | external eyeWideL: t = "EyeWideL";
121 |
122 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
123 | external eyeWideR: t = "EyeWideR";
124 |
125 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
126 | external jawForward: t = "JawForward";
127 |
128 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
129 | external jawLeft: t = "JawLeft";
130 |
131 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
132 | external jawOpen: t = "JawOpen";
133 |
134 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
135 | external jawRight: t = "JawRight";
136 |
137 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
138 | external mouthClose: t = "MouthClose";
139 |
140 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
141 | external mouthDimpleL: t = "MouthDimpleL";
142 |
143 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
144 | external mouthDimpleR: t = "MouthDimpleR";
145 |
146 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
147 | external mouthFrownL: t = "MouthFrownL";
148 |
149 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
150 | external mouthFrownR: t = "MouthFrownR";
151 |
152 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
153 | external mouthFunnel: t = "MouthFunnel";
154 |
155 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
156 | external mouthLeft: t = "MouthLeft";
157 |
158 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
159 | external mouthLowerDownL: t = "MouthLowerDownL";
160 |
161 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
162 | external mouthLowerDownR: t = "MouthLowerDownR";
163 |
164 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
165 | external mouthPressL: t = "MouthPressL";
166 |
167 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
168 | external mouthPressR: t = "MouthPressR";
169 |
170 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
171 | external mouthPucker: t = "MouthPucker";
172 |
173 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
174 | external mouthRight: t = "MouthRight";
175 |
176 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
177 | external mouthRollLower: t = "MouthRollLower";
178 |
179 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
180 | external mouthRollUpper: t = "MouthRollUpper";
181 |
182 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
183 | external mouthShrugLower: t = "MouthShrugLower";
184 |
185 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
186 | external mouthShrugUpper: t = "MouthShrugUpper";
187 |
188 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
189 | external mouthSmileL: t = "MouthSmileL";
190 |
191 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
192 | external mouthSmileR: t = "MouthSmileR";
193 |
194 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
195 | external mouthStretchL: t = "MouthStretchL";
196 |
197 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
198 | external mouthStretchR: t = "MouthStretchR";
199 |
200 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
201 | external mouthUpperUpL: t = "MouthUpperUpL";
202 |
203 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
204 | external mouthUpperUpR: t = "MouthUpperUpR";
205 |
206 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
207 | external noseSneerL: t = "NoseSneerL";
208 |
209 | [@bs.module "expo"] [@bs.scope ("AR", "BlendShape")]
210 | external noseSneerR: t = "NoseSneerR";
211 | };
212 |
213 | module FaceAnchorProp = {
214 | type t = string;
215 |
216 | [@bs.module "expo"] [@bs.scope ("AR", "FaceAnchorProp")]
217 | external geometry: t = "Geometry";
218 |
219 | [@bs.module "expo"] [@bs.scope ("AR", "FaceAnchorProp")]
220 | external blendShapes: t = "BlendShapes";
221 | };
222 |
223 | module PlaneDetection = {
224 | type t = string;
225 |
226 | [@bs.module "expo"] [@bs.scope ("AR", "PlaneDetection")]
227 | external none: t = "None";
228 |
229 | [@bs.module "expo"] [@bs.scope ("AR", "PlaneDetection")]
230 | external horizontal: t = "Horizontal";
231 |
232 | [@bs.module "expo"] [@bs.scope ("AR", "PlaneDetection")]
233 | external vertical: t = "Vertical";
234 | };
235 |
236 | module WorldAlignment = {
237 | type t = string;
238 |
239 | [@bs.module "expo"] [@bs.scope ("AR", "WorldAlignment")]
240 | external gravity: t = "Gravity";
241 |
242 | [@bs.module "expo"] [@bs.scope ("AR", "WorldAlignment")]
243 | external gravityAndHeading: t = "GravityAndHeading";
244 |
245 | [@bs.module "expo"] [@bs.scope ("AR", "WorldAlignment")]
246 | external alignmentCamera: t = "AlignmentCamera";
247 | };
248 |
249 | module EventType = {
250 | type t;
251 |
252 | [@bs.module "expo"] [@bs.scope ("AR", "EventType")]
253 | external frameDidUpdate: t = "FrameDidUpdate";
254 |
255 | [@bs.module "expo"] [@bs.scope ("AR", "EventType")]
256 | external didFailWithError: t = "DidFailWithError";
257 |
258 | [@bs.module "expo"] [@bs.scope ("AR", "EventType")]
259 | external anchorsDidUpdate: t = "AnchorsDidUpdate";
260 |
261 | [@bs.module "expo"] [@bs.scope ("AR", "EventType")]
262 | external cameraDidChangeTrackingState: t = "CameraDidChangeTrackingState";
263 |
264 | [@bs.module "expo"] [@bs.scope ("AR", "EventType")]
265 | external sessionWasInterrupted: t = "SessionWasInterrupted";
266 |
267 | [@bs.module "expo"] [@bs.scope ("AR", "EventType")]
268 | external sessionInterruptionEnded: t = "SessionInterruptionEnded";
269 | };
270 |
271 | module AnchorType = {
272 | type t = string;
273 |
274 | [@bs.module "expo"] [@bs.scope ("AR", "AnchorType")]
275 | external face: t = "Face";
276 |
277 | [@bs.module "expo"] [@bs.scope ("AR", "AnchorType")]
278 | external image: t = "Image";
279 |
280 | [@bs.module "expo"] [@bs.scope ("AR", "AnchorType")]
281 | external plane: t = "Plane";
282 |
283 | [@bs.module "expo"] [@bs.scope ("AR", "AnchorType")]
284 | external anchor: t = "Anchor";
285 | };
286 |
287 | module AnchorEventType = {
288 | type t = string;
289 |
290 | [@bs.module "expo"] [@bs.scope ("AR", "AnchorEventType")]
291 | external add: t = "Add";
292 |
293 | [@bs.module "expo"] [@bs.scope ("AR", "AnchorEventType")]
294 | external update: t = "Update";
295 |
296 | [@bs.module "expo"] [@bs.scope ("AR", "AnchorEventType")]
297 | external remove: t = "Remove";
298 | };
299 |
300 | module FrameAttribute = {
301 | type t = string;
302 |
303 | [@bs.module "expo"] [@bs.scope ("AR", "FrameAttribute")]
304 | external anchors: t = "Anchors";
305 |
306 | [@bs.module "expo"] [@bs.scope ("AR", "FrameAttribute")]
307 | external rawFeaturePoints: t = "RawFeaturePoints";
308 |
309 | [@bs.module "expo"] [@bs.scope ("AR", "FrameAttribute")]
310 | external lightEstimation: t = "LightEstimation";
311 |
312 | [@bs.module "expo"] [@bs.scope ("AR", "FrameAttribute")]
313 | external capturedDepthData: t = "CapturedDepthData";
314 | };
315 |
316 | module TrackingState = {
317 | type t = string;
318 |
319 | [@bs.module "expo"] [@bs.scope ("AR", "TrackingState")]
320 | external notAvailable: t = "NotAvailable";
321 |
322 | [@bs.module "expo"] [@bs.scope ("AR", "TrackingState")]
323 | external limited: t = "Limited";
324 |
325 | [@bs.module "expo"] [@bs.scope ("AR", "TrackingState")]
326 | external normal: t = "Normal";
327 | };
328 |
329 | module TrackingStateReason = {
330 | type t = string;
331 |
332 | [@bs.module "expo"] [@bs.scope ("AR", "TrackingStateReason")]
333 | external none: t = "None";
334 |
335 | [@bs.module "expo"] [@bs.scope ("AR", "TrackingStateReason")]
336 | external initializing: t = "Initializing";
337 |
338 | [@bs.module "expo"] [@bs.scope ("AR", "TrackingStateReason")]
339 | external excessiveMotion: t = "ExcessiveMotion";
340 |
341 | [@bs.module "expo"] [@bs.scope ("AR", "TrackingStateReason")]
342 | external insufficientFeatures: t = "InsufficientFeatures";
343 |
344 | [@bs.module "expo"] [@bs.scope ("AR", "TrackingStateReason")]
345 | external relocalizing: t = "Relocalizing";
346 | };
347 |
348 | type size = {
349 | width: float,
350 | height: float,
351 | };
352 |
353 | type vector3 = {
354 | x: float,
355 | y: float,
356 | z: float,
357 | };
358 |
359 | type vector2 = {
360 | x: float,
361 | y: float,
362 | };
363 |
364 | type textureCoordinate = {
365 | u: float,
366 | v: float,
367 | };
368 |
369 | type matrix = array(float);
370 |
371 | type faceGeometry = {
372 | vertexCount: float,
373 | textureCoordinateCount: float,
374 | triangleCount: float,
375 | vertices: array(vector3),
376 | textureCoordinates: array(textureCoordinate),
377 | triangleIndices: array(float),
378 | };
379 |
380 | type anchor = {
381 | [@bs.as "type"]
382 | type_: AnchorType.t,
383 | transform: matrix,
384 | id: string,
385 | center: option(vector3),
386 | extent: option(extent),
387 | image: option(image),
388 | geometry: option(faceGeometry),
389 | blendShapes: option(Js.Dict.t(float)),
390 | }
391 | and image = {
392 | name: string,
393 | size,
394 | }
395 | and extent = {
396 | width: float,
397 | length: float,
398 | };
399 |
400 | type hitTest = {
401 | [@bs.as "type"]
402 | type_: float,
403 | distance: float,
404 | localTransform: array(float),
405 | worldTransform: array(float),
406 | anchor,
407 | };
408 |
409 | type hitTestResults = {hitTest};
410 |
411 | type detectionImage = {
412 | uri: string,
413 | width: float,
414 | name: option(string),
415 | };
416 |
417 | type arFrameAnchorRequest = {
418 | [@bs.as "ARFaceTrackingConfiguration"]
419 | arFaceTrackingConfiguration: option(arFaceTrackingConfiguration),
420 | }
421 | and arFaceTrackingConfiguration = {
422 | geometry: bool,
423 | blendShapes: array(BlendShape.t),
424 | };
425 |
426 | type arFrameRequest = {
427 | // [@bs.optional]
428 | anchors: option(arFrameAnchorRequest),
429 | // [@bs.optional]
430 | rawFeaturePoints: option(bool),
431 | // [@bs.optional]
432 | lightEstimation: option(bool),
433 | // [@bs.optional]
434 | capturedDepthData: option(bool),
435 | };
436 |
437 | type lightEstimation = {
438 | ambientIntensity: float,
439 | ambientColorTemperature: float,
440 | primaryLightDirection: option(vector3),
441 | primaryLightIntensity: option(float),
442 | };
443 |
444 | type rawFeaturePoint = {
445 | x: float,
446 | y: float,
447 | z: float,
448 | id: string,
449 | };
450 |
451 | type cameraCalibrationData(
452 | 'lensDistortionLookupTable,
453 | 'inverseLensDistortionLookupTable,
454 | ) = {
455 | intrinsicMatrix: matrix,
456 | intrinsicMatrixReferenceDimensions: size,
457 | extrinsicMatrix: matrix,
458 | pixelSize: float,
459 | lensDistortionLookupTable: 'lensDistortionLookupTable,
460 | inverseLensDistortionLookupTable: 'inverseLensDistortionLookupTable,
461 | lensDistortionCenter: vector3,
462 | };
463 |
464 | type capturedDepthData = {
465 | timestamp: float,
466 | depthDataQuality: DepthDataQuality.t,
467 | depthDataAccuracy: DepthDataAccuracy.t,
468 | depthDataFiltered: bool,
469 | cameraCalibrationData: cameraCalibrationData(string, string),
470 | };
471 |
472 | type arFrame = {
473 | timestamp: float,
474 | anchors: option(array(anchor)),
475 | rawFeaturePoints: option(array(rawFeaturePoint)),
476 | lightEstimation: option(lightEstimation),
477 | capturedDepthData: option(capturedDepthData),
478 | };
479 |
480 | type arMatrices = {
481 | transform: matrix,
482 | viewMatrix: matrix,
483 | projectionMatrix: matrix,
484 | };
485 |
486 | type arStartResult = {capturedImageTexture: float};
487 |
488 | type imageResolution = {
489 | width: float,
490 | height: float,
491 | };
492 |
493 | type videoFormat = {
494 | [@bs.as "type"]
495 | type_: string,
496 | imageResolution,
497 | framesPerSecond: float,
498 | };
499 |
500 | [@bs.module "expo"] [@bs.scope "AR"]
501 | external isAvailable: unit => bool = "isAvailable";
502 |
503 | [@bs.module "expo"] [@bs.scope "AR"]
504 | external getVersion: unit => string = "getVersion";
505 |
506 | [@bs.module "expo"] [@bs.scope "AR"]
507 | external removeAllListeners: EventType.t => unit = "removeAllListeners";
508 |
509 | [@bs.module "expo"] [@bs.scope "AR"]
510 | external onFrameDidUpdate: (unit => unit) => unit = "onFrameDidUpdate";
511 |
512 | [@bs.module "expo"] [@bs.scope "AR"]
513 | external onDidFailWithError: ({. error: string} => unit) => unit =
514 | "onDidFailWithError";
515 |
516 | [@bs.module "expo"] [@bs.scope "AR"]
517 | external onAnchorsDidUpdate:
518 | (
519 | {
520 | .
521 | anchors: array(anchor),
522 | eventType: AnchorEventType.t,
523 | } =>
524 | unit
525 | ) =>
526 | unit =
527 | "onAnchorsDidUpdate";
528 |
529 | [@bs.module "expo"] [@bs.scope "AR"]
530 | external onCameraDidChangeTrackingState:
531 | (
532 | {
533 | .
534 | trackingState: TrackingState.t,
535 | trackingStateReason: TrackingStateReason.t,
536 | } =>
537 | unit
538 | ) =>
539 | unit =
540 | "onCameraDidChangeTrackingState";
541 |
542 | [@bs.module "expo"] [@bs.scope "AR"]
543 | external onSessionWasInterrupted: (unit => unit) => unit =
544 | "onSessionWasInterrupted";
545 |
546 | [@bs.module "expo"] [@bs.scope "AR"]
547 | external onSessionInterruptionEnded: (unit => unit) => unit =
548 | "onSessionInterruptionEnded";
549 |
550 | [@bs.module "expo"] [@bs.scope "AR"]
551 | external performHitTest:
552 | (
553 | {
554 | .
555 | x: float,
556 | y: float,
557 | },
558 | HitTestResultTypes.t
559 | ) =>
560 | hitTestResults =
561 | "performHitTest";
562 |
563 | [@bs.module "expo"] [@bs.scope "AR"]
564 | external setDetectionImagesAsync:
565 | Js.Dict.t(detectionImage) => Js.Promise.t(unit) =
566 | "setDetectionImagesAsync";
567 |
568 | [@bs.module "expo"] [@bs.scope "AR"]
569 | external getCurrentFrame: arFrameRequest => Js.Nullable.t(arFrame) =
570 | "getCurrentFrame";
571 |
572 | [@bs.module "expo"] [@bs.scope "AR"]
573 | external getARMatrices: (float, float) => array(arMatrices) = "getARMatrices";
574 |
575 | [@bs.module "expo"] [@bs.scope "AR"]
576 | external startAsync:
577 | (React.ref(React.element), TrackingConfiguration.t) => Js.Promise.t(unit) =
578 | "startAsync";
579 |
580 | [@bs.module "expo"] [@bs.scope "AR"]
581 | external stopAsync: unit => Js.Promise.t(unit) = "stopAsync";
582 |
583 | [@bs.module "expo"] [@bs.scope "AR"] external reset: unit => unit = "reset";
584 |
585 | [@bs.module "expo"] [@bs.scope "AR"] external pause: unit => unit = "pause";
586 |
587 | [@bs.module "expo"] [@bs.scope "AR"] external resume: unit => unit = "resume";
588 |
589 | [@bs.module "expo"] [@bs.scope "AR"]
590 | external isConfigurationAvailable: TrackingConfiguration.t => bool =
591 | "isConfigurationAvailable";
592 |
593 | [@bs.module "expo"] [@bs.scope "AR"]
594 | external setConfigurationAsync: TrackingConfiguration.t => Js.Promise.t(unit) =
595 | "setConfigurationAsync";
596 |
597 | [@bs.module "expo"] [@bs.scope "AR"]
598 | external isFrontCameraAvailable: unit => bool = "isFrontCameraAvailable";
599 |
600 | [@bs.module "expo"] [@bs.scope "AR"]
601 | external isRearCameraAvailable: unit => bool = "isRearCameraAvailable";
602 |
603 | [@bs.module "expo"] [@bs.scope "AR"]
604 | external planeDetection: unit => PlaneDetection.t = "planeDetection";
605 |
606 | [@bs.module "expo"] [@bs.scope "AR"]
607 | external setPlaneDetection: PlaneDetection.t => unit = "setPlaneDetection";
608 |
609 | [@bs.module "expo"] [@bs.scope "AR"]
610 | external setWorldOriginAsync: matrix => unit = "setWorldOriginAsync";
611 |
612 | [@bs.module "expo"] [@bs.scope "AR"]
613 | external setLightEstimationEnabled: bool => unit = "setLightEstimationEnabled";
614 |
615 | [@bs.module "expo"] [@bs.scope "AR"]
616 | external getLightEstimationEnabled: unit => bool = "getLightEstimationEnabled";
617 |
618 | [@bs.module "expo"] [@bs.scope "AR"]
619 | external setProvidesAudioData: bool => unit = "setProvidesAudioData";
620 |
621 | [@bs.module "expo"] [@bs.scope "AR"]
622 | external getProvidesAudioData: unit => bool = "getProvidesAudioData";
623 |
624 | [@bs.module "expo"] [@bs.scope "AR"]
625 | external setAutoFocusEnabled: bool => unit = "setAutoFocusEnabled";
626 |
627 | [@bs.module "expo"] [@bs.scope "AR"]
628 | external getAutoFocusEnabled: unit => bool = "getAutoFocusEnabled";
629 |
630 | [@bs.module "expo"] [@bs.scope "AR"]
631 | external setWorldAlignment: WorldAlignment.t => unit = "setWorldAlignment";
632 |
633 | [@bs.module "expo"] [@bs.scope "AR"]
634 | external getWorldAlignment: unit => WorldAlignment.t = "getWorldAlignment";
635 |
636 | [@bs.module "expo"] [@bs.scope "AR"]
637 | external getCameraTexture: unit => float = "getCameraTexture";
638 |
639 | [@bs.module "expo"] [@bs.scope "AR"]
640 | external getSupportedVideoFormats:
641 | TrackingConfiguration.t => array(videoFormat) =
642 | "getSupportedVideoFormats";
643 |
--------------------------------------------------------------------------------