@xhsreds/reds-rn-next 0.10.1-beta202511201716 → 0.10.1-fix-pull-refresh-animated202511211152

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/coverage/.tmp/coverage-10.json +1 -1
  2. package/coverage/.tmp/coverage-11.json +1 -1
  3. package/coverage/.tmp/coverage-12.json +1 -1
  4. package/coverage/.tmp/coverage-13.json +1 -1
  5. package/coverage/.tmp/coverage-14.json +1 -1
  6. package/coverage/.tmp/coverage-15.json +1 -1
  7. package/coverage/.tmp/coverage-17.json +1 -1
  8. package/coverage/.tmp/coverage-18.json +1 -1
  9. package/coverage/.tmp/coverage-19.json +1 -1
  10. package/coverage/.tmp/coverage-2.json +1 -1
  11. package/coverage/.tmp/coverage-21.json +1 -1
  12. package/coverage/.tmp/coverage-23.json +1 -1
  13. package/coverage/.tmp/coverage-24.json +1 -1
  14. package/coverage/.tmp/coverage-25.json +1 -1
  15. package/coverage/.tmp/coverage-27.json +1 -1
  16. package/coverage/.tmp/coverage-28.json +1 -1
  17. package/coverage/.tmp/coverage-29.json +1 -1
  18. package/coverage/.tmp/coverage-3.json +1 -1
  19. package/coverage/.tmp/coverage-30.json +1 -1
  20. package/coverage/.tmp/coverage-31.json +1 -1
  21. package/coverage/.tmp/coverage-32.json +1 -1
  22. package/coverage/.tmp/coverage-33.json +1 -1
  23. package/coverage/.tmp/coverage-34.json +1 -1
  24. package/coverage/.tmp/coverage-35.json +1 -1
  25. package/coverage/.tmp/coverage-36.json +1 -1
  26. package/coverage/.tmp/coverage-37.json +1 -1
  27. package/coverage/.tmp/coverage-38.json +1 -1
  28. package/coverage/.tmp/coverage-39.json +1 -1
  29. package/coverage/.tmp/coverage-40.json +1 -1
  30. package/coverage/.tmp/coverage-41.json +1 -1
  31. package/coverage/.tmp/coverage-42.json +1 -1
  32. package/coverage/.tmp/coverage-5.json +1 -1
  33. package/coverage/.tmp/coverage-6.json +1 -1
  34. package/coverage/.tmp/coverage-7.json +1 -1
  35. package/coverage/.tmp/coverage-9.json +1 -1
  36. package/lib/cjs/components/PullRefresh/PullRefresh.js +40 -10
  37. package/lib/cjs/components/PullRefresh/PullRefresh.js.map +1 -1
  38. package/lib/cjs/components/Radio/Radio.js +3 -3
  39. package/lib/cjs/components/Radio/Radio.js.map +1 -1
  40. package/lib/cjs/components/Radio/styles.js +7 -5
  41. package/lib/cjs/components/Radio/styles.js.map +1 -1
  42. package/lib/cjs/components/Sheets/AnimatedSheets.js +2 -2
  43. package/lib/cjs/components/Sheets/AnimatedSheets.js.map +1 -1
  44. package/lib/cjs/components/Slider/Slider.js +34 -74
  45. package/lib/cjs/components/Slider/Slider.js.map +1 -1
  46. package/lib/cjs/components/TextView/TextView.js +3 -6
  47. package/lib/cjs/components/TextView/TextView.js.map +1 -1
  48. package/lib/esm/components/PullRefresh/PullRefresh.js +40 -10
  49. package/lib/esm/components/PullRefresh/PullRefresh.js.map +1 -1
  50. package/lib/esm/components/Radio/Radio.js +3 -3
  51. package/lib/esm/components/Radio/Radio.js.map +1 -1
  52. package/lib/esm/components/Radio/styles.js +7 -5
  53. package/lib/esm/components/Radio/styles.js.map +1 -1
  54. package/lib/esm/components/Sheets/AnimatedSheets.js +2 -2
  55. package/lib/esm/components/Sheets/AnimatedSheets.js.map +1 -1
  56. package/lib/esm/components/Slider/Slider.js +36 -76
  57. package/lib/esm/components/Slider/Slider.js.map +1 -1
  58. package/lib/esm/components/TextView/TextView.js +3 -6
  59. package/lib/esm/components/TextView/TextView.js.map +1 -1
  60. package/lib/src/components/Slider/Slider.d.ts +1 -1
  61. package/lib/types/components/Slider/Slider.d.ts +1 -1
  62. package/package.json +2 -2
  63. package/src/components/PullRefresh/PullRefresh.tsx +69 -33
  64. package/src/components/Radio/Radio.tsx +3 -3
  65. package/src/components/Radio/styles.ts +5 -3
  66. package/src/components/Sheets/AnimatedSheets.tsx +112 -116
  67. package/src/components/Slider/Slider.tsx +37 -103
  68. package/src/components/Slider/demo/index.tsx +0 -18
  69. package/src/components/TextView/TextView.tsx +3 -6
  70. package/src/components/TextView/demo/index.tsx +1 -1
  71. package/src/i18n/@types/resources.d.ts +27 -27
  72. package/src/i18n/index.json +31 -31
@@ -1 +1 @@
1
- {"version":3,"file":"TextView.js","sources":["../../../../src/components/TextView/TextView.tsx"],"sourcesContent":["import { useState, useRef, useEffect, useCallback, useMemo, forwardRef, useImperativeHandle } from \"react\";\nimport { TextInput, View, Text, TouchableWithoutFeedback, ColorValue, Keyboard, Platform } from \"react-native\";\nimport { TextViewDefaultProps, RedsTextView } from \"./interface\";\nimport createStyles from \"./styles\";\nimport runes from \"runes\";\nimport useMounted from \"../../pvCount/useUnmountedProcess\";\nimport { useThemeColor } from \"../ConfigProvider\";\n\nconst TextField = forwardRef((props: RedsTextView, ref) => {\n const {\n type,\n modelValue,\n clearable = false,\n maxLength,\n disabled = false,\n readonly,\n autofocus = false,\n showCount = false,\n placeholder,\n rows = 3,\n onFocus,\n onBlur,\n onChange,\n onClear,\n style = {},\n containerStyle = {},\n layout,\n actionLayout,\n placeholderTextColor,\n } = props || {};\n useMounted(\"TextView\");\n const styles = createStyles(disabled, actionLayout || \"vertical\");\n const [focused, setFocused] = useState(autofocus);\n const [value, setValue] = useState(modelValue || \"\");\n const [modelValueStringLength, setModelValueStringLength] = useState(0);\n const [showClear, setShowClear] = useState(false);\n const [showActionArea, setShowActionArea] = useState(false);\n const inputRef = useRef<TextInput>(null);\n const themeColor = useThemeColor();\n\n const limitValueLength = useCallback(\n (value: string) => {\n const valueLength = runes(value || \"\").length;\n if (typeof maxLength === \"number\" && valueLength > maxLength) {\n const mValue = value;\n if (mValue && modelValueStringLength === +maxLength) {\n return mValue;\n }\n return runes.substr(value, 0, +maxLength);\n }\n return value;\n },\n [maxLength],\n );\n\n useImperativeHandle(ref, () => ({\n textInputRef: inputRef,\n }));\n\n const updateValue = useCallback(\n (upValue: string) => {\n // let value = limitValueLength(upValue);\n onChange && onChange(upValue);\n setValue(upValue);\n },\n [onChange],\n );\n\n const handleChangeText = useCallback(\n (value: string) => {\n const filteredValue = props.returnKeyType !== \"next\" ? value.replace(/\\n/g, \"\") : value;\n updateValue(filteredValue);\n // Only apply cursor fix on iOS when text equals maxLength (indicating truncation)\n if (Platform.OS === \"ios\" && maxLength && value.length >= maxLength && inputRef.current) {\n // Use requestAnimationFrame instead of setTimeout\n requestAnimationFrame(() => {\n inputRef.current?.setNativeProps({\n selection: { start: maxLength, end: maxLength },\n });\n });\n }\n },\n [maxLength, updateValue],\n );\n\n const handleClear = useCallback(() => {\n setValue(\"\");\n updateValue(\"\");\n onClear && onClear(value);\n }, [onClear]);\n\n const handleFocus = useCallback(() => {\n if (readonly) {\n inputRef.current?.blur();\n }\n setFocused(true);\n onFocus && onFocus(value);\n }, [onFocus, readonly]);\n\n const handleBlur = useCallback(() => {\n setFocused(false);\n if (!readonly) {\n onBlur && onBlur(value);\n }\n }, [readonly, onBlur]);\n\n useEffect(() => {\n setValue(modelValue || \"\");\n }, [modelValue]);\n\n useEffect(() => {\n setShowClear(clearable && value.length > 0);\n }, [clearable, value]);\n\n useEffect(() => {\n setFocused(autofocus);\n }, [autofocus]);\n\n useEffect(() => {\n // setModelValueStringLength(runes(value).length);\n setModelValueStringLength(value.length);\n }, [value]);\n\n useEffect(() => {\n setShowActionArea(showClear || showCount);\n }, [showClear, showCount]);\n\n const textFieldColor = useMemo(() => {\n const ColorMap = {\n primary: themeColor.Primary2,\n normal: themeColor.Fill1,\n basic: themeColor.Bg,\n };\n return ColorMap[layout!];\n }, [layout]);\n\n const handleKeyPress = ({ nativeEvent }: any) => {\n if (nativeEvent.key === \"Enter\") {\n if (props.returnKeyType !== \"next\") {\n Keyboard.dismiss();\n }\n }\n };\n\n return (\n <View testID=\"wrapper\" style={[styles.wrapper, { backgroundColor: textFieldColor }, containerStyle]}>\n <TextInput\n testID=\"text-input\"\n ref={inputRef}\n style={[styles.input, { minHeight: rows * 24, height: \"auto\" }, style]}\n value={value}\n onChangeText={handleChangeText}\n onFocus={handleFocus}\n onBlur={handleBlur}\n editable={!readonly && !disabled}\n keyboardType={type}\n placeholder={placeholder}\n multiline\n returnKeyType={props.returnKeyType as any}\n autoFocus={focused}\n maxLength={maxLength}\n onKeyPress={handleKeyPress}\n onSubmitEditing={props.onSubmitEditing}\n selectionColor={styles.inputSelectionColor.color}\n placeholderTextColor={(placeholderTextColor || styles.inputPlaceHolder.color) as ColorValue}\n />\n {showActionArea && (\n <View style={[styles.ButtomActionArea]} testID=\"action-area\">\n {showCount && maxLength && (\n <View style={styles.rightItem}>\n <Text style={styles.count}>{`${Math.min(modelValueStringLength, maxLength)}/${maxLength}`}</Text>\n </View>\n )}\n {showClear && modelValueStringLength && focused && (\n <View style={styles.rightItem}>\n <TouchableWithoutFeedback onPress={handleClear}>\n <View style={styles.clearIconContainer}>\n <Text style={styles.clearIcon}>清空</Text>\n </View>\n </TouchableWithoutFeedback>\n </View>\n )}\n </View>\n )}\n </View>\n );\n});\n\n// @ts-ignore\nTextField.defaultProps = TextViewDefaultProps;\n\nexport default TextField;\n"],"names":["TextField","forwardRef","props","ref","_ref","type","modelValue","_ref$clearable","clearable","maxLength","_ref$disabled","disabled","readonly","_ref$autofocus","autofocus","_ref$showCount","showCount","placeholder","_ref$rows","rows","onFocus","onBlur","onChange","onClear","_ref$style","style","_ref$containerStyle","containerStyle","layout","actionLayout","placeholderTextColor","useMounted","styles","createStyles","_useState","useState","_useState2","_slicedToArray","focused","setFocused","_useState3","_useState4","value","setValue","_useState5","_useState6","modelValueStringLength","setModelValueStringLength","_useState7","_useState8","showClear","setShowClear","_useState9","_useState0","showActionArea","setShowActionArea","inputRef","useRef","themeColor","useThemeColor","useCallback","valueLength","runes","length","mValue","substr","useImperativeHandle","textInputRef","updateValue","upValue","handleChangeText","filteredValue","returnKeyType","replace","Platform","OS","current","requestAnimationFrame","_inputRef$current","setNativeProps","selection","start","end","handleClear","handleFocus","_inputRef$current2","blur","handleBlur","useEffect","textFieldColor","useMemo","ColorMap","primary","Primary2","normal","Fill1","basic","Bg","handleKeyPress","_ref2","nativeEvent","key","Keyboard","dismiss","React","createElement","View","testID","wrapper","backgroundColor","TextInput","input","minHeight","height","onChangeText","editable","keyboardType","multiline","autoFocus","onKeyPress","onSubmitEditing","selectionColor","inputSelectionColor","color","inputPlaceHolder","ButtomActionArea","rightItem","Text","count","concat","Math","min","TouchableWithoutFeedback","onPress","clearIconContainer","clearIcon","defaultProps","TextViewDefaultProps"],"mappings":";;;;;;;;;;;;;;AAQMA,IAAAA,SAAY,gBAAAC,UAAA,CAAW,UAACC,KAAA,EAAqBC,GAAQ,EAAA;AACnD,EAAA,IAAAC,IAAA,GAoBFF,SAAS,EAAC;IAnBZG,IAAA,GAAAD,IAAA,CAAAC,IAAA;IACAC,UAAA,GAAAF,IAAA,CAAAE,UAAA;IAAAC,cAAA,GAAAH,IAAA,CACAI,SAAY;AAAZA,IAAAA,SAAY,GAAAD,cAAA,KAAA,KAAA,CAAA,GAAA,KAAA,GAAAA,cAAA;IACZE,SAAA,GAAAL,IAAA,CAAAK,SAAA;IAAAC,aAAA,GAAAN,IAAA,CACAO,QAAW;AAAXA,IAAAA,QAAW,GAAAD,aAAA,KAAA,KAAA,CAAA,GAAA,KAAA,GAAAA,aAAA;IACXE,QAAA,GAAAR,IAAA,CAAAQ,QAAA;IAAAC,cAAA,GAAAT,IAAA,CACAU,SAAY;AAAZA,IAAAA,SAAY,GAAAD,cAAA,KAAA,KAAA,CAAA,GAAA,KAAA,GAAAA,cAAA;IAAAE,cAAA,GAAAX,IAAA,CACZY,SAAY;AAAZA,IAAAA,SAAY,GAAAD,cAAA,KAAA,KAAA,CAAA,GAAA,KAAA,GAAAA,cAAA;IACZE,WAAA,GAAAb,IAAA,CAAAa,WAAA;IAAAC,SAAA,GAAAd,IAAA,CACAe,IAAO;AAAPA,IAAAA,IAAO,GAAAD,SAAA,KAAA,KAAA,CAAA,GAAA,CAAA,GAAAA,SAAA;IACPE,OA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A;IAAAjF,KAAA,EAAOO,MAAO,CAAA8F,SAAAA;AAAA,GAAA,iBACjBtB,KAAA,CAAAC,aAAA,CAAA2B,wBAAA,EAAA;AAAyBC,IAAAA,OAAS,EAAAlD,WAAAA;AAAA,GAAA,iBAChCqB,KAAA,CAAAC,aAAA,CAAAC,IAAA,EAAA;IAAKjF,KAAO,EAAAO,MAAA,CAAOsG,kBAAAA;AAClB,GAAA,iBAAA9B,KAAA,CAAAC,aAAA,CAACsB,IAAK,EAAA;IAAAtG,KAAA,EAAOO,MAAO,CAAAuG,SAAAA;AAAA,GAAA,EAAW,cAAE,CACnC,CACF,CACF,CAEJ,CAEJ,CAAA,CAAA;AAEJ,CAAC,EAAA;AAGDvI,SAAA,CAAUwI,YAAe,GAAAC,oBAAA;;;;"}
1
+ {"version":3,"file":"TextView.js","sources":["../../../../src/components/TextView/TextView.tsx"],"sourcesContent":["import { useState, useRef, useEffect, useCallback, useMemo, forwardRef, useImperativeHandle } from \"react\";\nimport { TextInput, View, Text, TouchableWithoutFeedback, ColorValue, Keyboard, Platform } from \"react-native\";\nimport { TextViewDefaultProps, RedsTextView } from \"./interface\";\nimport createStyles from \"./styles\";\nimport runes from \"runes\";\nimport useMounted from \"../../pvCount/useUnmountedProcess\";\nimport { useThemeColor } from \"../ConfigProvider\";\n\nconst TextField = forwardRef((props: RedsTextView, ref) => {\n const {\n type,\n modelValue,\n clearable = false,\n maxLength,\n disabled = false,\n readonly,\n autofocus = false,\n showCount = false,\n placeholder,\n rows = 3,\n onFocus,\n onBlur,\n onChange,\n onClear,\n style = {},\n containerStyle = {},\n layout,\n actionLayout,\n placeholderTextColor,\n } = props || {};\n useMounted(\"TextView\");\n const styles = createStyles(disabled, actionLayout || \"vertical\");\n const [focused, setFocused] = useState(autofocus);\n const [value, setValue] = useState(modelValue || \"\");\n const [modelValueStringLength, setModelValueStringLength] = useState(0);\n const [showClear, setShowClear] = useState(false);\n const [showActionArea, setShowActionArea] = useState(false);\n const inputRef = useRef<TextInput>(null);\n const themeColor = useThemeColor();\n\n const limitValueLength = useCallback(\n (value: string) => {\n const valueLength = runes(value || \"\").length;\n if (typeof maxLength === \"number\" && valueLength > maxLength) {\n const mValue = value;\n if (mValue && modelValueStringLength === +maxLength) {\n return mValue;\n }\n return runes.substr(value, 0, +maxLength);\n }\n return value;\n },\n [maxLength],\n );\n\n useImperativeHandle(ref, () => ({\n textInputRef: inputRef,\n }));\n\n const updateValue = useCallback(\n (upValue: string) => {\n // let value = limitValueLength(upValue);\n onChange && onChange(upValue);\n setValue(upValue);\n },\n [onChange],\n );\n\n const handleChangeText = useCallback(\n (value: string) => {\n updateValue(value);\n // Only apply cursor fix on iOS when text equals maxLength (indicating truncation)\n if (Platform.OS === \"ios\" && maxLength && value.length >= maxLength && inputRef.current) {\n // Use requestAnimationFrame instead of setTimeout\n requestAnimationFrame(() => {\n inputRef.current?.setNativeProps({\n selection: { start: maxLength, end: maxLength },\n });\n });\n }\n },\n [maxLength, updateValue],\n );\n\n const handleClear = useCallback(() => {\n setValue(\"\");\n updateValue(\"\");\n onClear && onClear(value);\n }, [onClear]);\n\n const handleFocus = useCallback(() => {\n if (readonly) {\n inputRef.current?.blur();\n }\n setFocused(true);\n onFocus && onFocus(value);\n }, [onFocus, readonly]);\n\n const handleBlur = useCallback(() => {\n setFocused(false);\n if (!readonly) {\n onBlur && onBlur(value);\n }\n }, [readonly, onBlur]);\n\n useEffect(() => {\n setValue(modelValue || \"\");\n }, [modelValue]);\n\n useEffect(() => {\n setShowClear(clearable && value.length > 0);\n }, [clearable, value]);\n\n useEffect(() => {\n setFocused(autofocus);\n }, [autofocus]);\n\n useEffect(() => {\n // setModelValueStringLength(runes(value).length);\n setModelValueStringLength(value.length);\n }, [value]);\n\n useEffect(() => {\n setShowActionArea(showClear || showCount);\n }, [showClear, showCount]);\n\n const textFieldColor = useMemo(() => {\n const ColorMap = {\n primary: themeColor.Primary2,\n normal: themeColor.Fill1,\n basic: themeColor.Bg,\n };\n return ColorMap[layout!];\n }, [layout]);\n\n const handleKeyPress = ({ nativeEvent }: any) => {\n if (nativeEvent.key === \"Enter\" && props.returnKeyType !== \"next\") {\n Keyboard.dismiss();\n }\n };\n\n return (\n <View testID=\"wrapper\" style={[styles.wrapper, { backgroundColor: textFieldColor }, containerStyle]}>\n <TextInput\n testID=\"text-input\"\n ref={inputRef}\n style={[styles.input, { minHeight: rows * 24, height: \"auto\" }, style]}\n value={value}\n onChangeText={handleChangeText}\n onFocus={handleFocus}\n onBlur={handleBlur}\n editable={!readonly && !disabled}\n keyboardType={type}\n placeholder={placeholder}\n multiline\n returnKeyType={props.returnKeyType as any}\n autoFocus={focused}\n maxLength={maxLength}\n onKeyPress={handleKeyPress}\n onSubmitEditing={props.onSubmitEditing}\n selectionColor={styles.inputSelectionColor.color}\n placeholderTextColor={(placeholderTextColor || styles.inputPlaceHolder.color) as ColorValue}\n />\n {showActionArea && (\n <View style={[styles.ButtomActionArea]} testID=\"action-area\">\n {showCount && maxLength && (\n <View style={styles.rightItem}>\n <Text style={styles.count}>{`${Math.min(modelValueStringLength, maxLength)}/${maxLength}`}</Text>\n </View>\n )}\n {showClear && modelValueStringLength && focused && (\n <View style={styles.rightItem}>\n <TouchableWithoutFeedback onPress={handleClear}>\n <View style={styles.clearIconContainer}>\n <Text style={styles.clearIcon}>清空</Text>\n </View>\n </TouchableWithoutFeedback>\n </View>\n )}\n </View>\n )}\n </View>\n );\n});\n\n// @ts-ignore\nTextField.defaultProps = TextViewDefaultProps;\n\nexport default TextField;\n"],"names":["TextField","forwardRef","props","ref","_ref","type","modelValue","_ref$clearable","clearable","maxLength","_ref$disabled","disabled","readonly","_ref$autofocus","autofocus","_ref$showCount","showCount","placeholder","_ref$rows","rows","onFocus","onBlur","onChange","onClear","_ref$style","style","_ref$containerStyle","containerStyle","layout","actionLayout","placeholderTextColor","useMounted","styles","createStyles","_useState","useState","_useState2","_slicedToArray","focused","setFocused","_useState3","_useState4","value","setValue","_useState5","_useState6","modelValueStringLength","setModelValueStringLength","_useState7","_useState8","showClear","setShowClear","_useState9","_useState0","showActionArea","setShowActionArea","inputRef","useRef","themeColor","useThemeColor","useCallback","valueLength","runes","length","mValue","substr","useImperativeHandle","textInputRef","updateValue","upValue","handleChangeText","Platform","OS","current","requestAnimationFrame","_inputRef$current","setNativeProps","selection","start","end","handleClear","handleFocus","_inputRef$current2","blur","handleBlur","useEffect","textFieldColor","useMemo","ColorMap","primary","Primary2","normal","Fill1","basic","Bg","handleKeyPress","_ref2","nativeEvent","key","returnKeyType","Keyboard","dismiss","React","createElement","View","testID","wrapper","backgroundColor","TextInput","input","minHeight","height","onChangeText","editable","keyboardType","multiline","autoFocus","onKeyPress","onSubmitEditing","selectionColor","inputSelectionColor","color","inputPlaceHolder","ButtomActionArea","rightItem","Text","count","concat","Math","min","TouchableWithoutFeedback","onPress","clearIconContainer","clearIcon","defaultProps","TextViewDefaultProps"],"mappings":";;;;;;;;;;;;;;AAQMA,IAAAA,SAAY,gBAAAC,UAAA,CAAW,UAACC,KAAA,EAAqBC,GAAQ,EAAA;AACnD,EAAA,IAAAC,IAAA,GAoBFF,SAAS,EAAC;IAnBZG,IAAA,GAAAD,IAAA,CAAAC,IAAA;IACAC,UAAA,GAAAF,IAAA,CAAAE,UAAA;IAAAC,cAAA,GAAAH,IAAA,CACAI,SAAY;AAAZA,IAAAA,SAAY,GAAAD,cAAA,KAAA,KAAA,CAAA,GAAA,KAAA,GAAAA,cAAA;IACZE,SAAA,GAAAL,IAAA,CAAAK,SAAA;IAAAC,aAAA,GAAAN,IAAA,CACAO,QAAW;AAAXA,IAAAA,QAAW,GAAAD,aAAA,KAAA,KAAA,CAAA,GAAA,KAAA,GAAAA,aAAA;IACXE,QAAA,GAAAR,IAAA,CAAAQ,QAAA;IAAAC,cAAA,GAAAT,IAAA,CACAU,SAAY;AAAZA,IAAAA,SAAY,GAAAD,cAAA,KAAA,KAAA,CAAA,GAAA,KAAA,GAAAA,cAAA;IAAAE,cAAA,GAAAX,IAAA,C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AAa,IAAAJ,sBAAA,IAA0BR,OACtC,mBAAAgE,KAAA,CAAAC,aAAA,CAACC,IAAK,EAAA;IAAA/E,KAAA,EAAOO,MAAO,CAAA4F,SAAAA;AAAA,GAAA,iBACjBtB,KAAA,CAAAC,aAAA,CAAA2B,wBAAA,EAAA;AAAyBC,IAAAA,OAAS,EAAAnD,WAAAA;AAAA,GAAA,iBAChCsB,KAAA,CAAAC,aAAA,CAAAC,IAAA,EAAA;IAAK/E,KAAO,EAAAO,MAAA,CAAOoG,kBAAAA;AAClB,GAAA,iBAAA9B,KAAA,CAAAC,aAAA,CAACsB,IAAK,EAAA;IAAApG,KAAA,EAAOO,MAAO,CAAAqG,SAAAA;AAAA,GAAA,EAAW,cAAE,CACnC,CACF,CACF,CAEJ,CAEJ,CAAA,CAAA;AAEJ,CAAC,EAAA;AAGDrI,SAAA,CAAUsI,YAAe,GAAAC,oBAAA;;;;"}
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { RedsSlider } from "./interface/index";
3
3
  declare const Slider: {
4
- ({ defaultValue, min, max, initalValue, onValueChange, dotStyle, step, }: RedsSlider): React.JSX.Element;
4
+ ({ defaultValue, min, max, initalValue, onValueChange, dotStyle }: RedsSlider): React.JSX.Element;
5
5
  defaultProps: {
6
6
  value: number;
7
7
  min: number;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { RedsSlider } from "./interface/index";
3
3
  declare const Slider: {
4
- ({ defaultValue, min, max, initalValue, onValueChange, dotStyle, step, }: RedsSlider): React.JSX.Element | undefined;
4
+ ({ defaultValue, min, max, initalValue, onValueChange, dotStyle }: RedsSlider): React.JSX.Element | undefined;
5
5
  defaultProps: {
6
6
  value: number;
7
7
  min: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xhsreds/reds-rn-next",
3
- "version": "0.10.1-beta202511201716",
3
+ "version": "0.10.1-fix-pull-refresh-animated202511211152",
4
4
  "author": "贾斌(呀哈) <jiabin@xiaohongshu.com>",
5
5
  "license": "ISC",
6
6
  "dependencies": {
@@ -26,7 +26,7 @@
26
26
  "react-native-fs": "2.20.0",
27
27
  "react-native-svg": "13.14.0",
28
28
  "@xhs/react-native-harmony": "*",
29
- "@xhsreds/reds-token-next": "0.10.1-beta202511201716"
29
+ "@xhsreds/reds-token-next": "0.10.0"
30
30
  },
31
31
  "peerDependenciesMeta": {
32
32
  "ozone-schema-web": {
@@ -296,11 +296,14 @@ export default function PullRefresh(props: RedsPullRefresh) {
296
296
 
297
297
  // 重写ScrollView的onScroll事件(自定义:用于手势门控/头部位置; Android 原生:注入 RefreshControl)
298
298
  const scrollContent = useMemo(() => {
299
- return React.Children.map(props.children, (child: any) =>
300
- React.cloneElement(child, {
301
- // 设置滚动响应频率
302
- scrollEventThrottle: 1,
303
- ...(Platform.OS === "android" && props.nativeAndroidPullRefresh
299
+ return React.Children.map(props.children, (child: any) => {
300
+ const originalOnScroll = child.props.onScroll;
301
+ const hasNativeDriver =
302
+ originalOnScroll &&
303
+ (originalOnScroll["__isNative"] === true || (originalOnScroll as any)?._animation?.useNativeDriver === true);
304
+
305
+ const injectedProps =
306
+ Platform.OS === "android" && props.nativeAndroidPullRefresh
304
307
  ? {
305
308
  refreshControl: (
306
309
  <RNRefreshControl
@@ -326,37 +329,70 @@ export default function PullRefresh(props: RedsPullRefresh) {
326
329
  />
327
330
  ),
328
331
  onScroll: (evt: any) => {
329
- if (child.props.onScroll && typeof child.props.onScroll === "function") {
330
- child.props.onScroll(evt);
332
+ if (originalOnScroll && typeof originalOnScroll === "function") {
333
+ originalOnScroll(evt);
331
334
  }
332
335
  },
333
336
  }
334
- : {
335
- onScroll: (evt: any) => {
336
- setScrollY(evt.nativeEvent.contentOffset.y);
337
- // iOS下拉刷新Loading时,ScrollView向上滑动的时候,refreshControl部分同样上滑
338
- if (pullState === PullState.LOADING && evt.nativeEvent.contentOffset.y > 0) {
339
- const y = Math.max(0, pullAnimHeight - evt.nativeEvent.contentOffset.y);
340
- viewRef.current &&
341
- viewRef.current.setNativeProps({
342
- style: {
343
- transform: [{ translateY: y }],
344
- },
345
- });
346
- animatedViewRef.current &&
347
- animatedViewRef.current.setNativeProps({
348
- style: {
349
- transform: [{ translateY: y }],
350
- },
351
- });
352
- }
353
- if (child.props.onScroll && typeof child.props.onScroll === "function") {
354
- child.props.onScroll(evt);
355
- }
356
- },
357
- }),
358
- }),
359
- );
337
+ : hasNativeDriver
338
+ ? {
339
+ // When the child uses native-driver Animated.event, keep it intact to avoid crashes
340
+ onScroll: originalOnScroll,
341
+ onMomentumScrollEnd: (evt: any) => {
342
+ setScrollY(evt.nativeEvent.contentOffset.y);
343
+ child.props.onMomentumScrollEnd && child.props.onMomentumScrollEnd(evt);
344
+ },
345
+ onScrollEndDrag: (evt: any) => {
346
+ setScrollY(evt.nativeEvent.contentOffset.y);
347
+ // Keep header position in loading state
348
+ if (pullState === PullState.LOADING && evt.nativeEvent.contentOffset.y > 0) {
349
+ const y = Math.max(0, pullAnimHeight - evt.nativeEvent.contentOffset.y);
350
+ viewRef.current &&
351
+ viewRef.current.setNativeProps({
352
+ style: {
353
+ transform: [{ translateY: y }],
354
+ },
355
+ });
356
+ animatedViewRef.current &&
357
+ animatedViewRef.current.setNativeProps({
358
+ style: {
359
+ transform: [{ translateY: y }],
360
+ },
361
+ });
362
+ }
363
+ child.props.onScrollEndDrag && child.props.onScrollEndDrag(evt);
364
+ },
365
+ }
366
+ : {
367
+ onScroll: (evt: any) => {
368
+ setScrollY(evt.nativeEvent.contentOffset.y);
369
+ // iOS下拉刷新Loading时,ScrollView向上滑动的时候,refreshControl部分同样上滑
370
+ if (pullState === PullState.LOADING && evt.nativeEvent.contentOffset.y > 0) {
371
+ const y = Math.max(0, pullAnimHeight - evt.nativeEvent.contentOffset.y);
372
+ viewRef.current &&
373
+ viewRef.current.setNativeProps({
374
+ style: {
375
+ transform: [{ translateY: y }],
376
+ },
377
+ });
378
+ animatedViewRef.current &&
379
+ animatedViewRef.current.setNativeProps({
380
+ style: {
381
+ transform: [{ translateY: y }],
382
+ },
383
+ });
384
+ }
385
+ if (originalOnScroll && typeof originalOnScroll === "function") {
386
+ originalOnScroll(evt);
387
+ }
388
+ },
389
+ };
390
+
391
+ return React.cloneElement(child, {
392
+ scrollEventThrottle: 1,
393
+ ...injectedProps,
394
+ });
395
+ });
360
396
  }, [
361
397
  pullState,
362
398
  props.children,
@@ -64,9 +64,9 @@ const Radio = (props: RedsRadio) => {
64
64
  const labelStyle = getLabelStyle(disabled || parent?.disabled, size, parent?.direction);
65
65
 
66
66
  const iconSizeMap: Record<"small" | "medium" | "large", number> = {
67
- small: 12,
68
- medium: 16,
69
- large: 20,
67
+ small: 16,
68
+ medium: 20,
69
+ large: 24,
70
70
  };
71
71
 
72
72
  const rightStyle = getRightIconStyle(size);
@@ -2,9 +2,9 @@ import { StyleSheet, ViewStyle, TextStyle, DimensionValue } from "react-native";
2
2
  import { useThemeColor } from "../ConfigProvider";
3
3
  import { typography } from "@xhs/reds-token-next";
4
4
  const iconSizeMap: Record<"small" | "medium" | "large" | string, number> = {
5
- small: 12,
6
- medium: 16,
7
- large: 20,
5
+ small: typography.B1FontSize,
6
+ medium: typography.H3FontSize,
7
+ large: typography.H2FontSize,
8
8
  };
9
9
  const fontSizeMap: Record<"small" | "medium" | "large", number> = {
10
10
  small: 12,
@@ -43,6 +43,7 @@ export const getContainerStyle = (direction?: string | undefined, position?: "le
43
43
  alignItems: "center",
44
44
  justifyContent: "flex-start",
45
45
  backgroundColor: direction === "vertical" ? themeColor.Bg : undefined,
46
+ paddingHorizontal: 16,
46
47
  };
47
48
  };
48
49
 
@@ -98,6 +99,7 @@ export const getLabelStyle = (
98
99
 
99
100
  return {
100
101
  color: disabled ? themeColor.Disabled : themeColor.Title,
102
+ lineHeight: iconSizeMap[size],
101
103
  fontSize: fontSizeMap[size],
102
104
  marginRight: direction === "horizontal" ? 8 : 0,
103
105
  };
@@ -402,127 +402,123 @@ const AnimatedSheets = forwardRef((props: RedsSheets, ref) => {
402
402
  ) : (
403
403
  <></>
404
404
  )}
405
- {_visible ? (
406
- <Animated.View
407
- testID="Sheets"
408
- style={[
409
- styles.picker,
410
- { backgroundColor: themeColor.Bg2 },
411
- {
412
- height: sheetsHeight,
413
- transform: [{ translateY }],
414
- },
415
- { zIndex: props.zIndex },
416
- props.sheetsStyle,
417
- ]}
418
- >
419
- {props.header ? <View onLayout={handleLabelLayout}>{props.header}</View> : <></>}
420
- {/** normal */}
421
- {showLabel && !props.header ? (
422
- <View
423
- style={[
424
- props.headlerLayout === "center" ? styles.labelContainer : styles.leftLabelContainer,
425
- { backgroundColor: themeColor.Bg2 },
426
- props.headerStyle,
427
- ]}
428
- onLayout={handleLabelLayout}
429
- >
430
- {!cancel ? (
431
- props.headlerLayout === "center" ? (
432
- <Block />
433
- ) : (
434
- <></>
435
- )
436
- ) : (
437
- <TouchableOpacity onPress={handleCancel} activeOpacity={1}>
438
- {cancelType === SheetsActionType.text ? (
439
- <Text style={[styles.cancel, { color: themeColor.Title }]} testID="cancel">
440
- {cancelText || cancelKey}
441
- </Text>
442
- ) : (
443
- iconWrapper("cancel")
444
- )}
445
- </TouchableOpacity>
446
- )}
447
- {label ? (
448
- <Text style={[styles.label, { color: themeColor.Title }]}>
449
- {label}
450
- {showMask}
451
- </Text>
405
+ <Animated.View
406
+ testID="Sheets"
407
+ style={[
408
+ styles.picker,
409
+ { backgroundColor: themeColor.Bg2 },
410
+ {
411
+ height: sheetsHeight,
412
+ transform: [{ translateY }],
413
+ },
414
+ { zIndex: props.zIndex },
415
+ props.sheetsStyle,
416
+ ]}
417
+ >
418
+ {props.header ? <View onLayout={handleLabelLayout}>{props.header}</View> : <></>}
419
+ {/** normal */}
420
+ {showLabel && !props.header ? (
421
+ <View
422
+ style={[
423
+ props.headlerLayout === "center" ? styles.labelContainer : styles.leftLabelContainer,
424
+ { backgroundColor: themeColor.Bg2 },
425
+ props.headerStyle,
426
+ ]}
427
+ onLayout={handleLabelLayout}
428
+ >
429
+ {!cancel ? (
430
+ props.headlerLayout === "center" ? (
431
+ <Block />
452
432
  ) : (
453
433
  <></>
454
- )}
455
- {!close ? (
456
- props.headlerLayout === "center" ? (
457
- <Block />
458
- ) : (
459
- <></>
460
- )
461
- ) : (
462
- <TouchableOpacity onPress={handleConfirm} activeOpacity={1}>
463
- {closeType === SheetsActionType.text ? (
464
- <View>
465
- <Text
466
- style={[
467
- styles.confirm,
468
- { color: themeColor.Primary },
469
- { elevation: 0, shadowColor: "transparent" },
470
- ]}
471
- testID="close"
472
- >
473
- {closeText || sureKey}
474
- </Text>
475
- </View>
476
- ) : (
477
- iconWrapper("confirm")
478
- )}
479
- </TouchableOpacity>
480
- )}
481
- </View>
482
- ) : (
483
- <></>
484
- )}
485
-
486
- {/** 拖拽按钮 */}
487
- {sheetsType === SheetsType.dragable && !props.header ? (
488
- <Animated.View style={[styles.dragableContainer]} {...panResponder.panHandlers} testID={"draggable"}>
489
- <View style={[styles.dragable, { backgroundColor: themeColor.Fill3 }]} />
490
- </Animated.View>
491
- ) : (
492
- <></>
493
- )}
494
-
495
- <View onLayout={handleLayout}>{children}</View>
496
-
497
- {/** action */}
498
- {showAction ? (
499
- <View style={[styles.actionContainer]} onLayout={handleActionLayout}>
500
- {cancel ? (
501
- <View style={styles.action}>
502
- <Button block onClick={handleCancel}>
434
+ )
435
+ ) : (
436
+ <TouchableOpacity onPress={handleCancel} activeOpacity={1}>
437
+ {cancelType === SheetsActionType.text ? (
438
+ <Text style={[styles.cancel, { color: themeColor.Title }]} testID="cancel">
503
439
  {cancelText || cancelKey}
504
- </Button>
505
- </View>
506
- ) : (
507
- <></>
508
- )}
509
- {close ? (
510
- <View style={styles.action}>
511
- <Button block onClick={handleConfirm} type="primary">
512
- {closeText || sureKey}
513
- </Button>
514
- </View>
440
+ </Text>
441
+ ) : (
442
+ iconWrapper("cancel")
443
+ )}
444
+ </TouchableOpacity>
445
+ )}
446
+ {label ? (
447
+ <Text style={[styles.label, { color: themeColor.Title }]}>
448
+ {label}
449
+ {showMask}
450
+ </Text>
451
+ ) : (
452
+ <></>
453
+ )}
454
+ {!close ? (
455
+ props.headlerLayout === "center" ? (
456
+ <Block />
515
457
  ) : (
516
458
  <></>
517
- )}
518
- </View>
519
- ) : (
520
- <></>
521
- )}
522
- </Animated.View>
523
- ) : (
524
- <></>
525
- )}
459
+ )
460
+ ) : (
461
+ <TouchableOpacity onPress={handleConfirm} activeOpacity={1}>
462
+ {closeType === SheetsActionType.text ? (
463
+ <View>
464
+ <Text
465
+ style={[
466
+ styles.confirm,
467
+ { color: themeColor.Primary },
468
+ { elevation: 0, shadowColor: "transparent" },
469
+ ]}
470
+ testID="close"
471
+ >
472
+ {closeText || sureKey}
473
+ </Text>
474
+ </View>
475
+ ) : (
476
+ iconWrapper("confirm")
477
+ )}
478
+ </TouchableOpacity>
479
+ )}
480
+ </View>
481
+ ) : (
482
+ <></>
483
+ )}
484
+
485
+ {/** 拖拽按钮 */}
486
+ {sheetsType === SheetsType.dragable && !props.header ? (
487
+ <Animated.View style={[styles.dragableContainer]} {...panResponder.panHandlers} testID={"draggable"}>
488
+ <View style={[styles.dragable, { backgroundColor: themeColor.Fill3 }]} />
489
+ </Animated.View>
490
+ ) : (
491
+ <></>
492
+ )}
493
+
494
+ <View onLayout={handleLayout}>{children}</View>
495
+
496
+ {/** action */}
497
+ {showAction ? (
498
+ <View style={[styles.actionContainer]} onLayout={handleActionLayout}>
499
+ {cancel ? (
500
+ <View style={styles.action}>
501
+ <Button block onClick={handleCancel}>
502
+ {cancelText || cancelKey}
503
+ </Button>
504
+ </View>
505
+ ) : (
506
+ <></>
507
+ )}
508
+ {close ? (
509
+ <View style={styles.action}>
510
+ <Button block onClick={handleConfirm} type="primary">
511
+ {closeText || sureKey}
512
+ </Button>
513
+ </View>
514
+ ) : (
515
+ <></>
516
+ )}
517
+ </View>
518
+ ) : (
519
+ <></>
520
+ )}
521
+ </Animated.View>
526
522
  </>
527
523
  );
528
524
  });