Skip to content

Commit 4db0c03

Browse files
Add ref forwarding to Marker and Popup (visgl#2191)
1 parent bb553e7 commit 4db0c03

File tree

9 files changed

+371
-229
lines changed

9 files changed

+371
-229
lines changed

docs/api-reference/geolocate-control.md

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,60 @@ function App() {
5252
</TabItem>
5353
</Tabs>
5454

55-
## Reference
55+
56+
## Properties
57+
58+
### Reactive Properties
59+
60+
#### `style`: CSSProperties {#style}
61+
62+
CSS style override that applies to the control's container.
63+
64+
### Callbacks
65+
66+
#### `onGeolocate`: (evt: [GeolocateResultEvent](./types.md#geolocateresultevent)) => void {#ongeolocate}
67+
68+
Called on each Geolocation API position update that returned as success.
69+
70+
#### `onError`: (evt: [GeolocateErrorEvent](./types.md#geolocateerrorevent)) => void {#onerror}
71+
72+
Called on each Geolocation API position update that returned as an error.
73+
74+
#### `onOutOfMaxBounds`: (evt: [GeolocateResultEvent](./types.md#geolocateresultevent)) => void {#onoutofmaxbounds}
75+
76+
Called on each Geolocation API position update that returned as success but user position is out of map `maxBounds`.
77+
78+
#### `onTrackUserLocationStart`: (evt: [GeolocateEvent](./types.md#geolocateevent)) => void {#ontrackuserlocationstart}
79+
80+
Called when the GeolocateControl changes to the active lock state.
81+
82+
#### `onTrackUserLocationEnd`: (evt: [GeolocateEvent](./types.md#geolocateevent)) => void {#ontrackuserlocationend}
83+
84+
Called when the GeolocateControl changes to the background state.
85+
86+
87+
### Other Properties
88+
89+
The properties in this section are not reactive. They are only used when the component first mounts.
90+
91+
Any options supported by the `GeolocateControl` class ([Mapbox](https://docs.mapbox.com/mapbox-gl-js/api/markers/#geolocatecontrol) | [Maplibre](https://maplibre.org/maplibre-gl-js-docs/api/markers/#geolocatecontrol)), such as
92+
93+
- `positionOptions`
94+
- `fitBoundsOptions`
95+
- `trackUserLocation`
96+
- `showAccuracyCircle`
97+
- `showUserLocation`
98+
99+
Plus the following:
100+
101+
#### `position`: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' {#position}
102+
103+
Default: `'bottom-right'`
104+
105+
Placement of the control relative to the map.
106+
107+
108+
## Methods
56109

57110
The underlying native `GeolocateControl` instance is accessible via a [React ref](https://reactjs.org/docs/refs-and-the-dom.html#creating-refs) hook.
58111
You may use it to call any imperative methods:
@@ -108,59 +161,6 @@ function App() {
108161
</Tabs>
109162

110163

111-
## Properties
112-
113-
114-
### Reactive Properties
115-
116-
#### `style`: CSSProperties {#style}
117-
118-
CSS style override that applies to the control's container.
119-
120-
### Callbacks
121-
122-
#### `onGeolocate`: (evt: [GeolocateResultEvent](./types.md#geolocateresultevent)) => void {#ongeolocate}
123-
124-
Called on each Geolocation API position update that returned as success.
125-
126-
#### `onError`: (evt: [GeolocateErrorEvent](./types.md#geolocateerrorevent)) => void {#onerror}
127-
128-
Called on each Geolocation API position update that returned as an error.
129-
130-
#### `onOutOfMaxBounds`: (evt: [GeolocateResultEvent](./types.md#geolocateresultevent)) => void {#onoutofmaxbounds}
131-
132-
Called on each Geolocation API position update that returned as success but user position is out of map `maxBounds`.
133-
134-
#### `onTrackUserLocationStart`: (evt: [GeolocateEvent](./types.md#geolocateevent)) => void {#ontrackuserlocationstart}
135-
136-
Called when the GeolocateControl changes to the active lock state.
137-
138-
#### `onTrackUserLocationEnd`: (evt: [GeolocateEvent](./types.md#geolocateevent)) => void {#ontrackuserlocationend}
139-
140-
Called when the GeolocateControl changes to the background state.
141-
142-
143-
### Other Properties
144-
145-
The properties in this section are not reactive. They are only used when the component first mounts.
146-
147-
Any options supported by the `GeolocateControl` class ([Mapbox](https://docs.mapbox.com/mapbox-gl-js/api/markers/#geolocatecontrol) | [Maplibre](https://maplibre.org/maplibre-gl-js-docs/api/markers/#geolocatecontrol)), such as
148-
149-
- `positionOptions`
150-
- `fitBoundsOptions`
151-
- `trackUserLocation`
152-
- `showAccuracyCircle`
153-
- `showUserLocation`
154-
155-
Plus the following:
156-
157-
#### `position`: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' {#position}
158-
159-
Default: `'bottom-right'`
160-
161-
Placement of the control relative to the map.
162-
163-
164164
## Source
165165

166166
[geolocate-control.ts](https://github.com/visgl/react-map-gl/tree/7.0-release/src/components/geolocate-control.ts)

0 commit comments

Comments
 (0)