To manually install @react-native-community/datetimepicker on iOS, follow these steps:
- Install CocoaPods.
- Run
pod init inside your ios folder. - Update your
Podfile with the configuration below (replace MyApp with your actual target name). - Note: Because the library uses Swift, you must ensure
use_frameworks! is enabled. - Run
pod install in the ios folder. - Start your project using
npm run start and npm run start:ios.
Important Configuration Details:
- Set
platform :ios, '8.0' or higher. - Point the
RNDateTimePicker pod to the path in node_modules. - If using React Native >= 0.42.0, explicitly include
yoga. - Include necessary React subspecs (
Core, CxxBridge, DevSupport, RCTText, RCTNetwork, RCTWebSocket).
# Allowed sources
source 'https://github.com/CocoaPods/Specs.git'
target 'MyApp' do
# As we use Swift, ensure that `use_frameworks` is enabled.
use_frameworks!
# Specific iOS platform we are targetting
platform :ios, '8.0'
# Point to the installed version
pod 'RNDateTimePicker', :path => '../node_modules/@react-native-community/datetimepicker/RNDateTimePicker.podspec'
# React/React-Native specific pods
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # Needed for debugging
]
# Explicitly include Yoga if you are using RN >= 0.42.0
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
# Third party deps podspec link
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
end