diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..6909a10
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,22 @@
+# Changelog of `reason-react-native-maps`
+
+## 0.26.0 - 2019-11-1
+
+Note that there are breaking changes in this release:
+
+- `react-native-maps` is now a peer dependency to make it more straightforward
+ to use other versions of said package.
+- added constructors for some types passed as arguments to `MapView` methods
+- scripts are brought in line with those for `@reason-react-native/*` packages.
+
+Other changes:
+
+- documentation added for components and types
+
+## 0.24.1 - 2019-06-24
+
+`View` props added to components
+
+## 0.24.0 - 2019-06-17
+
+Initial release.
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..86d6545
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019 sgny
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
index a626df9..d1db8b1 100644
--- a/README.md
+++ b/README.md
@@ -1,27 +1,77 @@
# BuckleScript bindings to React Native Maps
+_This branch does not support `GeoJSON`. Please use the `geojson` branch and the
+`reason-react-native-maps-geojson` package if you need support for that format._
+
[![Version](https://img.shields.io/npm/v/reason-react-native-maps.svg)](https://www.npmjs.com/package/reason-react-native-maps)
-These are complete BuckleScript bindings to [`React Native Maps`](https://github.com/react-native-community/react-native-maps), in Reason syntax.
+These are complete BuckleScript bindings to
+[`React Native Maps`](https://github.com/react-native-community/react-native-maps),
+in Reason syntax.
+
+Version `x.y.z` of `reason-react-native-maps` should be compatible with version
+`x.y.*` of `react-native-maps`.
+
+## Changes
+
+Please see the [changelog](./CHANGELOG.md).
+
+## Installation
+
+With `yarn`:
+
+```shell
+yarn add reason-react-native-maps
+```
+
+With `npm`:
+
+```shell
+npm install reason-react-native-maps
+```
+
+`react-native-maps` should be properly installed if you are using React Native
+versions below 0.60 linked. Please refer to the relevant
+[instructions](https://github.com/react-native-community/react-native-maps/blob/master/docs/installation.md).
+
+Finally, `reason-react-native-maps` should be added to `bs-dependencies` in
+`BuckleScript` configuration of the project (`bsconfig.json`). For example,
-Version of these bindings follow that of the `React Native Maps` package.
+```json
+{
+ ...
+ "bs-dependencies": ["reason-react", "reason-react-native", "reason-react-native-maps"],
+ ...
+}
+```
## Modules
### [MapView](docs/MapView.md)
+
### [Marker](docs/Marker.md)
+
### [Heatmap](docs/Heatmap.md)
+
### [Circle](docs/Circle.md)
+
### [Overlay](docs/Overlay.md)
+
### [Polygon](docs/Polygon.md)
+
### [Polyline](docs/Polyline.md)
+
### [Callout](docs/Callout.md)
+
### [CalloutSubview](docs/CalloutSubview.md)
## Types
### [LatLng](docs/LatLng.md)
+
### [Region](docs/Region.md)
+
### [Shared](docs/Shared.md)
-Further documentation will be added later. Documentation has been adapted from that for `React Native Maps`.
+Further documentation will be added later. Documentation has been adapted from
+that for `React Native Maps`.
diff --git a/bsconfig.json b/bsconfig.json
index f7be156..38b4bb1 100644
--- a/bsconfig.json
+++ b/bsconfig.json
@@ -16,6 +16,6 @@
"subdirs": false
}
],
- "bsc-flags": ["-bs-no-version-header", "-warn-error @a"],
+ "bsc-flags": ["-bs-no-version-header", "-warn-error @a", "-w @a-105"],
"bs-dependencies": ["reason-react", "reason-react-native"]
}
diff --git a/docs/Callout.md b/docs/Callout.md
index 4b195f4..fc9d145 100644
--- a/docs/Callout.md
+++ b/docs/Callout.md
@@ -9,7 +9,11 @@
## Events
-Callback that is called when the user presses on the callout. The `onPress` event returns `ReactNative.Event.syntheticEvent({. action: action})`. Accordingly, to handle the event you need to pass a function of type `ReactNative.Event.syntheticEvent({. action: action}) => unit`. You will need to use the `##` accessor for each individual key within the function specified.
+Callback that is called when the user presses on the callout. The `onPress`
+event returns `ReactNative.Event.syntheticEvent({. action: action})`.
+Accordingly, to handle the event you need to pass a function of type
+`ReactNative.Event.syntheticEvent({. action: action}) => unit`. You will need to
+use the `##` accessor for each individual key within the function specified.
## Types
diff --git a/docs/CalloutSubview.md b/docs/CalloutSubview.md
index e447a58..02b46f9 100644
--- a/docs/CalloutSubview.md
+++ b/docs/CalloutSubview.md
@@ -1,14 +1,18 @@
# `CalloutSubview` Component API
-**Note**: Supported on iOS only.
-Use to handle press on specific subview of callout.
-This component should be a child of a `Callout` component.
+**Note**: Supported on iOS only. Use to handle press on specific subview of
+callout. This component should be a child of a `Callout` component.
## Events
### `onPress`
-Callback that is called when the user presses on this subview inside callout. The `onPress` event returns `ReactNative.Event.syntheticEvent({. action: action})`. Accordingly, to handle the event you need to pass a function of type `ReactNative.Event.syntheticEvent({. action: action}) => unit`. You will need to use the `##` accessor for each individual key within the function specified.
+Callback that is called when the user presses on this subview inside callout.
+The `onPress` event returns
+`ReactNative.Event.syntheticEvent({. action: action})`. Accordingly, to handle
+the event you need to pass a function of type
+`ReactNative.Event.syntheticEvent({. action: action}) => unit`. You will need to
+use the `##` accessor for each individual key within the function specified.
## Types
diff --git a/docs/Heatmap.md b/docs/Heatmap.md
index 7b52b25..d809be8 100644
--- a/docs/Heatmap.md
+++ b/docs/Heatmap.md
@@ -13,7 +13,9 @@
### `gradient`
-[Android Doc](https://developers.google.com/maps/documentation/android-sdk/utility/heatmap#custom) | [iOS Doc](https://developers.google.com/maps/documentation/ios-sdk/utility/heatmap#customize)
+[Android Doc](https://developers.google.com/maps/documentation/android-sdk/utility/heatmap#custom)
+|
+[iOS Doc](https://developers.google.com/maps/documentation/ios-sdk/utility/heatmap#customize)
| Prop | Type | Default | Note |
| -------------- | ---------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------- |
diff --git a/docs/LatLng.md b/docs/LatLng.md
index bcf08ca..c5f450e 100644
--- a/docs/LatLng.md
+++ b/docs/LatLng.md
@@ -4,7 +4,8 @@
### `t`
-This type needs to be created, as well as consumed. When the type is returned, individual keys may be accessed using the `##` accessor.
+This type needs to be created, as well as consumed. When the type is returned,
+individual keys may be accessed using the `##` accessor.
```reason
type t = {
diff --git a/docs/MapView.md b/docs/MapView.md
index bd3277c..f252a69 100644
--- a/docs/MapView.md
+++ b/docs/MapView.md
@@ -43,53 +43,62 @@
| `kmlSrc` | `string` | | The URL from KML file. **Note:** Google Maps and Markers only (either Android or iOS with `PROVIDER_GOOGLE`). |
| `compassOffset` | `point` | | If set, changes the position of the compass. **Note:** iOS Maps only. |
-Please also see [Reason React Native documentation of `View` props](https://reasonml-community.github.io/reason-react-native/en/docs/components/View/) for additional supported props.
+Please also see
+[Reason React Native documentation of `View` props](https://reasonml-community.github.io/reason-react-native/en/docs/components/View/)
+for additional supported props.
## Events
-Events return either no data or an appropriate instance of the parametrised type `ReactNative.Event.syntheticEvent('a)`. Accordingly, to handle events you need to pass functions of type `unit => unit` or `ReactNative.Event.syntheticEvent('a) => unit` where `'a` should be of the type specified in the table below. In the latter case, you will need to use the `##` accessor for each individual key within the function specified. For example: `onPress={e => Console.log(e##nativeEvent)}`.
-
-| Event Name | `'a` (if applicable) | Notes |
-| ------------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `onCalloutPress` | | Callback that is called when a callout is tapped by the user. |
-| `onMapReady` | | Callback that is called once the map is fully loaded. |
-| `onKmlReady` | `kmlContainer` | Callback that is called once the kml is fully loaded. |
-| `onRegionChange` | `Region.t` | Callback that is called continuously when the region changes, such as when a user is dragging the map. |
-| `onRegionChangeComplete` | `Region.t` | Callback that is called once when the region changes, such as when the user is done moving the map. |
-| `onUserLocationChange` | `{. coordinate: location }` | Callback that is called when the underlying map figures our users current location (coordinate also includes isFromMockProvider value for Android API 18 and above). Make sure **showsUserLocation** is set to _true_ and that the provider is `` `google ``. |
-| `onPress` | `copos` | Callback that is called when user taps on the map. |
-| `onDoublePress` | `copos` | Callback that is called when user double taps on the map. |
-| `onPanDrag` | `copos` | Callback that is called when user presses and drags the map. **NOTE**: for iOS `scrollEnabled` should be set to `false` to trigger the event |
-| `onPoiClick` | `poi` | Callback that is called when user click on a POI. |
-| `onLongPress` | `copos` | Callback that is called when user makes a "long press" somewhere on the map. |
-| `onMarkerPress` | | Callback that is called when a marker on the map is tapped by the user. |
-| `onMarkerSelect` | | Callback that is called when a marker on the map becomes selected. This will be called when the callout for that marker is about to be shown. **Note**: iOS only. |
-| `onMarkerDeselect` | | Callback that is called when a marker on the map becomes deselected. This will be called when the callout for that marker is about to be hidden. **Note**: iOS only. |
-| `onMarkerDragStart` | `copos` | Callback that is called when the user initiates a drag on a marker (if it is draggable) |
-| `onMarkerDrag` | `copos` | Callback called continuously as a marker is dragged |
-| `onMarkerDragEnd` | `copos` | Callback that is called when a drag on a marker finishes. This is usually the point you will want to setState on the marker's coordinate again |
-| `onIndoorLevelActivated` | `indoorLevel` | Callback that is called when a level on indoor building is activated |
-| `onIndoorBuildingFocused` | `indoorBuilding` | Callback that is called when a indoor building is focused/unfocused |
+Events return either no data or an appropriate instance of the parametrised type
+`ReactNative.Event.syntheticEvent('a)`. Accordingly, to handle events you need
+to pass functions of type `unit => unit` or
+`ReactNative.Event.syntheticEvent('a) => unit` where `'a` should be of the type
+specified in the table below. In the latter case, you will need to use the `##`
+accessor for each individual key within the function specified. For example:
+`onPress={e => Console.log(e##nativeEvent)}`.
+
+| Event Name | `'a` (if applicable) | Notes |
+| ------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `onCalloutPress` | | Callback that is called when a callout is tapped by the user. |
+| `onMapReady` | | Callback that is called once the map is fully loaded. |
+| `onKmlReady` | `kmlContainer` | Callback that is called once the kml is fully loaded. |
+| `onRegionChange` | `Region.t` | Callback that is called continuously when the region changes, such as when a user is dragging the map. |
+| `onRegionChangeComplete` | `Region.t` | Callback that is called once when the region changes, such as when the user is done moving the map. |
+| `onUserLocationChange` | `{. "coordinate": location }` | Callback that is called when the underlying map figures our users current location (coordinate also includes isFromMockProvider value for Android API 18 and above). Make sure **showsUserLocation** is set to _true_ and that the provider is `` `google ``. |
+| `onPress` | `copos` | Callback that is called when user taps on the map. |
+| `onDoublePress` | `copos` | Callback that is called when user double taps on the map. |
+| `onPanDrag` | `copos` | Callback that is called when user presses and drags the map. **NOTE**: for iOS `scrollEnabled` should be set to `false` to trigger the event |
+| `onPoiClick` | `poi` | Callback that is called when user click on a POI. |
+| `onLongPress` | `copos` | Callback that is called when user makes a "long press" somewhere on the map. |
+| `onMarkerPress` | | Callback that is called when a marker on the map is tapped by the user. |
+| `onMarkerSelect` | | Callback that is called when a marker on the map becomes selected. This will be called when the callout for that marker is about to be shown. **Note**: iOS only. |
+| `onMarkerDeselect` | | Callback that is called when a marker on the map becomes deselected. This will be called when the callout for that marker is about to be hidden. **Note**: iOS only. |
+| `onMarkerDragStart` | `copos` | Callback that is called when the user initiates a drag on a marker (if it is draggable) |
+| `onMarkerDrag` | `copos` | Callback called continuously as a marker is dragged |
+| `onMarkerDragEnd` | `copos` | Callback that is called when a drag on a marker finishes. This is usually the point you will want to setState on the marker's coordinate again |
+| `onIndoorLevelActivated` | `indoorLevel` | Callback that is called when a level on indoor building is activated |
+| `onIndoorBuildingFocused` | `indoorBuilding` | Callback that is called when a indoor building is focused/unfocused |
## Methods
-Deprecated methods are not supported. All methods require the `MapView` element as the first argument. For additional arguments please refer to the table below.
-
-| Method Name | Types of Additional Arguments | Returns | Notes |
-| --------------------------- | ------------------------------------------------------------------------ | ---------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `getCamera` | unit | `camera` | Returns the current camera configuration. |
-| `animateCamera` | `camera`,
`{. duration: float }` | unit | Animate the camera to a new view. In JS, you can pass a partial camera object here; any property not given will remain unmodified, however, that is not supported in these bindings and a camera object is required. Do note that any optional arguments not specified in the new object will not be modified. |
-| `setCamera` | `camera`,
`{. duration: float }` | unit | Like `animateCamera`, but sets the new view instantly, without an animation. |
-| `animateToRegion` | `Region.t`, `float` | unit | duration of the animation should be specified as a `float` |
-| `getMapBoundaries` | unit | `Js.Promise.t(mapBoundaries)` | Returns current boundaries of the map |
-| `setMapBoundaries` | `mapBoundaries` | unit | The boundary is defined by the map's center coordinates, not the device's viewport itself. **Note:** Google Maps only. |
-| `setIndoorActiveLevelIndex` | `int` | unit | `levelIndex` should be specified as an `int` |
-| `fitToElements` | `bool` | unit | Can specify whether the transition should be animated by the additonal argument |
-| `fitToSuppliedMarkers` | `array(string)`,
`{. edgePadding: edgePadding, animated: bool }` | unit | markerIDs should be specified as `array(string)` If you need to use this in `ComponentDidMount`, make sure you put it in a timeout or it will cause performance problems. |
-| `fitToCoordinates` | `array(LatLng.t)`,
`{. edgePadding: edgePadding, animated: bool }` | unit | Coordinates should be specified as an array of `LatLng.t`. Options may also be specified. If called in `ComponentDidMount` in android, it will cause an exception. It is recommended to be called from the MapView `onLayout` event. |
-| `pointForCoordinate` | `LatLng.t` | `Js.Promise.t(point)` | Converts a map coordinate (specified as `LatLng.t`) to a view coordinate (`point`). |
-| `coordinateForPoint` | `point` | `Js.Promise.t(LatLng.t)` | Converts a view coordinate (`point`) to a map coordinate (specified as `LatLng.t`). |
-| `getMarkersFrames` | `bool` | `Js.Promise.t({. "markerID": {. point: point, frame: frame } })` | Get markers' centers and frames in view coordinates, can limit to only visible markers by the additional argument. **Note**: iOS only. |
+Deprecated methods are not supported. All methods require the `MapView` element
+as the first argument. For additional arguments please refer to the table below.
+
+| Method Name | Types of Additional Arguments | Returns | Notes |
+| --------------------------- | ------------------------------------ | ---------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `getCamera` | unit | `camera` | Returns the current camera configuration. |
+| `animateCamera` | `camera`,
`duration` | unit | Animate the camera to a new view. In JS, you can pass a partial camera object here; any property not given will remain unmodified, however, that is not supported in these bindings and a camera object is required. Do note that any optional arguments not specified in the new object will not be modified. |
+| `setCamera` | `camera`,
`duration` | unit | Like `animateCamera`, but sets the new view instantly, without an animation. |
+| `animateToRegion` | `Region.t`, `float` | unit | duration of the animation should be specified as a `float` |
+| `getMapBoundaries` | unit | `Js.Promise.t(mapBoundaries)` | Returns current boundaries of the map |
+| `setMapBoundaries` | `mapBoundaries` | unit | The boundary is defined by the map's center coordinates, not the device's viewport itself. **Note:** Google Maps only. |
+| `setIndoorActiveLevelIndex` | `int` | unit | `levelIndex` should be specified as an `int` |
+| `fitToElements` | `bool` | unit | Can specify whether the transition should be animated by the additonal argument |
+| `fitToSuppliedMarkers` | `array(string)`,
`fitConfig` | unit | markerIDs should be specified as `array(string)` If you need to use this in `ComponentDidMount`, make sure you put it in a timeout or it will cause performance problems. |
+| `fitToCoordinates` | `array(LatLng.t)`,
`fitConfig` | unit | Coordinates should be specified as an array of `LatLng.t`. Options may also be specified. If called in `ComponentDidMount` in android, it will cause an exception. It is recommended to be called from the MapView `onLayout` event. |
+| `pointForCoordinate` | `LatLng.t` | `Js.Promise.t(point)` | Converts a map coordinate (specified as `LatLng.t`) to a view coordinate (`point`). |
+| `coordinateForPoint` | `point` | `Js.Promise.t(LatLng.t)` | Converts a view coordinate (`point`) to a map coordinate (specified as `LatLng.t`). |
+| `getMarkersFrames` | `bool` | `Js.Promise.t({. "markerID": {. point: point, frame: frame } })` | Get markers' centers and frames in view coordinates, can limit to only visible markers by the additional argument. **Note**: iOS only. |
## Types
@@ -108,41 +117,50 @@ camera:
camera
```
-Note that `altitude` is only for when `MapKit` is used on iOS and `zoom` is only for use with Google Maps. Specification of height differs between MapKit on iOS and Google Maps differ. For a cross-platform app, it is necessary to specify both the zoom level and the altitude separately.
+Note that `altitude` is only for when `MapKit` is used on iOS and `zoom` is only
+for use with Google Maps. Specification of height differs between MapKit on iOS
+and Google Maps differ. For a cross-platform app, it is necessary to specify
+both the zoom level and the altitude separately.
### `location`
-```
-type location {
- latitude: Number,
- longitude: Number,
- altitude: Number,
- timestamp: Number, //Milliseconds since Unix epoch
- accuracy: Number,
- altitudeAccuracy: Number,
- speed: Number,
-}
+```reason
+type location = {
+ .
+ "latitude": float,
+ "longitude": float,
+ "altitude": float,
+ "timestamp": float,
+ "accuracy": float,
+ "altitudeAccuracy": float,
+ "speed": float,
+};
```
-### `point`
+`timestamp` is milliseconds elapsed since the epoch
+### `duration`
+
+```reason
+duration: (~duration: float) => duration
```
-type point {
- x: Number,
- y: Number,
-}
+
+### `fitConfig`
+
+```reason
+fitConfig: (~edgePadding: edgePadding, ~animated: bool) => fitConfig
```
### `frame`
-```
+```reason
type frame = {
.
"x": float,
"y": float,
"width": float,
"height": float,
-}
+};
```
### `edgePadding`
@@ -162,6 +180,12 @@ type mapBoundaries = {
}
```
+```reason
+mapBoundaries:
+ (~northEast: LatLng.t, ~southWest: LatLng.t) =>
+ mapBoundaries
+```
+
### `marker`
```reason
diff --git a/docs/Marker.md b/docs/Marker.md
index b4b167d..d316941 100644
--- a/docs/Marker.md
+++ b/docs/Marker.md
@@ -25,7 +25,13 @@
## Events
-Events return either no data or an appropriate instance of the parametrised type `ReactNative.Event.syntheticEvent('a)`. Accordingly, to handle events you need to pass functions of type `unit => unit` or `ReactNative.Event.syntheticEvent('a) => unit` where `'a` should be of the type specified in the table below. In the latter case, you will need to use the `##` accessor for each individual key within the function specified. For example: `onPress={e => Console.log(e##nativeEvent)}`.
+Events return either no data or an appropriate instance of the parametrised type
+`ReactNative.Event.syntheticEvent('a)`. Accordingly, to handle events you need
+to pass functions of type `unit => unit` or
+`ReactNative.Event.syntheticEvent('a) => unit` where `'a` should be of the type
+specified in the table below. In the latter case, you will need to use the `##`
+accessor for each individual key within the function specified. For example:
+`onPress={e => Console.log(e##nativeEvent)}`.
| Event Name | `'a` (if applicable) | Notes |
| ---------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -49,12 +55,15 @@ Events return either no data or an appropriate instance of the parametrised type
## Child Components
-Child components can be added within a `Marker` and rendered content will replace the marker symbol. This is a way of creating custom markers and allowing use of native SVGs.
+Child components can be added within a `Marker` and rendered content will
+replace the marker symbol. This is a way of creating custom markers and allowing
+use of native SVGs.
Example:
```reason
-open ReasonReact;
+open ReactNative;
+open ReactNativeMaps;
The amount of north-to-south distance (measured in degrees) to display on the map. Unlike longitudinal distances, which vary based on the latitude, one degree of latitude is always approximately 111 kilometers (69 miles).
+> The amount of north-to-south distance (measured in degrees) to display on the
+> map. Unlike longitudinal distances, which vary based on the latitude, one
+> degree of latitude is always approximately 111 kilometers (69 miles).
-A [visual explanation](https://stackoverflow.com/questions/36685372/how-to-zoom-in-out-in-react-native-map/36688156#36688156) may be found on `stackoverflow`.
+A
+[visual explanation](https://stackoverflow.com/questions/36685372/how-to-zoom-in-out-in-react-native-map/36688156#36688156)
+may be found on `stackoverflow`.
diff --git a/docs/Shared.md b/docs/Shared.md
index 0fd7580..65f1bd0 100644
--- a/docs/Shared.md
+++ b/docs/Shared.md
@@ -4,7 +4,8 @@
### `point`
-This type needs to be created, as well as consumed. When the type is returned, individual keys may be accessed using the `##` accessor.
+This type needs to be created, as well as consumed. When the type is returned,
+individual keys may be accessed using the `##` accessor.
```reason
type point = {
diff --git a/package.json b/package.json
index 38527a8..dfe0a93 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,12 @@
{
"name": "reason-react-native-maps",
- "version": "0.24.1",
+ "version": "0.26.0",
+ "publishConfig": {
+ "access": "public"
+ },
+ "peerDependencies": {
+ "react-native-maps": "~0.26.0"
+ },
"author": "sgny (https://github.com/sgny)",
"repository": "https://github.com/sgny/reason-react-native-maps.git",
"license": "MIT",
@@ -11,19 +17,56 @@
"react-native",
"react-native-maps"
],
+ "files": [
+ "*",
+ "!.DS_Store",
+ "!**/*.bs.js",
+ "!.merlin",
+ "!lib/bs",
+ "!lib/ocaml"
+ ],
+ "scripts": {
+ "format:most": "prettier --write \"**/*.{md,json,js,css}\"",
+ "format:re": "find . -name \"*.re\" -or -name \"*.rei\" | grep -v \"node_modules\" | xargs bsrefmt --in-place",
+ "format": "yarn format:most && yarn format:re",
+ "re:start": "bsb -make-world -w",
+ "re:build": "bsb -make-world",
+ "re:clean-build": "bsb -clean-world -make-world",
+ "start": "yarn re:start",
+ "build": "yarn re:build",
+ "test": "yarn re:clean-build"
+ },
"scripts": {
"clean": "bsb -clean-world",
"start": "bsb -make-world -w",
"build": "bsb -make-world",
"clean-build": "bsb -clean-world -make-world"
},
- "peerDependencies": {
- "bs-platform": "~5.0.4",
- "react-native": "~0.59.9",
+ "devDependencies": {
+ "bs-platform": "^5.2.0",
+ "husky": "^1.3.0",
+ "lint-staged": "^8.1.0",
+ "prettier": "^1.18.0",
"reason-react": "^0.7.0",
"reason-react-native": "^0.60.0"
},
- "dependencies": {
- "react-native-maps": "~0.24.0"
+ "prettier": {
+ "trailingComma": "all",
+ "proseWrap": "always"
+ },
+ "lint-staged": {
+ "*.{md,json,js,css}": [
+ "prettier --write",
+ "git add"
+ ],
+ "*.{re,rei}": [
+ "bsrefmt --in-place",
+ "git add"
+ ]
+ },
+ "husky": {
+ "hooks": {
+ "pre-commit": "lint-staged"
+ }
}
}
diff --git a/src/MapView.re b/src/MapView.re
index 49d14f3..0a0e3f9 100644
--- a/src/MapView.re
+++ b/src/MapView.re
@@ -27,6 +27,10 @@ type mapBoundaries = {
"northEast": LatLng.t,
"southWest": LatLng.t,
};
+[@bs.obj]
+external mapBoundaries:
+ (~northEast: LatLng.t, ~southWest: LatLng.t) => mapBoundaries =
+ "";
type marker;
[@bs.obj]
@@ -70,11 +74,17 @@ type location = {
"speed": float,
};
+type duration;
+[@bs.obj] external duration: (~duration: float) => duration = "";
+
+type fitConfig;
+[@bs.obj]
+external fitConfig: (~edgePadding: edgePadding, ~animated: bool) => fitConfig =
+ "";
+
[@bs.send] external getCamera: (element, unit) => unit = "";
-[@bs.send]
-external animateCamera: (element, camera, {. "duration": float}) => unit = "";
-[@bs.send]
-external setCamera: (element, camera, {. "duration": float}) => unit = "";
+[@bs.send] external animateCamera: (element, camera, duration) => unit = "";
+[@bs.send] external setCamera: (element, camera, duration) => unit = "";
[@bs.send] external animateToRegion: (element, Region.t, float) => unit = "";
[@bs.send]
external getMapBoundaries: (element, unit) => Js.Promise.t(mapBoundaries) =
@@ -83,31 +93,10 @@ external getMapBoundaries: (element, unit) => Js.Promise.t(mapBoundaries) =
[@bs.send] external setIndoorActiveLevelIndex: (element, int) => unit = "";
[@bs.send] external fitToElements: (element, bool) => unit = "";
[@bs.send]
-external fitToSuppliedMarkers:
- (
- element,
- array(string),
- {
- .
- "edgePadding": edgePadding,
- "animated": bool,
- }
- ) =>
- unit =
+external fitToSuppliedMarkers: (element, array(string), fitConfig) => unit =
"";
[@bs.send]
-external fitToCoordinates:
- (
- element,
- array(LatLng.t),
- {
- .
- "edgePadding": edgePadding,
- "animated": bool,
- }
- ) =>
- unit =
- "";
+external fitToCoordinates: (element, array(LatLng.t), fitConfig) => unit = "";
[@bs.send]
external pointForCoordinate: (element, LatLng.t) => Js.Promise.t(point) = "";
[@bs.send]
diff --git a/src/Overlay.bs.js b/src/Overlay.bs.js
index ae1b9f1..3f21498 100644
--- a/src/Overlay.bs.js
+++ b/src/Overlay.bs.js
@@ -1 +1,6 @@
-/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */
+"use strict";
+
+var defaultAction = "overlay-press";
+
+exports.defaultAction = defaultAction;
+/* No side effect */
diff --git a/src/Overlay.re b/src/Overlay.re
index d7b98bc..1728189 100644
--- a/src/Overlay.re
+++ b/src/Overlay.re
@@ -1,9 +1,20 @@
+type point = Shared.point;
+
+let defaultAction = "overlay-press";
+
[@react.component] [@bs.module "react-native-maps/lib/components/MapOverlay"]
-// supports view props
external make:
(
~image: ReactNative.Image.Source.t=?,
~bounds: (LatLng.t, LatLng.t),
+ ~onPress: ReactNative.Event.syntheticEvent({
+ .
+ "action": string,
+ "coordinate": LatLng.t,
+ "position": point,
+ }) =>
+ unit
+ =?,
~tappable: bool,
// View props
~accessibilityComponentType: [@bs.string] [