Skip to content

Commit 3f1b18d

Browse files
authored
chore: merge dev into main
2 parents 7fa05f3 + 1088a79 commit 3f1b18d

31 files changed

+1443
-416
lines changed

.github/actions/setup/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ runs:
1111

1212
- name: Restore dependencies
1313
id: yarn-cache
14-
uses: actions/cache/restore@v4.2.4
14+
uses: actions/cache/restore@v4.3.0
1515
with:
1616
path: |
1717
**/node_modules
@@ -28,7 +28,7 @@ runs:
2828

2929
- name: Cache dependencies
3030
if: steps.yarn-cache.outputs.cache-hit != 'true'
31-
uses: actions/cache/save@v4.2.4
31+
uses: actions/cache/save@v4.3.0
3232
with:
3333
path: |
3434
**/node_modules
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Deploy docs to GH pages
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: 'pages'
15+
cancel-in-progress: false
16+
17+
jobs:
18+
deploy:
19+
if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.target_commitish, 'main')
20+
environment:
21+
name: github-pages
22+
url: ${{ steps.deployment.outputs.page_url }}
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/[email protected]
27+
with:
28+
fetch-depth: 0
29+
- name: Setup
30+
uses: ./.github/actions/setup
31+
- name: Build
32+
run: yarn docs
33+
- name: Setup Pages
34+
uses: actions/[email protected]
35+
- name: Upload artifact
36+
uses: actions/[email protected]
37+
with:
38+
path: './docs'
39+
- name: Deploy to GitHub Pages
40+
id: deployment
41+
uses: actions/[email protected]

.github/workflows/pull_request.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,27 @@ jobs:
4848
- name: Run unit tests
4949
run: yarn test --maxWorkers=2 --coverage
5050

51+
docs:
52+
runs-on: ubuntu-latest
53+
needs: [lint]
54+
steps:
55+
- name: Checkout
56+
uses: actions/[email protected]
57+
with:
58+
fetch-depth: 0
59+
60+
- name: Setup
61+
uses: ./.github/actions/setup
62+
63+
- name: Generate nitrogen code
64+
run: yarn nitrogen
65+
66+
- name: Build docs
67+
run: yarn docs
68+
5169
build-android:
5270
runs-on: ubuntu-latest
53-
needs: [lint, test]
71+
needs: [lint, test, docs]
5472
steps:
5573
- name: Checkout
5674
uses: actions/[email protected]
@@ -74,7 +92,7 @@ jobs:
7492
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
7593
7694
- name: Cache Gradle
77-
uses: actions/cache@v4.2.4
95+
uses: actions/cache@v4.3.0
7896
with:
7997
path: |
8098
~/.gradle/wrapper
@@ -93,7 +111,7 @@ jobs:
93111
run: yarn build:android
94112
build-ios:
95113
runs-on: macos-latest
96-
needs: [lint, test]
114+
needs: [lint, test, docs]
97115
env:
98116
XCODE_VERSION: '26.0.1'
99117
steps:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,4 @@ android/.kotlinc/
9595

9696
tsconfig.tsbuildinfo
9797
expoConfig/build
98+
docs/

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ CHANGELOG.md
22
node_modules/
33
lib/
44
expoConfig/build/
5+
docs/
6+
.yarn

README.md

Lines changed: 12 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -3,131 +3,29 @@
33
[![npm version](https://img.shields.io/npm/v/react-native-google-maps-plus.svg?logo=npm&color=cb0000)](https://www.npmjs.com/package/react-native-google-maps-plus)
44
[![Dev Release](https://img.shields.io/npm/v/react-native-google-maps-plus/dev.svg?label=dev%20release&color=orange)](https://www.npmjs.com/package/react-native-google-maps-plus)
55
[![Build](https://github.com/pinpong/react-native-google-maps-plus/actions/workflows/release.yml/badge.svg)](https://github.com/pinpong/react-native-google-maps-plus/actions/workflows/release.yml)
6+
[![API Docs](https://img.shields.io/static/v1?label=typedoc&message=docs&color=informational)](https://pinpong.github.io/react-native-google-maps-plus)
67
![React Native](https://img.shields.io/badge/react--native-%3E%3D0.81.0-61dafb.svg?logo=react)
78

89
React Native wrapper for Android & iOS Google Maps SDK.
910

10-
## Installation
11+
## Documentation
1112

12-
`react-native-nitro-modules` is required as this library relies on [Nitro Modules](https://nitro.margelo.com/).
13+
Full installation guide and API reference:
14+
https://pinpong.github.io/react-native-google-maps-plus
1315

14-
```sh
15-
yarn add react-native-google-maps-plus react-native-nitro-modules
16-
```
17-
18-
**iOS**
19-
20-
Add this to your Podfile only for bare React Native apps.
21-
(Not required for Expo, handled by the config plugin.)
22-
23-
```ruby
24-
post_install do |installer|
25-
react_native_post_install(
26-
installer,
27-
config[:reactNativePath],
28-
:mac_catalyst_enabled => false,
29-
# :ccache_enabled => true
30-
)
31-
32-
require_relative '../node_modules/react-native-google-maps-plus/scripts/svgkit_patch'
33-
apply_svgkit_patch(installer)
34-
end
35-
```
36-
37-
### Expo Projects
38-
39-
Add your keys to the `app.json`.
40-
The config plugin automatically injects them into your native Android and iOS builds during `expo prebuild`.
41-
42-
```json
43-
{
44-
"expo": {
45-
"plugins": [
46-
[
47-
"react-native-google-maps-plus",
48-
{
49-
"googleMapsAndroidApiKey": "YOUR_ANDROID_MAPS_API_KEY",
50-
"googleMapsIosApiKey": "YOUR_IOS_MAPS_API_KEY"
51-
}
52-
]
53-
]
54-
}
55-
}
56-
```
57-
58-
## Setup API Key
59-
60-
You will need a valid **Google Maps API Key** from the [Google Cloud Console](https://console.cloud.google.com/).
61-
62-
### Android
63-
64-
**Note:** These instructions apply to **bare React Native apps only**.
65-
Expo projects should use the config plugin instead (see Expo section above).
66-
67-
See the official [Google Maps Android SDK configuration guide](https://developers.google.com/maps/documentation/android-sdk/config#step_3_add_your_api_key_to_the_project) for more details.
68-
69-
### iOS
70-
71-
**Note:** These instructions apply to **bare React Native apps only**.
72-
Expo projects should use the config plugin instead (see Expo section above).
73-
74-
See the official [Google Maps iOS SDK configuration guide](https://developers.google.com/maps/documentation/ios-sdk/config#get-key) for more details.
75-
76-
## Dependencies & Native Documentation
77-
78-
This package is React Native wrapper around the official Google Maps SDKs.
79-
For full API behavior, configuration options, and feature reference, please consult the native documentation:
80-
81-
- **iOS Google Maps SDK**
82-
https://developers.google.com/maps/documentation/ios-sdk
83-
84-
- **Android Google Maps SDK**
85-
https://developers.google.com/maps/documentation/android-sdk
86-
87-
- **Maps Utility Libraries (iOS & Android)**
88-
https://developers.google.com/maps/documentation/ios-sdk/utility
89-
https://developers.google.com/maps/documentation/android-sdk/utility
90-
91-
- **SVG Rendering** (used for custom marker icons)
92-
- iOS: https://github.com/SVGKit/SVGKit
93-
- Android: https://bigbadaboom.github.io/androidsvg/
94-
95-
These libraries are automatically linked during installation.
96-
If you encounter build issues, try cleaning and rebuilding your native project.
97-
98-
> **Note:** This package follows the native SDKs closely. Props and behavior match the underlying Google Maps APIs whenever possible.
16+
## Contributing
9917

100-
## Usage
18+
- [Development workflow](CONTRIBUTING.md#development-workflow)
19+
- [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
20+
- [Code of conduct](CODE_OF_CONDUCT.md)
10121

102-
Basic map:
22+
## License
10323

104-
```tsx
105-
import React from 'react';
106-
import { GoogleMapsView } from 'react-native-google-maps-plus';
24+
MIT
10725

108-
export default function App() {
109-
return (
110-
<GoogleMapsView
111-
style={{ flex: 1 }}
112-
initialProps={{
113-
camera: {
114-
center: { latitude: 37.7749, longitude: -122.4194 },
115-
zoom: 12,
116-
},
117-
}}
118-
markers={[
119-
{
120-
id: '1',
121-
zIndex: 1,
122-
coordinate: { latitude: 37.7749, longitude: -122.4194 },
123-
},
124-
]}
125-
/>
126-
);
127-
}
128-
```
26+
---
12927

130-
Check out the example app in the [example](./example) folder.
28+
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
13129

13230
## Contributing
13331

android/src/main/java/com/rngooglemapsplus/GoogleMapsViewImpl.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,10 +867,9 @@ class GoogleMapsViewImpl(
867867
}
868868

869869
override fun onDetachedFromWindow() {
870-
super.onDetachedFromWindow()
871870
lifecycleObserver?.let { lifecycle?.removeObserver(it) }
872871
lifecycle = null
873-
lifecycleObserver?.toCreatedState()
872+
super.onDetachedFromWindow()
874873
}
875874

876875
override fun onMarkerClick(marker: Marker): Boolean {

android/src/main/java/com/rngooglemapsplus/MapLifecycleEventObserver.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class MapLifecycleEventObserver(
3535
}
3636

3737
private fun toState(state: Lifecycle.State) {
38+
if (currentState == Lifecycle.State.DESTROYED) return
3839
while (currentState != state) {
3940
when {
4041
currentState < state -> upFromCurrentState()

android/src/main/java/com/rngooglemapsplus/extensions/LocationExtension.kt

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,38 +20,53 @@ fun Location.toRnLocation(): RNLocation =
2020
elapsedRealtimeNanos = elapsedRealtimeNanos.toDouble(),
2121
bearingAccuracyDegrees =
2222
when {
23-
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ->
24-
bearingAccuracyDegrees.toDouble()
25-
26-
else -> null
23+
Build.VERSION.SDK_INT < Build.VERSION_CODES.O -> null
24+
else ->
25+
try {
26+
if (hasBearingAccuracy()) bearingAccuracyDegrees.toDouble() else null
27+
} catch (_: IllegalStateException) {
28+
null
29+
}
2730
},
2831
speedAccuracyMetersPerSecond =
2932
when {
30-
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ->
31-
speedAccuracyMetersPerSecond.toDouble()
32-
33-
else -> null
33+
Build.VERSION.SDK_INT < Build.VERSION_CODES.O -> null
34+
else ->
35+
try {
36+
if (hasSpeedAccuracy()) speedAccuracyMetersPerSecond.toDouble() else null
37+
} catch (_: IllegalStateException) {
38+
null
39+
}
3440
},
3541
verticalAccuracyMeters =
3642
when {
37-
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ->
38-
verticalAccuracyMeters.toDouble()
39-
40-
else -> null
43+
Build.VERSION.SDK_INT < Build.VERSION_CODES.O -> null
44+
else ->
45+
try {
46+
if (hasVerticalAccuracy()) verticalAccuracyMeters.toDouble() else null
47+
} catch (_: IllegalStateException) {
48+
null
49+
}
4150
},
4251
mslAltitudeMeters =
4352
when {
44-
Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE ->
45-
mslAltitudeMeters
46-
47-
else -> null
53+
Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE -> null
54+
else ->
55+
try {
56+
if (hasMslAltitude()) mslAltitudeMeters else null
57+
} catch (_: IllegalStateException) {
58+
null
59+
}
4860
},
4961
mslAltitudeAccuracyMeters =
5062
when {
51-
Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE ->
52-
mslAltitudeAccuracyMeters.toDouble()
53-
54-
else -> null
63+
Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE -> null
64+
else ->
65+
try {
66+
if (hasMslAltitude()) mslAltitudeAccuracyMeters.toDouble() else null
67+
} catch (_: IllegalStateException) {
68+
null
69+
}
5570
},
5671
isMock =
5772
when {

0 commit comments

Comments
 (0)