Skip to content

Commit

Permalink
10.0.0-alpha4: Fix ExpoPlugin after name change
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrauber committed Jun 12, 2024
1 parent aeef5c3 commit 737ad50
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 32 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,5 @@ coverage

# Config plugin
/plugin/build

.env
34 changes: 32 additions & 2 deletions docs/MapView.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,40 @@
| pitchEnabled | `boolean` | `true` | `false` | Enable/Disable pitch on map |
| rotateEnabled | `boolean` | `true` | `false` | Enable/Disable rotation on map |
| attributionEnabled | `boolean` | `true` | `false` | Enable/Disable attribution on map.<br/><br/>This must be enabled for Mapbox-hosted tiles and styles. Please refer to the Mapbox Terms of Service.<br/>Other providers do not require this. |
| attributionPosition | `{top?: number, left?: number} \| {top?: number, right?: number} \| {bottom?: number, left?: number} \| {bottom?: number, right?: number}` | `none` | `false` | Adds attribution offset, e.g. `{top: 8, left: 8}` will put attribution button in top-left corner of the map |
| attributionPosition | `\| {
top?: number;
left?: number;
}
\| {
top?: number;
right?: number;
}
\| {
bottom?: number;
left?: number;
}
\| {
bottom?: number;
right?: number;
}` | `none` | `false` | Adds attribution offset, e.g. `{top: 8, left: 8}` will put attribution button in top-left corner of the map |
| tintColor | `string \| unknown[]` | `none` | `false` | MapView's tintColor |
| logoEnabled | `boolean` | `false` | `false` | Enable/Disable the logo on the map. |
| logoPosition | `{top?: number, left?: number} \| {top?: number, right?: number} \| {bottom?: number, left?: number} \| {bottom?: number, right?: number}` | `none` | `false` | Adds logo offset, e.g. `{top: 8, left: 8}` will put the logo in top-left corner of the map |
| logoPosition | `\| {
top?: number;
left?: number;
}
\| {
top?: number;
right?: number;
}
\| {
bottom?: number;
left?: number;
}
\| {
bottom?: number;
right?: number;
}` | `none` | `false` | Adds logo offset, e.g. `{top: 8, left: 8}` will put the logo in top-left corner of the map |
| compassEnabled | `boolean` | `none` | `false` | Enable/Disable the compass from appearing on the map |
| compassViewPosition | `number` | `none` | `false` | Change corner of map the compass starts at. 0: TopLeft, 1: TopRight, 2: BottomLeft, 3: BottomRight |
| compassViewMargins | `object` | `none` | `false` | Add margins to the compass with x and y values |
Expand Down
8 changes: 4 additions & 4 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ platform :ios, min_ios_version_supported

prepare_react_native_project!

$RNMBGL_SPM_Spec = {
$RCTMLN_SPM_Spec = {
url: "https://github.com/maplibre/maplibre-gl-native-distribution",
requirement: {
kind: "upToNextMajorVersion",
Expand All @@ -18,7 +18,7 @@ $RNMBGL_SPM_Spec = {
product_name: "MapLibre"
}

# We ingore warning except for RNMBGL
# We ingore warning except for RCTMLN
INHIBIT_WARNING_BY_DEFAULT = true

if INHIBIT_WARNING_BY_DEFAULT
Expand Down Expand Up @@ -86,14 +86,14 @@ target 'RNMaplibreExample' do
)
# This method has been removed in react native 0.73
# __apply_Xcode_12_5_M1_post_install_workaround(installer)
$RNMBGL.post_install(installer)
$RCTMLN.post_install(installer)
end
else
# CI configuration
post_install do |installer|
react_native_post_install(installer)
#__apply_Xcode_12_5_M1_post_install_workaround(installer)
$RNMBGL.post_install(installer)
$RCTMLN.post_install(installer)
end
end
end
5 changes: 2 additions & 3 deletions ios/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Add the following to your `ios/Podfile`:
```ruby
post_install do |installer|
... other post install hooks
$RNMBGL.post_install(installer)
$RCTMLN.post_install(installer)
end
```

Expand All @@ -31,15 +31,14 @@ environments. The map either does not render at all or appears garbled when pann
It is best to test on a real device if at all possible at this time
until this is fixed upstream. iOS devs can open the workspace in Xcode and run from there.


## Installing a specific version

The current default MapLibre version is `6.4.0`.
If you want to install a different version, you can override as follows in
your `Podfile`:

```ruby
$RNMBGL_Use_SPM = {
$RCTMLN_Use_SPM = {
url: "https://github.com/maplibre/maplibre-gl-native-distribution",
requirement: {
kind: "upToNextMajorVersion",
Expand Down
10 changes: 5 additions & 5 deletions maplibre-react-native.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ require 'json'

package = JSON.parse(File.read(File.join(__dir__, 'package.json')))

$RNMBGL = Object.new
$RCTMLN = Object.new

def $RNMBGL._add_spm_to_target(project, target, url, requirement, product_name)
def $RCTMLN._add_spm_to_target(project, target, url, requirement, product_name)
pkg_class = Xcodeproj::Project::Object::XCRemoteSwiftPackageReference
ref_class = Xcodeproj::Project::Object::XCSwiftPackageProductDependency
pkg = project.root_object.package_references.find { |p| p.class == pkg_class && p.repositoryURL == url }
Expand All @@ -23,7 +23,7 @@ def $RNMBGL._add_spm_to_target(project, target, url, requirement, product_name)
end
end

def $RNMBGL.post_install(installer)
def $RCTMLN.post_install(installer)
spm_spec = {
url: "https://github.com/maplibre/maplibre-gl-native-distribution",
requirement: {
Expand All @@ -33,8 +33,8 @@ def $RNMBGL.post_install(installer)
product_name: "MapLibre"
}

if $RNMBGL_SPM_Spec.is_a?(Hash)
spm_spec = $RNMBGL_SPM_Spec
if $RCTMLN_SPM_Spec.is_a?(Hash)
spm_spec = $RCTMLN_SPM_Spec
end
project = installer.pods_project
self._add_spm_to_target(
Expand Down
24 changes: 12 additions & 12 deletions plugin/src/__tests__/__snapshots__/withMapLibre-test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ target 'HelloWorld' do
# @generated begin post_installer - expo prebuild (DO NOT MODIFY) sync-4092f82b887b5b9edb84642c2a56984d69b9a403
post_install do |installer|
# @generated begin @maplibre/maplibre-react-native-post_installer - expo prebuild (DO NOT MODIFY) sync-88648fec2f0169e784fba60266091187f7753f15
$RNMBGL.post_install(installer)
# @generated begin @maplibre/maplibre-react-native-post_installer - expo prebuild (DO NOT MODIFY) sync-72b8976cc2231a4441a5b54389fb6e10bd42a1be
$RCTMLN.post_install(installer)
# @generated end @maplibre/maplibre-react-native-post_installer
end
# @generated end post_installer
Expand Down Expand Up @@ -47,8 +47,8 @@ target 'HelloWorld' do
# @generated begin post_installer - expo prebuild (DO NOT MODIFY) sync-4092f82b887b5b9edb84642c2a56984d69b9a403
post_install do |installer|
# @generated begin @maplibre/maplibre-react-native-post_installer - expo prebuild (DO NOT MODIFY) sync-88648fec2f0169e784fba60266091187f7753f15
$RNMBGL.post_install(installer)
# @generated begin @maplibre/maplibre-react-native-post_installer - expo prebuild (DO NOT MODIFY) sync-72b8976cc2231a4441a5b54389fb6e10bd42a1be
$RCTMLN.post_install(installer)
# @generated end @maplibre/maplibre-react-native-post_installer
end
# @generated end post_installer
Expand Down Expand Up @@ -97,8 +97,8 @@ target 'HelloWorld' do
use_flipper!()
post_install do |installer|
# @generated begin @maplibre/maplibre-react-native-post_installer - expo prebuild (DO NOT MODIFY) sync-88648fec2f0169e784fba60266091187f7753f15
$RNMBGL.post_install(installer)
# @generated begin @maplibre/maplibre-react-native-post_installer - expo prebuild (DO NOT MODIFY) sync-72b8976cc2231a4441a5b54389fb6e10bd42a1be
$RCTMLN.post_install(installer)
# @generated end @maplibre/maplibre-react-native-post_installer
react_native_post_install(installer)
end
Expand All @@ -125,8 +125,8 @@ target 'HelloWorld' do
# if !ENV['CI']
# use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1')
# post_install do |installer|
# @generated begin @maplibre/maplibre-react-native-post_installer - expo prebuild (DO NOT MODIFY) sync-88648fec2f0169e784fba60266091187f7753f15
$RNMBGL.post_install(installer)
# @generated begin @maplibre/maplibre-react-native-post_installer - expo prebuild (DO NOT MODIFY) sync-72b8976cc2231a4441a5b54389fb6e10bd42a1be
$RCTMLN.post_install(installer)
# @generated end @maplibre/maplibre-react-native-post_installer
# flipper_post_install(installer)
# end
Expand All @@ -135,7 +135,7 @@ target 'HelloWorld' do
# @generated begin pre_installer - expo prebuild (DO NOT MODIFY) sync-00old-id
INVALID_pre_install do |installer|
# @generated begin @react-native-mapbox-gl/maps-pre_installer - expo prebuild (DO NOT MODIFY) sync-00
INVALID_$RNMBGL.pre_install(installer)
INVALID_$RCTMLN.pre_install(installer)
# @generated end @react-native-mapbox-gl/maps-pre_installer
end
# @generated end pre_installer
Expand Down Expand Up @@ -165,14 +165,14 @@ target 'HelloWorld' do
# @generated begin pre_installer - expo prebuild (DO NOT MODIFY) sync-00old-id
INVALID_pre_install do |installer|
# @generated begin @react-native-mapbox-gl/maps-pre_installer - expo prebuild (DO NOT MODIFY) sync-00
INVALID_$RNMBGL.pre_install(installer)
INVALID_$RCTMLN.pre_install(installer)
# @generated end @react-native-mapbox-gl/maps-pre_installer
end
# @generated end pre_installer
# @generated begin post_installer - expo prebuild (DO NOT MODIFY) sync-4092f82b887b5b9edb84642c2a56984d69b9a403
post_install do |installer|
# @generated begin @maplibre/maplibre-react-native-post_installer - expo prebuild (DO NOT MODIFY) sync-88648fec2f0169e784fba60266091187f7753f15
$RNMBGL.post_install(installer)
# @generated begin @maplibre/maplibre-react-native-post_installer - expo prebuild (DO NOT MODIFY) sync-72b8976cc2231a4441a5b54389fb6e10bd42a1be
$RCTMLN.post_install(installer)
# @generated end @maplibre/maplibre-react-native-post_installer
end
# @generated end post_installer
Expand Down
8 changes: 4 additions & 4 deletions plugin/src/__tests__/fixtures/cocoapodFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ target 'HelloWorld' do
# @generated begin pre_installer - expo prebuild (DO NOT MODIFY) sync-00old-id
INVALID_pre_install do |installer|
# @generated begin @react-native-mapbox-gl/maps-pre_installer - expo prebuild (DO NOT MODIFY) sync-00
INVALID_$RNMBGL.pre_install(installer)
INVALID_$RCTMLN.pre_install(installer)
# @generated end @react-native-mapbox-gl/maps-pre_installer
end
# @generated end pre_installer
# @generated begin post_installer - expo prebuild (DO NOT MODIFY) sync-00old-id-2
INVALID_post_install do |installer|
# @generated begin @react-native-mapbox-gl/maps-post_installer - expo prebuild (DO NOT MODIFY) sync-001
INVALID_$RNMBGL.post_install(installer)
INVALID_$RCTMLN.post_install(installer)
# @generated end @react-native-mapbox-gl/maps-post_installer
end
# @generated end post_installer
Expand Down Expand Up @@ -148,14 +148,14 @@ target 'HelloWorld' do
# @generated begin pre_installer - expo prebuild (DO NOT MODIFY) sync-00old-id
INVALID_pre_install do |installer|
# @generated begin @react-native-mapbox-gl/maps-pre_installer - expo prebuild (DO NOT MODIFY) sync-00
INVALID_$RNMBGL.pre_install(installer)
INVALID_$RCTMLN.pre_install(installer)
# @generated end @react-native-mapbox-gl/maps-pre_installer
end
# @generated end pre_installer
# @generated begin post_installer - expo prebuild (DO NOT MODIFY) sync-00old-id-2
INVALID_post_install do |installer|
# @generated begin @react-native-mapbox-gl/maps-post_installer - expo prebuild (DO NOT MODIFY) sync-001
INVALID_$RNMBGL.post_install(installer)
INVALID_$RCTMLN.post_install(installer)
# @generated end @react-native-mapbox-gl/maps-post_installer
end
# @generated end post_installer
Expand Down
4 changes: 2 additions & 2 deletions plugin/src/withMapLibre.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function addMapLibreInstallerBlock(
return mergeContents({
tag: `@maplibre/maplibre-react-native-${blockName}_installer`,
src,
newSrc: ` $RNMBGL.${blockName}_install(installer)`,
newSrc: ` $RCTMLN.${blockName}_install(installer)`,
anchor: new RegExp(`${blockName}_install do \\|installer\\|`),
offset: 1,
comment: '#',
Expand Down Expand Up @@ -133,7 +133,7 @@ export function setExcludedArchitectures(project: XcodeProject): XcodeProject {
const withoutSignatures: ConfigPlugin = config => {
const shellScript = `if [ "$XCODE_VERSION_MAJOR" = "1500" ]; then
echo "Remove signature files (Xcode 15 workaround)";
rm -rf "$CONFIGURATION_BUILD_DIR/Mapbox.xcframework-ios.signature";
rm -rf "$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature";
fi`;
return withXcodeProject(config, async config => {
const xcodeProject = config.modResults;
Expand Down

0 comments on commit 737ad50

Please sign in to comment.