@momo-kits/foundation 0.92.6-rc.19 → 0.92.6-rc.21

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/Input/Input.tsx CHANGED
@@ -169,7 +169,7 @@ const Input = forwardRef(
169
169
  <TextInput
170
170
  {...props}
171
171
  accessibilityLabel={accessibilityLabel}
172
- editable={editable || !disabled}
172
+ editable={editable && !disabled}
173
173
  secureTextEntry={secure}
174
174
  textAlignVertical="center"
175
175
  ref={inputRef}
@@ -38,31 +38,33 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
38
38
  const minWidth = size == 'small' ? 36 : 48;
39
39
  const [widthAnimated, setWidthAnimated] = useState<Animated.Value>();
40
40
  const lastOffset = useRef(0);
41
- const debounce = useRef<any>();
41
+ const lastDirection = useRef<string>();
42
42
  const [showText, setShowText] = React.useState(true);
43
43
 
44
44
  useEffect(() => {
45
45
  if (!label) return;
46
46
 
47
47
  const listener = animatedValue?.addListener(({value}) => {
48
- clearTimeout(debounce.current);
49
- debounce.current = setTimeout(() => {
50
- const down = value > lastOffset.current;
48
+ if (value !== lastOffset.current) {
49
+ const direction = value > lastOffset.current ? 'down' : 'up';
51
50
  lastOffset.current = value;
52
- if (down) {
53
- Animated.timing(widthAnimated!, {
54
- toValue: minWidth,
55
- duration: 200,
56
- useNativeDriver: false,
57
- }).start(() => setShowText(false));
58
- } else {
59
- Animated.timing(widthAnimated!, {
60
- toValue: maxWidth.current,
61
- duration: 200,
62
- useNativeDriver: false,
63
- }).start(() => setShowText(true));
51
+ if (lastDirection.current !== direction) {
52
+ lastDirection.current = direction;
53
+ if (direction === 'down') {
54
+ Animated.timing(widthAnimated!, {
55
+ toValue: minWidth,
56
+ duration: 200,
57
+ useNativeDriver: false,
58
+ }).start(() => setShowText(false));
59
+ } else {
60
+ Animated.timing(widthAnimated!, {
61
+ toValue: maxWidth.current,
62
+ duration: 200,
63
+ useNativeDriver: false,
64
+ }).start(() => setShowText(true));
65
+ }
64
66
  }
65
- }, 200);
67
+ }
66
68
  });
67
69
 
68
70
  return () => {
@@ -122,6 +124,7 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
122
124
  <Text
123
125
  style={styles.label}
124
126
  color="white"
127
+ numberOfLines={1}
125
128
  typography="action_default_bold">
126
129
  {label}
127
130
  </Text>
package/Layout/Screen.tsx CHANGED
@@ -234,7 +234,7 @@ const Screen = forwardRef(
234
234
  },
235
235
  ],
236
236
  {
237
- useNativeDriver: false,
237
+ useNativeDriver: true,
238
238
  listener: (e: NativeSyntheticEvent<NativeScrollEvent>) => {
239
239
  if (animatedHeader?.type == 'surface') {
240
240
  const offsetY = e.nativeEvent.contentOffset.y;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.6-rc.19",
3
+ "version": "0.92.6-rc.21",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},