Skip to content

Commit

Permalink
Set MapboxMobileEvents as a dynamic framework
Browse files Browse the repository at this point in the history
  • Loading branch information
rossmartin committed Mar 7, 2021
1 parent 963da67 commit dbb5c7c
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions react-native-mapbox-navigation.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@ require "json"

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

TargetsToChangeToDynamic = ['MapboxMobileEvents']

$RNMBNAV = Object.new

def $RNMBNAV.post_install(installer)
installer.pod_targets.each do |pod|
if TargetsToChangeToDynamic.include?(pod.name)
if pod.send(:build_type) != Pod::BuildType.dynamic_framework
pod.instance_variable_set(:@build_type,Pod::BuildType.dynamic_framework)
puts "* Changed #{pod.name} to `#{pod.send(:build_type)}`"
fail "Unable to change build_type" unless mobile_events_target.send(:build_type) == Pod::BuildType.dynamic_framework
end
end
end
end

def $RNMBNAV.pre_install(installer)
installer.aggregate_targets.each do |target|
target.pod_targets.select { |p| TargetsToChangeToDynamic.include?(p.name) }.each do |mobile_events_target|
mobile_events_target.instance_variable_set(:@build_type,Pod::BuildType.dynamic_framework)
puts "* Changed #{mobile_events_target.name} to #{mobile_events_target.send(:build_type)}"
fail "Unable to change build_type" unless mobile_events_target.send(:build_type) == Pod::BuildType.dynamic_framework
end
end
end

Pod::Spec.new do |s|
s.name = "react-native-mapbox-navigation"
s.version = package["version"]
Expand All @@ -19,10 +45,6 @@ Pod::Spec.new do |s|
s.requires_arc = true

s.dependency "React-Core"
# For more info on why "@react-native-mapbox-gl-mapbox-static" is required,
# check out this PR on the react-native-mapbox-gl/maps repo
# https://github.com/react-native-mapbox-gl/maps/pull/714
s.dependency '@react-native-mapbox-gl-mapbox-static', '6.3.0'
s.dependency "MapboxNavigation", "~> 1.2.1"
end

0 comments on commit dbb5c7c

Please sign in to comment.