Skip to content
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

修复 小时存在24时,分、秒存在60秒的问题 #34

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
6 changes: 3 additions & 3 deletions view/BaseDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ export default class BaseDialog extends BaseComponent {
show(callback, state = {}) {
this.setState({ _isShow: true, ...state }, () => {
if (!this.props.showAnimationType || this.props.showAnimationType == 'spring') {
Animated.spring(this._path, { toValue: 1 }).start(() => {
Animated.spring(this._path, { toValue: 1, useNativeDriver: true }).start(() => {
callback && callback();
});
} else {
Animated.timing(this._path, { toValue: 1 }).start(() => {
Animated.timing(this._path, { toValue: 1, useNativeDriver: true }).start(() => {
callback && callback();
});
}
});
}

dismiss(callback) {
Animated.timing(this._path, { toValue: 0, duration: 200 }).start(() => {
Animated.timing(this._path, { toValue: 0, duration: 200, useNativeDriver: true }).start(() => {
this.setState({ _isShow: false }, () => {
callback && callback();
});
Expand Down
26 changes: 13 additions & 13 deletions view/DatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,39 +97,39 @@ class DatePicker extends BaseDialog {
if (this.props.HH) {
let hours = [];
for (let i = 0; i < 24; i++) {
hours.push((i + 1) + '时');
hours.push(i + '时');
}
pickerData.push(hours);
if (this.props.selectedValue) {
selectedIndex.push((this.props.selectedValue[3] ? parseInt(this.props.selectedValue[3]) : new Date().getHours()) - 1);
selectedIndex.push((this.props.selectedValue[3] ? parseInt(this.props.selectedValue[3]) : new Date().getHours()));
} else {
selectedIndex.push((new Date().getHours() - 1));
selectedIndex.push((new Date().getHours()));
}
this.props.selectedValue[3] = (selectedIndex[3] + 1) + '时';
this.props.selectedValue[3] = (selectedIndex[3]) + '时';
if (this.props.mm) {
let minutes = [];
for (let i = 0; i < 60; i++) {
minutes.push((i + 1) + '分');
minutes.push(i + '分');
}
pickerData.push(minutes);
if (this.props.selectedValue) {
selectedIndex.push((this.props.selectedValue[4] ? parseInt(this.props.selectedValue[4]) : new Date().getMinutes()) - 1);
selectedIndex.push((this.props.selectedValue[4] ? parseInt(this.props.selectedValue[4]) : new Date().getMinutes()));
} else {
selectedIndex.push((new Date().getMinutes() - 1));
selectedIndex.push((new Date().getMinutes()));
}
this.props.selectedValue[4] = (selectedIndex[4] + 1) + '分';
this.props.selectedValue[4] = (selectedIndex[4]) + '分';
if (this.props.ss) {
let seconds = [];
for (let i = 0; i < 60; i++) {
seconds.push((i + 1) + '秒');
seconds.push(i + '秒');
}
pickerData.push(seconds);
if (this.props.selectedValue) {
selectedIndex.push((this.props.selectedValue[5] ? parseInt(this.props.selectedValue[5]) : 1) - 1);
selectedIndex.push((this.props.selectedValue[5] ? parseInt(this.props.selectedValue[5]) : 1));
} else {
selectedIndex.push(1);
selectedIndex.push(0);
}
this.props.selectedValue[5] = (selectedIndex[5] + 1) + '秒';
this.props.selectedValue[5] = (selectedIndex[5]) + '秒';
}
}
}
Expand Down Expand Up @@ -203,4 +203,4 @@ class DatePicker extends BaseDialog {
}
}

export default DatePicker;
export default DatePicker;