ListItem.js 11 KB

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