@admin-layout/gluestack-ui-mobile 12.2.4-alpha.1 → 12.2.4-alpha.12

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,11 +1,11 @@
1
1
  import React from 'react';
2
- import {Box,Pressable,Center,Text, SafeAreaView} from '@gluestack-ui/themed';
2
+ import { Box, Pressable, Center, Text, SafeAreaView } from '@gluestack-ui/themed';
3
3
  import { useSelector } from 'react-redux';
4
4
  import { useRoute } from '@react-navigation/native';
5
5
  import { navigationRef } from '@common-stack/client-react';
6
6
 
7
- export const BottomTabBar = ({ state, descriptors, navigation,...props }: any) => {
8
- const tabBarProps = props?.customTabBarProps??{};
7
+ export const BottomTabBar = ({ state, descriptors, navigation, ...props }: any) => {
8
+ const tabBarProps = props?.customTabBarProps ?? {};
9
9
  const settings = useSelector<any>((state) => state.settings) as any;
10
10
  //const currentRoute: any = useRoute();
11
11
  const currentRoute: any = navigationRef.isReady() ? navigationRef?.getCurrentRoute() : null;
@@ -23,118 +23,117 @@ export const BottomTabBar = ({ state, descriptors, navigation,...props }: any) =
23
23
  (b.options.priority ? b.options.priority : b.options.title),
24
24
  );
25
25
 
26
- const onPress = React.useCallback((route, navigation, isFocused) => {
27
- if (route?.route) {
28
- const event = navigation.emit({
29
- type: 'tabPress',
30
- target: route.route.key,
31
- canPreventDefault: true,
32
- });
33
-
34
- if (!isFocused && !event.defaultPrevented) {
35
- // The `merge: true` option makes sure that the params inside the tab screen are preserved
36
- navigation.navigate({
37
- name: route.route.name,
38
- merge: true,
39
- orgName: currentRoute?.params?.orgName || platformState?.orgName,
40
- });
41
- }
42
- }
43
- }, []);
26
+ const onPress = React.useCallback((route, navigation, isFocused) => {
27
+ if (route?.route) {
28
+ const event = navigation.emit({
29
+ type: 'tabPress',
30
+ target: route.route.key,
31
+ canPreventDefault: true,
32
+ });
44
33
 
45
- const onLongPress = React.useCallback((route, navigation, isFocused) => {
46
- if (route?.route) {
47
- navigation.emit({
48
- type: 'tabLongPress',
49
- target: route.route.key,
34
+ if (!isFocused && !event.defaultPrevented) {
35
+ // The `merge: true` option makes sure that the params inside the tab screen are preserved
36
+ navigation.navigate({
37
+ name: route.route.name,
38
+ merge: true,
39
+ orgName: currentRoute?.params?.orgName || platformState?.orgName,
50
40
  });
51
41
  }
52
- }, []);
42
+ }
43
+ }, []);
53
44
 
45
+ const onLongPress = React.useCallback((route, navigation, isFocused) => {
46
+ if (route?.route) {
47
+ navigation.emit({
48
+ type: 'tabLongPress',
49
+ target: route.route.key,
50
+ });
51
+ }
52
+ }, []);
54
53
 
55
54
  return (
56
55
  <SafeAreaView>
57
- <Box
58
- flexDirection="row"
59
- width="100%"
60
- alignSelf="center"
61
- bg={'$white'}
62
- borderTopWidth={"$1"}
63
- borderTopColor={'#d3d3d3'}
64
- py={"$4"}
65
- {...tabBarProps}
66
- >
67
- {appRoutes.map((route: any, index: any) => {
68
- const options = route.options;
69
- const label =
70
- options.tabBarLabel !== undefined
71
- ? options.tabBarLabel
72
- : options.title !== undefined
56
+ <Box
57
+ flexDirection="row"
58
+ width="100%"
59
+ alignSelf="center"
60
+ bg={'$white'}
61
+ borderTopWidth={'$1'}
62
+ borderTopColor={'#d3d3d3'}
63
+ py={'$4'}
64
+ {...tabBarProps}
65
+ >
66
+ {appRoutes.map((route: any, index: any) => {
67
+ const options = route.options;
68
+ const label =
69
+ options.tabBarLabel !== undefined
70
+ ? options.tabBarLabel
71
+ : options.title !== undefined
73
72
  ? options.title
74
73
  : route.route.name;
75
74
 
76
- const isFocused = state.index === route.index;
75
+ const isFocused = state.index === route.index;
77
76
 
78
- // const onPress = () => {
79
- // const event = navigation.emit({
80
- // type: 'tabPress',
81
- // target: route.route.key,
82
- // canPreventDefault: true,
83
- // });
77
+ // const onPress = () => {
78
+ // const event = navigation.emit({
79
+ // type: 'tabPress',
80
+ // target: route.route.key,
81
+ // canPreventDefault: true,
82
+ // });
84
83
 
85
- // if (!isFocused && !event.defaultPrevented) {
86
- // // The `merge: true` option makes sure that the params inside the tab screen are preserved
87
- // navigation.navigate({
88
- // name: route.route.name,
89
- // merge: true,
90
- // orgName: currentRoute?.params?.orgName || platformState?.orgName,
91
- // });
92
- // }
93
- // };
84
+ // if (!isFocused && !event.defaultPrevented) {
85
+ // // The `merge: true` option makes sure that the params inside the tab screen are preserved
86
+ // navigation.navigate({
87
+ // name: route.route.name,
88
+ // merge: true,
89
+ // orgName: currentRoute?.params?.orgName || platformState?.orgName,
90
+ // });
91
+ // }
92
+ // };
94
93
 
95
- // const onLongPress = () => {
96
- // navigation.emit({
97
- // type: 'tabLongPress',
98
- // target: route.route.key,
99
- // });
100
- // };
94
+ // const onLongPress = () => {
95
+ // navigation.emit({
96
+ // type: 'tabLongPress',
97
+ // target: route.route.key,
98
+ // });
99
+ // };
101
100
 
102
- return (
103
- <Pressable
104
- key={index}
105
- opacity={isFocused ? "$100" : "$50"}
106
- // pb="$8"
107
- // pt={"$3"}
108
- flex={1}
109
- onPress={()=>onPress(route,navigation,isFocused)}
110
- onLongPress={()=>onLongPress(route,navigation,isFocused)}
111
- testID={options.tabBarTestID}
112
- accessibilityState={isFocused ? { selected: true } : {}}
113
- accessibilityLabel={options.tabBarAccessibilityLabel}
114
- >
115
- <Center>
116
- {options?.tabBarIcon
117
- ? options.tabBarIcon({
118
- color: isFocused
119
- ? options.tabBarActiveTintColor
120
- : options.tabBarInactiveTintColor,
121
- size: 24,
122
- })
123
- : null}
101
+ return (
102
+ <Pressable
103
+ key={index}
104
+ opacity={isFocused ? '$100' : '$50'}
105
+ // pb="$8"
106
+ // pt={"$3"}
107
+ flex={1}
108
+ onPress={() => onPress(route, navigation, isFocused)}
109
+ onLongPress={() => onLongPress(route, navigation, isFocused)}
110
+ testID={options.tabBarTestID}
111
+ accessibilityState={isFocused ? { selected: true } : {}}
112
+ accessibilityLabel={options.tabBarAccessibilityLabel}
113
+ >
114
+ <Center>
115
+ {options?.tabBarIcon
116
+ ? options.tabBarIcon({
117
+ color: isFocused
118
+ ? options.tabBarActiveTintColor
119
+ : options.tabBarInactiveTintColor,
120
+ size: 24,
121
+ })
122
+ : null}
124
123
 
125
- <Text
126
- color={isFocused ? options.tabBarActiveTintColor : options.tabBarInactiveTintColor}
127
- style={{fontSize:12}}
128
- >
129
- {label}
130
- </Text>
131
- </Center>
132
- </Pressable>
133
- );
134
- })}
135
- </Box>
124
+ <Text
125
+ color={isFocused ? options.tabBarActiveTintColor : options.tabBarInactiveTintColor}
126
+ style={{ fontSize: 12 }}
127
+ >
128
+ {label}
129
+ </Text>
130
+ </Center>
131
+ </Pressable>
132
+ );
133
+ })}
134
+ </Box>
136
135
  </SafeAreaView>
137
136
  );
138
137
  };
139
138
 
140
- export default BottomTabBar;
139
+ export default BottomTabBar;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Box, Text } from '@gluestack-ui/themed';
2
+ import { Box, Text } from '@gluestack-ui/themed';
3
3
 
4
4
  export const Sample = () => {
5
5
  return (
@@ -1,14 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- import {
4
- Toast,
5
- VStack,
6
- ToastTitle,
7
- ToastDescription,
8
- Pressable,
9
- Icon,
10
- CloseIcon,
11
- } from '@gluestack-ui/themed';
3
+ import { Toast, VStack, ToastTitle, ToastDescription, Pressable, Icon, CloseIcon } from '@gluestack-ui/themed';
12
4
 
13
5
  interface IToast {
14
6
  id: string;
@@ -17,7 +9,7 @@ interface IToast {
17
9
  description?: string;
18
10
  isClosable?: boolean;
19
11
  toast?: any;
20
- variant?:any
12
+ variant?: any;
21
13
  }
22
14
 
23
15
  // variants:
@@ -25,7 +17,15 @@ interface IToast {
25
17
  // solid,
26
18
  // outline
27
19
 
28
- export const ToastAlert = ({ id, status = 'info', title='', description = '',variant='solid', isClosable, toast=null }: IToast) => {
20
+ export const ToastAlert = ({
21
+ id,
22
+ status = 'info',
23
+ title = '',
24
+ description = '',
25
+ variant = 'solid',
26
+ isClosable,
27
+ toast = null,
28
+ }: IToast) => {
29
29
  const toastId = 'toast-' + id;
30
30
  const actionType = status || 'info';
31
31
  return (
@@ -1,38 +1,28 @@
1
1
  import React from 'react';
2
- import {
3
- Box,
4
- Button,
5
- Heading,
6
- Text,
7
- HStack,
8
- Pressable,
9
- Divider,
10
- ButtonText,
11
- SafeAreaView,
12
- } from '@gluestack-ui/themed';
2
+ import { Box, Button, Heading, Text, HStack, Pressable, Divider, ButtonText, SafeAreaView } from '@gluestack-ui/themed';
13
3
  import { useNavigation } from '@react-navigation/native';
14
4
  import { Ionicons } from '@expo/vector-icons';
15
5
  import { Linking } from 'react-native';
16
6
 
17
- const UnAuthenticatedComponent = () => {
7
+ const UnAuthenticatedComponent = () => {
18
8
  const navigation = useNavigation<any>();
19
9
  return (
20
10
  <SafeAreaView flex={1}>
21
- <Box flex={1} borderTopWidth={'$1'} borderTopColor={'$trueGray200'}>
22
- {/* <Box h={'$1'} bg={Colors.primaryBgColor} /> */}
23
- <Box flex={1} p={'$6'} bg="$white" justifyContent={'center'}>
24
- <Heading mt={'$2'}>Login</Heading>
25
- <Text fontSize="$md" mt={'$2'}>
26
- Log in to continue.
27
- </Text>
28
- <Button bg={'$blue500'} size="lg" my={'$3'} onPress={() => navigation.navigate('MainStack.Login')}>
29
- <ButtonText color="$white">Login</ButtonText>
30
- </Button>
31
- <Divider my={'$3'} />
11
+ <Box flex={1} borderTopWidth={'$1'} borderTopColor={'$trueGray200'}>
12
+ {/* <Box h={'$1'} bg={Colors.primaryBgColor} /> */}
13
+ <Box flex={1} p={'$6'} bg="$white" justifyContent={'center'}>
14
+ <Heading mt={'$2'}>Login</Heading>
15
+ <Text fontSize="$md" mt={'$2'}>
16
+ Log in to continue.
17
+ </Text>
18
+ <Button bg={'$blue500'} size="lg" my={'$3'} onPress={() => navigation.navigate('MainStack.Login')}>
19
+ <ButtonText color="$white">Login</ButtonText>
20
+ </Button>
21
+ <Divider my={'$3'} />
22
+ </Box>
32
23
  </Box>
33
- </Box>
34
- </SafeAreaView>
24
+ </SafeAreaView>
35
25
  );
36
26
  };
37
27
 
38
- export default UnAuthenticatedComponent;
28
+ export default UnAuthenticatedComponent;
@@ -11,7 +11,7 @@ const ProLayout: React.FC<any> = (props) => {
11
11
  const [appRoutes, setAppRoutes] = React.useState<any>([]);
12
12
  const { pathKey, appLayout } = useLayoutSetting(props);
13
13
  AppLayout = appLayout;
14
- const {appFeatures} = routeConfigKeyReplace(pathKey, props?.features,appLayout);
14
+ const { appFeatures } = routeConfigKeyReplace(pathKey, props?.features, appLayout);
15
15
  AppFeatures = appFeatures;
16
16
 
17
17
  React.useEffect(() => {
package/src/index.ts CHANGED
@@ -5,7 +5,7 @@ import { settingsReducer } from './redux/settings';
5
5
  import { useAfterInteractions } from './hooks/use-after-interactions';
6
6
  import useIsReady from './hooks/useIsReady';
7
7
  import routeConfigKeyReplace from './utils/routeConfigKeyReplace';
8
- import {getReplacedRouteConfig} from './utils/getReplacedRouteConfig'
8
+ import { getReplacedRouteConfig } from './utils/getReplacedRouteConfig';
9
9
  import LayoutFeature, { ProLayout, AppFeatures, AppLayout } from './containers/layout/module';
10
10
  import { useLayoutSetting, LayoutSettingProps } from './hooks/useLayoutSetting';
11
11
  import i18next from './config/i18next';
@@ -21,7 +21,6 @@ export * from '@gluestack-ui/config';
21
21
  export * from '@gluestack-style/react';
22
22
  //............................gluestack-ui....///
23
23
 
24
-
25
24
  export {
26
25
  useLayoutSetting,
27
26
  LayoutSettingProps,
@@ -400,7 +400,7 @@ export class GenerateMobileNavigations {
400
400
  `.replace(/,(\s*)$/, ''); // Removes trailing comma
401
401
 
402
402
  // Use Prettier to format the code
403
- classStructure = prettier.format(classStructure, { parser: 'babel' });
403
+ classStructure = await prettier.format(classStructure, { parser: 'babel' });
404
404
 
405
405
  const appFeatures = importStatements + '\n' + classStructure;
406
406
 
@@ -550,7 +550,7 @@ export class GenerateMobileNavigations {
550
550
  `.replace(/,(\s*)$/, ''); // Removes trailing comma
551
551
 
552
552
  // Use Prettier to format the code
553
- classStructure = prettier.format(classStructure, { parser: 'babel' });
553
+ classStructure = await prettier.format(classStructure, { parser: 'babel' });
554
554
 
555
555
  const appFeatures = importStatements + '\n' + classStructure;
556
556
 
@@ -620,7 +620,7 @@ export class GenerateMobileNavigations {
620
620
  `.replace(/,(\s*)$/, ''); // Removes trailing comma
621
621
 
622
622
  // Use Prettier to format the code
623
- classStructure = prettier.format(classStructure, { parser: 'babel' });
623
+ classStructure = await prettier.format(classStructure, { parser: 'babel' });
624
624
 
625
625
  const appFeatures = importStatements + '\n' + classStructure;
626
626
 
@@ -807,7 +807,7 @@ export class GenerateMobileNavigations {
807
807
  }
808
808
  stackNavigator = importStatements + '\n' + moduleRender;
809
809
  let stackNavigation = stackNavigator;
810
- stackNavigation = prettier.format(stackNavigation, { parser: 'babel' });
810
+ stackNavigation = await prettier.format(stackNavigation, { parser: 'babel' });
811
811
  const stackDirName = path.dirname(stackDirPath);
812
812
  try {
813
813
  const isDirCreated = await this.#makeDir(stackDirName);
@@ -987,7 +987,7 @@ export class GenerateMobileNavigations {
987
987
  moduleNavigation = importStatements + '\n' + moduleRender;
988
988
  const drawerNavigator = moduleNavigation;
989
989
  let drawerNavigation = drawerNavigator;
990
- drawerNavigation = prettier.format(drawerNavigation, { parser: 'babel' });
990
+ drawerNavigation = await prettier.format(drawerNavigation, { parser: 'babel' });
991
991
  const drawerDirName = path.dirname(drawerDirPath);
992
992
  try {
993
993
  const isDirCreated = await this.#makeDir(drawerDirName);
@@ -1257,7 +1257,7 @@ export class GenerateMobileNavigations {
1257
1257
  moduleNavigation = importStatements + '\n' + moduleRender;
1258
1258
  const bottomTabNavigator = moduleNavigation;
1259
1259
  let bottomTabNavigation = bottomTabNavigator;
1260
- bottomTabNavigation = prettier.format(bottomTabNavigation, { parser: 'babel' });
1260
+ bottomTabNavigation = await prettier.format(bottomTabNavigation, { parser: 'babel' });
1261
1261
  const bottomDirName = path.dirname(bottomDirPath);
1262
1262
  try {
1263
1263
  const isDirCreated = await this.#makeDir(bottomDirName);
@@ -1684,7 +1684,7 @@ export class GenerateMobileNavigations {
1684
1684
  export default AppNavigations;
1685
1685
  `;
1686
1686
  appNavigation = importStatements + '\n' + rootComponent + '\n' + appComponent;
1687
- appNavigation = prettier.format(appNavigation, { parser: 'babel' });
1687
+ appNavigation = await prettier.format(appNavigation, { parser: 'babel' });
1688
1688
  try {
1689
1689
  await this.#writeFile(navigationDirPath, appNavigation);
1690
1690
  } catch (error) {