From 2b01a52b4895d19c9f44aebf18a2895e03fdfdbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=9D=A4?= Date: Wed, 20 Nov 2024 17:17:46 +0800 Subject: [PATCH 1/5] fix: Tooltip flash style (#1391) --- components/tooltip/Tooltip.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/tooltip/Tooltip.tsx b/components/tooltip/Tooltip.tsx index cddd76c4..356612b0 100644 --- a/components/tooltip/Tooltip.tsx +++ b/components/tooltip/Tooltip.tsx @@ -152,6 +152,9 @@ const InternalTooltip: React.ForwardRefRenderFunction< }) const safeFloatingStyles = useMemo(() => { + if (floatingStyles.left === 0 && floatingStyles.top === 0) { + return { display: 'none' } as const + } if (isNaN(floatingStyles.left) || isNaN(floatingStyles.top)) { return { display: 'none' } as const } @@ -171,7 +174,8 @@ const InternalTooltip: React.ForwardRefRenderFunction< + style={{ marginTop: StatusBar.currentHeight }} + collapsable={false}> Date: Wed, 20 Nov 2024 17:41:20 +0800 Subject: [PATCH 2/5] feat: Slider ref --- components/slider/PropsType.tsx | 4 ++++ components/slider/slider.tsx | 29 +++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/components/slider/PropsType.tsx b/components/slider/PropsType.tsx index 34e0101b..7b5d7689 100644 --- a/components/slider/PropsType.tsx +++ b/components/slider/PropsType.tsx @@ -8,6 +8,10 @@ export type SliderMarks = { } export type SliderValueType = number | [number, number] +export interface SliderRef { + onSlide: (changeX: number) => void +} + export type BaseSliderProps = { min?: number max?: number diff --git a/components/slider/slider.tsx b/components/slider/slider.tsx index d0fd3759..c6ac61b7 100644 --- a/components/slider/slider.tsx +++ b/components/slider/slider.tsx @@ -3,6 +3,7 @@ import React, { useCallback, useContext, useEffect, + useImperativeHandle, useMemo, useRef, useState, @@ -18,7 +19,12 @@ import Animated, { import HapticsContext from '../provider/HapticsContext' import { useTheme } from '../style' import Marks from './marks' -import { BaseSliderProps, SliderProps, SliderValueType } from './PropsType' +import { + BaseSliderProps, + SliderProps, + SliderRef, + SliderValueType, +} from './PropsType' import SliderStyles from './style' import Thumb from './thumb' import Ticks from './ticks' @@ -33,8 +39,9 @@ function nearest(arr: number[], target: number) { }) } -export function Slider( +function InternalSlider( props: SliderProps, + ref, ) { const { value: propsValue, @@ -359,6 +366,15 @@ export function Slider( ) } + // ================== Actions Ref ================== + const actions = React.useMemo( + () => ({ + onSlide, + }), + [onSlide], + ) + useImperativeHandle(ref, () => actions) + return ( @@ -384,3 +400,12 @@ export function Slider( ) } + +const Slider = React.forwardRef(InternalSlider) as (( + props: React.PropsWithChildren, +) => React.ReactElement) & + Pick + +Slider.displayName = 'Slider' + +export default React.memo(Slider) From ac415633c54211d59ba355695439112afcebf9be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=9D=A4?= Date: Fri, 6 Dec 2024 11:15:48 +0800 Subject: [PATCH 3/5] feat: Slider ref --- components/slider/index.tsx | 2 +- components/slider/slider.tsx | 5 +++-- components/types.ts | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/slider/index.tsx b/components/slider/index.tsx index 2de397f7..c8eb8208 100644 --- a/components/slider/index.tsx +++ b/components/slider/index.tsx @@ -1,4 +1,4 @@ -import { Slider } from './slider' +import Slider from './slider' export type { SliderProps } from './PropsType' diff --git a/components/slider/slider.tsx b/components/slider/slider.tsx index c6ac61b7..718cc7e7 100644 --- a/components/slider/slider.tsx +++ b/components/slider/slider.tsx @@ -1,5 +1,6 @@ import getMiniDecimal from '@rc-component/mini-decimal' import React, { + ForwardedRef, useCallback, useContext, useEffect, @@ -41,7 +42,7 @@ function nearest(arr: number[], target: number) { function InternalSlider( props: SliderProps, - ref, + ref: ForwardedRef, ) { const { value: propsValue, @@ -402,7 +403,7 @@ function InternalSlider( } const Slider = React.forwardRef(InternalSlider) as (( - props: React.PropsWithChildren, + props: React.PropsWithChildren & React.RefAttributes, ) => React.ReactElement) & Pick diff --git a/components/types.ts b/components/types.ts index 337f3f6c..82dcdf18 100644 --- a/components/types.ts +++ b/components/types.ts @@ -48,7 +48,7 @@ export type { } from './radio/PropsType' export type { ResultNativeProps as ResultProps } from './result/index' export type { SearchBarProps } from './search-bar/index' -export type { SliderProps } from './slider/PropsType' +export type { SliderProps, SliderRef } from './slider/PropsType' export type { StepperProps } from './stepper/PropsType' export type { StepsProps } from './steps/index' export type { From dbff373219a04487bf76bd9d28cbc34c10cf3dd1 Mon Sep 17 00:00:00 2001 From: HHX <57352881+houhongxu@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:22:16 +0800 Subject: [PATCH 4/5] fix: new Date not adhering to ISO 8601 (#1401) Co-authored-by: houhongxu --- components/date-picker-view/date-picker-view.tsx | 5 +++-- components/date-picker/date-picker.tsx | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/date-picker-view/date-picker-view.tsx b/components/date-picker-view/date-picker-view.tsx index 1835b687..b3698d51 100644 --- a/components/date-picker-view/date-picker-view.tsx +++ b/components/date-picker-view/date-picker-view.tsx @@ -17,14 +17,15 @@ import { PickerViewStyle } from '../picker-view/style' import { WithThemeStyles } from '../style' import { DatePickerViewPropsType } from './PropsType' import useRenderLabel from './useRenderLabel' +import dayjs from 'dayjs' export interface DatePickerViewProps extends DatePickerViewPropsType, WithThemeStyles {} const defaultProps = { - minDate: new Date('2000-1-1'), - maxDate: new Date('2030-1-1'), + minDate: dayjs('2000-1-1').toDate(), + maxDate: dayjs('2030-1-1').toDate(), mode: 'date', } diff --git a/components/date-picker/date-picker.tsx b/components/date-picker/date-picker.tsx index fdaaf474..1526548c 100644 --- a/components/date-picker/date-picker.tsx +++ b/components/date-picker/date-picker.tsx @@ -26,8 +26,8 @@ export type DatePickerRef = any export interface DatePickerProps extends DatePickerPropsType {} const defaultProps = { - minDate: new Date('2000-1-1'), - maxDate: new Date('2030-1-1'), + minDate: dayjs('2000-1-1').toDate(), + maxDate: dayjs('2030-1-1').toDate(), precision: 'day', } From cb436649fd62e7ce654c8444749268d6681d6730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=9D=A4?= Date: Wed, 11 Dec 2024 11:44:09 +0800 Subject: [PATCH 5/5] bump 5.3.2 --- CHANGELOG.en-US.md | 8 ++++++++ CHANGELOG.zh-CN.md | 8 ++++++++ package.json | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 7846219c..9f0f2a6a 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -14,6 +14,14 @@ toc: false --- +### 5.3.2 +`2024-12-11` + - **Tooltip** + - feat: Add offset settings to tooltip [#1398](https://github.com/ant-design/ant-design-mobile-rn/pull/1398) + - fix: Tooltip flash style [#1391](https://github.com/ant-design/ant-design-mobile-rn/issues/1391) + - feat: Slider ref + - fix: new Date not adhering to ISO 8601 [#1401](https://github.com/ant-design/ant-design-mobile-rn/pull/1401) + ### 5.3.1 `2024-11-20` - **Carousel** diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 6730520c..17ca3746 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -14,6 +14,14 @@ toc: false --- +### 5.3.2 +`2024-12-11` + - **Tooltip** + - feat: Add offset settings to tooltip [#1398](https://github.com/ant-design/ant-design-mobile-rn/pull/1398) + - fix: Tooltip flash style [#1391](https://github.com/ant-design/ant-design-mobile-rn/issues/1391) + - feat: Slider ref + - fix: new Date not adhering to ISO 8601 [#1401](https://github.com/ant-design/ant-design-mobile-rn/pull/1401) + ### 5.3.1 `2024-11-20` - **Carousel** diff --git a/package.json b/package.json index 652e8e3a..a0eb35df 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ant-design/react-native", - "version": "5.3.1", + "version": "5.3.2", "description": "基于蚂蚁金服移动设计规范的 React Native 组件库", "keywords": [ "ant",