Application Android et IOS pour l'amicale des élèves https://play.google.com/store/apps/details?id=fr.amicaleinsat.application
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.

ListItem.js 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. // @flow
  2. import { Platform, PixelRatio } from "react-native";
  3. import pickerTheme from "./Picker";
  4. import variable from "./../variables/platform";
  5. export default (variables /*: * */ = variable) => {
  6. const platform = variables.platform;
  7. const selectedStyle = {
  8. "NativeBase.Text": {
  9. color: variables.listItemSelected
  10. },
  11. "NativeBase.Icon": {
  12. color: variables.listItemSelected
  13. }
  14. };
  15. const listItemTheme = {
  16. "NativeBase.InputGroup": {
  17. "NativeBase.Icon": {
  18. paddingRight: 5
  19. },
  20. "NativeBase.IconNB": {
  21. paddingRight: 5
  22. },
  23. "NativeBase.Input": {
  24. paddingHorizontal: 5
  25. },
  26. flex: 1,
  27. borderWidth: null,
  28. margin: -10,
  29. borderBottomColor: "transparent"
  30. },
  31. ".searchBar": {
  32. "NativeBase.Item": {
  33. "NativeBase.Icon": {
  34. backgroundColor: "transparent",
  35. color: variables.dropdownLinkColor,
  36. fontSize:
  37. platform === "ios"
  38. ? variables.iconFontSize - 10
  39. : variables.iconFontSize - 5,
  40. alignItems: "center",
  41. marginTop: 2,
  42. paddingRight: 8
  43. },
  44. "NativeBase.IconNB": {
  45. backgroundColor: "transparent",
  46. color: null,
  47. alignSelf: "center"
  48. },
  49. "NativeBase.Input": {
  50. alignSelf: "center"
  51. },
  52. alignSelf: "center",
  53. alignItems: "center",
  54. justifyContent: "flex-start",
  55. flex: 1,
  56. height: platform === "ios" ? 30 : 40,
  57. borderColor: "transparent",
  58. backgroundColor: "#fff",
  59. borderRadius: 5
  60. },
  61. "NativeBase.Button": {
  62. ".transparent": {
  63. "NativeBase.Text": {
  64. fontWeight: "500"
  65. },
  66. paddingHorizontal: null,
  67. paddingLeft: platform === "ios" ? 10 : null
  68. },
  69. paddingHorizontal: platform === "ios" ? undefined : null,
  70. width: platform === "ios" ? undefined : 0,
  71. height: platform === "ios" ? undefined : 0
  72. },
  73. backgroundColor: variables.toolbarInputColor,
  74. padding: 10,
  75. marginLeft: null
  76. },
  77. "NativeBase.CheckBox": {
  78. marginLeft: -10,
  79. marginRight: 10
  80. },
  81. ".first": {
  82. ".itemHeader": {
  83. paddingTop: variables.listItemPadding + 3
  84. }
  85. },
  86. ".itemHeader": {
  87. ".first": {
  88. paddingTop: variables.listItemPadding + 3
  89. },
  90. borderBottomWidth: platform === "ios" ? variables.borderWidth : null,
  91. marginLeft: null,
  92. padding: variables.listItemPadding,
  93. paddingLeft: variables.listItemPadding + 5,
  94. paddingTop:
  95. platform === "ios" ? variables.listItemPadding + 25 : undefined,
  96. paddingBottom:
  97. platform === "android" ? variables.listItemPadding + 20 : undefined,
  98. flexDirection: "row",
  99. borderColor: variables.listBorderColor,
  100. "NativeBase.Text": {
  101. fontSize: 14,
  102. color: platform === "ios" ? undefined : variables.listNoteColor
  103. }
  104. },
  105. ".itemDivider": {
  106. borderBottomWidth: null,
  107. marginLeft: null,
  108. padding: variables.listItemPadding,
  109. paddingLeft: variables.listItemPadding + 5,
  110. backgroundColor: variables.listDividerBg,
  111. flexDirection: "row",
  112. borderColor: variables.listBorderColor
  113. },
  114. ".selected": {
  115. "NativeBase.Left": {
  116. ...selectedStyle
  117. },
  118. "NativeBase.Body": {
  119. ...selectedStyle
  120. },
  121. "NativeBase.Right": {
  122. ...selectedStyle
  123. },
  124. ...selectedStyle
  125. },
  126. "NativeBase.Left": {
  127. "NativeBase.Body": {
  128. "NativeBase.Text": {
  129. ".note": {
  130. color: variables.listNoteColor,
  131. fontWeight: "200"
  132. },
  133. fontWeight: "600"
  134. },
  135. marginLeft: 10,
  136. alignItems: null,
  137. alignSelf: null
  138. },
  139. "NativeBase.Icon": {
  140. width: variables.iconFontSize - 10,
  141. fontSize: variables.iconFontSize - 10
  142. },
  143. "NativeBase.IconNB": {
  144. width: variables.iconFontSize - 10,
  145. fontSize: variables.iconFontSize - 10
  146. },
  147. "NativeBase.Text": {
  148. alignSelf: "center"
  149. },
  150. flexDirection: "row"
  151. },
  152. "NativeBase.Body": {
  153. "NativeBase.Text": {
  154. marginHorizontal: variables.listItemPadding,
  155. ".note": {
  156. color: variables.listNoteColor,
  157. fontWeight: "200"
  158. }
  159. },
  160. alignSelf: null,
  161. alignItems: null
  162. },
  163. "NativeBase.Right": {
  164. "NativeBase.Badge": {
  165. alignSelf: null
  166. },
  167. "NativeBase.PickerNB": {
  168. "NativeBase.Button": {
  169. marginRight: -15,
  170. "NativeBase.Text": {
  171. color: variables.topTabBarActiveTextColor
  172. }
  173. }
  174. },
  175. "NativeBase.Button": {
  176. alignSelf: null,
  177. ".transparent": {
  178. "NativeBase.Text": {
  179. color: variables.topTabBarActiveTextColor
  180. }
  181. }
  182. },
  183. "NativeBase.Icon": {
  184. alignSelf: null,
  185. fontSize: variables.iconFontSize - 8,
  186. color: "#c9c8cd"
  187. },
  188. "NativeBase.IconNB": {
  189. alignSelf: null,
  190. fontSize: variables.iconFontSize - 8,
  191. color: "#c9c8cd"
  192. },
  193. "NativeBase.Text": {
  194. ".note": {
  195. color: variables.listNoteColor,
  196. fontWeight: "200"
  197. },
  198. alignSelf: null
  199. },
  200. "NativeBase.Thumbnail": {
  201. alignSelf: null
  202. },
  203. "NativeBase.Image": {
  204. alignSelf: null
  205. },
  206. "NativeBase.Radio": {
  207. alignSelf: null
  208. },
  209. "NativeBase.Checkbox": {
  210. alignSelf: null
  211. },
  212. "NativeBase.Switch": {
  213. alignSelf: null
  214. },
  215. padding: null,
  216. flex: 0.28
  217. },
  218. "NativeBase.Text": {
  219. ".note": {
  220. color: variables.listNoteColor,
  221. fontWeight: "200"
  222. },
  223. alignSelf: "center"
  224. },
  225. ".last": {
  226. marginLeft: -(variables.listItemPadding + 5),
  227. paddingLeft: (variables.listItemPadding + 5) * 2,
  228. top: 1
  229. },
  230. ".avatar": {
  231. "NativeBase.Left": {
  232. flex: 0,
  233. alignSelf: "flex-start",
  234. paddingTop: 14
  235. },
  236. "NativeBase.Body": {
  237. "NativeBase.Text": {
  238. marginLeft: null
  239. },
  240. flex: 1,
  241. paddingVertical: variables.listItemPadding,
  242. borderBottomWidth: variables.borderWidth,
  243. borderColor: variables.listBorderColor,
  244. marginLeft: variables.listItemPadding + 5
  245. },
  246. "NativeBase.Right": {
  247. "NativeBase.Text": {
  248. ".note": {
  249. fontSize: variables.noteFontSize - 2
  250. }
  251. },
  252. flex: 0,
  253. paddingRight: variables.listItemPadding + 5,
  254. alignSelf: "stretch",
  255. paddingVertical: variables.listItemPadding,
  256. borderBottomWidth: variables.borderWidth,
  257. borderColor: variables.listBorderColor
  258. },
  259. ".noBorder": {
  260. "NativeBase.Body": {
  261. borderBottomWidth: null
  262. },
  263. "NativeBase.Right": {
  264. borderBottomWidth: null
  265. }
  266. },
  267. borderBottomWidth: null,
  268. paddingVertical: null,
  269. paddingRight: null
  270. },
  271. ".thumbnail": {
  272. "NativeBase.Left": {
  273. flex: 0
  274. },
  275. "NativeBase.Body": {
  276. "NativeBase.Text": {
  277. marginLeft: null
  278. },
  279. flex: 1,
  280. paddingVertical: variables.listItemPadding + 8,
  281. borderBottomWidth: variables.borderWidth,
  282. borderColor: variables.listBorderColor,
  283. marginLeft: variables.listItemPadding + 5
  284. },
  285. "NativeBase.Right": {
  286. "NativeBase.Button": {
  287. ".transparent": {
  288. "NativeBase.Text": {
  289. fontSize: variables.listNoteSize,
  290. color: variables.sTabBarActiveTextColor
  291. }
  292. },
  293. height: null
  294. },
  295. flex: 0,
  296. justifyContent: "center",
  297. alignSelf: "stretch",
  298. paddingRight: variables.listItemPadding + 5,
  299. paddingVertical: variables.listItemPadding + 5,
  300. borderBottomWidth: variables.borderWidth,
  301. borderColor: variables.listBorderColor
  302. },
  303. ".noBorder": {
  304. "NativeBase.Body": {
  305. borderBottomWidth: null
  306. },
  307. "NativeBase.Right": {
  308. borderBottomWidth: null
  309. }
  310. },
  311. borderBottomWidth: null,
  312. paddingVertical: null,
  313. paddingRight: null
  314. },
  315. ".icon": {
  316. ".last": {
  317. "NativeBase.Body": {
  318. borderBottomWidth: null
  319. },
  320. "NativeBase.Right": {
  321. borderBottomWidth: null
  322. },
  323. borderBottomWidth: variables.borderWidth,
  324. borderColor: variables.listBorderColor
  325. },
  326. "NativeBase.Left": {
  327. "NativeBase.Button": {
  328. "NativeBase.IconNB": {
  329. marginHorizontal: null,
  330. fontSize: variables.iconFontSize - 5
  331. },
  332. "NativeBase.Icon": {
  333. marginHorizontal: null,
  334. fontSize: variables.iconFontSize - 8
  335. },
  336. alignSelf: "center",
  337. height: 29,
  338. width: 29,
  339. borderRadius: 6,
  340. paddingVertical: null,
  341. paddingHorizontal: null,
  342. alignItems: "center",
  343. justifyContent: "center"
  344. },
  345. "NativeBase.Icon": {
  346. width: variables.iconFontSize - 5,
  347. fontSize: variables.iconFontSize - 2
  348. },
  349. "NativeBase.IconNB": {
  350. width: variables.iconFontSize - 5,
  351. fontSize: variables.iconFontSize - 2
  352. },
  353. paddingRight: variables.listItemPadding + 5,
  354. flex: 0,
  355. height: 44,
  356. justifyContent: "center",
  357. alignItems: "center"
  358. },
  359. "NativeBase.Body": {
  360. "NativeBase.Text": {
  361. marginLeft: null,
  362. fontSize: 17
  363. },
  364. flex: 1,
  365. height: 44,
  366. justifyContent: "center",
  367. borderBottomWidth: 1 / PixelRatio.getPixelSizeForLayoutSize(1),
  368. borderColor: variables.listBorderColor
  369. },
  370. "NativeBase.Right": {
  371. "NativeBase.Text": {
  372. textAlign: "center",
  373. color: "#8F8E95",
  374. fontSize: 17
  375. },
  376. "NativeBase.IconNB": {
  377. color: "#C8C7CC",
  378. fontSize: variables.iconFontSize - 10,
  379. alignSelf: "center",
  380. paddingLeft: 10,
  381. paddingTop: 3
  382. },
  383. "NativeBase.Icon": {
  384. color: "#C8C7CC",
  385. fontSize: variables.iconFontSize - 10,
  386. alignSelf: "center",
  387. paddingLeft: 10,
  388. paddingTop: 3
  389. },
  390. "NativeBase.Switch": {
  391. marginRight: Platform.OS === "ios" ? undefined : -5,
  392. alignSelf: null
  393. },
  394. "NativeBase.PickerNB": {
  395. ...pickerTheme()
  396. },
  397. flexDirection: "row",
  398. alignItems: "center",
  399. flex: 0,
  400. alignSelf: "stretch",
  401. height: 44,
  402. justifyContent: "flex-end",
  403. borderBottomWidth: 1 / PixelRatio.getPixelSizeForLayoutSize(1),
  404. borderColor: variables.listBorderColor,
  405. paddingRight: variables.listItemPadding + 5
  406. },
  407. ".noBorder": {
  408. "NativeBase.Body": {
  409. borderBottomWidth: null
  410. },
  411. "NativeBase.Right": {
  412. borderBottomWidth: null
  413. }
  414. },
  415. borderBottomWidth: null,
  416. paddingVertical: null,
  417. paddingRight: null,
  418. height: 44,
  419. justifyContent: "center"
  420. },
  421. ".noBorder": {
  422. borderBottomWidth: null
  423. },
  424. ".noIndent": {
  425. marginLeft: null,
  426. padding: variables.listItemPadding,
  427. paddingLeft: variables.listItemPadding + 6
  428. },
  429. alignItems: "center",
  430. flexDirection: "row",
  431. paddingRight: variables.listItemPadding + 6,
  432. paddingVertical: variables.listItemPadding + 3,
  433. marginLeft: variables.listItemPadding + 6,
  434. borderBottomWidth: 1 / PixelRatio.getPixelSizeForLayoutSize(1),
  435. backgroundColor: variables.listBg,
  436. borderColor: variables.listBorderColor
  437. };
  438. return listItemTheme;
  439. };