问题
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