Application Android et IOS pour l'amicale des élèves
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AboutScreen.js 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. import React from 'react';
  2. import {Platform, StyleSheet, Linking, Alert, FlatList} from 'react-native';
  3. import {Container, Content, Text, Card, CardItem, Body, Icon, Left, Right, Thumbnail, H1, ListItem} from 'native-base';
  4. import CustomHeader from "../../components/CustomHeader";
  5. import i18n from "i18n-js";
  6. import appJson from '../../app';
  7. import packageJson from '../../package';
  8. import CustomMaterialIcon from "../../components/CustomMaterialIcon";
  9. const links = {
  10. appstore: 'https://qwant.com',
  11. playstore: 'https://qwant.com',
  12. gitlab: 'https://qwant.com',
  13. bugs: 'https://qwant.com',
  14. changelog: 'https://qwant.com',
  15. license: 'https://qwant.com',
  16. mail: "mailto:arnaud.vergnet@netc.fr?subject=Application Amicale INSA Toulouse&body=",
  17. linkedin: 'https://www.linkedin.com/in/arnaud-vergnet-434ba5179/',
  18. facebook: 'https://www.facebook.com/arnaud.vergnet',
  19. react: 'https://facebook.github.io/react-native/',
  20. };
  21. function openWebLink(link) {
  22. Linking.openURL(link).catch((err) => console.error('Error opening link', err));
  23. }
  24. export default class AboutScreen extends React.Component {
  25. appData = [
  26. {
  27. onPressCallback: () => openWebLink(Platform.OS === "ios" ? links.appstore : links.playstore),
  28. icon: Platform.OS === "ios" ? 'apple' : 'google-play',
  29. text: Platform.OS === "ios" ? i18n.t('aboutScreen.appstore') : i18n.t('aboutScreen.playstore'),
  30. showChevron: true
  31. },
  32. {
  33. onPressCallback: () => openWebLink(links.gitlab),
  34. icon: 'git',
  35. text: 'Gitlab',
  36. showChevron: true
  37. },
  38. {
  39. onPressCallback: () => openWebLink(links.bugs),
  40. icon: 'bug',
  41. text: i18n.t('aboutScreen.bugs'),
  42. showChevron: true
  43. },
  44. {
  45. onPressCallback: () => openWebLink(links.changelog),
  46. icon: 'refresh',
  47. text: i18n.t('aboutScreen.changelog'),
  48. showChevron: true
  49. },
  50. {
  51. onPressCallback: () => openWebLink(links.license),
  52. icon: 'file-document',
  53. text: i18n.t('aboutScreen.license'),
  54. showChevron: true
  55. },
  56. ];
  57. authorData = [
  58. {
  59. onPressCallback: () => Alert.alert('Coucou', 'Whaou'),
  60. icon: 'account-circle',
  61. text: 'Arnaud VERGNET',
  62. showChevron: false
  63. },
  64. {
  65. onPressCallback: () => openWebLink(links.mail),
  66. icon: 'email',
  67. text: i18n.t('aboutScreen.mail'),
  68. showChevron: true
  69. },
  70. {
  71. onPressCallback: () => openWebLink(links.linkedin),
  72. icon: 'linkedin',
  73. text: 'Linkedin',
  74. showChevron: true
  75. },
  76. {
  77. onPressCallback: () => openWebLink(links.facebook),
  78. icon: 'facebook',
  79. text: 'Facebook',
  80. showChevron: true
  81. },
  82. ];
  83. technoData = [
  84. {
  85. onPressCallback: () => openWebLink(links.react),
  86. icon: 'react',
  87. text: i18n.t('aboutScreen.reactNative'),
  88. showChevron: false
  89. },
  90. {
  91. onPressCallback: () => this.props.navigation.navigate('AboutDependenciesScreen', {data: packageJson.dependencies}),
  92. icon: 'developer-board',
  93. text: i18n.t('aboutScreen.libs'),
  94. showChevron: true
  95. },
  96. ];
  97. getCardItem(onPressCallback, icon, text, showChevron) {
  98. return (
  99. <CardItem button
  100. onPress={onPressCallback}>
  101. <Left>
  102. <CustomMaterialIcon icon={icon}/>
  103. <Text>{text}</Text>
  104. </Left>
  105. {showChevron ?
  106. <Right>
  107. <CustomMaterialIcon icon="chevron-right"
  108. fontSize={20}/>
  109. </Right>
  110. :
  111. <Right/>
  112. }
  113. </CardItem>)
  114. ;
  115. }
  116. render() {
  117. const nav = this.props.navigation;
  118. return (
  119. <Container>
  120. <CustomHeader navigation={nav} title={i18n.t('screens.about')}/>
  121. <Content>
  122. <Card>
  123. <CardItem>
  124. <Left>
  125. <Thumbnail square source={require('../../assets/amicale.png')}/>
  126. <Body>
  127. <H1>Amicale INSA Toulouse</H1>
  128. <Text note>
  129. v.{appJson.expo.version}
  130. </Text>
  131. </Body>
  132. </Left>
  133. </CardItem>
  134. <FlatList
  135. data={this.appData}
  136. keyExtractor={(item) => item.icon}
  137. renderItem={({item}) =>
  138. this.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron)
  139. }
  140. />
  141. </Card>
  142. <Card>
  143. <CardItem header>
  144. <Text>{i18n.t('aboutScreen.author')}</Text>
  145. </CardItem>
  146. <FlatList
  147. data={this.authorData}
  148. keyExtractor={(item) => item.icon}
  149. renderItem={({item}) =>
  150. this.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron)
  151. }
  152. />
  153. </Card>
  154. <Card>
  155. <CardItem header>
  156. <Text>{i18n.t('aboutScreen.technologies')}</Text>
  157. </CardItem>
  158. <FlatList
  159. data={this.technoData}
  160. keyExtractor={(item) => item.icon}
  161. renderItem={({item}) =>
  162. this.getCardItem(item.onPressCallback, item.icon, item.text, item.showChevron)
  163. }
  164. />
  165. </Card>
  166. </Content>
  167. </Container>
  168. );
  169. }
  170. }
  171. const styles = StyleSheet.create({
  172. container: {
  173. flex: 1,
  174. backgroundColor: '#fff',
  175. alignItems: 'center',
  176. justifyContent: 'center',
  177. },
  178. });