From 858137df2384ee4bea6108871865ea69356dbc20 Mon Sep 17 00:00:00 2001 From: Henning Hall Date: Sat, 25 Aug 2018 01:22:53 +0200 Subject: [PATCH] Added textColor property (ios) --- DatePickerAndroid.js | 48 ++ DatePickerIOS.js | 179 ++++++ .../project.pbxproj | 533 +++++++----------- .../xcschemes/DatePickerExample.xcscheme | 2 + example/yarn.lock | 6 +- index.js | 60 +- ios/DatePickerX.xcodeproj/project.pbxproj | 276 +++++++++ .../contents.xcworkspacedata | 7 + ios/DatePickerX/DatePicker.h | 15 + ios/DatePickerX/DatePicker.m | 103 ++++ ios/DatePickerX/DatePickerXManager.h | 19 + ios/DatePickerX/DatePickerXManager.m | 49 ++ 12 files changed, 906 insertions(+), 391 deletions(-) create mode 100644 DatePickerAndroid.js create mode 100644 DatePickerIOS.js create mode 100644 ios/DatePickerX.xcodeproj/project.pbxproj create mode 100644 ios/DatePickerX.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 ios/DatePickerX/DatePicker.h create mode 100644 ios/DatePickerX/DatePicker.m create mode 100644 ios/DatePickerX/DatePickerXManager.h create mode 100644 ios/DatePickerX/DatePickerXManager.m diff --git a/DatePickerAndroid.js b/DatePickerAndroid.js new file mode 100644 index 0000000..69507fd --- /dev/null +++ b/DatePickerAndroid.js @@ -0,0 +1,48 @@ +import { + Platform, + NativeModules, + NativeAppEventEmitter, + Text, + requireNativeComponent, + ViewPropTypes, + StyleSheet, + DatePickerIOS, +} from 'react-native'; +import React, { Component } from 'react' +import PropTypes from 'prop-types'; +import { DatePicker } from 'react-native-date-picker-x'; + +const NativeDatePicker = requireNativeComponent(`DatePickerManager`, DatePickerAndroid, { nativeOnly: { onChange: true } }); + +class DatePickerAndroid extends React.Component { + + static defaultProps = { + mode: 'datetime', + minuteInterval: 1, + }; + + _onChange = e => this.props.onDateChange(new Date(parseInt(e.nativeEvent.date))); + _maximumDate = () => this.props.maximumDate && this.props.maximumDate.getTime(); + _minimumDate = () => this.props.minimumDate && this.props.minimumDate.getTime(); + render = () => ( + + ) +} + +const styles = StyleSheet.create({ + picker: { + width: 310, + height: 180, + } +}) + +DatePickerAndroid.propTypes = DatePickerIOS.propTypes; + +export default DatePickerAndroid; diff --git a/DatePickerIOS.js b/DatePickerIOS.js new file mode 100644 index 0000000..a76e86b --- /dev/null +++ b/DatePickerIOS.js @@ -0,0 +1,179 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + * This is a controlled component version of RCTDatePickerIOS + * + * @format + * @flow + */ + +'use strict'; + +import React from 'react'; +import { StyleSheet, View, requireNativeComponent } from 'react-native'; +const invariant = require('fbjs/lib/invariant'); + +import type {ViewProps} from 'ViewPropTypes'; + +const RCTDatePickerIOS = requireNativeComponent('DatePickerX'); + +type Event = Object; + +type Props = $ReadOnly<{| + ...ViewProps, + + /** + * The currently selected date. + */ + date?: ?Date, + + /** + * Provides an initial value that will change when the user starts selecting + * a date. It is useful for simple use-cases where you do not want to deal + * with listening to events and updating the date prop to keep the + * controlled state in sync. The controlled state has known bugs which + * causes it to go out of sync with native. The initialDate prop is intended + * to allow you to have native be source of truth. + */ + initialDate?: ?Date, + + /** + * The date picker locale. + */ + locale?: ?string, + + /** + * Maximum date. + * + * Restricts the range of possible date/time values. + */ + maximumDate?: ?Date, + + /** + * Minimum date. + * + * Restricts the range of possible date/time values. + */ + minimumDate?: ?Date, + + /** + * The interval at which minutes can be selected. + */ + minuteInterval?: ?(1 | 2 | 3 | 4 | 5 | 6 | 10 | 12 | 15 | 20 | 30), + + /** + * The date picker mode. + */ + mode?: ?('date' | 'time' | 'datetime'), + + /** + * Date change handler. + * + * This is called when the user changes the date or time in the UI. + * The first and only argument is an Event. For getting the date the picker + * was changed to, use onDateChange instead. + */ + onChange?: ?(event: Event) => void, + + /** + * Date change handler. + * + * This is called when the user changes the date or time in the UI. + * The first and only argument is a Date object representing the new + * date and time. + */ + onDateChange: (date: Date) => void, + + /** + * Timezone offset in minutes. + * + * By default, the date picker will use the device's timezone. With this + * parameter, it is possible to force a certain timezone offset. For + * instance, to show times in Pacific Standard Time, pass -7 * 60. + */ + timeZoneOffsetInMinutes?: ?number, +|}>; + +/** + * Use `DatePickerIOS` to render a date/time picker (selector) on iOS. This is + * a controlled component, so you must hook in to the `onDateChange` callback + * and update the `date` prop in order for the component to update, otherwise + * the user's change will be reverted immediately to reflect `props.date` as the + * source of truth. + */ +export default class DatePickerIOS extends React.Component { + static DefaultProps = { + mode: 'datetime', + }; + + // $FlowFixMe How to type a native component to be able to call setNativeProps + _picker: ?React.ElementRef = null; + + componentDidUpdate() { + if (this.props.date) { + const propsTimeStamp = this.props.date.getTime(); + if (this._picker) { + this._picker.setNativeProps({ + date: propsTimeStamp, + }); + } + } + } + + _onChange = (event: Event) => { + const nativeTimeStamp = event.nativeEvent.timestamp; + this.props.onDateChange && + this.props.onDateChange(new Date(nativeTimeStamp)); + this.props.onChange && this.props.onChange(event); + }; + + render() { + const props = this.props; + invariant( + props.date || props.initialDate, + 'A selected date or initial date should be specified.', + ); + return ( + + { + this._picker = picker; + }} + style={styles.datePickerIOS} + date={ + props.date + ? props.date.getTime() + : props.initialDate + ? props.initialDate.getTime() + : undefined + } + locale={props.locale ? props.locale : undefined} + maximumDate={ + props.maximumDate ? props.maximumDate.getTime() : undefined + } + minimumDate={ + props.minimumDate ? props.minimumDate.getTime() : undefined + } + mode={props.mode} + minuteInterval={props.minuteInterval} + timeZoneOffsetInMinutes={props.timeZoneOffsetInMinutes} + onChange={this._onChange} + onStartShouldSetResponder={() => true} + onResponderTerminationRequest={() => false} + textColor={props.textColor} + /> + + ); + } +} + +const styles = StyleSheet.create({ + datePickerIOS: { + height: 216, + width: 310, + }, +}); diff --git a/example/ios/DatePickerExample.xcodeproj/project.pbxproj b/example/ios/DatePickerExample.xcodeproj/project.pbxproj index 86a4b8b..382dfa5 100644 --- a/example/ios/DatePickerExample.xcodeproj/project.pbxproj +++ b/example/ios/DatePickerExample.xcodeproj/project.pbxproj @@ -5,6 +5,7 @@ }; objectVersion = 46; objects = { + /* Begin PBXBuildFile section */ 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; @@ -21,24 +22,10 @@ 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; - 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; - 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; - 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; - 2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */; }; - 2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */; }; - 2D02E4C41E0B4AEC006451C7 /* libRCTLinking-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */; }; - 2D02E4C51E0B4AEC006451C7 /* libRCTNetwork-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */; }; - 2D02E4C61E0B4AEC006451C7 /* libRCTSettings-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */; }; - 2D02E4C71E0B4AEC006451C7 /* libRCTText-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */; }; - 2D02E4C81E0B4AEC006451C7 /* libRCTWebSocket-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */; }; - 2D16E6881FA4F8E400B85C8A /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D16E6891FA4F8E400B85C8A /* libReact.a */; }; - 2DCD954D1E0B4F2C00145EB5 /* DatePickerExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* DatePickerExampleTests.m */; }; - 2DF0FFEE2056DD460020B375 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3EA31DF850E9000B6D8A /* libReact.a */; }; + 19D8B17D0461408D86F34238 /* libDatePickerX.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0297D8D33D204EB6939D06AC /* libDatePickerX.a */; }; 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; }; 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; }; - 4ED899A4FB5F46C4A8D988BA /* libRNDeviceInfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B5CC7D0F452041D19A995B59 /* libRNDeviceInfo.a */; }; - D44511274A6E4E6AA7A4F570 /* libRNDeviceInfo-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 35AF2FBE48BB4F8C8793EC95 /* libRNDeviceInfo-tvOS.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -105,13 +92,6 @@ remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; remoteInfo = React; }; - 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 2D02E47A1E0B4A5D006451C7; - remoteInfo = "DatePickerExample-tvOS"; - }; 2D16E6711FA4F8DC00B85C8A /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */; @@ -280,6 +260,41 @@ remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4; remoteInfo = "jschelpers-tvOS"; }; + 5B5A668A2130BD1300599381 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BEE75557964943A593A20B4C /* DatePickerX.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = DA5891D81BA9A9FC002B4DB2; + remoteInfo = DatePickerX; + }; + 5BD54658212F465F005A1D38 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = ACBEF59FB76B4DA396910134 /* RNDeviceInfo.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = DA5891D81BA9A9FC002B4DB2; + remoteInfo = RNDeviceInfo; + }; + 5BD5465A212F465F005A1D38 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = ACBEF59FB76B4DA396910134 /* RNDeviceInfo.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = E72EC1401F7ABB5A0001BC90; + remoteInfo = "RNDeviceInfo-tvOS"; + }; + 5BD54669212F58B6005A1D38 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 5BD54664212F58B6005A1D38 /* DatePicker.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = DA5891D81BA9A9FC002B4DB2; + remoteInfo = DatePicker; + }; + 5BD5466B212F58B6005A1D38 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 5BD54664212F58B6005A1D38 /* DatePicker.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = E72EC1401F7ABB5A0001BC90; + remoteInfo = "DatePicker-tvOS"; + }; 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; @@ -327,6 +342,7 @@ 00E356EE1AD99517003FC87E /* DatePickerExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DatePickerExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 00E356F21AD99517003FC87E /* DatePickerExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DatePickerExampleTests.m; sourceTree = ""; }; + 0297D8D33D204EB6939D06AC /* libDatePickerX.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libDatePickerX.a; sourceTree = ""; }; 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; }; 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; }; 13B07F961A680F5B00A75B9A /* DatePickerExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DatePickerExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -337,16 +353,23 @@ 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = DatePickerExample/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = DatePickerExample/main.m; sourceTree = ""; }; 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; - 2D02E47B1E0B4A5D006451C7 /* DatePickerExample-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DatePickerExample-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 2D02E4901E0B4A5D006451C7 /* DatePickerExample-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "DatePickerExample-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 21BDF87D12ED4E5BA97C6E9D /* libDatePickerX-tvOS.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = "libDatePickerX-tvOS.a"; sourceTree = ""; }; 2D16E6891FA4F8E400B85C8A /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 35AF2FBE48BB4F8C8793EC95 /* libRNDeviceInfo-tvOS.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = "libRNDeviceInfo-tvOS.a"; sourceTree = ""; }; + 5BD54664212F58B6005A1D38 /* DatePicker.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = DatePicker.xcodeproj; path = ../node_modules/iosPicker/DatePicker.xcodeproj; sourceTree = ""; }; 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = ""; }; + 62D581CB2FE141BD93E3BDEC /* datepickerTests.xctest */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = wrapper.cfbundle; path = datepickerTests.xctest; sourceTree = ""; }; + 65F988A37E9A43C8B739257B /* datepicker.app */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = wrapper.application; path = datepicker.app; sourceTree = ""; }; + 750890A0CBC840CF8D69CDF6 /* datepicker-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = wrapper.cfbundle; path = "datepicker-tvOSTests.xctest"; sourceTree = ""; }; 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; + 82D6622A3FE241129BEFC1AB /* libDatePicker.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libDatePicker.a; sourceTree = ""; }; 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; + 96F289FB785A45A0AB87F2A6 /* libDatePicker-tvOS.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = "libDatePicker-tvOS.a"; sourceTree = ""; }; + ACBEF59FB76B4DA396910134 /* RNDeviceInfo.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNDeviceInfo.xcodeproj; path = "../node_modules/react-native-device-info/ios/RNDeviceInfo.xcodeproj"; sourceTree = ""; }; ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = ""; }; - ACBEF59FB76B4DA396910134 /* RNDeviceInfo.xcodeproj */ = {isa = PBXFileReference; name = "RNDeviceInfo.xcodeproj"; path = "../node_modules/react-native-device-info/ios/RNDeviceInfo.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; - B5CC7D0F452041D19A995B59 /* libRNDeviceInfo.a */ = {isa = PBXFileReference; name = "libRNDeviceInfo.a"; path = "libRNDeviceInfo.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; - 35AF2FBE48BB4F8C8793EC95 /* libRNDeviceInfo-tvOS.a */ = {isa = PBXFileReference; name = "libRNDeviceInfo-tvOS.a"; path = "libRNDeviceInfo-tvOS.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; + B5CC7D0F452041D19A995B59 /* libRNDeviceInfo.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNDeviceInfo.a; sourceTree = ""; }; + BEE75557964943A593A20B4C /* DatePickerX.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = DatePickerX.xcodeproj; path = "../node_modules/react-native-date-picker-x/ios/DatePickerX.xcodeproj"; sourceTree = ""; }; + BFBCDF28AC82400D8445D24D /* datepicker-tvOS.app */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = wrapper.application; path = "datepicker-tvOS.app"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -375,31 +398,7 @@ 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, - 4ED899A4FB5F46C4A8D988BA /* libRNDeviceInfo.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D02E4781E0B4A5D006451C7 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D16E6881FA4F8E400B85C8A /* libReact.a in Frameworks */, - 2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */, - 2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */, - 2D02E4C41E0B4AEC006451C7 /* libRCTLinking-tvOS.a in Frameworks */, - 2D02E4C51E0B4AEC006451C7 /* libRCTNetwork-tvOS.a in Frameworks */, - 2D02E4C61E0B4AEC006451C7 /* libRCTSettings-tvOS.a in Frameworks */, - 2D02E4C71E0B4AEC006451C7 /* libRCTText-tvOS.a in Frameworks */, - 2D02E4C81E0B4AEC006451C7 /* libRCTWebSocket-tvOS.a in Frameworks */, - D44511274A6E4E6AA7A4F570 /* libRNDeviceInfo-tvOS.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D02E48D1E0B4A5D006451C7 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 2DF0FFEE2056DD460020B375 /* libReact.a in Frameworks */, + 19D8B17D0461408D86F34238 /* libDatePickerX.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -525,11 +524,55 @@ 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { isa = PBXGroup; children = ( + 5BD54664212F58B6005A1D38 /* DatePicker.xcodeproj */, 2D16E6891FA4F8E400B85C8A /* libReact.a */, ); name = Frameworks; sourceTree = ""; }; + 5B5A66862130BD1300599381 /* Products */ = { + isa = PBXGroup; + children = ( + 5B5A668B2130BD1300599381 /* libDatePickerX.a */, + ); + name = Products; + sourceTree = ""; + }; + 5BD5462E212F465E005A1D38 /* Recovered References */ = { + isa = PBXGroup; + children = ( + B5CC7D0F452041D19A995B59 /* libRNDeviceInfo.a */, + 35AF2FBE48BB4F8C8793EC95 /* libRNDeviceInfo-tvOS.a */, + 65F988A37E9A43C8B739257B /* datepicker.app */, + 62D581CB2FE141BD93E3BDEC /* datepickerTests.xctest */, + BFBCDF28AC82400D8445D24D /* datepicker-tvOS.app */, + 750890A0CBC840CF8D69CDF6 /* datepicker-tvOSTests.xctest */, + 82D6622A3FE241129BEFC1AB /* libDatePicker.a */, + 96F289FB785A45A0AB87F2A6 /* libDatePicker-tvOS.a */, + 0297D8D33D204EB6939D06AC /* libDatePickerX.a */, + 21BDF87D12ED4E5BA97C6E9D /* libDatePickerX-tvOS.a */, + ); + name = "Recovered References"; + sourceTree = ""; + }; + 5BD54654212F465F005A1D38 /* Products */ = { + isa = PBXGroup; + children = ( + 5BD54659212F465F005A1D38 /* libRNDeviceInfo.a */, + 5BD5465B212F465F005A1D38 /* libRNDeviceInfo-tvOS.a */, + ); + name = Products; + sourceTree = ""; + }; + 5BD54665212F58B6005A1D38 /* Products */ = { + isa = PBXGroup; + children = ( + 5BD5466A212F58B6005A1D38 /* libDatePicker.a */, + 5BD5466C212F58B6005A1D38 /* libDatePicker-tvOS.a */, + ); + name = Products; + sourceTree = ""; + }; 5E91572E1DD0AC6500FF2AA8 /* Products */ = { isa = PBXGroup; children = ( @@ -564,6 +607,7 @@ 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, ACBEF59FB76B4DA396910134 /* RNDeviceInfo.xcodeproj */, + BEE75557964943A593A20B4C /* DatePickerX.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -585,6 +629,7 @@ 00E356EF1AD99517003FC87E /* DatePickerExampleTests */, 83CBBA001A601CBA00E9B192 /* Products */, 2D16E6871FA4F8E400B85C8A /* Frameworks */, + 5BD5462E212F465E005A1D38 /* Recovered References */, ); indentWidth = 2; sourceTree = ""; @@ -596,8 +641,6 @@ children = ( 13B07F961A680F5B00A75B9A /* DatePickerExample.app */, 00E356EE1AD99517003FC87E /* DatePickerExampleTests.xctest */, - 2D02E47B1E0B4A5D006451C7 /* DatePickerExample-tvOS.app */, - 2D02E4901E0B4A5D006451C7 /* DatePickerExample-tvOSTests.xctest */, ); name = Products; sourceTree = ""; @@ -650,42 +693,6 @@ productReference = 13B07F961A680F5B00A75B9A /* DatePickerExample.app */; productType = "com.apple.product-type.application"; }; - 2D02E47A1E0B4A5D006451C7 /* DatePickerExample-tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "DatePickerExample-tvOS" */; - buildPhases = ( - 2D02E4771E0B4A5D006451C7 /* Sources */, - 2D02E4781E0B4A5D006451C7 /* Frameworks */, - 2D02E4791E0B4A5D006451C7 /* Resources */, - 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "DatePickerExample-tvOS"; - productName = "DatePickerExample-tvOS"; - productReference = 2D02E47B1E0B4A5D006451C7 /* DatePickerExample-tvOS.app */; - productType = "com.apple.product-type.application"; - }; - 2D02E48F1E0B4A5D006451C7 /* DatePickerExample-tvOSTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "DatePickerExample-tvOSTests" */; - buildPhases = ( - 2D02E48C1E0B4A5D006451C7 /* Sources */, - 2D02E48D1E0B4A5D006451C7 /* Frameworks */, - 2D02E48E1E0B4A5D006451C7 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */, - ); - name = "DatePickerExample-tvOSTests"; - productName = "DatePickerExample-tvOSTests"; - productReference = 2D02E4901E0B4A5D006451C7 /* DatePickerExample-tvOSTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -699,14 +706,8 @@ CreatedOnToolsVersion = 6.2; TestTargetID = 13B07F861A680F5B00A75B9A; }; - 2D02E47A1E0B4A5D006451C7 = { - CreatedOnToolsVersion = 8.2.1; - ProvisioningStyle = Automatic; - }; - 2D02E48F1E0B4A5D006451C7 = { - CreatedOnToolsVersion = 8.2.1; - ProvisioningStyle = Automatic; - TestTargetID = 2D02E47A1E0B4A5D006451C7; + 13B07F861A680F5B00A75B9A = { + DevelopmentTeam = BJRNYA69VT; }; }; }; @@ -722,6 +723,14 @@ productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; projectDirPath = ""; projectReferences = ( + { + ProductGroup = 5BD54665212F58B6005A1D38 /* Products */; + ProjectRef = 5BD54664212F58B6005A1D38 /* DatePicker.xcodeproj */; + }, + { + ProductGroup = 5B5A66862130BD1300599381 /* Products */; + ProjectRef = BEE75557964943A593A20B4C /* DatePickerX.xcodeproj */; + }, { ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; @@ -770,13 +779,15 @@ ProductGroup = 146834001AC3E56700842450 /* Products */; ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; }, + { + ProductGroup = 5BD54654212F465F005A1D38 /* Products */; + ProjectRef = ACBEF59FB76B4DA396910134 /* RNDeviceInfo.xcodeproj */; + }, ); projectRoot = ""; targets = ( 13B07F861A680F5B00A75B9A /* DatePickerExample */, 00E356ED1AD99517003FC87E /* DatePickerExampleTests */, - 2D02E47A1E0B4A5D006451C7 /* DatePickerExample-tvOS */, - 2D02E48F1E0B4A5D006451C7 /* DatePickerExample-tvOSTests */, ); }; /* End PBXProject section */ @@ -1006,6 +1017,41 @@ remoteRef = 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 5B5A668B2130BD1300599381 /* libDatePickerX.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libDatePickerX.a; + remoteRef = 5B5A668A2130BD1300599381 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 5BD54659212F465F005A1D38 /* libRNDeviceInfo.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libRNDeviceInfo.a; + remoteRef = 5BD54658212F465F005A1D38 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 5BD5465B212F465F005A1D38 /* libRNDeviceInfo-tvOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libRNDeviceInfo-tvOS.a"; + remoteRef = 5BD5465A212F465F005A1D38 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 5BD5466A212F58B6005A1D38 /* libDatePicker.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libDatePicker.a; + remoteRef = 5BD54669212F58B6005A1D38 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 5BD5466C212F58B6005A1D38 /* libDatePicker-tvOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libDatePicker-tvOS.a"; + remoteRef = 5BD5466B212F58B6005A1D38 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -1060,21 +1106,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 2D02E4791E0B4A5D006451C7 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D02E48E1E0B4A5D006451C7 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -1092,20 +1123,6 @@ shellPath = /bin/sh; shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; }; - 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Bundle React Native Code And Images"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -1126,23 +1143,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 2D02E4771E0B4A5D006451C7 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */, - 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2D02E48C1E0B4A5D006451C7 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2DCD954D1E0B4F2C00145EB5 /* DatePickerExampleTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -1151,11 +1151,6 @@ target = 13B07F861A680F5B00A75B9A /* DatePickerExample */; targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; }; - 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 2D02E47A1E0B4A5D006451C7 /* DatePickerExample-tvOS */; - targetProxy = 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */; - }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -1179,24 +1174,35 @@ "DEBUG=1", "$(inherited)", ); + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo", + "$(SRCROOT)/../node_modules/react-native-datepicker/ios/datepicker", + "$(SRCROOT)/../node_modules/date-picker/ios/DatePicker", + "$(SRCROOT)/../node_modules/react-native-date-picker-x/ios/DatePickerX", + ); INFOPLIST_FILE = DatePickerExampleTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - OTHER_LDFLAGS = ( - "-ObjC", - "-lc++", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DatePickerExample.app/DatePickerExample"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo", + OTHER_LDFLAGS = ( + "-ObjC", + "-lc++", ); + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DatePickerExample.app/DatePickerExample"; }; name = Debug; }; @@ -1205,24 +1211,35 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; COPY_PHASE_STRIP = NO; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo", + "$(SRCROOT)/../node_modules/react-native-datepicker/ios/datepicker", + "$(SRCROOT)/../node_modules/date-picker/ios/DatePicker", + "$(SRCROOT)/../node_modules/react-native-date-picker-x/ios/DatePickerX", + ); INFOPLIST_FILE = DatePickerExampleTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - OTHER_LDFLAGS = ( - "-ObjC", - "-lc++", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DatePickerExample.app/DatePickerExample"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo", + OTHER_LDFLAGS = ( + "-ObjC", + "-lc++", ); + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DatePickerExample.app/DatePickerExample"; }; name = Release; }; @@ -1232,27 +1249,14 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CURRENT_PROJECT_VERSION = 1; DEAD_CODE_STRIPPING = NO; - INFOPLIST_FILE = DatePickerExample/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = ( - "$(inherited)", - "-ObjC", - "-lc++", - ); - PRODUCT_NAME = DatePickerExample; - VERSIONING_SYSTEM = "apple-generic"; + DEVELOPMENT_TEAM = BJRNYA69VT; HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo", + "$(SRCROOT)/../node_modules/react-native-datepicker/ios/datepicker", + "$(SRCROOT)/../node_modules/date-picker/ios/DatePicker", + "$(SRCROOT)/../node_modules/react-native-date-picker-x/ios/DatePickerX", ); - }; - name = Debug; - }; - 13B07F951A680F5B00A75B9A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 1; INFOPLIST_FILE = DatePickerExample/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_LDFLAGS = ( @@ -1262,148 +1266,31 @@ ); PRODUCT_NAME = DatePickerExample; VERSIONING_SYSTEM = "apple-generic"; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo", - ); - }; - name = Release; - }; - 2D02E4971E0B4A5E006451C7 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "DatePickerExample-tvOS/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = ( - "-ObjC", - "-lc++", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.DatePickerExample-tvOS"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 9.2; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - ); - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo", - ); }; name = Debug; }; - 2D02E4981E0B4A5E006451C7 /* Release */ = { + 13B07F951A680F5B00A75B9A /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "DatePickerExample-tvOS/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = ( - "-ObjC", - "-lc++", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.DatePickerExample-tvOS"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 9.2; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - ); + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = BJRNYA69VT; HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo", + "$(SRCROOT)/../node_modules/react-native-datepicker/ios/datepicker", + "$(SRCROOT)/../node_modules/date-picker/ios/DatePicker", + "$(SRCROOT)/../node_modules/react-native-date-picker-x/ios/DatePickerX", ); - }; - name = Release; - }; - 2D02E4991E0B4A5E006451C7 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "DatePickerExample-tvOSTests/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + INFOPLIST_FILE = DatePickerExample/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; OTHER_LDFLAGS = ( - "-ObjC", - "-lc++", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.DatePickerExample-tvOSTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DatePickerExample-tvOS.app/DatePickerExample-tvOS"; - TVOS_DEPLOYMENT_TARGET = 10.1; - LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - ); - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo", - ); - }; - name = Debug; - }; - 2D02E49A1E0B4A5E006451C7 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "DatePickerExample-tvOSTests/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - OTHER_LDFLAGS = ( "-ObjC", "-lc++", ); - PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.DatePickerExample-tvOSTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DatePickerExample-tvOS.app/DatePickerExample-tvOS"; - TVOS_DEPLOYMENT_TARGET = 10.1; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - "\"$(SRCROOT)/$(TARGET_NAME)\"", - ); - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "$(SRCROOT)/../node_modules/react-native-device-info/ios/RNDeviceInfo", - ); + PRODUCT_NAME = DatePickerExample; + VERSIONING_SYSTEM = "apple-generic"; }; name = Release; }; @@ -1504,24 +1391,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "DatePickerExample-tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D02E4971E0B4A5E006451C7 /* Debug */, - 2D02E4981E0B4A5E006451C7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "DatePickerExample-tvOSTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2D02E4991E0B4A5E006451C7 /* Debug */, - 2D02E49A1E0B4A5E006451C7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "DatePickerExample" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/example/ios/DatePickerExample.xcodeproj/xcshareddata/xcschemes/DatePickerExample.xcscheme b/example/ios/DatePickerExample.xcodeproj/xcshareddata/xcschemes/DatePickerExample.xcscheme index 2b28f70..45f3eee 100644 --- a/example/ios/DatePickerExample.xcodeproj/xcshareddata/xcschemes/DatePickerExample.xcscheme +++ b/example/ios/DatePickerExample.xcodeproj/xcshareddata/xcschemes/DatePickerExample.xcscheme @@ -54,6 +54,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" shouldUseLaunchSchemeArgsEnv = "YES"> this.props.onDateChange(new Date(parseInt(e.nativeEvent.date))); - _maximumDate = () => this.props.maximumDate && this.props.maximumDate.getTime(); - _minimumDate = () => this.props.minimumDate && this.props.minimumDate.getTime(); - render = () => ( - - ) -} - -class DatePickerIOSWithSize extends React.Component { - render = () => -} - - -const styles = StyleSheet.create({ - picker: { - width: 310, - height: 180, - } -}) - -export default ios ? DatePickerIOSWithSize : DatePickerAndroid; +export default Platform.OS === 'ios' ? DatePickerIOS : DatePickerAndroid diff --git a/ios/DatePickerX.xcodeproj/project.pbxproj b/ios/DatePickerX.xcodeproj/project.pbxproj new file mode 100644 index 0000000..cd1d34b --- /dev/null +++ b/ios/DatePickerX.xcodeproj/project.pbxproj @@ -0,0 +1,276 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 5B5A664D2130B82E00599381 /* DatePickerXManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B5A664B2130B82D00599381 /* DatePickerXManager.m */; }; + DA5891DC1BA9A9FC002B4DB2 /* DatePicker.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DA5891DB1BA9A9FC002B4DB2 /* DatePicker.h */; }; + DA5891DE1BA9A9FC002B4DB2 /* DatePicker.m in Sources */ = {isa = PBXBuildFile; fileRef = DA5891DD1BA9A9FC002B4DB2 /* DatePicker.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + DA5891D61BA9A9FC002B4DB2 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + DA5891DC1BA9A9FC002B4DB2 /* DatePicker.h in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 5B5A664B2130B82D00599381 /* DatePickerXManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DatePickerXManager.m; sourceTree = ""; }; + 5B5A664C2130B82E00599381 /* DatePickerXManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatePickerXManager.h; sourceTree = ""; }; + DA5891D81BA9A9FC002B4DB2 /* libDatePickerX.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libDatePickerX.a; sourceTree = BUILT_PRODUCTS_DIR; }; + DA5891DB1BA9A9FC002B4DB2 /* DatePicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DatePicker.h; sourceTree = ""; }; + DA5891DD1BA9A9FC002B4DB2 /* DatePicker.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DatePicker.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + DA5891D51BA9A9FC002B4DB2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + DA5891CF1BA9A9FC002B4DB2 = { + isa = PBXGroup; + children = ( + DA5891DA1BA9A9FC002B4DB2 /* DatePickerX */, + DA5891D91BA9A9FC002B4DB2 /* Products */, + ); + sourceTree = ""; + }; + DA5891D91BA9A9FC002B4DB2 /* Products */ = { + isa = PBXGroup; + children = ( + DA5891D81BA9A9FC002B4DB2 /* libDatePickerX.a */, + ); + name = Products; + sourceTree = ""; + }; + DA5891DA1BA9A9FC002B4DB2 /* DatePickerX */ = { + isa = PBXGroup; + children = ( + 5B5A664C2130B82E00599381 /* DatePickerXManager.h */, + 5B5A664B2130B82D00599381 /* DatePickerXManager.m */, + DA5891DB1BA9A9FC002B4DB2 /* DatePicker.h */, + DA5891DD1BA9A9FC002B4DB2 /* DatePicker.m */, + ); + path = DatePickerX; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + DA5891D71BA9A9FC002B4DB2 /* DatePickerX */ = { + isa = PBXNativeTarget; + buildConfigurationList = DA5891E11BA9A9FC002B4DB2 /* Build configuration list for PBXNativeTarget "DatePickerX" */; + buildPhases = ( + DA5891D41BA9A9FC002B4DB2 /* Sources */, + DA5891D51BA9A9FC002B4DB2 /* Frameworks */, + DA5891D61BA9A9FC002B4DB2 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = DatePickerX; + productName = RNDeviceInfo; + productReference = DA5891D81BA9A9FC002B4DB2 /* libDatePickerX.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + DA5891D01BA9A9FC002B4DB2 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0700; + ORGANIZATIONNAME = Learnium; + TargetAttributes = { + DA5891D71BA9A9FC002B4DB2 = { + CreatedOnToolsVersion = 7.0; + }; + }; + }; + buildConfigurationList = DA5891D31BA9A9FC002B4DB2 /* Build configuration list for PBXProject "DatePickerX" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = DA5891CF1BA9A9FC002B4DB2; + productRefGroup = DA5891D91BA9A9FC002B4DB2 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + DA5891D71BA9A9FC002B4DB2 /* DatePickerX */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + DA5891D41BA9A9FC002B4DB2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DA5891DE1BA9A9FC002B4DB2 /* DatePicker.m in Sources */, + 5B5A664D2130B82E00599381 /* DatePickerXManager.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + DA5891DF1BA9A9FC002B4DB2 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + DA5891E01BA9A9FC002B4DB2 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + DA5891E21BA9A9FC002B4DB2 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(BUILT_PRODUCTS_DIR)/usr/local/include", + "$(SRCROOT)/../../React/**", + "$(SRCROOT)/node_modules/react-native/React/**", + "$(SRCROOT)/../react-native/React/**", + "$(SRCROOT)/../../../node_modules/react-native/React/**", + ); + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + DA5891E31BA9A9FC002B4DB2 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(BUILT_PRODUCTS_DIR)/usr/local/include", + "$(SRCROOT)/../../React/**", + "$(SRCROOT)/node_modules/react-native/React/**", + "$(SRCROOT)/../react-native/React/**", + "$(SRCROOT)/../../../node_modules/react-native/React/**", + ); + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + DA5891D31BA9A9FC002B4DB2 /* Build configuration list for PBXProject "DatePickerX" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DA5891DF1BA9A9FC002B4DB2 /* Debug */, + DA5891E01BA9A9FC002B4DB2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + DA5891E11BA9A9FC002B4DB2 /* Build configuration list for PBXNativeTarget "DatePickerX" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DA5891E21BA9A9FC002B4DB2 /* Debug */, + DA5891E31BA9A9FC002B4DB2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = DA5891D01BA9A9FC002B4DB2 /* Project object */; +} diff --git a/ios/DatePickerX.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/DatePickerX.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..9664117 --- /dev/null +++ b/ios/DatePickerX.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ios/DatePickerX/DatePicker.h b/ios/DatePickerX/DatePicker.h new file mode 100644 index 0000000..94c11f4 --- /dev/null +++ b/ios/DatePickerX/DatePicker.h @@ -0,0 +1,15 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +@interface DatePicker : UIDatePicker + +- (void)setTextColorProp:(NSString *)hexColor; + +@end + diff --git a/ios/DatePickerX/DatePicker.m b/ios/DatePickerX/DatePicker.m new file mode 100644 index 0000000..96816ca --- /dev/null +++ b/ios/DatePickerX/DatePicker.m @@ -0,0 +1,103 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "DatePicker.h" + +#import "RCTUtils.h" +#import "UIView+React.h" + +@interface DatePicker () + +@property (nonatomic, copy) RCTBubblingEventBlock onChange; + +@end + +@implementation DatePicker + + +#define UIColorFromRGB(rgbHex) [UIColor colorWithRed:((float)((rgbHex & 0xFF0000) >> 16))/255.0 green:((float)((rgbHex & 0xFF00) >> 8))/255.0 blue:((float)(rgbHex & 0xFF))/255.0 alpha:1.0] + + +- (UIColor *) colorFromHexCode:(NSString *)hexString { + NSString *cleanString = [hexString stringByReplacingOccurrencesOfString:@"#" withString:@""]; + if([cleanString length] == 3) { + cleanString = [NSString stringWithFormat:@"%@%@%@%@%@%@", + [cleanString substringWithRange:NSMakeRange(0, 1)],[cleanString substringWithRange:NSMakeRange(0, 1)], + [cleanString substringWithRange:NSMakeRange(1, 1)],[cleanString substringWithRange:NSMakeRange(1, 1)], + [cleanString substringWithRange:NSMakeRange(2, 1)],[cleanString substringWithRange:NSMakeRange(2, 1)]]; + } + if([cleanString length] == 6) { + cleanString = [cleanString stringByAppendingString:@"ff"]; + } + + unsigned int baseValue; + [[NSScanner scannerWithString:cleanString] scanHexInt:&baseValue]; + + float red = ((baseValue >> 24) & 0xFF)/255.0f; + float green = ((baseValue >> 16) & 0xFF)/255.0f; + float blue = ((baseValue >> 8) & 0xFF)/255.0f; + float alpha = ((baseValue >> 0) & 0xFF)/255.0f; + + return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; +} + +- (instancetype)initWithFrame:(CGRect)frame +{ + if ((self = [super initWithFrame:frame])) { + [self addTarget:self action:@selector(didChange) + forControlEvents:UIControlEventValueChanged]; + } + + + unsigned result = 0; + NSScanner *scanner = [NSScanner scannerWithString:@"#0000ff"]; + + [scanner setScanLocation:1]; // bypass '#' character + [scanner scanHexInt:&result]; + + + [self setValue:UIColorFromRGB(result) forKeyPath:@"textColor"]; + SEL selector = NSSelectorFromString(@"setHighlightsToday:"); + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDatePicker instanceMethodSignatureForSelector:selector]]; + BOOL no = NO; + [invocation setSelector:selector]; + [invocation setArgument:&no atIndex:2]; + [invocation invokeWithTarget:self]; + + return self; +} + +- (void)setTextColorProp:(NSString *)hexColor +{ + // Hex to int color + unsigned intColor = 0; + NSScanner *scanner = [NSScanner scannerWithString:hexColor]; + [scanner setScanLocation:1]; // bypass '#' character + [scanner scanHexInt:&intColor]; + + // Setting picker text color + [self setValue:UIColorFromRGB(intColor) forKeyPath:@"textColor"]; + SEL selector = NSSelectorFromString(@"setHighlightsToday:"); + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDatePicker instanceMethodSignatureForSelector:selector]]; + BOOL no = NO; + [invocation setSelector:selector]; + [invocation setArgument:&no atIndex:2]; + [invocation invokeWithTarget:self]; +} + + +RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) + +- (void)didChange +{ + if (_onChange) { + _onChange(@{ @"timestamp": @(self.date.timeIntervalSince1970 * 1000.0) }); + } +} + +@end + diff --git a/ios/DatePickerX/DatePickerXManager.h b/ios/DatePickerX/DatePickerXManager.h new file mode 100644 index 0000000..c8d1533 --- /dev/null +++ b/ios/DatePickerX/DatePickerXManager.h @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import +#import + +@interface RCTConvert(UIDatePicker) + ++ (UIDatePickerMode)UIDatePickerMode:(id)json; + +@end + +@interface DatePickerXManager : RCTViewManager + +@end diff --git a/ios/DatePickerX/DatePickerXManager.m b/ios/DatePickerX/DatePickerXManager.m new file mode 100644 index 0000000..8d61660 --- /dev/null +++ b/ios/DatePickerX/DatePickerXManager.m @@ -0,0 +1,49 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "DatePickerXManager.h" + + +#import "DatePicker.h" +#import "UIView+React.h" + +@implementation RCTConvert(UIDatePicker) + +RCT_ENUM_CONVERTER(UIDatePickerMode, (@{ + @"time": @(UIDatePickerModeTime), + @"date": @(UIDatePickerModeDate), + @"datetime": @(UIDatePickerModeDateAndTime), + @"countdown": @(UIDatePickerModeCountDownTimer), // not supported yet +}), UIDatePickerModeTime, integerValue) + +@end + +@implementation DatePickerXManager + +RCT_EXPORT_MODULE() + +- (UIView *)view +{ + return [DatePicker new]; +} + +RCT_EXPORT_VIEW_PROPERTY(date, NSDate) +RCT_EXPORT_VIEW_PROPERTY(locale, NSLocale) +RCT_EXPORT_VIEW_PROPERTY(minimumDate, NSDate) +RCT_EXPORT_VIEW_PROPERTY(maximumDate, NSDate) +RCT_EXPORT_VIEW_PROPERTY(minuteInterval, NSInteger) +RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock) +RCT_REMAP_VIEW_PROPERTY(mode, datePickerMode, UIDatePickerMode) +RCT_REMAP_VIEW_PROPERTY(timeZoneOffsetInMinutes, timeZone, NSTimeZone) + + +RCT_CUSTOM_VIEW_PROPERTY(textColor, NSString, DatePicker) +{ + [view setTextColorProp:[RCTConvert NSString:json]]; +} + +@end