@momo-kits/foundation 0.160.1-beta.7 → 0.160.1-beta.9

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.
@@ -1,4 +1,4 @@
1
- import React, { useContext, useEffect, useRef, useState } from 'react';
1
+ import React, { useContext, useEffect, useState } from 'react';
2
2
  import {
3
3
  LayoutChangeEvent,
4
4
  StyleSheet,
@@ -43,12 +43,12 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
43
43
  const { theme } = useContext(ApplicationContext);
44
44
  const scaledFontSize = useScaleSize(16);
45
45
  const scaledLineHeight = useScaleSize(22);
46
- const maxWidth = useRef(0);
46
+ const maxWidth = useSharedValue(0);
47
47
  const minWidth = size === 'small' ? 36 : 48;
48
48
  const opacityAnimated = useSharedValue(0);
49
49
  const widthAnimated = useSharedValue<number | null>(null);
50
- const lastOffset = useRef(0);
51
- const lastDirection = useRef<string | null>(null);
50
+ const lastOffset = useSharedValue(0);
51
+ const lastDirection = useSharedValue<string | null>(null);
52
52
  const [showText, setShowText] = useState(true);
53
53
 
54
54
  useEffect(() => {
@@ -61,11 +61,11 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
61
61
  (value) => {
62
62
  'worklet';
63
63
  if (!label || !animatedValue) return;
64
- if (value !== lastOffset.current && value > 0) {
65
- const direction = value > lastOffset.current ? 'down' : 'up';
66
- lastOffset.current = value;
67
- if (lastDirection.current !== direction) {
68
- lastDirection.current = direction;
64
+ if (value !== lastOffset.value && value > 0) {
65
+ const direction = value > lastOffset.value ? 'down' : 'up';
66
+ lastOffset.value = value;
67
+ if (lastDirection.value !== direction) {
68
+ lastDirection.value = direction;
69
69
  if (direction === 'down') {
70
70
  opacityAnimated.value = withTiming(0, { duration: 100 });
71
71
  widthAnimated.value = withTiming(
@@ -78,7 +78,7 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
78
78
  } else {
79
79
  opacityAnimated.value = withTiming(1, { duration: 100 });
80
80
  widthAnimated.value = withTiming(
81
- maxWidth.current,
81
+ maxWidth.value,
82
82
  { duration: 100 },
83
83
  (finished) => {
84
84
  if (finished) runOnJS(setShowText)(true);
@@ -102,7 +102,7 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
102
102
  const handleLayout = (event: LayoutChangeEvent) => {
103
103
  const layout = event.nativeEvent.layout;
104
104
  if (widthAnimated.value != null) return;
105
- maxWidth.current = layout.width;
105
+ maxWidth.value = layout.width;
106
106
  widthAnimated.value = layout.width;
107
107
  };
108
108
 
@@ -1,6 +1,5 @@
1
1
  import React, { useContext, useEffect, useState } from 'react';
2
2
  import {
3
- Easing,
4
3
  LayoutAnimation,
5
4
  Platform,
6
5
  StyleSheet,
@@ -9,6 +8,7 @@ import {
9
8
  } from 'react-native';
10
9
  import Animated, {
11
10
  cancelAnimation,
11
+ Easing,
12
12
  interpolate,
13
13
  useAnimatedStyle,
14
14
  useSharedValue,
package/Text/utils.ts CHANGED
@@ -4,7 +4,7 @@ import { ScaleSizeContext } from '../Context';
4
4
 
5
5
  const deviceWidth = Dimensions.get('window').width;
6
6
  const DEFAULT_SCREEN_SIZE = 375;
7
- const MAX_FONT_SCALE = 1.5;
7
+ const MAX_FONT_SCALE = 1.2;
8
8
  const MAX_DEVICE_SCALE = 5;
9
9
 
10
10
  const useScaleSize = (size: number, scaleRate?: number) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.160.1-beta.7",
3
+ "version": "0.160.1-beta.9",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},