From a81feb295307aea108710999e21eb70a29799303 Mon Sep 17 00:00:00 2001 From: shenzhiqing Date: Sat, 27 Aug 2022 15:35:30 +0800 Subject: [PATCH 1/4] =?UTF-8?q?style(Calendar):=20=E4=BF=AE=E6=94=B9Calend?= =?UTF-8?q?ar=E7=BB=84=E4=BB=B6=E5=AE=89=E5=8D=93=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20#382?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/Calendar/index.tsx | 90 ++++++++++++++++------------ 1 file changed, 51 insertions(+), 39 deletions(-) diff --git a/packages/core/src/Calendar/index.tsx b/packages/core/src/Calendar/index.tsx index 773cce4a9..5c1a3967c 100644 --- a/packages/core/src/Calendar/index.tsx +++ b/packages/core/src/Calendar/index.tsx @@ -66,16 +66,16 @@ const Calendar = (props: CalendarProps) => { render ) : ( - onPressBarLeft && onPressBarLeft()}> + onPressBarLeft && onPressBarLeft()}> {barRightText} - + {title} - goToday()}> + goToday()}> {barLeftText} @@ -125,40 +125,42 @@ const Calendar = (props: CalendarProps) => { key={index} style={ lunarAll.type === 1 - ? styles.otherMonth + ? [styles.dateBase, styles.otherMonth] : lunarAll.type === 2 - ? [styles.currentMonth, { backgroundColor: color }] + ? [styles.currentMonth, styles.dateBase, { backgroundColor: color }] : lunarAll.type === 3 - ? [styles.selectMonth, { borderColor: color }] - : styles.day + ? [styles.selectMonth, styles.dateBase, { borderColor: color }] + : styles.dateBase } onPress={() => goSelectDay(day)} > - - {day.monthDays} - - {lunarHoliday === true && ( + - {nameLen > 3 ? {day.lunarHolidays} : day.lunarHolidays || day.lunar} + {day.monthDays} - )} + {lunarHoliday === true && ( + + {nameLen > 3 ? {day.lunarHolidays} : day.lunarHolidays || day.lunar} + + )} + ); }); @@ -249,16 +251,29 @@ const Calendar = (props: CalendarProps) => { const styles = StyleSheet.create({ header: { flex: 1, + display: 'flex', backgroundColor: '#329BCB', flexDirection: 'row', padding: 10, alignItems: 'center', justifyContent: 'space-between', }, + headerBtnWrap: { + flex: 1, + }, headerBtn: { flexDirection: 'row', alignItems: 'center', - width: 50, + // width: 50, + }, + headerTextWrap: { + flex: 1, + alignItems: 'center', + }, + headerTextTouch: { + flex: 1, + display: 'flex', + flexDirection: 'row-reverse', }, headerText: { fontSize: 20, @@ -299,31 +314,28 @@ const styles = StyleSheet.create({ flexDirection: 'row', paddingHorizontal: 2, }, - currentMonth: { - backgroundColor: '#329BCB', - borderRadius: 50, + dateBase: { marginHorizontal: 2, width: MainWidth / 7 - 4.5, height: MainWidth / 7 - 4.5, + ...Platform.select({ + ios: {}, + android: { + justifyContent: 'center', + }, + }), + }, + currentMonth: { + backgroundColor: '#329BCB', + borderRadius: 50, }, selectMonth: { borderWidth: 1, borderColor: '#329BCB', borderRadius: 50, - marginHorizontal: 2, - width: MainWidth / 7 - 4.5, - height: MainWidth / 7 - 4.5, }, otherMonth: { borderRadius: 50, - marginHorizontal: 2, - width: MainWidth / 7 - 4.5, - height: MainWidth / 7 - 4.5, - }, - day: { - marginHorizontal: 2, - width: MainWidth / 7 - 4.5, - height: MainWidth / 7 - 4.5, }, dayText: { textAlign: 'center', From a91cd78fa11b1bdf7a67148714c34ac155cc5b5c Mon Sep 17 00:00:00 2001 From: shenzhiqing Date: Sat, 3 Sep 2022 17:33:39 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix(MenuDropdown):=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E4=B8=8B=E6=8B=89=E6=A1=86=E5=8A=A8=E7=94=BB?= =?UTF-8?q?=20#376?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/MenuDropdown/index.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/core/src/MenuDropdown/index.tsx b/packages/core/src/MenuDropdown/index.tsx index cbd94c547..196f8b9fc 100644 --- a/packages/core/src/MenuDropdown/index.tsx +++ b/packages/core/src/MenuDropdown/index.tsx @@ -51,9 +51,14 @@ export default class MenuDropdown extends React.Component { }; animateClose = () => { - this.setState({ - listHeightValue: new Animated.Value(0), - }); + // this.setState({ + // listHeightValue: new Animated.Value(0), + // }); + Animated.timing(this.state.listHeightValue, { + toValue: 0, + duration: 400, + useNativeDriver: false, // 动画值在不同的驱动方式之间是不能兼容的。因此如果你在某个动画中启用了原生驱动,那么所有和此动画依赖相同动画值的其他动画也必须启用原生驱动。 + }).start(); }; menuContainer = (event: LayoutChangeEvent) => { From 2c49050b68ebd1fc29fb30d3af00fdf5052fbed9 Mon Sep 17 00:00:00 2001 From: shenzhiqing Date: Sat, 3 Sep 2022 17:37:06 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix(DragDrawer):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E5=88=B0=E5=BA=95=E5=90=8E=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=A1=86=E4=BC=9A=E5=90=91=E4=B8=8A=E5=BC=B9=E5=88=B0=E9=A1=B6?= =?UTF-8?q?=E9=83=A8=E7=9A=84=E9=97=AE=E9=A2=98=20#384?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/DragDrawer/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/DragDrawer/index.tsx b/packages/core/src/DragDrawer/index.tsx index 7cacb4ace..63491a763 100644 --- a/packages/core/src/DragDrawer/index.tsx +++ b/packages/core/src/DragDrawer/index.tsx @@ -60,7 +60,7 @@ function DragDrawer(props: DragDrawerProps) { listener: () => { let values = DEVICE_HEIGHT - 30 - gestureState.moveY; setViewHeight(values); - animatedViewHeight.setValue(values); + animatedViewHeight.setValue(values > 50 ? values : 50); }, useNativeDriver: false, }, // 可选的异步监听函数 From be56672e4d71f6a4ca85f2ff4c8d793c3ad29f2c Mon Sep 17 00:00:00 2001 From: shenzhiqing Date: Sat, 3 Sep 2022 17:44:54 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix(DragDrawer):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E5=88=B0=E5=BA=95=E5=90=8E=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=A1=86=E4=BC=9A=E5=90=91=E4=B8=8A=E5=BC=B9=E5=88=B0=E9=A1=B6?= =?UTF-8?q?=E9=83=A8=E7=9A=84=E9=97=AE=E9=A2=98=20#384?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/DragDrawer/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/DragDrawer/index.tsx b/packages/core/src/DragDrawer/index.tsx index 63491a763..7cacb4ace 100644 --- a/packages/core/src/DragDrawer/index.tsx +++ b/packages/core/src/DragDrawer/index.tsx @@ -60,7 +60,7 @@ function DragDrawer(props: DragDrawerProps) { listener: () => { let values = DEVICE_HEIGHT - 30 - gestureState.moveY; setViewHeight(values); - animatedViewHeight.setValue(values > 50 ? values : 50); + animatedViewHeight.setValue(values); }, useNativeDriver: false, }, // 可选的异步监听函数