@jacques_gordon/expo-mapbox-navigation 2.2.17 → 2.2.19

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/app.plugin.js CHANGED
@@ -318,19 +318,34 @@ def _expo_mapbox_nav_add_spm(installer)
318
318
  end
319
319
  `;
320
320
 
321
- // Find the last post_install block and add our call inside it,
322
- // or add a new post_install block if none exists.
323
- if (podfile.includes('post_install do |installer|')) {
324
- // Add our helper def before the first post_install
325
- // and our call inside the existing post_install
321
+ // Find the last post_integrate block and add our call inside it,
322
+ // or add a new post_integrate block if none exists.
323
+ //
324
+ // WHY post_integrate INSTEAD OF post_install:
325
+ // React Native/Expo's own CocoaPods post_install logic runs a step
326
+ // that re-derives and regenerates each pod target's SPM package
327
+ // product dependencies (visible in the pod install log as
328
+ // "[SPM] Cleaning old SPM dependencies from Pods project" / "[SPM]
329
+ // Adding SPM dependencies to Pods project"). Since our hook was
330
+ // previously injected at the START of the existing post_install
331
+ // block, it ran BEFORE that RN/Expo step — which then silently
332
+ // dropped our manually-added MapboxNavigationNative product
333
+ // dependency (while, by chance, preserving MapboxNavigationCore and
334
+ // MapboxNavigationUIKit, since something in RN/Expo's own derivation
335
+ // logic happens to recognize those two but not a product that's
336
+ // needed only transitively). CocoaPods' post_integrate hook is
337
+ // documented to run strictly after all post_install hooks AND after
338
+ // the Pods project has already been saved to disk, specifically so
339
+ // that later hooks can alter it after the fact. Injecting here
340
+ // guarantees our changes are applied last and are not overwritten.
341
+ if (podfile.includes('post_integrate do |installer|')) {
326
342
  podfile = spmHook + podfile.replace(
327
- 'post_install do |installer|',
328
- 'post_install do |installer|\n _expo_mapbox_nav_add_spm(installer)'
343
+ 'post_integrate do |installer|',
344
+ 'post_integrate do |installer|\n _expo_mapbox_nav_add_spm(installer)'
329
345
  );
330
346
  } else {
331
- // No post_install block — add both the helper and a new block
332
347
  podfile = podfile + spmHook + `
333
- post_install do |installer|
348
+ post_integrate do |installer|
334
349
  _expo_mapbox_nav_add_spm(installer)
335
350
  end
336
351
  `;
@@ -5,18 +5,6 @@ import CoreLocation
5
5
  // re-exported by MapboxNavigationCore in Navigation SDK v3.
6
6
  import MapboxNavigationCore
7
7
  import MapboxNavigationUIKit
8
- // IMPORTANT: MapboxNavigationCore depends internally on MapboxNavigationNative
9
- // (native ObjC classes like MBNNAmenity), but we never call its APIs
10
- // directly, so no code in this module naturally references it by name.
11
- // React Native/Expo's CocoaPods post_install SPM step re-derives which
12
- // package products a pod target actually needs (independently of our own
13
- // config-plugin hook that explicitly registers it), and that derivation
14
- // appears to work off of literal `import` statements in Swift source. Without
15
- // this explicit import, that step silently drops the MapboxNavigationNative
16
- // product dependency after our hook adds it, causing "Undefined symbols"
17
- // for MBNN* classes at the final app link step even though the package
18
- // resolves and MapboxNavigationCore itself compiles fine.
19
- import MapboxNavigationNative
20
8
 
21
9
  public class ExpoMapboxNavigationView: ExpoView {
22
10
 
@@ -0,0 +1,22 @@
1
+ // MapboxNavigationCore depends internally on MapboxNavigationNative (native
2
+ // ObjC classes such as MBNNAmenity), but no file in this module calls its
3
+ // APIs directly. React Native/Expo's CocoaPods post_install SPM step
4
+ // re-derives which package products a pod target actually needs
5
+ // (independently of our own config-plugin hook that explicitly registers it
6
+ // via Xcodeproj manipulation), and that derivation appears to work off of
7
+ // literal `import` statements found in Swift source files. Without an
8
+ // explicit import somewhere in this module, that step silently drops the
9
+ // MapboxNavigationNative product dependency after our hook adds it, causing
10
+ // "Undefined symbols" for MBNN* classes at the final app link step — even
11
+ // though the package resolves correctly and MapboxNavigationCore itself
12
+ // compiles fine.
13
+ //
14
+ // This import is isolated in its own file (rather than placed in
15
+ // ExpoMapboxNavigationView.swift) because MapboxNavigationNative exposes raw
16
+ // types that collide by name with types MapboxNavigationCore re-exports at a
17
+ // higher level (e.g. Waypoint, and enum cases like .automobile, .walking,
18
+ // .cycling, .automobileAvoidingTraffic). Importing both modules in the same
19
+ // file makes those symbols ambiguous to the compiler. Keeping this import in
20
+ // its own compilation unit, with nothing else in the file, satisfies the
21
+ // SPM auto-detection step without affecting name resolution anywhere else.
22
+ import MapboxNavigationNative
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jacques_gordon/expo-mapbox-navigation",
3
- "version": "2.2.17",
3
+ "version": "2.2.19",
4
4
  "description": "Expo module for Mapbox Navigation SDK with 16KB page size support, NDK27, and Mapbox Maps v11.11.0+",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -318,19 +318,34 @@ def _expo_mapbox_nav_add_spm(installer)
318
318
  end
319
319
  `;
320
320
 
321
- // Find the last post_install block and add our call inside it,
322
- // or add a new post_install block if none exists.
323
- if (podfile.includes('post_install do |installer|')) {
324
- // Add our helper def before the first post_install
325
- // and our call inside the existing post_install
321
+ // Find the last post_integrate block and add our call inside it,
322
+ // or add a new post_integrate block if none exists.
323
+ //
324
+ // WHY post_integrate INSTEAD OF post_install:
325
+ // React Native/Expo's own CocoaPods post_install logic runs a step
326
+ // that re-derives and regenerates each pod target's SPM package
327
+ // product dependencies (visible in the pod install log as
328
+ // "[SPM] Cleaning old SPM dependencies from Pods project" / "[SPM]
329
+ // Adding SPM dependencies to Pods project"). Since our hook was
330
+ // previously injected at the START of the existing post_install
331
+ // block, it ran BEFORE that RN/Expo step — which then silently
332
+ // dropped our manually-added MapboxNavigationNative product
333
+ // dependency (while, by chance, preserving MapboxNavigationCore and
334
+ // MapboxNavigationUIKit, since something in RN/Expo's own derivation
335
+ // logic happens to recognize those two but not a product that's
336
+ // needed only transitively). CocoaPods' post_integrate hook is
337
+ // documented to run strictly after all post_install hooks AND after
338
+ // the Pods project has already been saved to disk, specifically so
339
+ // that later hooks can alter it after the fact. Injecting here
340
+ // guarantees our changes are applied last and are not overwritten.
341
+ if (podfile.includes('post_integrate do |installer|')) {
326
342
  podfile = spmHook + podfile.replace(
327
- 'post_install do |installer|',
328
- 'post_install do |installer|\n _expo_mapbox_nav_add_spm(installer)'
343
+ 'post_integrate do |installer|',
344
+ 'post_integrate do |installer|\n _expo_mapbox_nav_add_spm(installer)'
329
345
  );
330
346
  } else {
331
- // No post_install block — add both the helper and a new block
332
347
  podfile = podfile + spmHook + `
333
- post_install do |installer|
348
+ post_integrate do |installer|
334
349
  _expo_mapbox_nav_add_spm(installer)
335
350
  end
336
351
  `;