Header.js 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. import { PixelRatio } from "react-native";
  2. import variable from "./../variables/platform";
  3. export default (variables = variable) => {
  4. const platformStyle = variables.platformStyle;
  5. const platform = variables.platform;
  6. const headerTheme = {
  7. ".span": {
  8. height: 128,
  9. "NativeBase.Left": {
  10. alignSelf: "flex-start",
  11. },
  12. "NativeBase.Body": {
  13. alignSelf: "flex-end",
  14. alignItems: "flex-start",
  15. justifyContent: "center",
  16. paddingBottom: 26,
  17. },
  18. "NativeBase.Right": {
  19. alignSelf: "flex-start",
  20. },
  21. },
  22. ".hasSubtitle": {
  23. "NativeBase.Body": {
  24. "NativeBase.Title": {
  25. fontSize: variables.titleFontSize - 2,
  26. fontFamily: variables.titleFontfamily,
  27. textAlign: "center",
  28. },
  29. "NativeBase.Subtitle": {
  30. fontSize: variables.subTitleFontSize,
  31. fontFamily: variables.titleFontfamily,
  32. color: variables.subtitleColor,
  33. textAlign: "center",
  34. },
  35. },
  36. },
  37. ".noShadow": {
  38. elevation: 0,
  39. shadowColor: null,
  40. shadowOffset: null,
  41. shadowRadius: null,
  42. shadowOpacity: null,
  43. },
  44. ".hasTabs": {
  45. elevation: 0,
  46. shadowColor: null,
  47. shadowOffset: null,
  48. shadowRadius: null,
  49. shadowOpacity: null,
  50. borderBottomWidth: null,
  51. },
  52. ".hasSegment": {
  53. elevation: 0,
  54. shadowColor: null,
  55. shadowOffset: null,
  56. shadowRadius: null,
  57. shadowOpacity: null,
  58. borderBottomWidth: null,
  59. },
  60. "NativeBase.Button": {
  61. justifyContent: "center",
  62. alignSelf: "center",
  63. alignItems: "center",
  64. ".transparent": {
  65. "NativeBase.Text": {
  66. color: variables.toolbarBtnColor,
  67. fontWeight: "600",
  68. },
  69. "NativeBase.Icon": {
  70. color: variables.toolbarBtnColor,
  71. },
  72. "NativeBase.IconNB": {
  73. color: variables.toolbarBtnColor,
  74. },
  75. paddingHorizontal: variables.buttonPadding,
  76. },
  77. paddingHorizontal: 15,
  78. },
  79. ".searchBar": {
  80. "NativeBase.Item": {
  81. "NativeBase.Icon": {
  82. backgroundColor: "transparent",
  83. color: variables.dropdownLinkColor,
  84. fontSize: variables.toolbarSearchIconSize,
  85. alignItems: "center",
  86. marginTop: 2,
  87. paddingRight: 10,
  88. paddingLeft: 10,
  89. },
  90. "NativeBase.IconNB": {
  91. backgroundColor: "transparent",
  92. color: null,
  93. alignSelf: "center",
  94. },
  95. "NativeBase.Input": {
  96. alignSelf: "center",
  97. lineHeight: 24,
  98. height: variables.searchBarHeight,
  99. },
  100. alignSelf: "center",
  101. alignItems: "center",
  102. justifyContent: "flex-start",
  103. flex: 1,
  104. height: variables.searchBarHeight,
  105. borderColor: "transparent",
  106. backgroundColor: variables.toolbarInputColor,
  107. },
  108. "NativeBase.Button": {
  109. ".transparent": {
  110. "NativeBase.Text": {
  111. fontWeight: "500",
  112. },
  113. paddingHorizontal: null,
  114. paddingLeft: platform === "ios" ? 10 : null,
  115. },
  116. paddingHorizontal: platform === "ios" ? undefined : null,
  117. width: platform === "ios" ? undefined : 0,
  118. height: platform === "ios" ? undefined : 0,
  119. },
  120. },
  121. ".rounded": {
  122. "NativeBase.Item": {
  123. borderRadius: platform === "ios" && platformStyle !== "material" ? 25 : 3,
  124. },
  125. },
  126. "NativeBase.Left": {
  127. "NativeBase.Button": {
  128. ".hasText": {
  129. marginLeft: -10,
  130. height: 30,
  131. "NativeBase.Icon": {
  132. color: variables.toolbarBtnColor,
  133. fontSize: variables.iconHeaderSize,
  134. marginTop: 2,
  135. marginRight: 5,
  136. marginLeft: 2,
  137. },
  138. "NativeBase.Text": {
  139. color: variables.toolbarBtnColor,
  140. fontSize: 17,
  141. marginLeft: 2,
  142. lineHeight: 21,
  143. },
  144. "NativeBase.IconNB": {
  145. color: variables.toolbarBtnColor,
  146. fontSize: variables.iconHeaderSize,
  147. marginTop: 2,
  148. marginRight: 5,
  149. marginLeft: 2,
  150. },
  151. },
  152. ".transparent": {
  153. marginLeft: -3,
  154. "NativeBase.Icon": {
  155. color: variables.toolbarBtnColor,
  156. fontSize: variables.iconHeaderSize,
  157. marginTop: 2,
  158. marginRight: 2,
  159. marginLeft: 2,
  160. },
  161. "NativeBase.IconNB": {
  162. color: variables.toolbarBtnColor,
  163. fontSize: variables.iconHeaderSize,
  164. marginTop: 2,
  165. marginRight: 2,
  166. marginLeft: 2,
  167. },
  168. "NativeBase.Text": {
  169. color: variables.toolbarBtnColor,
  170. fontSize: 17,
  171. top: platform === "ios" ? undefined : -1.5,
  172. },
  173. backgroundColor: "transparent",
  174. borderColor: null,
  175. elevation: 0,
  176. shadowColor: null,
  177. shadowOffset: null,
  178. shadowRadius: null,
  179. shadowOpacity: null,
  180. },
  181. "NativeBase.Icon": {
  182. color: variables.toolbarBtnColor,
  183. },
  184. "NativeBase.IconNB": {
  185. color: variables.toolbarBtnColor,
  186. },
  187. alignSelf: null,
  188. paddingHorizontal: variables.buttonPadding,
  189. },
  190. flex: platform === "ios" && platformStyle !== "material" ? 1 : 0.5,
  191. alignSelf: "center",
  192. alignItems: "flex-start",
  193. },
  194. "NativeBase.Body": {
  195. flex: 1,
  196. alignItems: platform === "ios" && platformStyle !== "material" ? "center" : "flex-start",
  197. alignSelf: "center",
  198. "NativeBase.Segment": {
  199. borderWidth: 0,
  200. alignSelf: "flex-end",
  201. marginRight: platform === "ios" ? -40 : -55,
  202. },
  203. "NativeBase.Button": {
  204. alignSelf: "center",
  205. ".transparent": {
  206. backgroundColor: "transparent",
  207. },
  208. "NativeBase.Icon": {
  209. color: variables.toolbarBtnColor,
  210. },
  211. "NativeBase.IconNB": {
  212. color: variables.toolbarBtnColor,
  213. },
  214. "NativeBase.Text": {
  215. color: variables.inverseTextColor,
  216. backgroundColor: "transparent",
  217. },
  218. },
  219. },
  220. "NativeBase.Right": {
  221. "NativeBase.Button": {
  222. ".hasText": {
  223. height: 30,
  224. "NativeBase.Icon": {
  225. color: variables.toolbarBtnColor,
  226. fontSize: variables.iconHeaderSize - 2,
  227. marginTop: 2,
  228. marginRight: 2,
  229. marginLeft: 5,
  230. },
  231. "NativeBase.Text": {
  232. color: variables.toolbarBtnColor,
  233. fontSize: 17,
  234. lineHeight: 21,
  235. },
  236. "NativeBase.IconNB": {
  237. color: variables.toolbarBtnColor,
  238. fontSize: variables.iconHeaderSize - 2,
  239. marginTop: 2,
  240. marginRight: 2,
  241. marginLeft: 5,
  242. },
  243. },
  244. ".transparent": {
  245. marginRight: -8,
  246. paddingHorizontal: 15,
  247. borderRadius: 50,
  248. "NativeBase.Icon": {
  249. color: variables.toolbarBtnColor,
  250. fontSize: platform === "ios" ? variables.iconHeaderSize - 6 : variables.iconHeaderSize - 2,
  251. marginTop: 2,
  252. marginLeft: 2,
  253. marginRight: 2,
  254. },
  255. "NativeBase.IconNB": {
  256. color: variables.toolbarBtnColor,
  257. fontSize: platform === "ios" ? variables.iconHeaderSize - 6 : variables.iconHeaderSize - 2,
  258. marginTop: 2,
  259. marginLeft: 2,
  260. marginRight: 2,
  261. },
  262. "NativeBase.Text": {
  263. color: variables.toolbarBtnColor,
  264. fontSize: 17,
  265. top: platform === "ios" ? undefined : -1.5,
  266. },
  267. backgroundColor: "transparent",
  268. borderColor: null,
  269. elevation: 0,
  270. shadowColor: null,
  271. shadowOffset: null,
  272. shadowRadius: null,
  273. shadowOpacity: null,
  274. },
  275. "NativeBase.Icon": {
  276. color: variables.toolbarBtnColor,
  277. },
  278. "NativeBase.IconNB": {
  279. color: variables.toolbarBtnColor,
  280. },
  281. alignSelf: null,
  282. paddingHorizontal: variables.buttonPadding,
  283. },
  284. flex: 1,
  285. alignSelf: "center",
  286. alignItems: "flex-end",
  287. flexDirection: "row",
  288. justifyContent: "flex-end",
  289. },
  290. backgroundColor: variables.toolbarDefaultBg,
  291. flexDirection: "row",
  292. paddingHorizontal: 10,
  293. justifyContent: "center",
  294. paddingTop: platform === "ios" ? 15 : 0,
  295. borderBottomWidth: platform === "ios" ? 1 / PixelRatio.getPixelSizeForLayoutSize(1) : 0,
  296. borderBottomColor: variables.toolbarDefaultBorder,
  297. height: variables.toolbarHeight,
  298. elevation: 3,
  299. shadowColor: platformStyle === "material" ? "#000" : undefined,
  300. shadowOffset: platformStyle === "material" ? { width: 0, height: 2 } : undefined,
  301. shadowOpacity: platformStyle === "material" ? 0.2 : undefined,
  302. shadowRadius: platformStyle === "material" ? 1.2 : undefined,
  303. top: 0,
  304. left: 0,
  305. right: 0,
  306. };
  307. return headerTheme;
  308. };