@momo-kits/foundation 0.92.21-beta.2 → 0.92.21-beta.4

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/Layout/styles.ts CHANGED
@@ -2,6 +2,12 @@ import {Platform, StyleSheet} from 'react-native';
2
2
  import {Colors, Radius, Spacing} from '../Consts';
3
3
 
4
4
  export default StyleSheet.create({
5
+ extendedHeader: {
6
+ aspectRatio: 1.75,
7
+ position: 'absolute',
8
+ width: '100%',
9
+ height: 210,
10
+ },
5
11
  screenBanner: {
6
12
  width: '100%',
7
13
  },
package/Layout/types.ts CHANGED
@@ -1,8 +1,4 @@
1
- import {Animated} from 'react-native';
2
- import {InputSearchProps, InputSearchRef} from '../Input';
3
- import {LegacyRef} from 'react';
4
-
5
- export type HeaderType = 'default' | 'surface' | 'extended' | 'search' | 'none';
1
+ export type HeaderType = 'default' | 'surface' | 'extended' | 'none';
6
2
 
7
3
  export type GridContextProps = {
8
4
  /**
@@ -25,18 +21,3 @@ export type GridContextProps = {
25
21
  */
26
22
  getSizeSpan: (span: number) => number;
27
23
  };
28
-
29
- export type AnimatedInputSearchProps = {
30
- animatedValue: Animated.Value;
31
- headerRightWidth: number;
32
- heightHeader: number;
33
- headerType: HeaderType;
34
- inputSearchProps?: InputSearchProps;
35
- inputRef?: LegacyRef<InputSearchRef>;
36
- };
37
-
38
- export type ExtendHeaderProps = {
39
- headerBackground: string;
40
- animatedValue: Animated.Value;
41
- heightHeader: number;
42
- };
package/Title/index.tsx CHANGED
@@ -1,16 +1,13 @@
1
1
  import React, {FC, useContext, useState} from 'react';
2
2
  import {Text as RNText, TouchableOpacity, View, ViewStyle} from 'react-native';
3
- import {
4
- Typography,
5
- Colors,
6
- Icon,
7
- Badge,
8
- ApplicationContext,
9
- scaleSize,
10
- Text,
11
- } from '@momo-kits/foundation';
3
+ import {Icon} from '../Icon';
4
+ import {scaleSize, Text} from '../Text';
5
+ import {ApplicationContext} from '../Application';
6
+ import {Badge} from '../Badge';
7
+ import {Colors} from '../Consts';
12
8
  import styles from './styles';
13
9
  import {TitleProps} from './types';
10
+ import {Typography} from '../Text/types';
14
11
 
15
12
  const Title: FC<TitleProps> = ({
16
13
  title = 'Title',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.21-beta.2",
3
+ "version": "0.92.21-beta.4",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},
@@ -1,113 +0,0 @@
1
- import React, {FC, memo, useEffect, useRef} from 'react';
2
- import {Platform, StyleSheet, TextInput, TextStyle} from 'react-native';
3
- import {Colors} from '../Consts';
4
- import {scaleSize} from '../Text';
5
-
6
- export interface TextTypingProps {
7
- data: string[];
8
- timeDelayEnd?: number;
9
- timeDelayNextChar?: number;
10
- inputStyle?: TextStyle;
11
- }
12
-
13
- const TextTyping: FC<TextTypingProps> = ({
14
- data = [],
15
- timeDelayEnd = 2000,
16
- timeDelayNextChar = 20,
17
- inputStyle = {},
18
- }) => {
19
- const textRef = useRef<TextInput>(null);
20
-
21
- const currentIndex = useRef<number>(0);
22
- const currentCharIndex = useRef<number>(0);
23
- const currentText = useRef('');
24
-
25
- useEffect(() => {
26
- setTimeout(() => {
27
- playAnimation();
28
- }, 1000);
29
- }, []);
30
-
31
- const playAnimation = () => {
32
- const handleResetList = () => {
33
- currentIndex.current = 0;
34
- handleAnimation();
35
- };
36
-
37
- const handleAnimation = () => {
38
- const listChar = data?.[currentIndex.current]?.split('') || [];
39
- listChar.length !== 0 && showChar(listChar?.[currentCharIndex.current]);
40
- };
41
-
42
- currentIndex.current >= data?.length
43
- ? handleResetList()
44
- : handleAnimation();
45
- };
46
-
47
- const showChar = (char?: string) => {
48
- const handleResetString = () => {
49
- setTimeout(() => {
50
- reset();
51
- }, timeDelayEnd);
52
- };
53
-
54
- const handleShowChar = () => {
55
- setTimeout(() => {
56
- textRef.current?.setNativeProps?.({
57
- text: currentText.current + char,
58
- });
59
- currentText.current += char;
60
- currentCharIndex.current++;
61
- playAnimation();
62
- }, timeDelayNextChar);
63
- };
64
-
65
- currentCharIndex.current >= (data?.[currentIndex.current]?.length || 0)
66
- ? handleResetString()
67
- : handleShowChar();
68
- };
69
-
70
- const reset = () => {
71
- const handleNextString = () => {
72
- currentIndex.current++;
73
- playAnimation();
74
- };
75
-
76
- const handleReset = () => {
77
- setTimeout(() => {
78
- textRef.current?.setNativeProps?.({
79
- text: currentText.current.slice(0, -1),
80
- });
81
- currentText.current = currentText.current.slice(0, -1);
82
- currentCharIndex.current--;
83
- reset();
84
- }, timeDelayNextChar);
85
- };
86
-
87
- currentCharIndex.current <= 0 ? handleNextString() : handleReset();
88
- };
89
-
90
- return (
91
- <TextInput
92
- style={[styles.inputStyle, inputStyle]}
93
- ref={textRef}
94
- editable={false}
95
- autoCorrect={false}
96
- pointerEvents={'none'}
97
- numberOfLines={1}
98
- />
99
- );
100
- };
101
-
102
- export default memo(TextTyping);
103
-
104
- const styles = StyleSheet.create({
105
- inputStyle: {
106
- color: Colors.black_12,
107
- fontSize: scaleSize(12),
108
- height: Platform.select({
109
- android: 60,
110
- ios: 36,
111
- }),
112
- },
113
- });
@@ -1,58 +0,0 @@
1
- import React, {FC, useEffect, useRef} from 'react';
2
- import {InputSearch} from '../Input';
3
- import {Animated, Dimensions} from 'react-native';
4
- import {AnimatedInputSearchProps} from './types';
5
- import {Spacing} from '../Consts';
6
- import {scaleSize} from '../Text';
7
-
8
- const {width: screenWidth} = Dimensions.get('window');
9
- const SCREEN_PADDING = 12;
10
- const BACK_WIDTH = scaleSize(28);
11
-
12
- const AnimatedInputSearch: FC<AnimatedInputSearchProps> = ({
13
- animatedValue,
14
- headerRightWidth,
15
- inputSearchProps,
16
- inputRef,
17
- }) => {
18
- const widthAnimated = useRef(new Animated.Value(0));
19
-
20
- useEffect(() => {
21
- const listener = animatedValue.addListener(({value}) => {
22
- widthAnimated.current.setValue(value);
23
- });
24
- return () => {
25
- animatedValue?.removeListener(listener);
26
- };
27
- }, []);
28
-
29
- const translateX = widthAnimated.current.interpolate({
30
- inputRange: [0, 100],
31
- outputRange: [SCREEN_PADDING, BACK_WIDTH + SCREEN_PADDING * 2],
32
- extrapolate: 'clamp',
33
- });
34
-
35
- return (
36
- <Animated.View
37
- style={{
38
- transform: [{translateX}],
39
- marginVertical: Spacing.S,
40
- width: widthAnimated.current.interpolate({
41
- inputRange: [0, 100],
42
- outputRange: [
43
- screenWidth - SCREEN_PADDING * 2,
44
- screenWidth - SCREEN_PADDING * 3 - BACK_WIDTH - headerRightWidth,
45
- ],
46
- extrapolate: 'clamp',
47
- }),
48
- }}>
49
- <InputSearch
50
- ref={inputRef}
51
- {...inputSearchProps}
52
- showButtonText={false}
53
- />
54
- </Animated.View>
55
- );
56
- };
57
-
58
- export default AnimatedInputSearch;