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.

Header.js 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. // @flow
  2. import { PixelRatio, StatusBar } from 'react-native';
  3. import variable from './../variables/platform';
  4. import { PLATFORM } from './../variables/commonColor';
  5. export default (variables /* : * */ = variable) => {
  6. const platformStyle = variables.platformStyle;
  7. const platform = variables.platform;
  8. const headerTheme = {
  9. '.span': {
  10. height: 128,
  11. 'NativeBase.Left': {
  12. alignSelf: 'flex-start'
  13. },
  14. 'NativeBase.Body': {
  15. alignSelf: 'flex-end',
  16. alignItems: 'flex-start',
  17. justifyContent: 'center',
  18. paddingBottom: 26
  19. },
  20. 'NativeBase.Right': {
  21. alignSelf: 'flex-start'
  22. }
  23. },
  24. '.hasSubtitle': {
  25. 'NativeBase.Body': {
  26. 'NativeBase.Title': {
  27. fontSize: variables.titleFontSize - 2,
  28. fontFamily: variables.titleFontfamily,
  29. textAlign: 'center',
  30. fontWeight: '500',
  31. paddingBottom: 3
  32. },
  33. 'NativeBase.Subtitle': {
  34. fontSize: variables.subTitleFontSize,
  35. fontFamily: variables.titleFontfamily,
  36. color: variables.subtitleColor,
  37. textAlign: 'center'
  38. }
  39. }
  40. },
  41. '.transparent': {
  42. backgroundColor: 'transparent',
  43. borderBottomColor: 'transparent',
  44. elevation: 0,
  45. shadowColor: null,
  46. shadowOffset: null,
  47. shadowRadius: null,
  48. shadowOpacity: null,
  49. paddingTop:
  50. platform === PLATFORM.ANDROID ? StatusBar.currentHeight : undefined,
  51. height:
  52. platform === PLATFORM.ANDROID
  53. ? variables.toolbarHeight + StatusBar.currentHeight
  54. : variables.toolbarHeight
  55. },
  56. '.noShadow': {
  57. elevation: 0,
  58. shadowColor: null,
  59. shadowOffset: null,
  60. shadowRadius: null,
  61. shadowOpacity: null
  62. },
  63. '.hasTabs': {
  64. elevation: 0,
  65. shadowColor: null,
  66. shadowOffset: null,
  67. shadowRadius: null,
  68. shadowOpacity: null,
  69. borderBottomWidth: null
  70. },
  71. '.hasSegment': {
  72. elevation: 0,
  73. shadowColor: null,
  74. shadowOffset: null,
  75. shadowRadius: null,
  76. shadowOpacity: null,
  77. borderBottomWidth: null,
  78. 'NativeBase.Left': {
  79. flex: 0.3
  80. },
  81. 'NativeBase.Right': {
  82. flex: 0.3
  83. },
  84. 'NativeBase.Body': {
  85. flex: 1,
  86. 'NativeBase.Segment': {
  87. marginRight: 0,
  88. alignSelf: 'center',
  89. 'NativeBase.Button': {
  90. paddingLeft: 0,
  91. paddingRight: 0
  92. }
  93. }
  94. }
  95. },
  96. '.noLeft': {
  97. 'NativeBase.Left': {
  98. width: platform === PLATFORM.IOS ? undefined : 0,
  99. flex: platform === PLATFORM.IOS ? 1 : 0
  100. },
  101. 'NativeBase.Body': {
  102. 'NativeBase.Title': {
  103. paddingLeft: platform === PLATFORM.IOS ? undefined : 10
  104. },
  105. 'NativeBase.Subtitle': {
  106. paddingLeft: platform === PLATFORM.IOS ? undefined : 10
  107. }
  108. }
  109. },
  110. 'NativeBase.Button': {
  111. justifyContent: 'center',
  112. alignSelf: 'center',
  113. alignItems: 'center',
  114. '.transparent': {
  115. 'NativeBase.Text': {
  116. color: variables.toolbarBtnTextColor,
  117. fontWeight: '600'
  118. },
  119. 'NativeBase.Icon': {
  120. color: variables.toolbarBtnColor
  121. },
  122. 'NativeBase.IconNB': {
  123. color: variables.toolbarBtnColor
  124. },
  125. paddingHorizontal: variables.buttonPadding
  126. },
  127. paddingHorizontal: 15
  128. },
  129. '.searchBar': {
  130. 'NativeBase.Item': {
  131. 'NativeBase.Icon': {
  132. backgroundColor: 'transparent',
  133. color: variables.dropdownLinkColor,
  134. fontSize: variables.toolbarSearchIconSize,
  135. alignItems: 'center',
  136. marginTop: 2,
  137. paddingRight: 10,
  138. paddingLeft: 10
  139. },
  140. 'NativeBase.IconNB': {
  141. backgroundColor: 'transparent',
  142. color: null,
  143. alignSelf: 'center'
  144. },
  145. 'NativeBase.Input': {
  146. alignSelf: 'center',
  147. lineHeight: null,
  148. height: variables.searchBarInputHeight
  149. },
  150. alignSelf: 'center',
  151. alignItems: 'center',
  152. justifyContent: 'flex-start',
  153. flex: 1,
  154. height: variables.searchBarHeight,
  155. borderColor: 'transparent',
  156. backgroundColor: variables.toolbarInputColor
  157. },
  158. 'NativeBase.Button': {
  159. '.transparent': {
  160. 'NativeBase.Text': {
  161. fontWeight: '500'
  162. },
  163. paddingHorizontal: null,
  164. paddingLeft: platform === PLATFORM.IOS ? 10 : null
  165. },
  166. paddingHorizontal: platform === PLATFORM.IOS ? undefined : null,
  167. width: platform === PLATFORM.IOS ? undefined : 0,
  168. height: platform === PLATFORM.IOS ? undefined : 0
  169. }
  170. },
  171. '.rounded': {
  172. 'NativeBase.Item': {
  173. borderRadius:
  174. platform === PLATFORM.IOS && platformStyle !== PLATFORM.MATERIAL
  175. ? 25
  176. : 3
  177. }
  178. },
  179. 'NativeBase.Left': {
  180. 'NativeBase.Button': {
  181. '.hasText': {
  182. marginLeft: -10,
  183. height: 30,
  184. 'NativeBase.Icon': {
  185. color: variables.toolbarBtnColor,
  186. fontSize: variables.iconHeaderSize,
  187. marginTop: 2,
  188. marginRight: 5,
  189. marginLeft: 2
  190. },
  191. 'NativeBase.Text': {
  192. color: variables.toolbarBtnTextColor,
  193. fontSize: platform === PLATFORM.IOS ? 17 : 0,
  194. marginLeft: 7,
  195. lineHeight: 19.5
  196. },
  197. 'NativeBase.IconNB': {
  198. color: variables.toolbarBtnColor,
  199. fontSize: variables.iconHeaderSize,
  200. marginTop: 2,
  201. marginRight: 5,
  202. marginLeft: 2
  203. }
  204. },
  205. '.transparent': {
  206. marginLeft:
  207. platform === PLATFORM.IOS && platformStyle !== PLATFORM.MATERIAL
  208. ? -3
  209. : 0,
  210. 'NativeBase.Icon': {
  211. color: variables.toolbarBtnColor,
  212. fontSize:
  213. platform === PLATFORM.IOS &&
  214. variables.platformStyle !== PLATFORM.MATERIAL
  215. ? variables.iconHeaderSize + 1
  216. : variables.iconHeaderSize,
  217. marginTop: 0,
  218. marginRight: 2,
  219. marginLeft: 1,
  220. paddingTop: 1
  221. },
  222. 'NativeBase.IconNB': {
  223. color: variables.toolbarBtnColor,
  224. fontSize:
  225. platform === PLATFORM.IOS &&
  226. variables.platformStyle !== PLATFORM.MATERIAL
  227. ? variables.iconHeaderSize + 1
  228. : variables.iconHeaderSize - 2,
  229. marginTop: 0,
  230. marginRight: 2,
  231. marginLeft: 1,
  232. paddingTop: 1
  233. },
  234. 'NativeBase.Text': {
  235. color: variables.toolbarBtnTextColor,
  236. fontSize: platform === PLATFORM.IOS ? 17 : 0,
  237. top: platform === PLATFORM.IOS ? 1 : -1.5,
  238. paddingLeft:
  239. platform === PLATFORM.IOS && platformStyle !== PLATFORM.MATERIAL
  240. ? 2
  241. : 5,
  242. paddingRight:
  243. platform === PLATFORM.IOS && platformStyle !== PLATFORM.MATERIAL
  244. ? undefined
  245. : 10
  246. },
  247. backgroundColor: 'transparent',
  248. borderColor: null,
  249. elevation: 0,
  250. shadowColor: null,
  251. shadowOffset: null,
  252. shadowRadius: null,
  253. shadowOpacity: null
  254. },
  255. 'NativeBase.Icon': {
  256. color: variables.toolbarBtnColor
  257. },
  258. 'NativeBase.IconNB': {
  259. color: variables.toolbarBtnColor
  260. },
  261. alignSelf: null,
  262. paddingRight: variables.buttonPadding,
  263. paddingLeft:
  264. platform === PLATFORM.IOS && platformStyle !== PLATFORM.MATERIAL
  265. ? 4
  266. : 8
  267. },
  268. flex:
  269. platform === PLATFORM.IOS && platformStyle !== PLATFORM.MATERIAL
  270. ? 1
  271. : 0.4,
  272. alignSelf: 'center',
  273. alignItems: 'flex-start'
  274. },
  275. 'NativeBase.Body': {
  276. flex: 1,
  277. alignItems:
  278. platform === PLATFORM.IOS && platformStyle !== PLATFORM.MATERIAL
  279. ? 'center'
  280. : 'flex-start',
  281. alignSelf: 'center',
  282. 'NativeBase.Segment': {
  283. borderWidth: 0,
  284. alignSelf: 'flex-end',
  285. marginRight: platform === PLATFORM.IOS ? -40 : -55
  286. },
  287. 'NativeBase.Button': {
  288. alignSelf: 'center',
  289. '.transparent': {
  290. backgroundColor: 'transparent'
  291. },
  292. 'NativeBase.Icon': {
  293. color: variables.toolbarBtnColor
  294. },
  295. 'NativeBase.IconNB': {
  296. color: variables.toolbarBtnColor
  297. },
  298. 'NativeBase.Text': {
  299. color: variables.inverseTextColor,
  300. backgroundColor: 'transparent'
  301. }
  302. }
  303. },
  304. 'NativeBase.Right': {
  305. 'NativeBase.Button': {
  306. '.hasText': {
  307. height: 30,
  308. 'NativeBase.Icon': {
  309. color: variables.toolbarBtnColor,
  310. fontSize: variables.iconHeaderSize - 2,
  311. marginTop: 2,
  312. marginRight: 2,
  313. marginLeft: 5
  314. },
  315. 'NativeBase.Text': {
  316. color: variables.toolbarBtnTextColor,
  317. fontSize: platform === PLATFORM.IOS ? 17 : 14,
  318. lineHeight: 19.5
  319. },
  320. 'NativeBase.IconNB': {
  321. color: variables.toolbarBtnColor,
  322. fontSize: variables.iconHeaderSize - 2,
  323. marginTop: 2,
  324. marginRight: 2,
  325. marginLeft: 5
  326. }
  327. },
  328. '.transparent': {
  329. marginRight: platform === PLATFORM.IOS ? -9 : -5,
  330. paddingLeft: 15,
  331. paddingRight: 12,
  332. paddingHorizontal: 15,
  333. borderRadius: 50,
  334. 'NativeBase.Icon': {
  335. color: variables.toolbarBtnColor,
  336. fontSize: variables.iconHeaderSize - 2,
  337. marginTop: 0,
  338. marginLeft: 2,
  339. marginRight: 0
  340. // paddingTop: 0
  341. },
  342. 'NativeBase.IconNB': {
  343. color: variables.toolbarBtnColor,
  344. fontSize: variables.iconHeaderSize - 2,
  345. marginTop: 0,
  346. marginLeft: 2,
  347. marginRight: 0
  348. // paddingTop: 0
  349. },
  350. 'NativeBase.Text': {
  351. color: variables.toolbarBtnTextColor,
  352. fontSize: platform === PLATFORM.IOS ? 17 : 14,
  353. top: platform === PLATFORM.IOS ? 1 : -1.5,
  354. paddingRight:
  355. platform === PLATFORM.IOS &&
  356. variables.platformStyle !== PLATFORM.MATERIAL
  357. ? 0
  358. : undefined
  359. },
  360. backgroundColor: 'transparent',
  361. borderColor: null,
  362. elevation: 0,
  363. shadowColor: null,
  364. shadowOffset: null,
  365. shadowRadius: null,
  366. shadowOpacity: null
  367. },
  368. 'NativeBase.Icon': {
  369. color: variables.toolbarBtnColor
  370. },
  371. 'NativeBase.IconNB': {
  372. color: variables.toolbarBtnColor
  373. },
  374. alignSelf: null,
  375. paddingHorizontal: variables.buttonPadding
  376. },
  377. flex: 1,
  378. alignSelf: 'center',
  379. alignItems: 'flex-end',
  380. flexDirection: 'row',
  381. justifyContent: 'flex-end'
  382. },
  383. backgroundColor: variables.toolbarDefaultBg,
  384. flexDirection: 'row',
  385. // paddingHorizontal: 10,
  386. paddingLeft:
  387. platform === PLATFORM.IOS && variables.platformStyle !== PLATFORM.MATERIAL
  388. ? 6
  389. : 10,
  390. paddingRight: 10,
  391. justifyContent: 'center',
  392. paddingTop: platform === PLATFORM.IOS ? 18 : 0,
  393. borderBottomWidth:
  394. platform === PLATFORM.IOS
  395. ? 1 / PixelRatio.getPixelSizeForLayoutSize(1)
  396. : 0,
  397. borderBottomColor: variables.toolbarDefaultBorder,
  398. height:
  399. variables.platform === PLATFORM.IOS &&
  400. variables.platformStyle === PLATFORM.MATERIAL
  401. ? variables.toolbarHeight + 10
  402. : variables.toolbarHeight,
  403. elevation: 3,
  404. shadowColor: platformStyle === PLATFORM.MATERIAL ? '#000' : undefined,
  405. shadowOffset:
  406. platformStyle === PLATFORM.MATERIAL ? { width: 0, height: 2 } : undefined,
  407. shadowOpacity: platformStyle === PLATFORM.MATERIAL ? 0.2 : undefined,
  408. shadowRadius: platformStyle === PLATFORM.MATERIAL ? 1.2 : undefined,
  409. top: 0,
  410. left: 0,
  411. right: 0
  412. };
  413. return headerTheme;
  414. };