react-native-date-picker
Advanced tools
Comparing version 4.0.0 to 4.1.0
{ | ||
"name": "react-native-date-picker", | ||
"version": "4.0.0", | ||
"description": "A datetime picker for React Native. In-modal or stand-alone. Supports Android and iOS.", | ||
"version": "4.1.0", | ||
"description": "A datetime picker for React Native. In-modal or inlined. Supports Android and iOS.", | ||
"main": "src/index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -20,5 +20,5 @@ # React Native Date Picker | ||
## Stand-alone | ||
## Inlined | ||
The second option is to use the picker stand-alone. Inlined in a view or a custom made modal. | ||
The second option is to use the inlined picker. For instance in a view or a custom made modal. | ||
@@ -25,0 +25,0 @@ <table> |
import React from 'react' | ||
import { | ||
StyleSheet, | ||
requireNativeComponent, | ||
NativeModules, | ||
NativeEventEmitter, | ||
} from 'react-native' | ||
import { requireNativeComponent, NativeModules } from 'react-native' | ||
@@ -24,23 +19,2 @@ function addMinutes(date, minutesToAdd) { | ||
class DatePickerAndroid extends React.PureComponent { | ||
componentDidMount() { | ||
const { onConfirm, onCancel } = this.props | ||
const eventEmitter = new NativeEventEmitter(NativeModules.RNDatePicker) | ||
this.confirmListener = eventEmitter.addListener( | ||
'onConfirm', | ||
({ date: isoDate }) => { | ||
if (onConfirm) { | ||
onConfirm(this._fromIsoWithTimeZoneOffset(isoDate)) | ||
} | ||
} | ||
) | ||
this.cancelListener = eventEmitter.addListener('onCancel', () => { | ||
if (onCancel) onCancel() | ||
}) | ||
} | ||
componentWillUnmount() { | ||
this.confirmListener.remove() | ||
this.cancelListener.remove() | ||
} | ||
render() { | ||
@@ -50,3 +24,7 @@ const props = this.getProps() | ||
if (props.open) { | ||
NativeModules.RNDatePicker.openPicker(props) | ||
NativeModules.RNDatePicker.openPicker( | ||
props, | ||
this._onConfirm, | ||
this.props.onCancel | ||
) | ||
} | ||
@@ -103,4 +81,8 @@ return null | ||
} | ||
_onConfirm = (isoDate) => { | ||
this.props.onConfirm(this._fromIsoWithTimeZoneOffset(isoDate)) | ||
} | ||
} | ||
export default DatePickerAndroid |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
177854
576