react-native-salespanda 0.4.0 → 0.4.2

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.
Files changed (40) hide show
  1. package/README.md +89 -5
  2. package/android/build.gradle +186 -0
  3. package/lib/module/SalespandaApp.js +46 -12
  4. package/lib/module/SalespandaApp.js.map +1 -1
  5. package/lib/module/assets/images/index.js +1 -22
  6. package/lib/module/assets/images/index.js.map +1 -1
  7. package/lib/module/config/FlavorConfig.js +43 -0
  8. package/lib/module/config/FlavorConfig.js.map +1 -0
  9. package/lib/module/index.js +6 -0
  10. package/lib/module/index.js.map +1 -1
  11. package/lib/module/navigation/AppNavigator.js +8 -4
  12. package/lib/module/navigation/AppNavigator.js.map +1 -1
  13. package/lib/module/navigation/BottomTabNavigator.js +69 -41
  14. package/lib/module/navigation/BottomTabNavigator.js.map +1 -1
  15. package/lib/module/navigation/DrawerNavigator.js +13 -10
  16. package/lib/module/navigation/DrawerNavigator.js.map +1 -1
  17. package/lib/module/screens/CRMScreen.js.map +1 -1
  18. package/lib/module/screens/NotificationsScreen.js.map +1 -1
  19. package/lib/module/screens/ProfileScreen.js.map +1 -1
  20. package/lib/module/screens/ReportsScreen.js.map +1 -1
  21. package/lib/typescript/src/SalespandaApp.d.ts +12 -2
  22. package/lib/typescript/src/SalespandaApp.d.ts.map +1 -1
  23. package/lib/typescript/src/config/FlavorConfig.d.ts +20 -0
  24. package/lib/typescript/src/config/FlavorConfig.d.ts.map +1 -0
  25. package/lib/typescript/src/index.d.ts +2 -0
  26. package/lib/typescript/src/index.d.ts.map +1 -1
  27. package/lib/typescript/src/navigation/AppNavigator.d.ts.map +1 -1
  28. package/lib/typescript/src/navigation/BottomTabNavigator.d.ts.map +1 -1
  29. package/lib/typescript/src/navigation/DrawerNavigator.d.ts.map +1 -1
  30. package/package.json +1 -1
  31. package/src/SalespandaApp.tsx +57 -12
  32. package/src/config/FlavorConfig.ts +55 -0
  33. package/src/index.tsx +6 -0
  34. package/src/navigation/AppNavigator.tsx +9 -4
  35. package/src/navigation/BottomTabNavigator.tsx +84 -53
  36. package/src/navigation/DrawerNavigator.tsx +14 -4
  37. package/src/screens/CRMScreen.tsx +1 -1
  38. package/src/screens/NotificationsScreen.tsx +1 -1
  39. package/src/screens/ProfileScreen.tsx +1 -1
  40. package/src/screens/ReportsScreen.tsx +1 -1
package/src/index.tsx CHANGED
@@ -28,6 +28,12 @@ export {
28
28
  } from './config/SalespandaConfig';
29
29
  export type { SalespandaConfig } from './config/SalespandaConfig';
30
30
 
31
+ // ============================================
32
+ // FLAVOR CONFIGURATION
33
+ // ============================================
34
+ export { getFlavorConfig } from './config/FlavorConfig';
35
+ export { default as FlavorConfig } from './config/FlavorConfig';
36
+
31
37
  // ============================================
32
38
  // NAVIGATION COMPONENTS
33
39
  // ============================================
@@ -1,4 +1,5 @@
1
1
  import { NavigationContainer } from '@react-navigation/native';
2
+ import { StyleSheet } from 'react-native';
2
3
  import BottomTabNavigator from './BottomTabNavigator';
3
4
  import { SafeAreaView } from 'react-native-safe-area-context';
4
5
  import { Colors } from '../constants/Colors';
@@ -6,12 +7,16 @@ import { Colors } from '../constants/Colors';
6
7
  export default function AppNavigator() {
7
8
  return (
8
9
  <NavigationContainer>
9
- <SafeAreaView
10
- style={{ flex: 1, backgroundColor: Colors.background }}
11
- edges={['bottom', 'top']}
12
- >
10
+ <SafeAreaView style={styles.container} edges={['bottom', 'top']}>
13
11
  <BottomTabNavigator />
14
12
  </SafeAreaView>
15
13
  </NavigationContainer>
16
14
  );
17
15
  }
16
+
17
+ const styles = StyleSheet.create({
18
+ container: {
19
+ flex: 1,
20
+ backgroundColor: Colors.background,
21
+ },
22
+ });
@@ -1,5 +1,5 @@
1
1
  import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
2
- import { Image, View } from 'react-native';
2
+ import { Image, View, StyleSheet } from 'react-native';
3
3
  import HomeScreen from '../screens/HomeScreen';
4
4
  import NotificationsScreen from '../screens/NotificationsScreen';
5
5
  import ReportsScreen from '../screens/ReportsScreen';
@@ -22,59 +22,48 @@ import CRMScreen from '../screens/CRMScreen';
22
22
 
23
23
  const Tab = createBottomTabNavigator();
24
24
 
25
- export default function BottomTabNavigator() {
26
- const renderImageIcon =
27
- (inactive: any, active: any) =>
28
- ({ focused, size }: { focused: boolean; size: number }) => {
29
- if (focused) {
30
- return (
31
- <View
32
- style={{
33
- width: 48,
34
- height: 48,
35
- borderRadius: 24,
36
- alignItems: 'center',
37
- justifyContent: 'center',
38
- borderWidth: 4,
39
- borderColor: Colors.white,
40
- transform: [{ translateY: -6 }],
41
- }}
42
- >
43
- <Image
44
- source={active}
45
- resizeMode="contain"
46
- style={{ width: 42, height: 42, tintColor: Colors.primary }}
47
- />
48
- </View>
49
- );
50
- }
25
+ interface TabIconProps {
26
+ focused: boolean;
27
+ size: number;
28
+ }
29
+
30
+ interface ImageIconProps {
31
+ inactive: any;
32
+ active: any;
33
+ }
34
+
35
+ function ImageIcon({ inactive, active }: ImageIconProps) {
36
+ return ({ focused, size }: TabIconProps) => {
37
+ if (focused) {
51
38
  return (
52
- <Image
53
- source={inactive}
54
- resizeMode="contain"
55
- style={{ width: size, height: size, tintColor: Colors.black30 }}
56
- />
39
+ <View style={styles.activeIconContainer}>
40
+ <Image
41
+ source={active}
42
+ resizeMode="contain"
43
+ style={styles.activeIcon}
44
+ />
45
+ </View>
57
46
  );
58
- };
47
+ }
48
+ return (
49
+ <Image
50
+ source={inactive}
51
+ resizeMode="contain"
52
+ style={[styles.inactiveIcon, { width: size, height: size }]}
53
+ />
54
+ );
55
+ };
56
+ }
59
57
 
58
+ export default function BottomTabNavigator() {
60
59
  return (
61
- <SafeAreaView
62
- style={{ flex: 1, backgroundColor: Colors.background }}
63
- edges={['bottom']}
64
- >
60
+ <SafeAreaView style={styles.container} edges={['bottom']}>
65
61
  <Tab.Navigator
66
62
  screenOptions={{
67
63
  headerShown: false,
68
64
  sceneStyle: { backgroundColor: Colors.background },
69
65
  tabBarShowLabel: false,
70
- tabBarStyle: {
71
- borderTopWidth: 1,
72
- borderTopColor: Colors.border,
73
- backgroundColor: Colors.white,
74
- paddingBottom: 10,
75
- paddingTop: 8,
76
- height: 64,
77
- },
66
+ tabBarStyle: styles.tabBar,
78
67
  tabBarItemStyle: { overflow: 'visible' },
79
68
  }}
80
69
  >
@@ -82,7 +71,10 @@ export default function BottomTabNavigator() {
82
71
  name="Home"
83
72
  component={HomeScreen}
84
73
  options={{
85
- tabBarIcon: renderImageIcon(homeIcon, homeIconActive),
74
+ tabBarIcon: ImageIcon({
75
+ inactive: homeIcon,
76
+ active: homeIconActive,
77
+ }),
86
78
  headerShown: false,
87
79
  }}
88
80
  />
@@ -90,34 +82,73 @@ export default function BottomTabNavigator() {
90
82
  name="CRM"
91
83
  component={CRMScreen}
92
84
  options={{
93
- tabBarIcon: renderImageIcon(crmIcon, crmIconActive),
85
+ tabBarIcon: ImageIcon({ inactive: crmIcon, active: crmIconActive }),
94
86
  }}
95
87
  />
96
88
  <Tab.Screen
97
89
  name="Reports"
98
90
  component={ReportsScreen}
99
91
  options={{
100
- tabBarIcon: renderImageIcon(diaryIcon, diaryIconActive),
92
+ tabBarIcon: ImageIcon({
93
+ inactive: diaryIcon,
94
+ active: diaryIconActive,
95
+ }),
101
96
  }}
102
97
  />
103
98
  <Tab.Screen
104
99
  name="Notifications"
105
100
  component={NotificationsScreen}
106
101
  options={{
107
- tabBarIcon: renderImageIcon(
108
- notificationIcon,
109
- notificationIconActive
110
- ),
102
+ tabBarIcon: ImageIcon({
103
+ inactive: notificationIcon,
104
+ active: notificationIconActive,
105
+ }),
111
106
  }}
112
107
  />
113
108
  <Tab.Screen
114
109
  name="Profile"
115
110
  component={ProfileScreen}
116
111
  options={{
117
- tabBarIcon: renderImageIcon(analyticsIcon, analyticsIconActive),
112
+ tabBarIcon: ImageIcon({
113
+ inactive: analyticsIcon,
114
+ active: analyticsIconActive,
115
+ }),
118
116
  }}
119
117
  />
120
118
  </Tab.Navigator>
121
119
  </SafeAreaView>
122
120
  );
123
121
  }
122
+
123
+ const styles = StyleSheet.create({
124
+ container: {
125
+ flex: 1,
126
+ backgroundColor: Colors.background,
127
+ },
128
+ tabBar: {
129
+ borderTopWidth: 1,
130
+ borderTopColor: Colors.border,
131
+ backgroundColor: Colors.white,
132
+ paddingBottom: 10,
133
+ paddingTop: 8,
134
+ height: 64,
135
+ },
136
+ activeIconContainer: {
137
+ width: 48,
138
+ height: 48,
139
+ borderRadius: 24,
140
+ alignItems: 'center',
141
+ justifyContent: 'center',
142
+ borderWidth: 4,
143
+ borderColor: Colors.white,
144
+ transform: [{ translateY: -6 }],
145
+ },
146
+ activeIcon: {
147
+ width: 42,
148
+ height: 42,
149
+ tintColor: Colors.primary,
150
+ },
151
+ inactiveIcon: {
152
+ tintColor: Colors.black30,
153
+ },
154
+ });
@@ -38,9 +38,12 @@ const DrawerItem: React.FC<DrawerItemProps> = ({
38
38
  );
39
39
  };
40
40
 
41
- function CustomDrawerContent(props: any) {
42
- const { navigation } = props;
41
+ interface CustomDrawerContentProps {
42
+ navigation: any;
43
+ state?: any;
44
+ }
43
45
 
46
+ function CustomDrawerContent({ navigation }: CustomDrawerContentProps) {
44
47
  const [expanded, setExpanded] = React.useState<Record<string, boolean>>({
45
48
  'Campaign': false,
46
49
  'Sales WAR Room': false,
@@ -131,7 +134,7 @@ function CustomDrawerContent(props: any) {
131
134
  onPress={() => toggle(group.label)}
132
135
  activeOpacity={0.7}
133
136
  >
134
- <Text style={[styles.drawerLabel, { flex: 1 }]}>
137
+ <Text style={[styles.drawerLabel, styles.flexOne]}>
135
138
  {group.label}
136
139
  </Text>
137
140
  <Text style={styles.chevron}>{isOpen ? '▾' : '▸'}</Text>
@@ -156,10 +159,14 @@ function CustomDrawerContent(props: any) {
156
159
  );
157
160
  }
158
161
 
162
+ function renderDrawerContent(props: any) {
163
+ return <CustomDrawerContent navigation={props.navigation} />;
164
+ }
165
+
159
166
  export default function DrawerNavigator() {
160
167
  return (
161
168
  <Drawer.Navigator
162
- drawerContent={(props) => <CustomDrawerContent {...props} />}
169
+ drawerContent={renderDrawerContent}
163
170
  screenOptions={{
164
171
  headerShown: true,
165
172
  drawerType: 'slide',
@@ -288,4 +295,7 @@ const styles = StyleSheet.create({
288
295
  color: Colors.white,
289
296
  fontWeight: '500',
290
297
  },
298
+ flexOne: {
299
+ flex: 1,
300
+ },
291
301
  });
@@ -8,7 +8,7 @@ export default function CRMScreen() {
8
8
  <View style={styles.header}>
9
9
  <Text style={styles.headerTitle}>CRM</Text>
10
10
  </View>
11
- <ScrollView style={styles.scrollView}></ScrollView>
11
+ <ScrollView style={styles.scrollView} />
12
12
  </SafeAreaView>
13
13
  );
14
14
  }
@@ -8,7 +8,7 @@ export default function NotificationsScreen() {
8
8
  <View style={styles.header}>
9
9
  <Text style={styles.headerTitle}>Notification</Text>
10
10
  </View>
11
- <ScrollView style={styles.scrollView}></ScrollView>
11
+ <ScrollView style={styles.scrollView} />
12
12
  </SafeAreaView>
13
13
  );
14
14
  }
@@ -8,7 +8,7 @@ export default function ProfileScreen() {
8
8
  <View style={styles.header}>
9
9
  <Text style={styles.headerTitle}>Anyaltics</Text>
10
10
  </View>
11
- <ScrollView style={styles.scrollView}></ScrollView>
11
+ <ScrollView style={styles.scrollView} />
12
12
  </SafeAreaView>
13
13
  );
14
14
  }
@@ -8,7 +8,7 @@ export default function NotificationsScreen() {
8
8
  <View style={styles.header}>
9
9
  <Text style={styles.headerTitle}>Reports</Text>
10
10
  </View>
11
- <ScrollView style={styles.scrollView}></ScrollView>
11
+ <ScrollView style={styles.scrollView} />
12
12
  </SafeAreaView>
13
13
  );
14
14
  }