Skip to content

Commit

Permalink
Merge pull request #7 from avid21/master
Browse files Browse the repository at this point in the history
Use ViewPropTypes (with fallback) inside datepicker and improve falsy label props (Thanks to @Avid21)
  • Loading branch information
pinguinjkeke authored Nov 24, 2017
2 parents d017232 + fbcd730 commit ec105da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/date-picker.android.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React, { PureComponent } from 'react';
import { ColorPropType, StyleSheet, View } from 'react-native';
import { ColorPropType, StyleSheet, View, ViewPropTypes as RNViewPropTypes } from 'react-native';
import PropTypes from 'prop-types';
import moment from 'moment';
import Picker from './picker';

const ViewPropTypes = RNViewPropTypes || View.propTypes;

const styles = StyleSheet.create({
picker: {
flex: 1,
Expand Down Expand Up @@ -31,7 +33,7 @@ export default class DatePicker extends PureComponent {
minimumDate: PropTypes.instanceOf(Date),
mode: PropTypes.oneOf(['date', 'time', 'datetime']),
onDateChange: PropTypes.func.isRequired,
style: View.propTypes.style,
style: ViewPropTypes.style,
textColor: ColorPropType,
textSize: PropTypes.number,
itemSpace: PropTypes.number,
Expand Down
2 changes: 1 addition & 1 deletion src/picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default class Picker extends Component {
<PickerItem
key={index}
value={typeof data.value !== 'undefined' ? data.value : data}
label={data.label || data.toString()}
label={typeof data.label !== 'undefined' ? data.label : data.toString()}
/>
))}
</WheelCurvedPicker>
Expand Down

0 comments on commit ec105da

Please sign in to comment.