@mapsindoors/react-native-maps-indoors-mapbox 2.7.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -2,10 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
## Documentation
|
|
4
4
|
|
|
5
|
-
Visit [our reference document site](https://app.mapsindoors.com/mapsindoors/reference/react-native/mapbox/2.
|
|
5
|
+
Visit [our reference document site](https://app.mapsindoors.com/mapsindoors/reference/react-native/mapbox/2.8.0/index.html) to get an overview of what the MapsIndoors SDK offers.
|
|
6
6
|
|
|
7
7
|
## Changelog
|
|
8
8
|
|
|
9
|
+
### [2.8.0] - 2026-08-17
|
|
10
|
+
|
|
11
|
+
#### Changed
|
|
12
|
+
|
|
13
|
+
- **Breaking:** raised the minimum iOS deployment target to 16.0 (from 15.6), as required by the
|
|
14
|
+
MapsIndoors iOS SDK. Update your Podfile, and `expo-build-properties`' `deploymentTarget` if you
|
|
15
|
+
use Expo - see [iOS](#ios)
|
|
16
|
+
- **Breaking:** raised the minimum supported React Native version to 0.75.0
|
|
17
|
+
- Updated MapsIndoors Android SDK to 4.18.6
|
|
18
|
+
- Updated MapsIndoors iOS SDK to 4.19.1
|
|
19
|
+
|
|
20
|
+
#### Fixed
|
|
21
|
+
|
|
22
|
+
- The map turning black after navigating away from and back to the map screen when using
|
|
23
|
+
`react-native-screens`' native stack
|
|
24
|
+
- The map continuing to render in the background while the app was backgrounded, which wasted
|
|
25
|
+
battery
|
|
26
|
+
|
|
9
27
|
### 2.7.0
|
|
10
28
|
|
|
11
29
|
- Updated MapsIndoors Android SDK to 4.18.3
|
|
@@ -19,11 +37,12 @@ Visit [our reference document site](https://app.mapsindoors.com/mapsindoors/refe
|
|
|
19
37
|
|
|
20
38
|
### iOS
|
|
21
39
|
|
|
22
|
-
The MapsIndoors SDK requires iOS
|
|
23
|
-
Disable flipper and add
|
|
40
|
+
The MapsIndoors SDK requires iOS 16.0, so make sure that your podfile is configured for iOS 16.0.
|
|
41
|
+
Disable flipper and add `use_frameworks!` as well as adding config.build_settings to post install
|
|
42
|
+
script.
|
|
24
43
|
|
|
25
44
|
```pod
|
|
26
|
-
platform :ios, '
|
|
45
|
+
platform :ios, '16.0'
|
|
27
46
|
|
|
28
47
|
flipper_config = FlipperConfiguration.disabled
|
|
29
48
|
|
|
@@ -34,7 +53,7 @@ target 'MyApp' do
|
|
|
34
53
|
...
|
|
35
54
|
installer.pods_project.targets.each do |target|
|
|
36
55
|
target.build_configurations.each do |config|
|
|
37
|
-
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '
|
|
56
|
+
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.0'
|
|
38
57
|
end
|
|
39
58
|
end
|
|
40
59
|
end
|
|
@@ -104,8 +123,9 @@ allprojects {
|
|
|
104
123
|
|
|
105
124
|
This library implements native modules and can't be used with ExpoGO, developments build is required [Delopment Builds](https://docs.expo.dev/develop/development-builds/introduction/)
|
|
106
125
|
|
|
107
|
-
To build and run correctly, the native ios linkage required to
|
|
108
|
-
Project configuration can be done with the expo module
|
|
126
|
+
To build and run correctly, the native ios linkage is required to be set as dynamic
|
|
127
|
+
(`useFrameworks: "dynamic"`). Project configuration can be done with the expo module
|
|
128
|
+
expo-build-properties.
|
|
109
129
|
|
|
110
130
|
with npx :
|
|
111
131
|
`$ npx expo install expo-build-properties`
|
|
@@ -130,7 +150,8 @@ To enable it, you need to add the configuration in your expo configuration.
|
|
|
130
150
|
"expo-build-properties",
|
|
131
151
|
{
|
|
132
152
|
"ios": {
|
|
133
|
-
"deploymentTarget": "
|
|
153
|
+
"deploymentTarget": "16.0",
|
|
154
|
+
"useFrameworks": "dynamic"
|
|
134
155
|
}
|
|
135
156
|
}
|
|
136
157
|
],
|
|
@@ -139,7 +160,7 @@ To enable it, you need to add the configuration in your expo configuration.
|
|
|
139
160
|
{
|
|
140
161
|
"publicToken": "PUBLIC_TOKEN", // your map public token
|
|
141
162
|
"downloadToken": "DOWNLOAD_TOKEN", // your download token
|
|
142
|
-
"staticPods": true // OPTIONAL, add if your project
|
|
163
|
+
"staticPods": true // OPTIONAL, add if your project uses static linkage for pods (ex: "useFrameworks": "static" with expo-build-properties)
|
|
143
164
|
}
|
|
144
165
|
]
|
|
145
166
|
]
|
|
@@ -253,3 +274,5 @@ const changeTypePolygonColor = async (type: string, color: string) => {
|
|
|
253
274
|
typeDisplayRule?.setPolygonFillColor(color);
|
|
254
275
|
}
|
|
255
276
|
```
|
|
277
|
+
|
|
278
|
+
[2.8.0]: https://github.com/MapsPeople/react-native-mapsindoors-mapbox/compare/2.7.0...2.8.0
|
package/android/build.gradle
CHANGED
|
@@ -106,7 +106,7 @@ dependencies {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
implementation 'com.mapbox.maps:android-ndk27:11.16.1'
|
|
109
|
-
implementation 'com.mapspeople.mapsindoors:mapbox-ndk27:4.18.
|
|
109
|
+
implementation 'com.mapspeople.mapsindoors:mapbox-ndk27:4.18.6'
|
|
110
110
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
111
111
|
implementation 'androidx.core:core-ktx:1.3.2'
|
|
112
112
|
implementation 'com.github.bumptech.glide:glide:4.16.0'
|
|
@@ -7,9 +7,15 @@ import android.widget.FrameLayout;
|
|
|
7
7
|
|
|
8
8
|
import androidx.annotation.NonNull;
|
|
9
9
|
import androidx.annotation.Nullable;
|
|
10
|
+
import androidx.lifecycle.Lifecycle;
|
|
11
|
+
import androidx.lifecycle.LifecycleOwner;
|
|
12
|
+
import androidx.lifecycle.LifecycleRegistry;
|
|
13
|
+
import androidx.lifecycle.ViewTreeLifecycleOwner;
|
|
10
14
|
|
|
15
|
+
import com.facebook.react.bridge.LifecycleEventListener;
|
|
11
16
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
12
17
|
import com.facebook.react.bridge.ReadableArray;
|
|
18
|
+
import com.facebook.react.common.LifecycleState;
|
|
13
19
|
import com.facebook.react.common.MapBuilder;
|
|
14
20
|
import com.facebook.react.uimanager.ThemedReactContext;
|
|
15
21
|
import com.facebook.react.uimanager.ViewGroupManager;
|
|
@@ -26,6 +32,7 @@ import com.mapbox.maps.plugin.compass.CompassUtils;
|
|
|
26
32
|
import com.mapsindoors.core.OnResultReadyListener;
|
|
27
33
|
import com.mapsindoorsrn.core.models.MPCameraPosition;
|
|
28
34
|
|
|
35
|
+
import java.util.HashMap;
|
|
29
36
|
import java.util.Map;
|
|
30
37
|
|
|
31
38
|
public class MapsIndoorsViewManager extends ViewGroupManager<MapView> {
|
|
@@ -38,6 +45,13 @@ public class MapsIndoorsViewManager extends ViewGroupManager<MapView> {
|
|
|
38
45
|
|
|
39
46
|
private MapView view;
|
|
40
47
|
|
|
48
|
+
// A ViewManager is shared across every instance of its view type, so the per-view lifecycle owners are
|
|
49
|
+
// tracked here keyed by MapView rather than as a single field. Cleanup is manual: entries are removed in
|
|
50
|
+
// onDropViewInstance (which React Native calls when the view is unmounted). A plain HashMap, not a
|
|
51
|
+
// WeakHashMap: Mapbox installs its lifecycle observer against the owner (the value), and that observer
|
|
52
|
+
// holds the MapView, so a weak key would be kept reachable by its own value and never clear.
|
|
53
|
+
private final Map<MapView, MapViewLifecycleOwner> lifecycleOwners = new HashMap<>();
|
|
54
|
+
|
|
41
55
|
ReactApplicationContext mReactContext;
|
|
42
56
|
OnResultReadyListener mOnMapReadyCallback;
|
|
43
57
|
|
|
@@ -45,6 +59,33 @@ public class MapsIndoorsViewManager extends ViewGroupManager<MapView> {
|
|
|
45
59
|
mReactContext = reactContext;
|
|
46
60
|
mOnMapReadyCallback = onMapReadyCallback;
|
|
47
61
|
gson = new Gson();
|
|
62
|
+
|
|
63
|
+
// SPEX-2030: also gate the map lifecycle on the host (Activity) foreground state. The view stays
|
|
64
|
+
// attached to the window when the app is merely backgrounded (home button / app switch), so the
|
|
65
|
+
// attach listener alone would leave the renderer RESUMED and burning GL/battery in the background.
|
|
66
|
+
// React Native's host lifecycle (onHostResume/onHostPause) gives us the Activity foreground signal.
|
|
67
|
+
mReactContext.addLifecycleEventListener(new LifecycleEventListener() {
|
|
68
|
+
@Override
|
|
69
|
+
public void onHostResume() {
|
|
70
|
+
setHostResumedOnAll(true);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@Override
|
|
74
|
+
public void onHostPause() {
|
|
75
|
+
setHostResumedOnAll(false);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@Override
|
|
79
|
+
public void onHostDestroy() {
|
|
80
|
+
setHostResumedOnAll(false);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private void setHostResumedOnAll(boolean hostResumed) {
|
|
86
|
+
for (MapViewLifecycleOwner owner : lifecycleOwners.values()) {
|
|
87
|
+
owner.setHostResumed(hostResumed);
|
|
88
|
+
}
|
|
48
89
|
}
|
|
49
90
|
|
|
50
91
|
@NonNull
|
|
@@ -56,11 +97,102 @@ public class MapsIndoorsViewManager extends ViewGroupManager<MapView> {
|
|
|
56
97
|
@NonNull
|
|
57
98
|
@Override
|
|
58
99
|
protected MapView createViewInstance(@NonNull ThemedReactContext reactContext) {
|
|
100
|
+
// textureView = true (5th positional arg): a TextureView lives in the normal view hierarchy
|
|
101
|
+
// and is restored across detach/reattach, unlike the default SurfaceView whose surface is
|
|
102
|
+
// torn down when react-native-screens detaches the screen on navigation.
|
|
59
103
|
MapInitOptions options = new MapInitOptions(reactContext, MapInitOptions.Companion.getDefaultMapOptions(reactContext).toBuilder()
|
|
60
104
|
.glyphsRasterizationOptions(new GlyphsRasterizationOptions.Builder().rasterizationMode(GlyphsRasterizationMode.ALL_GLYPHS_RASTERIZED_LOCALLY).build()).build(),
|
|
61
|
-
MapInitOptions.Companion.getDefaultPluginList(), new CameraOptions.Builder().pitch(0.0).build()
|
|
62
|
-
|
|
63
|
-
|
|
105
|
+
MapInitOptions.Companion.getDefaultPluginList(), new CameraOptions.Builder().pitch(0.0).build(),
|
|
106
|
+
true);
|
|
107
|
+
final MapView mapView = new MapView(reactContext, options);
|
|
108
|
+
|
|
109
|
+
// Give the MapView an SDK-owned lifecycle and set it as the view's own ViewTreeLifecycleOwner.
|
|
110
|
+
// ViewTreeLifecycleOwner.get() checks the view itself before walking up the tree, so this wins
|
|
111
|
+
// over the per-screen LifecycleOwner that react-native-screens installs on the ancestor. That
|
|
112
|
+
// stops Mapbox v11 from binding its renderer to the screen lifecycle (which goes ON_STOP on
|
|
113
|
+
// navigate-away and is not reliably brought back to RESUMED on return -> black map).
|
|
114
|
+
// The owner is RESUMED only when the view is attached AND the host Activity is in the foreground;
|
|
115
|
+
// detaching (navigation) or backgrounding the app drives it to CREATED, which stops the renderer
|
|
116
|
+
// and releases the surface.
|
|
117
|
+
final MapViewLifecycleOwner lifecycleOwner = new MapViewLifecycleOwner();
|
|
118
|
+
lifecycleOwner.setHostResumed(mReactContext.getLifecycleState() == LifecycleState.RESUMED);
|
|
119
|
+
ViewTreeLifecycleOwner.set(mapView, lifecycleOwner);
|
|
120
|
+
lifecycleOwners.put(mapView, lifecycleOwner);
|
|
121
|
+
|
|
122
|
+
mapView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
|
|
123
|
+
@Override
|
|
124
|
+
public void onViewAttachedToWindow(@NonNull View v) {
|
|
125
|
+
lifecycleOwner.setAttached(true); // -> RESUMED if host is foreground (restores renderer/surface)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@Override
|
|
129
|
+
public void onViewDetachedFromWindow(@NonNull View v) {
|
|
130
|
+
lifecycleOwner.setAttached(false); // -> CREATED (stop rendering while off-screen)
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
view = mapView;
|
|
135
|
+
return mapView;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@Override
|
|
139
|
+
public void onDropViewInstance(@NonNull MapView view) {
|
|
140
|
+
super.onDropViewInstance(view);
|
|
141
|
+
MapViewLifecycleOwner lifecycleOwner = lifecycleOwners.remove(view);
|
|
142
|
+
if (lifecycleOwner != null) {
|
|
143
|
+
// Driving the lifecycle to DESTROYED lets the MapView's lifecycle observer tear it down on
|
|
144
|
+
// ON_DESTROY in v11; this releases the renderer/surface and avoids leaking the MapView.
|
|
145
|
+
lifecycleOwner.destroy();
|
|
146
|
+
}
|
|
147
|
+
if (this.view == view) {
|
|
148
|
+
this.view = null;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* A self-contained {@link LifecycleOwner} for a single MapView, so the map's renderer follows the
|
|
154
|
+
* view's own attach + host-foreground state rather than the per-screen LifecycleOwner that
|
|
155
|
+
* react-native-screens installs. RESUMED only when the view is attached AND the host Activity is in
|
|
156
|
+
* the foreground; otherwise CREATED (renderer stopped, surface released). This both fixes the
|
|
157
|
+
* navigate-away/back black map and stops the renderer when the app is backgrounded.
|
|
158
|
+
*/
|
|
159
|
+
static class MapViewLifecycleOwner implements LifecycleOwner {
|
|
160
|
+
private final LifecycleRegistry registry = new LifecycleRegistry(this);
|
|
161
|
+
private boolean attached = false;
|
|
162
|
+
private boolean hostResumed = false;
|
|
163
|
+
private boolean destroyed = false;
|
|
164
|
+
|
|
165
|
+
MapViewLifecycleOwner() {
|
|
166
|
+
registry.setCurrentState(Lifecycle.State.INITIALIZED);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
void setAttached(boolean attached) {
|
|
170
|
+
this.attached = attached;
|
|
171
|
+
sync();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
void setHostResumed(boolean hostResumed) {
|
|
175
|
+
this.hostResumed = hostResumed;
|
|
176
|
+
sync();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
void destroy() {
|
|
180
|
+
destroyed = true;
|
|
181
|
+
registry.setCurrentState(Lifecycle.State.DESTROYED);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
private void sync() {
|
|
185
|
+
if (destroyed) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
registry.setCurrentState((attached && hostResumed) ? Lifecycle.State.RESUMED : Lifecycle.State.CREATED);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
@NonNull
|
|
192
|
+
@Override
|
|
193
|
+
public Lifecycle getLifecycle() {
|
|
194
|
+
return registry;
|
|
195
|
+
}
|
|
64
196
|
}
|
|
65
197
|
|
|
66
198
|
@Nullable
|
package/app.plugin.js
CHANGED
|
@@ -181,7 +181,7 @@ const {
|
|
|
181
181
|
`post_install do |installer|\n
|
|
182
182
|
installer.pods_project.targets.each do |target|
|
|
183
183
|
target.build_configurations.each do |config|
|
|
184
|
-
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '
|
|
184
|
+
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.0'
|
|
185
185
|
end
|
|
186
186
|
end\n`
|
|
187
187
|
);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapsindoors/react-native-maps-indoors-mapbox",
|
|
3
3
|
"title": "React Native MapsIndoors Mapbox",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.8.0",
|
|
5
5
|
"description": "React Native MapsIndoors component with mapbox",
|
|
6
6
|
"react-native": "index.ts",
|
|
7
7
|
"files": [
|
|
@@ -37,15 +37,10 @@
|
|
|
37
37
|
"homepage": "https://www.mapspeople.com/mapsindoors",
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": ">=18.2.0",
|
|
40
|
-
"react-native": ">=0.
|
|
40
|
+
"react-native": ">=0.75.0 <1.0.x"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@
|
|
44
|
-
"@types/jest": "^29.5.2",
|
|
45
|
-
"@types/react": "^18.2.9",
|
|
46
|
-
"@types/react-dom": "18.2.0",
|
|
47
|
-
"@types/react-native": "^0.72.2",
|
|
48
|
-
"@types/react-test-renderer": "^18.0.0",
|
|
43
|
+
"@types/react": "^19.0.0",
|
|
49
44
|
"typedoc": "^0.24.8",
|
|
50
45
|
"typescript": "^5.0.4"
|
|
51
46
|
},
|
|
@@ -17,13 +17,22 @@ Pod::Spec.new do |s|
|
|
|
17
17
|
# optional - use expanded license entry instead:
|
|
18
18
|
# s.license = { :type => "MIT", :file => "LICENSE" }
|
|
19
19
|
s.authors = { 'MapsPeople' => 'info@mapspeople.com' }
|
|
20
|
-
s.platforms = { :ios => "
|
|
20
|
+
s.platforms = { :ios => "16.0" }
|
|
21
21
|
s.source = { :git => "https://github.com/github_account/react-native-maps-indoors-mapbox.git", :tag => "#{s.version}" }
|
|
22
22
|
|
|
23
23
|
s.source_files = "ios/**/*.{h,c,cc,cpp,m,mm,swift}"
|
|
24
24
|
s.requires_arc = true
|
|
25
25
|
|
|
26
26
|
install_modules_dependencies(s)
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
|
|
28
|
+
# MapsIndoors' iOS SDK is consumed via CocoaPods, which resolves MapsIndoorsCore and MapboxMaps
|
|
29
|
+
# 11.x transitively and embeds them into the consuming app.
|
|
30
|
+
#
|
|
31
|
+
# This deliberately does *not* use the Swift Package Manager integration introduced in SPEX-889:
|
|
32
|
+
# `spm_dependency` attaches the packages to the Pods project's own target, and nothing then
|
|
33
|
+
# embeds the resulting dynamic frameworks into the app bundle, so the app builds and links but
|
|
34
|
+
# dies at launch with `Library not loaded: @rpath/MapsIndoorsCore.framework/MapsIndoorsCore`.
|
|
35
|
+
# See SPEX-2429 before reintroducing SPM here.
|
|
36
|
+
s.dependency "MapsIndoorsMapbox11", "4.19.1"
|
|
37
|
+
s.dependency "MapsIndoorsCodable", "4.19.1"
|
|
29
38
|
end
|