@momo-kits/foundation 0.92.2-tracking.5 → 0.92.2-tracking.8

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.
@@ -15,7 +15,7 @@ import {
15
15
  View,
16
16
  ViewStyle,
17
17
  } from 'react-native';
18
- import {ApplicationContext} from './index';
18
+ import {ApplicationContext, MiniAppContext} from './index';
19
19
  import {Colors, Radius, Spacing, Styles} from '../Consts';
20
20
  import {Image} from '../Image';
21
21
  import {
@@ -31,10 +31,6 @@ import {PopupNotify} from '../Popup';
31
31
  import {Badge, BadgeDot} from '../Badge';
32
32
  import {getAccessibilityID} from './utils';
33
33
 
34
- const {
35
- MiniAppContext,
36
- } = require('react-native/Libraries/Components/ScreenContext');
37
-
38
34
  const NavigationButton: React.FC<NavigationButtonProps> = ({
39
35
  icon,
40
36
  tintColor,
@@ -1,16 +1,11 @@
1
1
  import React, {useContext, useEffect, useLayoutEffect, useRef} from 'react';
2
2
  import {ScreenParams} from './types';
3
3
  import Navigation from './Navigation';
4
- import {ApplicationContext} from './index';
4
+ import {ApplicationContext, MiniAppContext, ScreenContext} from './index';
5
5
  import {GridSystem} from '../Layout';
6
6
  import {useHeaderHeight} from '@react-navigation/stack';
7
7
  import {Alert, InteractionManager} from 'react-native';
8
8
 
9
- const {
10
- ScreenContext,
11
- MiniAppContext,
12
- } = require('react-native/Libraries/Components/ScreenContext');
13
-
14
9
  const StackScreen: React.FC<ScreenParams> = props => {
15
10
  const {theme, showGrid, navigator} = useContext(ApplicationContext);
16
11
  const startTime = useRef(Date.now());
@@ -1,3 +1,4 @@
1
+ import {Platform} from 'react-native';
1
2
  import {NavigationContainer} from './NavigationContainer';
2
3
  import Screen from '../Layout/Screen';
3
4
  import {
@@ -11,20 +12,19 @@ import {
11
12
  import BottomTab from './BottomTab';
12
13
  import {createContext} from 'react';
13
14
  import {defaultContext} from '../Consts';
14
- import {MiniAppInfo} from './types';
15
15
 
16
+ const Context = createContext({});
16
17
  const ApplicationContext = createContext(defaultContext);
17
- const MiniAppContext = createContext<MiniAppInfo>({
18
- appId: '',
19
- buildNumber: 0,
20
- code: '',
21
- toolkitConfig: {},
22
- fromCode: '',
23
- });
18
+
19
+ const MiniAppContext = (Platform as any).MiniAppContext ?? Context;
20
+ const ScreenContext = (Platform as any).ScreenContext ?? Context;
21
+ const ComponentContext = (Platform as any).ComponentContext ?? Context;
24
22
 
25
23
  export {
26
24
  ApplicationContext,
27
25
  MiniAppContext,
26
+ ScreenContext,
27
+ ComponentContext,
28
28
  NavigationContainer,
29
29
  Screen,
30
30
  BottomTab,
package/Button/index.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import React, {FC, useContext, useState} from 'react';
1
+ import React, {FC, useContext} from 'react';
2
2
  import {
3
3
  Animated,
4
4
  StyleSheet,
@@ -7,7 +7,7 @@ import {
7
7
  View,
8
8
  } from 'react-native';
9
9
  import LinearGradient from 'react-native-linear-gradient';
10
- import {ApplicationContext} from '../Application';
10
+ import {ApplicationContext, ComponentContext} from '../Application';
11
11
  import {Text} from '../Text';
12
12
  import {Typography} from '../Text/types';
13
13
  import {Colors, Spacing} from '../Consts';
@@ -16,10 +16,6 @@ import {Icon} from '../Icon';
16
16
  import {Loader} from '../Loader';
17
17
  import {formatComponentName} from '../Application/utils';
18
18
 
19
- const {
20
- ComponentContext,
21
- } = require('react-native/Libraries/Components/ScreenContext');
22
-
23
19
  const AnimationLinear = Animated.createAnimatedComponent(LinearGradient);
24
20
 
25
21
  export interface ButtonProps extends TouchableOpacityProps {
@@ -2,15 +2,11 @@ import React, {FC, useContext} from 'react';
2
2
  import {TouchableOpacity, View} from 'react-native';
3
3
  import {CheckBoxProps} from './types';
4
4
  import styles from './styles';
5
- import {ApplicationContext} from '../Application';
5
+ import {ApplicationContext, ComponentContext} from '../Application';
6
6
  import {Text} from '../Text';
7
7
  import {Icon} from '../Icon';
8
8
  import {formatNameLength} from '../Application/utils';
9
9
 
10
- const {
11
- ComponentContext,
12
- } = require('react-native/Libraries/Components/ScreenContext');
13
-
14
10
  const CheckBox: FC<CheckBoxProps> = ({
15
11
  value,
16
12
  disabled = false,
@@ -5,16 +5,12 @@ import {
5
5
  TouchableOpacity,
6
6
  TouchableOpacityProps,
7
7
  } from 'react-native';
8
- import {ApplicationContext} from '../Application';
8
+ import {ApplicationContext, ComponentContext} from '../Application';
9
9
  import {Colors} from '../Consts';
10
10
  import {Icon} from '../Icon';
11
11
  import styles from './styles';
12
12
  import {formatComponentName} from '../Application/utils';
13
13
 
14
- const {
15
- ComponentContext,
16
- } = require('react-native/Libraries/Components/ScreenContext');
17
-
18
14
  export interface IconButtonProps extends TouchableOpacityProps {
19
15
  /**
20
16
  * Represents the name or key of the icon to be displayed on the IconButton.
package/Image/index.tsx CHANGED
@@ -2,17 +2,13 @@ import React, {useContext, useEffect, useRef, useState} from 'react';
2
2
  import {StyleSheet, View} from 'react-native';
3
3
  import FastImage, {Source} from 'react-native-fast-image';
4
4
  import styles from './styles';
5
- import {ApplicationContext} from '../Application';
5
+ import {ApplicationContext, ComponentContext} from '../Application';
6
6
  import {Skeleton} from '../Skeleton';
7
7
  import {Icon} from '../Icon';
8
8
  import {Styles} from '../Consts';
9
9
  import {ImageProps} from './types';
10
10
  import {getAccessibilityID} from '../Application/utils';
11
11
 
12
- const {
13
- ComponentContext,
14
- } = require('react-native/Libraries/Components/ScreenContext');
15
-
16
12
  type Status = 'success' | 'loading' | 'error';
17
13
 
18
14
  const Image: React.FC<ImageProps> = ({
package/Input/Input.tsx CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  TouchableOpacity,
8
8
  View,
9
9
  } from 'react-native';
10
- import {ApplicationContext} from '../Application';
10
+ import {ApplicationContext, ComponentContext} from '../Application';
11
11
  import styles from './styles';
12
12
  import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
13
13
  import {InputProps} from './index';
@@ -16,10 +16,6 @@ import {checkTyping} from './utils';
16
16
  import {Loader} from '../Loader';
17
17
  import {formatComponentName} from '../Application/utils';
18
18
 
19
- const {
20
- ComponentContext,
21
- } = require('react-native/Libraries/Components/ScreenContext');
22
-
23
19
  const Input = forwardRef(
24
20
  (
25
21
  {
@@ -1,6 +1,6 @@
1
1
  import React, {useContext} from 'react';
2
2
  import {TextInput, TouchableOpacity, View} from 'react-native';
3
- import {ApplicationContext} from '../Application';
3
+ import {ApplicationContext, ComponentContext} from '../Application';
4
4
  import styles from './styles';
5
5
  import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
6
6
  import {InputDropDownProps} from './index';
@@ -9,10 +9,6 @@ import {Loader} from '../Loader';
9
9
  import {Styles} from '../Consts';
10
10
  import {formatComponentName} from '../Application/utils';
11
11
 
12
- const {
13
- ComponentContext,
14
- } = require('react-native/Libraries/Components/ScreenContext');
15
-
16
12
  const InputDropDown = ({
17
13
  value,
18
14
  floatingValue,
@@ -12,7 +12,7 @@ import {
12
12
  TouchableOpacity,
13
13
  View,
14
14
  } from 'react-native';
15
- import {ApplicationContext} from '../Application';
15
+ import {ApplicationContext, ComponentContext} from '../Application';
16
16
  import styles from './styles';
17
17
  import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
18
18
  import {InputMoneyProps} from './index';
@@ -20,10 +20,6 @@ import {Icon} from '../Icon';
20
20
  import {formatMoneyToNumber, formatNumberToMoney} from './utils';
21
21
  import {formatComponentName} from '../Application/utils';
22
22
 
23
- const {
24
- ComponentContext,
25
- } = require('react-native/Libraries/Components/ScreenContext');
26
-
27
23
  const InputMoney = forwardRef(
28
24
  (
29
25
  {
@@ -19,14 +19,10 @@ import {CaretProps, InputOTPProps} from './index';
19
19
  import {scaleSize, Text} from '../Text';
20
20
  import styles from './styles';
21
21
  import {ErrorView, getBorderColor} from './common';
22
- import {ApplicationContext} from '../Application';
22
+ import {ApplicationContext, ComponentContext} from '../Application';
23
23
  import {Spacing} from '../Consts';
24
24
  import {formatComponentName} from '../Application/utils';
25
25
 
26
- const {
27
- ComponentContext,
28
- } = require('react-native/Libraries/Components/ScreenContext');
29
-
30
26
  const OTPCaret: FC<CaretProps> = ({index, length}) => {
31
27
  const DURATION = 300;
32
28
  const {theme} = useContext(ApplicationContext);
@@ -7,16 +7,12 @@ import {
7
7
  View,
8
8
  } from 'react-native';
9
9
  import {InputSearchProps} from './index';
10
- import {ApplicationContext} from '../Application';
10
+ import {ApplicationContext, ComponentContext} from '../Application';
11
11
  import styles from './styles';
12
12
  import {Icon} from '../Icon';
13
13
  import {Text} from '../Text';
14
14
  import {checkTyping} from './utils';
15
15
 
16
- const {
17
- ComponentContext,
18
- } = require('react-native/Libraries/Components/ScreenContext');
19
-
20
16
  const InputSearch = forwardRef(
21
17
  (
22
18
  {
@@ -19,10 +19,6 @@ import {InputTextAreaProps} from './index';
19
19
  import {Icon} from '../Icon';
20
20
  import {ApplicationContext} from '../Application';
21
21
 
22
- const {
23
- ComponentContext,
24
- } = require('react-native/Libraries/Components/ScreenContext');
25
-
26
22
  const InputTextArea = forwardRef(
27
23
  (
28
24
  {
@@ -114,7 +110,6 @@ const InputTextArea = forwardRef(
114
110
  <View style={styles.textAreaView}>
115
111
  <TextInput
116
112
  {...props}
117
- accessibilityLabel={ComponentContext}
118
113
  ref={inputRef}
119
114
  editable={!disabled}
120
115
  textAlignVertical="top"
@@ -4,15 +4,11 @@ import {PopupNotifyProps} from './types';
4
4
  import {Radius, Spacing, Styles} from '../Consts';
5
5
  import {Image} from '../Image';
6
6
  import {Text} from '../Text';
7
- import {ApplicationContext} from '../Application';
7
+ import {ApplicationContext, MiniAppContext} from '../Application';
8
8
  import {Button} from '../Button';
9
9
  import {Icon} from '../Icon';
10
10
  import {getAccessibilityID} from '../Application/utils';
11
11
 
12
- const {
13
- MiniAppContext,
14
- } = require('react-native/Libraries/Components/ScreenContext');
15
-
16
12
  const PopupNotify: React.FC<PopupNotifyProps> = ({
17
13
  id,
18
14
  image,
@@ -1,16 +1,12 @@
1
1
  import React, {useContext, useEffect, useRef} from 'react';
2
2
  import {StyleSheet, TouchableOpacity, View} from 'react-native';
3
3
  import {PopupPromotionProps} from './types';
4
- import {ApplicationContext} from '../Application';
4
+ import {ApplicationContext, MiniAppContext} from '../Application';
5
5
  import {Image} from '../Image';
6
6
  import {Radius, Spacing} from '../Consts';
7
7
  import {Icon} from '../Icon';
8
8
  import {getAccessibilityID} from '../Application/utils';
9
9
 
10
- const {
11
- MiniAppContext,
12
- } = require('react-native/Libraries/Components/ScreenContext');
13
-
14
10
  const PopupPromotion: React.FC<PopupPromotionProps> = ({
15
11
  id,
16
12
  image,
package/Radio/index.tsx CHANGED
@@ -4,14 +4,10 @@ import {TouchableOpacity, View} from 'react-native';
4
4
  import {RadioProps} from './types';
5
5
  import {Text} from '../Text';
6
6
  import styles from './styles';
7
- import {ApplicationContext} from '../Application';
7
+ import {ApplicationContext, ComponentContext} from '../Application';
8
8
  import {Spacing} from '../Consts';
9
9
  import {formatNameLength} from '../Application/utils';
10
10
 
11
- const {
12
- ComponentContext,
13
- } = require('react-native/Libraries/Components/ScreenContext');
14
-
15
11
  const Radio: FC<RadioProps> = ({
16
12
  value,
17
13
  groupValue,
package/Switch/index.tsx CHANGED
@@ -3,10 +3,7 @@ import {TouchableOpacity, View} from 'react-native';
3
3
  import {SwitchProps} from './types';
4
4
  import styles from './styles';
5
5
  import {Colors} from '../Consts';
6
-
7
- const {
8
- ComponentContext,
9
- } = require('react-native/Libraries/Components/ScreenContext');
6
+ import {ComponentContext} from '../Application';
10
7
 
11
8
  const Switch: FC<SwitchProps> = ({
12
9
  value = false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.2-tracking.5",
3
+ "version": "0.92.2-tracking.8",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {