generated from nishkohli96/rn-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f6bd8f
commit a8174da
Showing
5 changed files
with
124 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import IoniconsI from 'react-native-vector-icons/Ionicons'; | ||
|
||
export const PermissionsList = [ | ||
{ | ||
navigateRoute: 'ContactsList', | ||
iconName: 'person-outline', | ||
label: 'Contacts', | ||
}, | ||
{ | ||
navigateRoute: 'Location', | ||
iconName: 'location-outline', | ||
label: 'Location', | ||
}, | ||
]; | ||
|
||
export const ChartList = [ | ||
{ | ||
navigateRoute: 'VictoryBarChart', | ||
iconName: 'bar-chart', | ||
label: 'Victory BarChart', | ||
}, | ||
/* No iOS code for these 2 pages, so they're at the bottom of the list */ | ||
{ | ||
navigateRoute: 'LineChartScreen', | ||
iconName: 'bar-chart', | ||
label: 'Line Chart', | ||
}, | ||
{ | ||
navigateRoute: 'RadarhartScreen', | ||
iconName: 'pie-chart-outline', | ||
label: 'Radar Chart', | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
|
||
import RenderListRoutes from '_Shared/RenderListRoutes'; | ||
import { PermissionsList } from '_Constants/ListRoutes'; | ||
|
||
const Permissions = () => { | ||
return ( | ||
<RenderListRoutes | ||
headerTitle="Permissions" | ||
routesArr={PermissionsList} | ||
/> | ||
); | ||
}; | ||
|
||
export default Permissions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,15 @@ | ||
import React from 'react'; | ||
import { TouchableOpacity, StyleSheet } from 'react-native'; | ||
import { useNavigation } from '@react-navigation/native'; | ||
import IoniconsI from 'react-native-vector-icons/Ionicons'; | ||
|
||
import { | ||
ThemedContainer, | ||
ThemedBody, | ||
ThemedHeading, | ||
ThemedCard, | ||
ThemedText, | ||
} from '_Shared/Comps.themed'; | ||
import Header from '_Shared/Header'; | ||
import { useThemeStore } from '_Store/theme.store'; | ||
import CommonStyles from '_Themes/CommonStyles'; | ||
import RenderListRoutes from '_Shared/RenderListRoutes'; | ||
import { PermissionsList } from '_Constants/ListRoutes'; | ||
|
||
const Permissions = () => { | ||
const navigation = useNavigation(); | ||
const { themeObj } = useThemeStore(); | ||
|
||
return ( | ||
<ThemedContainer> | ||
<Header title="Permissions" openDrawer /> | ||
<ThemedBody> | ||
<ThemedHeading> | ||
Click on any of the items to proceed further | ||
</ThemedHeading> | ||
|
||
<TouchableOpacity | ||
onPress={() => navigation.navigate('ContactsList')}> | ||
<ThemedCard style={styles.card}> | ||
<ThemedText> | ||
<IoniconsI | ||
name="person-outline" | ||
color={themeObj.colors.text} | ||
size={CommonStyles.icons.drawerIcon} | ||
/>{' '} | ||
Contacts | ||
</ThemedText> | ||
</ThemedCard> | ||
</TouchableOpacity> | ||
|
||
<TouchableOpacity | ||
onPress={() => navigation.navigate('Location')}> | ||
<ThemedCard style={styles.card}> | ||
<ThemedText> | ||
<IoniconsI | ||
name="location-outline" | ||
color={themeObj.colors.text} | ||
size={CommonStyles.icons.drawerIcon} | ||
/>{' '} | ||
Location | ||
</ThemedText> | ||
</ThemedCard> | ||
</TouchableOpacity> | ||
</ThemedBody> | ||
</ThemedContainer> | ||
<RenderListRoutes | ||
headerTitle="Permissions" | ||
routesArr={PermissionsList} | ||
/> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
card: { marginTop: 30, alignItems: 'center' }, | ||
}); | ||
|
||
export default Permissions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { TouchableOpacity, StyleSheet } from 'react-native'; | ||
import { useNavigation } from '@react-navigation/native'; | ||
import IoniconsI from 'react-native-vector-icons/Ionicons'; | ||
|
||
import { | ||
ThemedContainer, | ||
ThemedBody, | ||
ThemedHeading, | ||
ThemedCard, | ||
ThemedText, | ||
} from '_Shared/Comps.themed'; | ||
import Header from '_Shared/Header'; | ||
import { useThemeStore } from '_Store/theme.store'; | ||
import CommonStyles from '_Themes/CommonStyles'; | ||
|
||
const RenderListRoutes = ({ headerTitle, routesArr }) => { | ||
const navigation = useNavigation(); | ||
const { themeObj } = useThemeStore(); | ||
|
||
return ( | ||
<ThemedContainer> | ||
<Header title={headerTitle} openDrawer /> | ||
<ThemedBody> | ||
<ThemedHeading> | ||
Click on any of the items to proceed further | ||
</ThemedHeading> | ||
|
||
{routesArr.map((routeName, index) => ( | ||
<TouchableOpacity | ||
key={index} | ||
onPress={() => | ||
navigation.navigate(routeName.navigateRoute) | ||
}> | ||
<ThemedCard style={styles.card}> | ||
<ThemedText> | ||
{routeName.iconName && ( | ||
<IoniconsI | ||
name={routeName.iconName} | ||
color={themeObj.colors.text} | ||
size={CommonStyles.icons.drawerIcon} | ||
/> | ||
)}{' '} | ||
{routeName.label} | ||
</ThemedText> | ||
</ThemedCard> | ||
</TouchableOpacity> | ||
))} | ||
</ThemedBody> | ||
</ThemedContainer> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
card: { marginTop: 30, alignItems: 'center' }, | ||
}); | ||
|
||
RenderListRoutes.PropTypes = { | ||
headerTitle: PropTypes.string, | ||
routesArr: PropTypes.object, | ||
} | ||
|
||
RenderListRoutes.defaultProps = { | ||
headerTitle: 'headerTitle', | ||
routesArr: [], | ||
} | ||
|
||
export default RenderListRoutes; |