Как предварительно собрать модули React Native или есть ли способ использовать удаленные модули React Native в Podfile? - PullRequest
2 голосов
/ 09 июля 2020

В настоящее время у меня есть модуль ReactNative, реализованный в существующем проекте iOS. Пока проект работает хорошо, но время сборки значительно увеличилось, потому что xcode повторно компилирует каждую библиотеку React при каждой сборке. Я пытался использовать cocoapods-binary для предварительной сборки модулей React, однако этот плагин не работает с локальными модулями.

Вот мой подфайл:

platform :ios, "10.0"

plugin 'cocoapods-binary'

# Path to node_modules directory
$node_modules_path = "../../react-native-pojects/node_modules"

require_relative "#{$node_modules_path}/@react-native-community/cli-platform-ios/native_modules"

project "native-project",
  "Debug" => :debug,
  "Homolog" => :release,
  "Release" => :release

target "native-project" do
  
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # React Native pods
  pod "FBLazyVector", :path => "#{$node_modules_path}/react-native/Libraries/FBLazyVector"
  pod "FBReactNativeSpec", :path => "#{$node_modules_path}/react-native/Libraries/FBReactNativeSpec"
  pod "RCTRequired", :path => "#{$node_modules_path}/react-native/Libraries/RCTRequired"
  pod "RCTTypeSafety", :path => "#{$node_modules_path}/react-native/Libraries/TypeSafety"
  pod "React", :path => "#{$node_modules_path}/react-native/"
  pod "React-Core", :path => "#{$node_modules_path}/react-native/"
  pod "React-CoreModules", :path => "#{$node_modules_path}/react-native/React/CoreModules"
  pod "React-Core/DevSupport", :path => "#{$node_modules_path}/react-native/"
  pod "React-RCTActionSheet", :path => "#{$node_modules_path}/react-native/Libraries/ActionSheetIOS"
  pod "React-RCTAnimation", :path => "#{$node_modules_path}/react-native/Libraries/NativeAnimation"
  pod "React-RCTBlob", :path => "#{$node_modules_path}/react-native/Libraries/Blob"
  pod "React-RCTImage", :path => "#{$node_modules_path}/react-native/Libraries/Image"
  pod "React-RCTLinking", :path => "#{$node_modules_path}/react-native/Libraries/LinkingIOS"
  pod "React-RCTNetwork", :path => "#{$node_modules_path}/react-native/Libraries/Network"
  pod "React-RCTSettings", :path => "#{$node_modules_path}/react-native/Libraries/Settings"
  pod "React-RCTText", :path => "#{$node_modules_path}/react-native/Libraries/Text"
  pod "React-RCTVibration", :path => "#{$node_modules_path}/react-native/Libraries/Vibration"
  pod "React-Core/RCTWebSocket", :path => "#{$node_modules_path}/react-native/"
  pod "React-cxxreact", :path => "#{$node_modules_path}/react-native/ReactCommon/cxxreact"
  pod "React-jsi", :path => "#{$node_modules_path}/react-native/ReactCommon/jsi"
  pod "React-jsiexecutor", :path => "#{$node_modules_path}/react-native/ReactCommon/jsiexecutor"
  pod "React-jsinspector", :path => "#{$node_modules_path}/react-native/ReactCommon/jsinspector"
  pod "ReactCommon/callinvoker", :path => "#{$node_modules_path}/react-native/ReactCommon"
  pod "ReactCommon/turbomodule/core", :path => "#{$node_modules_path}/react-native/ReactCommon"
  pod "Yoga", :path => "#{$node_modules_path}/react-native/ReactCommon/yoga", :modular_headers => true
  pod "DoubleConversion", :podspec => "#{$node_modules_path}/react-native/third-party-podspecs/DoubleConversion.podspec"
  pod "glog", :podspec => "#{$node_modules_path}/react-native/third-party-podspecs/glog.podspec"
  pod "Folly", :podspec => "#{$node_modules_path}/react-native/third-party-podspecs/Folly.podspec"

  
  pod "RNGestureHandler", :git => "https://github.com/software-mansion/react-native-gesture-handler.git", :tag => "1.6.1", :binary => true
  pod "RNVectorIcons", :git => "https://github.com/oblador/react-native-vector-icons.git", :tag => "v7.0.0", :binary => true
  pod "RNReanimated", :git => "https://github.com/software-mansion/react-native-reanimated.git", :tag => "1.9.0", :binary => true
  pod "react-native-safe-area-context", :git => "https://github.com/th3rdwave/react-native-safe-area-context.git", :tag => "v3.0.7", :binary => true
  pod "RNDateTimePicker", :git => "https://github.com/react-native-community/datetimepicker.git", :tag => "v2.5.0", :binary => true
  pod "RNCMaskedView", :git => "https://github.com/react-native-community/react-native-masked-view.git"
  pod "RNCPicker", :git => "https://github.com/react-native-community/react-native-picker.git", :tag => "v1.6.5", :binary => true
  pod "BVLinearGradient", :git => "https://github.com/react-native-community/react-native-linear-gradient.git", :tag => "v2.5.6", :binary => true
  pod "react-native-document-picker", :git => "https://github.com/Elyx0/react-native-document-picker.git", :tag => "v3.5.3", :binary => true
  pod "RNFileViewer", :git => "https://github.com/vinzscam/react-native-file-viewer.git", :tag => "v2.1.0", :binary => true
  pod "rn-fetch-blob", :git => "https://github.com/joltup/rn-fetch-blob.git", :tag => "v0.10.15", :binary => true

end

1 Ответ

0 голосов
/ 09 июля 2020

У вас есть 2 способа решения вашей проблемы: 1. создать новый проект и заменить код 2. platform :ios, "10.0" на ~> platform :ios, "9.0" затем удалить папку модуля и запустить установку модуля в ios каталог

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...