Skip to content

Commit

Permalink
Merge pull request #97 from kshestakov/feature/custom_styles
Browse files Browse the repository at this point in the history
Feature/custom styles
  • Loading branch information
mmazzarolo authored Oct 17, 2017
2 parents 0d40c07 + 142cf25 commit bbd95df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ export default class DateTimePickerTester extends Component {
| Name | Type| Default | Description |
| --- | --- | --- | --- |
| cancelTextIOS | string | 'Cancel' | The text on the cancel button on iOS |
| cancelTextStyle | style | | The style of the cancel button text on iOS |
| confirmTextIOS | string | 'Confirm' | The text on the confirm button on iOS |
| confirmTextStyle | style | | The style of the confirm button text on iOS |
| customCancelButtonIOS | node | | A custom component for the cancel button on iOS |
| customConfirmButtonIOS | node | | A custom component for the confirm button on iOS |
| customTitleContainerIOS | node | | A custom component for the title container on iOS |
Expand All @@ -80,6 +82,7 @@ export default class DateTimePickerTester extends Component {
| onHideAfterConfirm | func | () => {} | Called after the hiding animation if a date was picked |
| onCancel | func | **REQUIRED** | Function called on dismiss |
| titleIOS | string | 'Pick a date' | The title text on iOS |
| titleStyle | style | | The style of the title text on iOS |
| minimumDate | Date | undefined | Min Date. Does not work with 'time' picker on Android. |
| maximumDate | Date | undefined | Max Date. Does not work with 'time' picker on Android. |
| is24Hour | bool | true | If false, the picker shows an AM/PM chooser on Android |
Expand Down
12 changes: 9 additions & 3 deletions src/CustomDatePickerIOS/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export default class CustomDatePickerIOS extends Component {
titleIOS: PropTypes.string,
isVisible: PropTypes.bool,
reactNativeModalPropsIOS: PropTypes.any,
titleStyle: PropTypes.any,
confirmTextStyle: PropTypes.any,
cancelTextStyle: PropTypes.any,
};

static defaultProps = {
Expand Down Expand Up @@ -94,12 +97,15 @@ export default class CustomDatePickerIOS extends Component {
datePickerContainerStyleIOS,
reactNativeModalPropsIOS,
date,
titleStyle,
confirmTextStyle,
cancelTextStyle,
...otherProps
} = this.props;

const titleContainer = (
<View style={styles.titleContainer}>
<Text style={styles.title}>{titleIOS}</Text>
<Text style={[styles.title, titleStyle]}>{titleIOS}</Text>
</View>
);
let confirmButton;
Expand All @@ -119,9 +125,9 @@ export default class CustomDatePickerIOS extends Component {
confirmButton = customConfirmButtonIOS;
}
} else {
confirmButton = <Text style={styles.confirmText}>{confirmTextIOS}</Text>;
confirmButton = <Text style={[styles.confirmText, confirmTextStyle]}>{confirmTextIOS}</Text>;
}
const cancelButton = <Text style={styles.cancelText}>{cancelTextIOS}</Text>;
const cancelButton = <Text style={[styles.cancelText, cancelTextStyle]}>{cancelTextIOS}</Text>;
return (
<ReactNativeModal
isVisible={isVisible}
Expand Down

0 comments on commit bbd95df

Please sign in to comment.