Skip to content

refactor: use not so generic names #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 27, 2019
Merged
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
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ Internally `DatePickerField` and `TimePickerField` call `DateTimePicker`'s `pick

| Property | Description |
| --- | --- |
| `date` | The date the picker field is currently displaying. |
| `minDate` | The minimum date the picker field can select. |
| `maxDate` | The maximum date the picker field can select. |
| `date` | The date the picker field is currently displaying. Property is of type `Date`. When used in markup, the provided string will be passed to the [Date constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) to create a new `Date` object. |
| `minDate` | The minimum date the picker field can select. Parsing of dates is handled similarly as with `date` property. |
| `maxDate` | The maximum date the picker field can select. Parsing of dates is handled similarly as with `date` property. |
| `locale` | Identifier of a locale that will be used to localize the names of the month names and also the order of the spinners (with `en_GB` first spinner is day, with `en_US` first spinner is month) (default is based on the device’s locale settings). |
| `dateFormat` | Format used for the text in the picker field (on android used as a pattern for a [SimpleDateFormat](https://developer.android.com/reference/java/text/SimpleDateFormat), on iOS used as a dateFormat for [NSDateFormatter](https://developer.apple.com/documentation/foundation/nsdateformatter), default is generated by the current value of the `locale` property). |
| `pickerDefaultDate` | The date that will be displayed in the picker, if it is opened while date is undefined (if `pickerDefaultDate` is undefined, the picker will display today) |
| `pickerDefaultDate` | The date that will be displayed in the picker, if it is opened while date is undefined (if `pickerDefaultDate` is undefined, the picker will display today). Parsing of dates is handled similarly as with `date` property. |
| `pickerTitle` | Text that will be displayed as title of the picker, default is undefined. |
| `pickerOkText` | Text for the confirmation button of the picker (default is OK on iOS, localized version of OK on android (based on the devices locale settings)). |
| `pickerCancelText` | Text for the cancel button of the picker (default is Cancel on iOS, localized version of Cancel on android (based on the devices locale settings)). |
Expand All @@ -179,10 +179,10 @@ Internally `DatePickerField` and `TimePickerField` call `DateTimePicker`'s `pick

| Property | Description |
| --- | --- |
| `time` | The time the picker field is currently displaying. |
| `time` | The time the picker field is currently displaying. Property is of type `Date`. When used in markup, the provided string will be parsed to a new `Date` object if it is in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Times) format. |
| `locale` | Identifier of a locale that will be used to create locale-specific time formatter of the time (if the format is 12-Hour, with de_DE locale “vorm.”/”nachm.” will be used to show whether time is before/after noon, with en_US locale “am”/”pm” will be used) (default is based on the device’s locale settings). The locale will also be used on iOS to determine whether the picker will be in 12 or 24 hour format. |
| `timeFormat` | Format used for the text in the picker field (on android used as a pattern for a [SimpleDateFormat](https://developer.android.com/reference/java/text/SimpleDateFormat), on iOS used as a dateFormat for [NSDateFormatter](https://developer.apple.com/documentation/foundation/nsdateformatter), default is generated by the current value of the locale property), the format will also be used on Android to determine whether the picker will be in 12 or 24 hour format. |
| `pickerDefaultTime` | The time that will be displayed in the picker, if it is opened while time is undefined (if defaultTime is undefined, the picker will display now). |
| `pickerDefaultTime` | The time that will be displayed in the picker, if it is opened while time is undefined (if defaultTime is undefined, the picker will display now). Parsing is handled similarly as with `time` property. |
| `pickerTitle` | Text that will be displayed as title of the picker, default is undefined. |
| `pickerOkText` | Text for the confirmation button of the picker (default is OK on iOS, localized version of OK on android (based on the devices locale settings)). |
| `pickerCancelText` | Text for the cancel button of the picker (default is Cancel on iOS, localized version of Cancel on android (based on the devices locale settings)). |
Expand All @@ -191,13 +191,13 @@ Internally `DatePickerField` and `TimePickerField` call `DateTimePicker`'s `pick

| Property | Description |
| --- | --- |
| `date` | The date the picker fields are currently displaying. |
| `minDate` | The minimum date the date component can select. |
| `maxDate` | The maximum date the time component can select. |
| `date` | The date the picker fields are currently displaying. Property is of type `Date`. When used in markup, the provided string will be passed to the [Date constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) to create a new `Date` object. |
| `minDate` | The minimum date the date component can select. Parsing of dates is handled similarly as with `date` property. |
| `maxDate` | The maximum date the time component can select. Parsing of dates is handled similarly as with `date` property. |
| `locale` | Identifier of a locale that will be used to localize the names of the month names, the order of the date spinners (with `en_GB` first spinner is day, with `en_US` first spinner is month), and to create locale-specific time formatter of the time (if the format is 12-Hour, with de_DE locale “vorm.”/”nachm.” will be used to show whether time is before/after noon, with en_US locale “am”/”pm” will be used) (default is based on the device’s locale settings). The locale will also be used on iOS to determine whether the picker will be in 12 or 24 hour format. |
| `dateFormat` | Format used for the text in the picker field (on android used as a pattern for a [SimpleDateFormat](https://developer.android.com/reference/java/text/SimpleDateFormat), on iOS used as a dateFormat for [NSDateFormatter](https://developer.apple.com/documentation/foundation/nsdateformatter), default is generated by the current value of the `locale` property). |
| `timeFormat` | Format used for the text in the picker field (on android used as a pattern for a [SimpleDateFormat](https://developer.android.com/reference/java/text/SimpleDateFormat), on iOS used as a dateFormat for [NSDateFormatter](https://developer.apple.com/documentation/foundation/nsdateformatter), default is generated by the current value of the locale property), the format will also be used on Android to determine whether the picker will be in 12 or 24 hour format. |
| `pickerDefaultTime` | The time that will be displayed in the picker, if it is opened while time is undefined (if defaultTime is undefined, the picker will display now). |
| `pickerDefaultDate` | The date and time that will be displayed in the pickers, if opened while `date` is `undefined` (if `pickerDefaultDate` is undefined, the picker will display now). Parsing of dates is handled similarly as with `date` property. |
| `pickerTitleDate` | Text that will be displayed as title of the picker, when the date component is tapped, default is undefined. |
| `pickerTitleTime` | Text that will be displayed as title of the picker, when the time component is tapped, default is undefined. |
| `pickerOkText` | Text for the confirmation button of the picker (default is OK on iOS, localized version of OK on android (based on the devices locale settings)). |
Expand Down
18 changes: 9 additions & 9 deletions src/ui/picker-field-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export abstract class PickerFieldBase extends TextField {
public pickerOkText: string;
public pickerCancelText: string;

private _tapHandler: (args: TouchGestureEventData) => void;
private _pickerFieldBaseTapHandler: (args: TouchGestureEventData) => void;

constructor() {
super();
Expand Down Expand Up @@ -36,11 +36,11 @@ export abstract class PickerFieldBase extends TextField {

initNativeView() {
super.initNativeView();
this._updateHandler(true);
this._updatePickerFieldBaseTapHandler(true);
}

disposeNativeView() {
this._updateHandler(false);
this._updatePickerFieldBaseTapHandler(false);
super.disposeNativeView();
}

Expand All @@ -51,18 +51,18 @@ export abstract class PickerFieldBase extends TextField {
protected onLocaleChanged(oldValue: string, newValue: string) {
}

private _updateHandler(subscribe: boolean) {
private _updatePickerFieldBaseTapHandler(subscribe: boolean) {
if (subscribe) {
this._tapHandler = this._tapHandler || ((args: TouchGestureEventData) => {
this._onTap(args);
this._pickerFieldBaseTapHandler = this._pickerFieldBaseTapHandler || ((args: TouchGestureEventData) => {
this._onPickerFieldBaseTap(args);
});
this.on(GestureTypes.tap, this._tapHandler);
this.on(GestureTypes.tap, this._pickerFieldBaseTapHandler);
} else {
this.off(GestureTypes.tap, this._tapHandler);
this.off(GestureTypes.tap, this._pickerFieldBaseTapHandler);
}
}

private _onTap(args: TouchGestureEventData) {
private _onPickerFieldBaseTap(args: TouchGestureEventData) {
this.open();
}
}
Expand Down