Podfile 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
  2. # Resolve react_native_pods.rb with node to allow for hoisting
  3. require Pod::Executable.execute_command('node', ['-p',
  4. 'require.resolve(
  5. "react-native/scripts/react_native_pods.rb",
  6. {paths: [process.argv[1]]},
  7. )', __dir__]).strip
  8. platform :ios, '13.4'
  9. prepare_react_native_project!
  10. # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
  11. # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
  12. #
  13. # To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
  14. # ```js
  15. # module.exports = {
  16. # dependencies: {
  17. # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
  18. # ```
  19. flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
  20. linkage = ENV['USE_FRAMEWORKS']
  21. if linkage != nil
  22. Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  23. use_frameworks! :linkage => linkage.to_sym
  24. end
  25. production = ENV["PRODUCTION"] == "1"
  26. target 'taroDemo' do
  27. use_expo_modules!
  28. post_integrate do |installer|
  29. begin
  30. expo_patch_react_imports!(installer)
  31. rescue => e
  32. Pod::UI.warn e
  33. end
  34. begin
  35. expo_patch_react_imports!(installer)
  36. rescue => e
  37. Pod::UI.warn e
  38. end
  39. end
  40. config = use_native_modules!
  41. use_react_native!(
  42. :path => config[:reactNativePath],
  43. # Enables Flipper.
  44. #
  45. # Note that if you have use_frameworks! enabled, Flipper will not work and
  46. # you should disable the next line.
  47. :flipper_configuration => flipper_config,
  48. # An absolute path to your application root.
  49. :app_path => "#{Pod::Config.instance.installation_root}/.."
  50. )
  51. target 'taroDemoTests' do
  52. inherit! :complete
  53. # Pods for testing
  54. end
  55. post_install do |installer|
  56. # !!! attention: for react native debug at release build only. remove next lines for your own application.
  57. find_and_replace("../node_modules/react-native/React/CoreModules/RCTDevLoadingView.mm","[self showOfflineMessage];","")
  58. find_and_replace("../node_modules/react-native/React/Base/RCTDefines.h","#define RCT_DEV 0", "#define RCT_DEV 1")
  59. find_and_replace("../node_modules/react-native/React/Base/RCTKeyCommands.m", "#if RCT_DEV", "#if DEBUG")
  60. # !!! end
  61. # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
  62. react_native_post_install(
  63. installer,
  64. config[:reactNativePath],
  65. :mac_catalyst_enabled => false
  66. )
  67. # Add these lines for Xcode 14 builds
  68. installer.generated_projects.each do |project|
  69. project.targets.each do |target|
  70. target.build_configurations.each do |config|
  71. config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
  72. end
  73. end
  74. end
  75. end
  76. end
  77. def find_and_replace(dir, findstr, replacestr)
  78. Dir[dir].each do |name|
  79. text = File.read(name)
  80. replace = text.gsub(findstr,replacestr)
  81. if text != replace
  82. puts "Fix: " + name
  83. File.open(name, "w") { |file| file.puts replace }
  84. STDOUT.flush
  85. end
  86. end
  87. Dir[dir + '*/'].each(&method(:find_and_replace))
  88. end