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

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.
@@ -38,18 +38,18 @@ 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;
51
- lastOffset.current = value;
52
- if (down) {
48
+ const direction = value > lastOffset.current ? 'down' : 'up';
49
+ lastOffset.current = value;
50
+ if (lastDirection.current !== direction) {
51
+ lastDirection.current = direction;
52
+ if (direction === 'down') {
53
53
  Animated.timing(widthAnimated!, {
54
54
  toValue: minWidth,
55
55
  duration: 200,
@@ -62,7 +62,7 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
62
62
  useNativeDriver: false,
63
63
  }).start(() => setShowText(true));
64
64
  }
65
- }, 200);
65
+ }
66
66
  });
67
67
 
68
68
  return () => {
@@ -122,6 +122,7 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
122
122
  <Text
123
123
  style={styles.label}
124
124
  color="white"
125
+ numberOfLines={1}
125
126
  typography="action_default_bold">
126
127
  {label}
127
128
  </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.20",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},