react-native-date-picker
Advanced tools
Comparing version 4.0.0-1 to 4.0.0-2
@@ -82,4 +82,25 @@ import { Component } from 'react' | ||
is24hourSource?: 'locale' | 'device' | ||
/** Enables the built-in modal */ | ||
modal?: boolean | ||
/** Modal prop only. Set to true to open the modal */ | ||
open?: boolean | ||
/** Modal callback invoked when the user presses the confirm button */ | ||
onConfirm?: (date: Date) => void | ||
/** Modal callback invoked when user presses the cancel button or closes the modal by a press outside */ | ||
onCancel?: () => void | ||
/** Modal confirm button text */ | ||
confirmText?: string | ||
/** Modal cancel button text */ | ||
cancelText?: string | ||
/** Modal title. Set to null to remove */ | ||
title?: string | null | ||
} | ||
export default class DatePicker extends Component<DatePickerProps> {} |
{ | ||
"name": "react-native-date-picker", | ||
"version": "4.0.0-1", | ||
"version": "4.0.0-2", | ||
"description": "A datetime picker for React Native. As modal or stand alone. Supports Android and iOS.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -53,2 +53,3 @@ import React from 'react' | ||
cancelText: this.props.cancelText ?? 'Cancel', | ||
androidVariant: this.props.androidVariant ?? 'nativeAndroid', | ||
}) | ||
@@ -55,0 +56,0 @@ } |
@@ -6,3 +6,2 @@ import React from 'react' | ||
import propTypes from './propTypes' | ||
import defaultProps from './defaultProps' | ||
import { colorToHex } from './colorToHex' | ||
@@ -16,24 +15,20 @@ import { throwIfInvalidProps } from './propChecker' | ||
DatePicker.defaultProps = defaultProps | ||
DatePicker.propTypes = propTypes | ||
const DatePickerWrapper = (props) => { | ||
const { | ||
textColor, | ||
fadeToColor, | ||
confirmText = 'Confirm', | ||
cancelText = 'Cancel', | ||
innerRef, | ||
...rest | ||
} = props | ||
if (__DEV__) throwIfInvalidProps(props) | ||
return ( | ||
<DatePicker | ||
ref={innerRef} | ||
textColor={colorToHex(textColor)} | ||
fadeToColor={colorToHex(fadeToColor)} | ||
ref={props.innerRef} | ||
{...props} | ||
textColor={colorToHex(props.textColor)} | ||
fadeToColor={colorToHex(props.fadeToColor)} | ||
title={getTitle(props)} | ||
confirmText={confirmText} | ||
cancelText={cancelText} | ||
{...rest} | ||
confirmText={props.confirmText ?? 'Confirm'} | ||
cancelText={props.cancelText ?? 'Cancel'} | ||
androidVariant={ | ||
props.androidVariant ?? props.modal ? 'nativeAndroid' : 'iosClone' | ||
} | ||
minuteInterval={props.minuteInterval ?? 1} | ||
mode={props.mode ?? 'datetime'} | ||
/> | ||
@@ -40,0 +35,0 @@ ) |
import { Platform, ViewPropTypes } from 'react-native' | ||
import PropTypes from 'prop-types' | ||
const androidProptypes = { | ||
const androidPropTypes = { | ||
fadeToColor: PropTypes.string, | ||
@@ -11,6 +11,16 @@ androidVariant: PropTypes.oneOf(['iosClone', 'nativeAndroid']), | ||
const modalPropTypes = { | ||
modal: PropTypes.bool, | ||
open: PropTypes.bool, | ||
onConfirm: PropTypes.func, | ||
onCancel: PropTypes.func, | ||
confirmText: PropTypes.string, | ||
cancelText: PropTypes.string, | ||
title: PropTypes.string, | ||
} | ||
const DateType = PropTypes.instanceOf(Date) | ||
export default { | ||
...(Platform === 'android' ? androidProptypes : {}), | ||
...(Platform === 'android' ? androidPropTypes : {}), | ||
date: DateType.isRequired, | ||
@@ -27,2 +37,3 @@ onChange: PropTypes.func, | ||
style: ViewPropTypes.style, | ||
...modalPropTypes, | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1260423
645
230