How can I know which React Native pod subspecs to add?

徘徊边缘 提交于 2019-12-07 02:18:20

问题


Working on an issue where I needed to add the react-native-device-info package to my iOS system, I had to add a dependency on React into my Podfile.

Initially I applied all the podspecs from a list I'd found on the net:

  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'DevSupport',
    'Core',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket'
  ]

But I realised that some of those would likely be unnecessary, and via trial and error whittled it down to:

  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'DevSupport',
    'Core',
    'RCTAnimation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTSettings',
    'RCTText'
  ]

My question is how can I work out which subspecs are necessary and why?

Also hoping the answer to this will give me a better understanding of what's going on when I use subspecs.


回答1:


Is it really necessary to trim out the unnecessary ones?

I just went with

pod 'React', :path => '../node_modules/react-native'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'


来源:https://stackoverflow.com/questions/52775976/how-can-i-know-which-react-native-pod-subspecs-to-add

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!