@xhsreds/reds-rn-next 0.10.1-beta202511241537 → 0.10.1-fix-pull-refresh202511272002
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.
- package/coverage/.tmp/coverage-0.json +1 -1
- package/coverage/.tmp/coverage-1.json +1 -1
- package/coverage/.tmp/coverage-10.json +1 -1
- package/coverage/.tmp/coverage-11.json +1 -1
- package/coverage/.tmp/coverage-12.json +1 -1
- package/coverage/.tmp/coverage-13.json +1 -1
- package/coverage/.tmp/coverage-14.json +1 -1
- package/coverage/.tmp/coverage-15.json +1 -1
- package/coverage/.tmp/coverage-16.json +1 -1
- package/coverage/.tmp/coverage-17.json +1 -1
- package/coverage/.tmp/coverage-18.json +1 -1
- package/coverage/.tmp/coverage-2.json +1 -1
- package/coverage/.tmp/coverage-20.json +1 -1
- package/coverage/.tmp/coverage-22.json +1 -1
- package/coverage/.tmp/coverage-23.json +1 -1
- package/coverage/.tmp/coverage-24.json +1 -1
- package/coverage/.tmp/coverage-25.json +1 -1
- package/coverage/.tmp/coverage-26.json +1 -1
- package/coverage/.tmp/coverage-27.json +1 -1
- package/coverage/.tmp/coverage-29.json +1 -1
- package/coverage/.tmp/coverage-3.json +1 -1
- package/coverage/.tmp/coverage-30.json +1 -1
- package/coverage/.tmp/coverage-31.json +1 -1
- package/coverage/.tmp/coverage-32.json +1 -1
- package/coverage/.tmp/coverage-33.json +1 -1
- package/coverage/.tmp/coverage-34.json +1 -1
- package/coverage/.tmp/coverage-35.json +1 -1
- package/coverage/.tmp/coverage-36.json +1 -1
- package/coverage/.tmp/coverage-37.json +1 -1
- package/coverage/.tmp/coverage-38.json +1 -1
- package/coverage/.tmp/coverage-39.json +1 -1
- package/coverage/.tmp/coverage-4.json +1 -1
- package/coverage/.tmp/coverage-40.json +1 -1
- package/coverage/.tmp/coverage-41.json +1 -1
- package/coverage/.tmp/coverage-42.json +1 -1
- package/coverage/.tmp/coverage-5.json +1 -1
- package/coverage/.tmp/coverage-6.json +1 -1
- package/coverage/.tmp/coverage-7.json +1 -1
- package/coverage/.tmp/coverage-8.json +1 -1
- package/coverage/.tmp/coverage-9.json +1 -1
- package/lib/cjs/components/Avatar/styles.js +5 -5
- package/lib/cjs/components/Avatar/styles.js.map +1 -1
- package/lib/cjs/components/AvatarGroup/AvatarGroup.js +1 -1
- package/lib/cjs/components/BottomBar/styles.js +1 -1
- package/lib/cjs/components/BottomBar/styles.js.map +1 -1
- package/lib/cjs/components/PickerView/Wheel.js +15 -21
- package/lib/cjs/components/PickerView/Wheel.js.map +1 -1
- package/lib/cjs/components/PullRefresh/PullRefresh.js +55 -10
- package/lib/cjs/components/PullRefresh/PullRefresh.js.map +1 -1
- package/lib/cjs/components/Radio/Radio.js +3 -3
- package/lib/cjs/components/Radio/Radio.js.map +1 -1
- package/lib/cjs/components/Radio/styles.js +7 -5
- package/lib/cjs/components/Radio/styles.js.map +1 -1
- package/lib/cjs/components/Sheets/AnimatedSheets.js +2 -2
- package/lib/cjs/components/Sheets/AnimatedSheets.js.map +1 -1
- package/lib/cjs/components/Slider/Slider.js +34 -74
- package/lib/cjs/components/Slider/Slider.js.map +1 -1
- package/lib/cjs/components/TextView/TextView.js +3 -6
- package/lib/cjs/components/TextView/TextView.js.map +1 -1
- package/lib/esm/components/Avatar/styles.js +5 -5
- package/lib/esm/components/Avatar/styles.js.map +1 -1
- package/lib/esm/components/AvatarGroup/AvatarGroup.js +1 -1
- package/lib/esm/components/BottomBar/styles.js +1 -1
- package/lib/esm/components/BottomBar/styles.js.map +1 -1
- package/lib/esm/components/PickerView/Wheel.js +15 -21
- package/lib/esm/components/PickerView/Wheel.js.map +1 -1
- package/lib/esm/components/PullRefresh/PullRefresh.js +55 -10
- package/lib/esm/components/PullRefresh/PullRefresh.js.map +1 -1
- package/lib/esm/components/Radio/Radio.js +3 -3
- package/lib/esm/components/Radio/Radio.js.map +1 -1
- package/lib/esm/components/Radio/styles.js +7 -5
- package/lib/esm/components/Radio/styles.js.map +1 -1
- package/lib/esm/components/Sheets/AnimatedSheets.js +2 -2
- package/lib/esm/components/Sheets/AnimatedSheets.js.map +1 -1
- package/lib/esm/components/Slider/Slider.js +36 -76
- package/lib/esm/components/Slider/Slider.js.map +1 -1
- package/lib/esm/components/TextView/TextView.js +3 -6
- package/lib/esm/components/TextView/TextView.js.map +1 -1
- package/lib/src/components/BottomBar/styles.d.ts +1 -1
- package/lib/src/components/Slider/Slider.d.ts +1 -1
- package/lib/types/components/BottomBar/styles.d.ts +1 -1
- package/lib/types/components/Slider/Slider.d.ts +1 -1
- package/package.json +2 -2
- package/src/components/Avatar/styles.ts +4 -5
- package/src/components/BottomBar/styles.ts +1 -1
- package/src/components/DatePicker/demo/index.tsx +0 -26
- package/src/components/PickerView/Wheel.tsx +11 -14
- package/src/components/PullRefresh/PullRefresh.tsx +76 -33
- package/src/components/Radio/Radio.tsx +3 -3
- package/src/components/Radio/styles.ts +5 -3
- package/src/components/Sheets/AnimatedSheets.tsx +112 -116
- package/src/components/Slider/Slider.tsx +37 -103
- package/src/components/Slider/demo/index.tsx +0 -18
- package/src/components/TextView/TextView.tsx +3 -6
- package/src/components/TextView/demo/index.tsx +1 -1
- package/src/i18n/@types/resources.d.ts +18 -18
- package/src/i18n/index.json +31 -31
|
@@ -402,127 +402,123 @@ const AnimatedSheets = forwardRef((props: RedsSheets, ref) => {
|
|
|
402
402
|
) : (
|
|
403
403
|
<></>
|
|
404
404
|
)}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
>
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
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
|
-
|
|
456
|
-
|
|
457
|
-
|
|
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
|
-
</
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
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
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
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
|
});
|
|
@@ -15,17 +15,10 @@ import { RedsSlider, SliderDefaultProps } from "./interface/index";
|
|
|
15
15
|
import styles from "./styles";
|
|
16
16
|
import useMounted from "../../pvCount/useUnmountedProcess";
|
|
17
17
|
|
|
18
|
-
const Slider = ({
|
|
19
|
-
defaultValue,
|
|
20
|
-
min = 0,
|
|
21
|
-
max = 100,
|
|
22
|
-
initalValue = 0,
|
|
23
|
-
onValueChange,
|
|
24
|
-
dotStyle = {},
|
|
25
|
-
step = 1,
|
|
26
|
-
}: RedsSlider) => {
|
|
18
|
+
const Slider = ({ defaultValue, min = 0, max = 100, initalValue = 0, onValueChange, dotStyle = {} }: RedsSlider) => {
|
|
27
19
|
useMounted("Slider");
|
|
28
|
-
const [
|
|
20
|
+
const [panResponder, setPanResponder] = useState(PanResponder.create({}));
|
|
21
|
+
const [sliderWidth, setSliderWidth] = useState(Dimensions.get("window").width * 0.8);
|
|
29
22
|
const [value, setValue] = useState(initalValue);
|
|
30
23
|
|
|
31
24
|
if (max < min) {
|
|
@@ -35,109 +28,51 @@ const Slider = ({
|
|
|
35
28
|
return;
|
|
36
29
|
}
|
|
37
30
|
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
(rawValue: number) => {
|
|
41
|
-
const steppedValue = Math.round((rawValue - min) / step) * step + min;
|
|
42
|
-
return Math.max(min, Math.min(max, steppedValue));
|
|
43
|
-
},
|
|
44
|
-
[min, max, step],
|
|
45
|
-
);
|
|
46
|
-
|
|
31
|
+
const thumbPosition = (value / (max - min)) * sliderWidth;
|
|
32
|
+
const step = 1;
|
|
47
33
|
const animatedValue = useRef(new Animated.Value((initalValue * sliderWidth) / (max - min))).current;
|
|
48
|
-
|
|
49
|
-
const animatedThumbValue = useRef(
|
|
50
|
-
new Animated.Value(
|
|
51
|
-
(initalValue * sliderWidth) / (max - min) > 0
|
|
52
|
-
? (initalValue * sliderWidth) / (max - min) - 8
|
|
53
|
-
: (initalValue * sliderWidth) / (max - min),
|
|
54
|
-
),
|
|
55
|
-
).current;
|
|
56
|
-
|
|
57
34
|
useEffect(() => {
|
|
58
35
|
const handleOrientationChange = () => {
|
|
59
|
-
setSliderWidth(Dimensions.get("window").width);
|
|
36
|
+
setSliderWidth(Dimensions.get("window").width * 0.8);
|
|
60
37
|
};
|
|
61
38
|
|
|
62
39
|
const subscription = Dimensions.addEventListener("change", handleOrientationChange);
|
|
40
|
+
createPanResponder();
|
|
63
41
|
return () => {
|
|
64
42
|
subscription.remove();
|
|
43
|
+
//Dimensions.removeEventListener("change", handleOrientationChange);
|
|
65
44
|
};
|
|
66
45
|
}, []);
|
|
67
46
|
|
|
68
47
|
// 可以根据需要调整的滑块高度
|
|
69
|
-
const hanleValueUpdate =
|
|
70
|
-
(gestureState
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
animatedThumbValue.setValue(
|
|
79
|
-
(steppedValue * sliderWidth) / (max - min) > 0
|
|
80
|
-
? (steppedValue * sliderWidth) / (max - min) - 8
|
|
81
|
-
: (steppedValue * sliderWidth) / (max - min),
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
if (onValueChange) {
|
|
85
|
-
onValueChange(steppedValue);
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
[min, max, sliderWidth, initalValue, step, getSteppedValue, onValueChange],
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
// 添加点击轨道跳转功能(可选)
|
|
92
|
-
const handleTrackPress = useCallback(
|
|
93
|
-
(event: GestureResponderEvent) => {
|
|
94
|
-
const { locationX } = event.nativeEvent;
|
|
95
|
-
const rawValue = (locationX / sliderWidth) * (max - min) + min;
|
|
96
|
-
const steppedValue = getSteppedValue(rawValue);
|
|
97
|
-
|
|
98
|
-
setValue(steppedValue);
|
|
99
|
-
|
|
100
|
-
// 使用动画过渡到新位置
|
|
101
|
-
Animated.timing(animatedValue, {
|
|
102
|
-
toValue: (steppedValue * sliderWidth) / (max - min),
|
|
103
|
-
duration: 200,
|
|
104
|
-
useNativeDriver: false,
|
|
105
|
-
}).start();
|
|
106
|
-
|
|
107
|
-
Animated.timing(animatedThumbValue, {
|
|
108
|
-
toValue:
|
|
109
|
-
(steppedValue * sliderWidth) / (max - min) > 0
|
|
110
|
-
? (steppedValue * sliderWidth) / (max - min) - 8
|
|
111
|
-
: (steppedValue * sliderWidth) / (max - min),
|
|
112
|
-
duration: 200,
|
|
113
|
-
useNativeDriver: false,
|
|
114
|
-
}).start();
|
|
115
|
-
|
|
116
|
-
if (onValueChange) {
|
|
117
|
-
onValueChange(steppedValue);
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
[sliderWidth, min, max, getSteppedValue, onValueChange, animatedValue, animatedThumbValue],
|
|
121
|
-
);
|
|
48
|
+
const hanleValueUpdate = (gestureState: PanResponderGestureState) => {
|
|
49
|
+
const currentValue = Math.max(min, Math.min(max, (gestureState.dx / sliderWidth) * (max - min) + initalValue));
|
|
50
|
+
|
|
51
|
+
setValue(currentValue);
|
|
52
|
+
animatedValue.setValue((currentValue * sliderWidth) / (max - min));
|
|
53
|
+
if (onValueChange) {
|
|
54
|
+
onValueChange(currentValue);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
122
57
|
|
|
123
58
|
const handleLayout = (event: LayoutChangeEvent) => {
|
|
124
59
|
setSliderWidth(event.nativeEvent.layout.width);
|
|
125
60
|
};
|
|
126
61
|
|
|
127
|
-
const
|
|
128
|
-
(
|
|
62
|
+
const createPanResponder = () => {
|
|
63
|
+
setPanResponder(
|
|
129
64
|
PanResponder.create({
|
|
130
65
|
onStartShouldSetPanResponder: () => true,
|
|
131
66
|
onMoveShouldSetPanResponder: () => true,
|
|
132
|
-
onPanResponderGrant: () =>
|
|
133
|
-
onPanResponderRelease: () =>
|
|
67
|
+
onPanResponderGrant: () => {},
|
|
68
|
+
onPanResponderRelease: () => {},
|
|
134
69
|
onPanResponderTerminate: () => {},
|
|
135
70
|
onPanResponderMove: (evt, gestureState) => {
|
|
136
71
|
hanleValueUpdate(gestureState);
|
|
137
72
|
},
|
|
138
73
|
}),
|
|
139
|
-
|
|
140
|
-
|
|
74
|
+
);
|
|
75
|
+
};
|
|
141
76
|
|
|
142
77
|
const styles = StyleSheet.create({
|
|
143
78
|
sliderContainer: {
|
|
@@ -146,7 +81,7 @@ const Slider = ({
|
|
|
146
81
|
justifyContent: "center",
|
|
147
82
|
},
|
|
148
83
|
trackContainer: {
|
|
149
|
-
width: "
|
|
84
|
+
width: "80%",
|
|
150
85
|
height: 4,
|
|
151
86
|
backgroundColor: "rgba(48, 48, 52, 0.20)",
|
|
152
87
|
borderRadius: 2,
|
|
@@ -172,22 +107,21 @@ const Slider = ({
|
|
|
172
107
|
},
|
|
173
108
|
});
|
|
174
109
|
|
|
110
|
+
//<View style={[styles.track, { width: sliderWidth }]}>
|
|
111
|
+
//<View style={[styles.thumb, { left: thumbPosition }]} {...panResponder.panHandlers} />
|
|
112
|
+
//</View>
|
|
175
113
|
return (
|
|
176
|
-
<
|
|
177
|
-
<View style={styles.
|
|
178
|
-
{
|
|
179
|
-
|
|
180
|
-
<View
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
style={[styles.thumbButton, { transform: [{ translateX: animatedThumbValue }] }, dotStyle]}
|
|
186
|
-
{...panResponder.panHandlers}
|
|
187
|
-
hitSlop={{ top: 20, bottom: 20, left: 20, right: 20 }}
|
|
188
|
-
/>
|
|
114
|
+
<TouchableWithoutFeedback onPress={(e) => {}}>
|
|
115
|
+
<View style={styles.sliderContainer} onLayout={handleLayout}>
|
|
116
|
+
<View style={styles.trackContainer}>
|
|
117
|
+
<Animated.View style={[styles.coloredTrack, { width: animatedValue }]} />
|
|
118
|
+
<Animated.View
|
|
119
|
+
style={[styles.thumbButton, { transform: [{ translateX: animatedValue }] }, dotStyle]}
|
|
120
|
+
{...panResponder.panHandlers}
|
|
121
|
+
/>
|
|
122
|
+
</View>
|
|
189
123
|
</View>
|
|
190
|
-
</
|
|
124
|
+
</TouchableWithoutFeedback>
|
|
191
125
|
);
|
|
192
126
|
};
|
|
193
127
|
|
|
@@ -8,7 +8,6 @@ const styles = StyleSheet.create({
|
|
|
8
8
|
justifyContent: "center",
|
|
9
9
|
paddingTop: 100,
|
|
10
10
|
paddingBottom: 100,
|
|
11
|
-
paddingHorizontal: 50,
|
|
12
11
|
},
|
|
13
12
|
scrollView: {
|
|
14
13
|
backgroundColor: "pink",
|
|
@@ -45,23 +44,6 @@ export default function App() {
|
|
|
45
44
|
<Br />
|
|
46
45
|
<Slider min={200} max={100}></Slider>
|
|
47
46
|
<Br />
|
|
48
|
-
<Desc>step使用示例</Desc>
|
|
49
|
-
<Slider
|
|
50
|
-
min={0}
|
|
51
|
-
max={100}
|
|
52
|
-
step={10} // 每次移动10个单位
|
|
53
|
-
initalValue={0}
|
|
54
|
-
onValueChange={(value: any) => console.log("Current value:", value)}
|
|
55
|
-
/>
|
|
56
|
-
<Br />
|
|
57
|
-
<Desc>step使用示例(或者更小的步长)</Desc>
|
|
58
|
-
<Slider
|
|
59
|
-
min={0}
|
|
60
|
-
max={1}
|
|
61
|
-
step={0.1} // 每次移动0.1个单位
|
|
62
|
-
initalValue={0.5}
|
|
63
|
-
onValueChange={(value: any) => console.log("Current value:", value)}
|
|
64
|
-
/>
|
|
65
47
|
</View>
|
|
66
48
|
);
|
|
67
49
|
}
|
|
@@ -68,8 +68,7 @@ const TextField = forwardRef((props: RedsTextView, ref) => {
|
|
|
68
68
|
|
|
69
69
|
const handleChangeText = useCallback(
|
|
70
70
|
(value: string) => {
|
|
71
|
-
|
|
72
|
-
updateValue(filteredValue);
|
|
71
|
+
updateValue(value);
|
|
73
72
|
// Only apply cursor fix on iOS when text equals maxLength (indicating truncation)
|
|
74
73
|
if (Platform.OS === "ios" && maxLength && value.length >= maxLength && inputRef.current) {
|
|
75
74
|
// Use requestAnimationFrame instead of setTimeout
|
|
@@ -135,10 +134,8 @@ const TextField = forwardRef((props: RedsTextView, ref) => {
|
|
|
135
134
|
}, [layout]);
|
|
136
135
|
|
|
137
136
|
const handleKeyPress = ({ nativeEvent }: any) => {
|
|
138
|
-
if (nativeEvent.key === "Enter") {
|
|
139
|
-
|
|
140
|
-
Keyboard.dismiss();
|
|
141
|
-
}
|
|
137
|
+
if (nativeEvent.key === "Enter" && props.returnKeyType !== "next") {
|
|
138
|
+
Keyboard.dismiss();
|
|
142
139
|
}
|
|
143
140
|
};
|
|
144
141
|
|
|
@@ -26,7 +26,7 @@ export default function App() {
|
|
|
26
26
|
clearable
|
|
27
27
|
actionLayout={"horizontal"}
|
|
28
28
|
autofocus={true}
|
|
29
|
-
returnKeyType={"
|
|
29
|
+
returnKeyType={"search"}
|
|
30
30
|
/>
|
|
31
31
|
<Desc>最大长度</Desc>
|
|
32
32
|
<TextView modelValue={modelValue} maxLength={100} showCount placeholder="占位符" />
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
interface Resources {
|
|
2
2
|
componentKey: {
|
|
3
|
-
sureKey: "
|
|
4
|
-
satisfyKey: "
|
|
5
|
-
confirmKey: "
|
|
6
|
-
uploadingKey: "
|
|
3
|
+
sureKey: "确定";
|
|
4
|
+
satisfyKey: "满意";
|
|
5
|
+
confirmKey: "确认";
|
|
6
|
+
uploadingKey: "上传中";
|
|
7
7
|
resetKey: "重置";
|
|
8
|
-
NoDataKey: "
|
|
8
|
+
NoDataKey: "暂无数据";
|
|
9
9
|
liveStreamingKey: "直播";
|
|
10
10
|
generallyKey: "一般";
|
|
11
|
-
uploadFailedKey: "
|
|
11
|
+
uploadFailedKey: "上传失败";
|
|
12
12
|
submitKey: "提交";
|
|
13
|
-
requestSuccessfulKey: "
|
|
13
|
+
requestSuccessfulKey: "请求成功";
|
|
14
14
|
cancelKey: "取消";
|
|
15
|
-
PullDownToRefreshKey: "
|
|
16
|
-
selectAllKey: "
|
|
17
|
-
requestDataKey: "
|
|
15
|
+
PullDownToRefreshKey: "下拉刷新";
|
|
16
|
+
selectAllKey: "全选";
|
|
17
|
+
requestDataKey: "请求数据中";
|
|
18
18
|
closeKey: "收起";
|
|
19
|
-
veryBadKey: "
|
|
20
|
-
searchKey: "
|
|
21
|
-
expandKey: "
|
|
22
|
-
IDCardPhotoKey: "
|
|
19
|
+
veryBadKey: "极差";
|
|
20
|
+
searchKey: "搜索";
|
|
21
|
+
expandKey: "展开";
|
|
22
|
+
IDCardPhotoKey: "身份证人像面";
|
|
23
23
|
finishKey: "完成";
|
|
24
|
-
surpriseKey: "
|
|
25
|
-
releaseRefreshKey: "
|
|
24
|
+
surpriseKey: "惊喜";
|
|
25
|
+
releaseRefreshKey: "松开刷新";
|
|
26
26
|
nationalEmblemSideOfIDCardKey: "身份证国徽面";
|
|
27
|
-
buttonKey: "
|
|
28
|
-
jumpKey: "
|
|
27
|
+
buttonKey: "按钮";
|
|
28
|
+
jumpKey: "跳转";
|
|
29
29
|
disappointmentKey: "失望";
|
|
30
30
|
};
|
|
31
31
|
}
|
package/src/i18n/index.json
CHANGED
|
@@ -1,4 +1,35 @@
|
|
|
1
1
|
{
|
|
2
|
+
"zh_cn": {
|
|
3
|
+
"componentKey": {
|
|
4
|
+
"sureKey": "确定",
|
|
5
|
+
"satisfyKey": "满意",
|
|
6
|
+
"confirmKey": "确认",
|
|
7
|
+
"uploadingKey": "上传中",
|
|
8
|
+
"resetKey": "重置",
|
|
9
|
+
"NoDataKey": "暂无数据",
|
|
10
|
+
"liveStreamingKey": "直播",
|
|
11
|
+
"generallyKey": "一般",
|
|
12
|
+
"uploadFailedKey": "上传失败",
|
|
13
|
+
"submitKey": "提交",
|
|
14
|
+
"requestSuccessfulKey": "请求成功",
|
|
15
|
+
"cancelKey": "取消",
|
|
16
|
+
"PullDownToRefreshKey": "下拉刷新",
|
|
17
|
+
"selectAllKey": "全选",
|
|
18
|
+
"requestDataKey": "请求数据中",
|
|
19
|
+
"closeKey": "收起",
|
|
20
|
+
"veryBadKey": "极差",
|
|
21
|
+
"searchKey": "搜索",
|
|
22
|
+
"expandKey": "展开",
|
|
23
|
+
"IDCardPhotoKey": "身份证人像面",
|
|
24
|
+
"finishKey": "完成",
|
|
25
|
+
"surpriseKey": "惊喜",
|
|
26
|
+
"releaseRefreshKey": "松开刷新",
|
|
27
|
+
"nationalEmblemSideOfIDCardKey": "身份证国徽面",
|
|
28
|
+
"buttonKey": "按钮",
|
|
29
|
+
"jumpKey": "跳转",
|
|
30
|
+
"disappointmentKey": "失望"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
2
33
|
"zh_tw": {
|
|
3
34
|
"componentKey": {
|
|
4
35
|
"sureKey": "確定",
|
|
@@ -60,36 +91,5 @@
|
|
|
60
91
|
"jumpKey": "Jump",
|
|
61
92
|
"disappointmentKey": "Disappointment"
|
|
62
93
|
}
|
|
63
|
-
},
|
|
64
|
-
"zh_cn": {
|
|
65
|
-
"componentKey": {
|
|
66
|
-
"sureKey": "确定",
|
|
67
|
-
"satisfyKey": "满意",
|
|
68
|
-
"confirmKey": "确认",
|
|
69
|
-
"uploadingKey": "上传中",
|
|
70
|
-
"resetKey": "重置",
|
|
71
|
-
"NoDataKey": "暂无数据",
|
|
72
|
-
"liveStreamingKey": "直播",
|
|
73
|
-
"generallyKey": "一般",
|
|
74
|
-
"uploadFailedKey": "上传失败",
|
|
75
|
-
"submitKey": "提交",
|
|
76
|
-
"requestSuccessfulKey": "请求成功",
|
|
77
|
-
"cancelKey": "取消",
|
|
78
|
-
"PullDownToRefreshKey": "下拉刷新",
|
|
79
|
-
"selectAllKey": "全选",
|
|
80
|
-
"requestDataKey": "请求数据中",
|
|
81
|
-
"closeKey": "收起",
|
|
82
|
-
"veryBadKey": "极差",
|
|
83
|
-
"searchKey": "搜索",
|
|
84
|
-
"expandKey": "展开",
|
|
85
|
-
"IDCardPhotoKey": "身份证人像面",
|
|
86
|
-
"finishKey": "完成",
|
|
87
|
-
"surpriseKey": "惊喜",
|
|
88
|
-
"releaseRefreshKey": "松开刷新",
|
|
89
|
-
"nationalEmblemSideOfIDCardKey": "身份证国徽面",
|
|
90
|
-
"buttonKey": "按钮",
|
|
91
|
-
"jumpKey": "跳转",
|
|
92
|
-
"disappointmentKey": "失望"
|
|
93
|
-
}
|
|
94
94
|
}
|
|
95
95
|
}
|