diff --git a/.changeset/four-bottles-hide.md b/.changeset/four-bottles-hide.md new file mode 100644 index 0000000000..3845bc7f17 --- /dev/null +++ b/.changeset/four-bottles-hide.md @@ -0,0 +1,5 @@ +--- +'@td-design/react-native': patch +--- + +fix: 修复slider组件滑动不到最后的bug diff --git a/packages/react-native/src/number-keyboard/NumberKeyboardModal.tsx b/packages/react-native/src/number-keyboard/NumberKeyboardModal.tsx index ed2928c9ec..c5e2124ce8 100644 --- a/packages/react-native/src/number-keyboard/NumberKeyboardModal.tsx +++ b/packages/react-native/src/number-keyboard/NumberKeyboardModal.tsx @@ -59,7 +59,13 @@ const NumberKeyboardModal: FC< - + ); }; diff --git a/packages/react-native/src/number-keyboard/NumberKeyboardView.tsx b/packages/react-native/src/number-keyboard/NumberKeyboardView.tsx index c59983c1d8..40ebd16a84 100644 --- a/packages/react-native/src/number-keyboard/NumberKeyboardView.tsx +++ b/packages/react-native/src/number-keyboard/NumberKeyboardView.tsx @@ -49,44 +49,48 @@ const NumberKeyboardView: FC = ({ }); const keyTypes = useMemo(() => { - const numberType = allowNegative ? [ - { - key: '0', - flex: 1, - }, - { - key: '.', - flex: 1, - }, - { - key: '-', - flex: 1, - }, - ] : [ - { - key: '0', - flex: 2, - }, - { - key: '.', - flex: 1, - }, - ]; - const integerType = allowNegative ? [ - { - key: '0', - flex: 2, - }, - { - key: '-', - flex: 1, - }, - ] : [ - { - key: '0', - flex: 1, - }, - ]; + const numberType = allowNegative + ? [ + { + key: '0', + flex: 1, + }, + { + key: '.', + flex: 1, + }, + { + key: '-', + flex: 1, + }, + ] + : [ + { + key: '0', + flex: 2, + }, + { + key: '.', + flex: 1, + }, + ]; + const integerType = allowNegative + ? [ + { + key: '0', + flex: 2, + }, + { + key: '-', + flex: 1, + }, + ] + : [ + { + key: '0', + flex: 1, + }, + ]; const types = { number: numberType, diff --git a/packages/react-native/src/number-keyboard/type.ts b/packages/react-native/src/number-keyboard/type.ts index bc6aaef3ce..e3b6b20e7e 100644 --- a/packages/react-native/src/number-keyboard/type.ts +++ b/packages/react-native/src/number-keyboard/type.ts @@ -20,7 +20,8 @@ export interface NumberKeyboardViewProps { allowNegative?: boolean; } -export interface NumberKeyboardItemProps extends Pick { +export interface NumberKeyboardItemProps + extends Pick { value?: string; onChange?: (value: string) => void; onCheck?: (value: string) => Promise; diff --git a/packages/react-native/src/slider/index.tsx b/packages/react-native/src/slider/index.tsx index d44570be05..2ec3833842 100644 --- a/packages/react-native/src/slider/index.tsx +++ b/packages/react-native/src/slider/index.tsx @@ -64,7 +64,7 @@ const Slider: FC = props => { } = props; const KNOB_WIDTH = height; const sliderRange = width - KNOB_WIDTH; - const oneStepValue = Math.floor(sliderRange / (max - min)) || 1; + const oneStepValue = Math.ceil(sliderRange / (max - min)) || 1; const { progressStyle, knobStyle, onGestureEvent, label } = useSlider({ min,