Skip to content

Commit

Permalink
发布0.3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
rtpryv010 committed Sep 1, 2021
1 parent 408c313 commit 71b9a9b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 55 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# [0.3.7]() (2021-09-01)
# [0.3.8]() (2021-09-01)

* 修复DatePicker和DateRangePicker没有继承CommonPicker相关属性的问题

# [0.3.7]() (2021-09-01)

~~* 修复DatePicker和DateRangePicker没有继承CommonPicker相关属性的问题~~

# [0.3.6]() (2021-08-31)

* 修复itemStyle android下选中颜色设置无效的问题[#31](https://github.com/yz1311/react-native-wheel-picker/issues/31)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yz1311/react-native-wheel-picker",
"version": "0.3.7",
"version": "0.3.8",
"description": "React native cross platform picker.",
"main": "index.js",
"types": "types/index.d.ts",
Expand Down
67 changes: 14 additions & 53 deletions src/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
} from "react-native";
import moment from "moment";
import CommonPicker from "./CommonPicker";
import PickerHeader from './PickerHeader';
import {IDatePickerProps as IProps} from '../types';


Expand Down Expand Up @@ -327,59 +326,21 @@ export default class DatePicker extends PureComponent<IProps,IState>{
}

render () {
const {mode, labelUnit, isModal, modalProps, modalVisible, onModalVisibleChange} = this.props;
const { width: deviceWidth } = Dimensions.get('window');
const pickerView = (
<View style={[{minHeight:240+(this.props.showHeader?40:0)},this.props.style]}>
{this.props.showHeader ?
<PickerHeader
{...this.props}
onPickerConfirm={()=>{
this.props.onPickerConfirm&&this.props.onPickerConfirm(this.targetDate);
}}
/>
:
null
}
{this.state.pickerData.length > 0 ?
<CommonPicker
{...this.props}
style={{width: deviceWidth}}
wheelStyles={this.props.mode === 'datetime'?[{minWidth: 20}]:[]}
showHeader={false}
pickerData={this.state.pickerData}
selectedValue={this.state.selectedDateArray}
onValueChange={(value, wheelIndex) => {
this._onDateChange(value, wheelIndex);
}}
/>
:
<View style={[{flex:1, backgroundColor:'white', justifyContent:'center', alignItems:'center'}, this.props.pickerWrapperStyle]}>
<Text style={{fontSize: 16, color:'#999999'}}>数据异常,请检查参数</Text>
</View>
}
</View>
return (
<CommonPicker
{...this.props}
style={[{width: deviceWidth}, this.props.style]}
wheelStyles={this.props.mode === 'datetime'?[{minWidth: 20}]:[]}
pickerData={this.state.pickerData}
selectedValue={this.state.selectedDateArray}
onValueChange={(value, wheelIndex) => {
this._onDateChange(value, wheelIndex);
}}
onPickerConfirm={()=>{
this.props.onPickerConfirm&&this.props.onPickerConfirm(this.targetDate);
}}
/>
);
if(isModal) {
const Modal = require('react-native-modal').default;
if(Modal) {
return (
<Modal
onBackdropPress={()=>{
onModalVisibleChange&&onModalVisibleChange(false);
}}
onBackButtonPress={()=>{
onModalVisibleChange&&onModalVisibleChange(false);
}}
{...(modalProps||{})}
style={[{flex:1, justifyContent:'flex-end',margin: 0}, (modalProps||{style: undefined}).style]}
isVisible={modalVisible}
>
{pickerView}
</Modal>
);
}
}
return pickerView;
}
}
2 changes: 2 additions & 0 deletions src/DateRangePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export default class DateRangePicker extends PureComponent<IProps,any>{
<View style={{flexDirection:'row',paddingHorizontal:8}}>
<DatePicker
{...this.props}
isModal={false}
style={[localStyles.picker]}
showHeader={false}
pickerWrapperStyle={[localStyles.picker,{marginLeft:20}]}
Expand All @@ -128,6 +129,7 @@ export default class DateRangePicker extends PureComponent<IProps,any>{
<View style={{flexDirection:'row',paddingHorizontal:8}}>
<DatePicker
{...this.props}
isModal={false}
style={[localStyles.picker]}
showHeader={false}
pickerWrapperStyle={[localStyles.picker,{marginLeft:20}]}
Expand Down

0 comments on commit 71b9a9b

Please sign in to comment.