react-native-date-picker
Advanced tools
Comparing version 3.0.3 to 3.1.0
{ | ||
"name": "react-native-date-picker", | ||
"version": "3.0.3", | ||
"version": "3.1.0", | ||
"description": "A Cross Platform React Native Picker", | ||
"main": "src/index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "jest src" | ||
}, | ||
@@ -13,5 +13,2 @@ "repository": { | ||
}, | ||
"dependencies": { | ||
"moment": "^2.22.1" | ||
}, | ||
"author": "henninghall", | ||
@@ -24,10 +21,20 @@ "license": "MIT", | ||
"date picker", | ||
"datepicker", | ||
"react native", | ||
"react native date picker", | ||
"react native datepicker", | ||
"react native datetimepicker", | ||
"react native date time picker", | ||
"react-native", | ||
"react-native-date-picker" | ||
], | ||
"dependencies": { | ||
"moment": "^2.22.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/preset-env": "^7.10.4", | ||
"babel-jest": "^26.1.0", | ||
"jest": "^26.1.0", | ||
"prettier": "^1.18.2" | ||
} | ||
} |
@@ -76,3 +76,5 @@ # React Native Date Picker [![npm](https://img.shields.io/npm/v/react-native-date-picker.svg)](https://www.npmjs.com/package/react-native-date-picker) [![Build status](https://img.shields.io/github/workflow/status/henninghall/react-native-date-picker/Android:%20build%20&%20test?label=tests)](https://github.com/henninghall/react-native-date-picker/actions) [![npm](https://img.shields.io/npm/dm/react-native-date-picker.svg)](https://www.npmjs.com/package/react-native-date-picker) | ||
| timeZoneOffsetInMinutes | Timezone offset in minutes (default: device's timezone) | | ||
| dividerHeight | Change the divider height (only supported for iosClone) | | ||
## About | ||
@@ -79,0 +81,0 @@ |
import React from 'react' | ||
import { StyleSheet, requireNativeComponent } from 'react-native' | ||
import moment from 'moment' | ||
import { throwIfInvalidProps } from './propChecker' | ||
@@ -14,3 +13,2 @@ const NativeDatePicker = requireNativeComponent( | ||
render() { | ||
if (__DEV__) throwIfInvalidProps(this.props) | ||
return ( | ||
@@ -17,0 +15,0 @@ <NativeDatePicker |
import React from 'react' | ||
import { StyleSheet, View, requireNativeComponent } from 'react-native' | ||
import { throwIfInvalidProps } from './propChecker' | ||
@@ -28,8 +27,7 @@ const RCTDatePickerIOS = requireNativeComponent('RNDatePicker') | ||
render() { | ||
const props = this.props | ||
if (__DEV__) throwIfInvalidProps(props) | ||
const { props } = this | ||
return ( | ||
<RCTDatePickerIOS | ||
testID={this.props.testID} | ||
key={this.props.textColor} // preventing "Today" string keep old text color when text color changes | ||
testID={props.testID} | ||
key={props.textColor} // preventing "Today" string keep old text color when text color changes | ||
ref={picker => { | ||
@@ -36,0 +34,0 @@ this._picker = picker |
@@ -35,6 +35,6 @@ import { Component } from 'react' | ||
/** | ||
* The Android style variant. | ||
* The Android style variant. | ||
*/ | ||
androidVariant?: 'iosClone' | 'nativeAndroid' | ||
/** | ||
@@ -72,4 +72,9 @@ * The date picker mode. | ||
textColor?: string | ||
/** | ||
* Changes the divider height of the android variant iosClone | ||
*/ | ||
dividerHeight?: number | ||
} | ||
export default class DatePicker extends Component<DatePickerProps> {} |
@@ -0,1 +1,2 @@ | ||
import React from 'react' | ||
import { Platform } from 'react-native' | ||
@@ -6,2 +7,4 @@ import DatePickerIOS from './DatePickerIOS' | ||
import defaultProps from './defaultProps' | ||
import { colorToHex } from './colorToHex' | ||
import { throwIfInvalidProps } from './propChecker' | ||
@@ -16,2 +19,15 @@ const DatePicker = Platform.select({ | ||
export default DatePicker | ||
const DatePickerWrapper = props => { | ||
const { textColor, fadeToColor, innerRef, ...rest } = props | ||
if (__DEV__) throwIfInvalidProps(props) | ||
return ( | ||
<DatePicker | ||
ref={innerRef} | ||
textColor={colorToHex(textColor)} | ||
fadeToColor={colorToHex(fadeToColor)} | ||
{...rest} | ||
/> | ||
) | ||
} | ||
export default React.memo(DatePickerWrapper) |
@@ -43,9 +43,2 @@ export function throwIfInvalidProps(props) { | ||
const colorCheck = new PropCheck( | ||
props => | ||
props && props.textColor && !props.textColor.startsWith("#"), | ||
"Invalid text color. Must be a hex string." | ||
) | ||
const checks = [widthCheck, heightCheck, modeCheck, colorCheck] | ||
const checks = [widthCheck, heightCheck, modeCheck] |
@@ -7,2 +7,3 @@ import { Platform, ViewPropTypes } from 'react-native' | ||
androidVariant: PropTypes.oneOf(['iosClone', 'nativeAndroid']), | ||
dividerHeight: PropTypes.number, | ||
} | ||
@@ -9,0 +10,0 @@ |
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
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
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
150232
88
492
0
214
4