Skip to content

Commit

Permalink
Merge branch 'main' of github.com:rnmapbox/maps into fix/gemfile
Browse files Browse the repository at this point in the history
  • Loading branch information
naftalibeder committed Oct 7, 2024
2 parents 6515031 + 96552bc commit a6b6d80
Show file tree
Hide file tree
Showing 5 changed files with 13,031 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ module.exports = {
'react-native/no-inline-styles': 0,
'@typescript-eslint/no-explicit-any': ['error', { ignoreRestArgs: true }],
},
ignorePatterns: ['**/rnmapbox.web.symlink', 'plugin/build/'],
ignorePatterns: ['**/rnmapbox.web.symlink', 'plugin/build/', 'example/dist'],
overrides: [
{
// Match TypeScript Files
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ node_modules
/bots/node_modules/
package-lock.json
/example/package-lock.json
yarn.lock
/example/yarn.lock

# Expo
.expo
example/dist

# Test generated files
/ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ Some notes about example app:
cd example/ios ; RNMBX11=1 pod update MapboxMaps
```
To build example in this mode on android:
Change `RNMBX11=true` in `example/android/gralde.properties`
Change `RNMBX11=true` in `example/android/gradle.properties`
- NewArchitecture/Fabric:
```
cd example/ios ; RCT_NEW_ARCH_ENABLED=1 pod update MapboxMaps
```
On android change `newArchEnabled=true` in `example/android/gralde.properties`
On android change `newArchEnabled=true` in `example/android/gradle.properties`

### Running example app for Web

Expand Down
39 changes: 34 additions & 5 deletions ios/RNMBX/RNMBXMapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,32 @@ extension RNMBXMapView {
}
}

typealias LayerSourceDetails = (source: String?, sourceLayer: String?)

#if RNMBX_11
func getLayerSourceDetails(layer: (any Layer)?) -> LayerSourceDetails? {
if let circleLayer = layer as? CircleLayer {
return (circleLayer.source, circleLayer.sourceLayer)
} else if let fillExtrusionLayer = layer as? FillExtrusionLayer {
return (fillExtrusionLayer.source, fillExtrusionLayer.sourceLayer)
} else if let fillLayer = layer as? FillLayer {
return (fillLayer.source, fillLayer.sourceLayer)
} else if let heatmapLayer = layer as? HeatmapLayer {
return (heatmapLayer.source, heatmapLayer.sourceLayer)
} else if let hillshadeLayer = layer as? HillshadeLayer {
return (hillshadeLayer.source, hillshadeLayer.sourceLayer)
} else if let lineLayer = layer as? LineLayer {
return (lineLayer.source, lineLayer.sourceLayer)
} else if let rasterLayer = layer as? RasterLayer {
return (rasterLayer.source, rasterLayer.sourceLayer)
} else if let symbolLayer = layer as? SymbolLayer {
return (symbolLayer.source, symbolLayer.sourceLayer)
} else {
return nil
}
}
#endif

extension RNMBXMapView {
func setSourceVisibility(_ visible: Bool, sourceId: String, sourceLayerId: String?) -> Void {
let style = self.mapboxMap.style
Expand All @@ -1424,14 +1450,18 @@ extension RNMBXMapView {
let layer = logged("setSourceVisibility.layer", info: { "\(layerInfo.id)" }) {
try style.layer(withId: layerInfo.id)
}

#if RNMBX_11
// RNMBX_11_TODO
let sourceDetails = getLayerSourceDetails(layer: layer)
#else
if let layer = layer {
if layer.source == sourceId {
let sourceDetails: LayerSourceDetails? = (source: layer?.source, sourceLayer: layer?.sourceLayer)
#endif

if let layer = layer, let sourceDetails = sourceDetails {
if sourceDetails.source == sourceId {
var good = true
if let sourceLayerId = sourceLayerId {
if sourceLayerId != layer.sourceLayer {
if sourceLayerId != sourceDetails.sourceLayer {
good = false
}
}
Expand All @@ -1444,7 +1474,6 @@ extension RNMBXMapView {
}
}
}
#endif
}
}
}
Expand Down
Loading

0 comments on commit a6b6d80

Please sign in to comment.