Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 40 additions & 41 deletions CalendarPicker/Controls.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
import React from 'react';
import {
View,
TouchableOpacity,
Text,
} from 'react-native';
import PropTypes from 'prop-types';

export default function Controls(props) {
const {
styles,
textStyles,
label,
component,
onPressControl,
disabled,
} = props;

return (
<TouchableOpacity
onPress={() => onPressControl()}
style={styles}
disabled={disabled}
hitSlop={{ top: 20, bottom: 20, left: 40, right: 40 }}
>
<View style={{opacity: disabled ? 0 : 1}}>
{ component ||
<Text style={[textStyles]}>
{ label }
</Text>
}
</View>
</TouchableOpacity>
);
}

Controls.propTypes = {
styles: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
label: PropTypes.string,
onPressControl: PropTypes.func.isRequired,
};
import React from 'react';
import {
TouchableOpacity,
Text,
} from 'react-native';
import PropTypes from 'prop-types';

export default function Controls(props) {
const {
styles,
textStyles,
label,
component,
onPressControl,
disabled,
} = props;

return (
<TouchableOpacity
onPress={() => onPressControl()}
style={styles}
disabled={disabled}
hitSlop={{ top: 20, bottom: 20, left: 40, right: 40 }}
>
{ component ?
( disabled ? null : component )
:
<Text style={[textStyles]}>
{ disabled ? null : label }
</Text>
}
</TouchableOpacity>
);
}

Controls.propTypes = {
styles: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
label: PropTypes.string,
onPressControl: PropTypes.func.isRequired,
};
Loading