react-native-navigation的迁移库

options-migration.mdx 8.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. # Common Options
  2. ## navBarTextColor
  3. Title text color
  4. ```js
  5. topBar: {
  6. title: {
  7. color: 'red'
  8. }
  9. }
  10. ```
  11. ## navBarTextFontSize
  12. Title font size
  13. ```js
  14. topBar: {
  15. title: {
  16. fontSize: 18
  17. }
  18. }
  19. ```
  20. ## navBarTextFontFamily
  21. Title font
  22. ```js
  23. topBar: {
  24. title: {
  25. fontFamily: 'Helvetica'
  26. }
  27. }
  28. ```
  29. ## navBarBackgroundColor
  30. TopBar background color
  31. ```js
  32. topBar: {
  33. background: {
  34. color: 'red'
  35. }
  36. }
  37. ```
  38. ## navBarCustomView
  39. Use a react view as the TopBar's background or use a React view instead of the textual title.
  40. ```js
  41. topBar: {
  42. background: {
  43. component: {
  44. name: 'example.CustomTopBarBackground'
  45. }
  46. },
  47. title: {
  48. component: {
  49. name: 'example.CustomTopBarTitle'
  50. }
  51. }
  52. }
  53. ```
  54. ## navBarClipToBounds
  55. Restrict the navbar background color to the navbar, and do not flow behind the status bar.
  56. ```js
  57. topBar: {
  58. background: {
  59. component: {
  60. name: 'example.CustomTopBarBackground',
  61. clipToBounds: true
  62. }
  63. },
  64. }
  65. ```
  66. ## navBarComponentAlignment
  67. Align the React view used as the title
  68. ```js
  69. topBar: {
  70. title: {
  71. component: {
  72. name: 'example.CustomTopBarTitle',
  73. alignment: 'center' | 'fill'
  74. }
  75. }
  76. }
  77. ```
  78. ## navBarCustomViewInitialProps
  79. Initial props passed to the React component
  80. ```js
  81. topBar: {
  82. background: {
  83. component: {
  84. name: 'example.CustomTopBarBackground',
  85. passProps: {}
  86. }
  87. },
  88. title: {
  89. component: {
  90. name: 'example.CustomTopBarTitle',
  91. passProps: {}
  92. }
  93. }
  94. }
  95. ```
  96. ## navBarButtonColor
  97. TopBar button color
  98. ```js
  99. topBar: {
  100. rightButtons: [
  101. {
  102. color: 'red'
  103. }
  104. ],
  105. leftButtons: [
  106. {
  107. color: 'red'
  108. }
  109. ],
  110. backButton: {
  111. color: 'red'
  112. }
  113. }
  114. ```
  115. ## navBarHidden
  116. TopBar visibility. When setting `visible: false`, you probably want to set `drawBehind: true` as well. Use `animate: false` to toggle visibility without animation.
  117. ```js
  118. topBar: {
  119. visible: false
  120. }
  121. ```
  122. ## navBarTransparent
  123. Transparent TopBar. Set `drawBehind: true` to draw the screen behind the transparent TopBar.
  124. ```js
  125. topBar: {
  126. background: {
  127. color: 'transparent'
  128. }
  129. }
  130. ```
  131. ## drawUnderNavBar
  132. Draw the screen behind the TopBar, Useful when the TopBar is toggled or transparent
  133. ```js
  134. topBar: {
  135. drawBehind: true
  136. }
  137. ```
  138. ## drawUnderTabBar
  139. Draw the screen behind the BottomTabs, Useful when toggling BottomTabs or when the BottomTabs are translucent.
  140. ```js
  141. bottomTabs: {
  142. drawBehind: true
  143. }
  144. ```
  145. ## tabBarHidden
  146. BottomTabs visibility.
  147. ```js
  148. bottomTabs: {
  149. visible: false
  150. }
  151. ```
  152. The BottomTab's visibility can be toggled only on **Android** using `mergeOptions`:
  153. ```js
  154. Navigation.mergeOptions(this.props.componentId, {
  155. bottomTabs: {
  156. visible: false
  157. }
  158. });
  159. ```
  160. On **iOS**, BottomTab visibility can be changed only when pushing screens. This means that if you'd like to hide BottomTabs when pushing a screen, You'll need to set the property to `false` in the options passed to the `push` command or via the `static options(passProps) {}` api.
  161. ## statusBarHidden
  162. StatusBar visibility. For android, also set `drawBehind: true`.
  163. ```js
  164. statusBar: {
  165. visible: false
  166. }
  167. ```
  168. ## statusBarTextColorScheme
  169. Theme of text and icons displayed in the StatusBar
  170. ```js
  171. statusBar: {
  172. style: 'light' | 'dark'
  173. }
  174. ```
  175. ## navBarSubtitleColor
  176. Subtitle color
  177. ```js
  178. topBar: {
  179. subtitle: {
  180. color: 'red'
  181. }
  182. }
  183. ```
  184. ## navBarSubtitleFontFamily
  185. Subtitle font
  186. ```js
  187. topBar: {
  188. subtitle: {
  189. fontFamily: 'Helvetica'
  190. }
  191. }
  192. ```
  193. ## navBarSubtitleFontSize
  194. Subtitle font size
  195. ```js
  196. topBar: {
  197. subtitle: {
  198. fontSize: 14
  199. }
  200. }
  201. ```
  202. ## screenBackgroundColor
  203. Screen color, visible before the actual React view is rendered
  204. ```js
  205. layout: {
  206. backgroundColor: 'red'
  207. }
  208. ```
  209. ## orientation
  210. ```js
  211. layout: {
  212. orientation: ['portrait', 'landscape'] // An array of supported orientations
  213. }
  214. ```
  215. ## disabledButtonColor
  216. Button color when `enabled: false` is used
  217. ```js
  218. topBar: {
  219. rightButtons: [
  220. {
  221. disabledColor: 'grey'
  222. }
  223. ]
  224. }
  225. ```
  226. ## navBarButtonFontSize
  227. Button font size
  228. ```js
  229. topBar: {
  230. rightButtons: [
  231. {
  232. fontSize: 13
  233. }
  234. ],
  235. leftButtons: [
  236. {
  237. fontSize: 13
  238. }
  239. ]
  240. }
  241. ```
  242. ## navBarLeftButtonFontSize
  243. Left button font size
  244. ```js
  245. {
  246. topBar: {
  247. leftButtons: [
  248. {
  249. fontSize: 13
  250. }
  251. ]
  252. }
  253. }
  254. ```
  255. ## navBarLeftButtonColor
  256. Left button color
  257. ```js
  258. {
  259. topBar: {
  260. leftButtons: [
  261. {
  262. color: 'red'
  263. }
  264. ]
  265. }
  266. }
  267. ```
  268. ## navBarLeftButtonFontWeight
  269. Left button font weight
  270. ```js
  271. {
  272. topBar: {
  273. leftButtons: [
  274. {
  275. weight: '300'
  276. }
  277. ]
  278. }
  279. }
  280. ```
  281. ## navBarRightButtonFontSize
  282. Right button font size
  283. ```js
  284. topBar: {
  285. leftButtons: [
  286. {
  287. fontSize: 13
  288. }
  289. ]
  290. }
  291. ```
  292. ## navBarRightButtonColor
  293. Right button color
  294. ```js
  295. topBar: {
  296. rightButtons: [
  297. {
  298. color: 'red'
  299. }
  300. ]
  301. }
  302. ```
  303. ## navBarRightButtonFontWeight
  304. Right button font weight
  305. ```js
  306. topBar: {
  307. rightButtons: [
  308. {
  309. weight: '400'
  310. }
  311. ]
  312. }
  313. ```
  314. ## modalPresentationStyle
  315. Controls the behavior of screens displayed modally.
  316. ### Options supported on iOS
  317. * `overCurrentContext` - Content is displayed over the previous screen. Useful for **transparent modals**
  318. * `formSheet` - Content is centered in the screen
  319. * `pageSheet` -Content partially covers the underlying content
  320. * `overFullScreen` - Content covers the screen, without detaching previous content.
  321. * `fullScreen` - Content covers the screen, previous content is detached.
  322. * `popover` - Content is displayed in a popover view.
  323. More information on the different styles for iOS can be found on https://developer.apple.com/documentation/uikit/uimodalpresentationstyle
  324. ### Options supported on Android
  325. * `overCurrentContext` - Content is displayed over the previous screen. Useful for **transparent modals**
  326. * `none` - Previous content is detached when the Modal's show animation ends
  327. ```js
  328. {
  329. modalPresentationStyle: 'overCurrentContext'
  330. }
  331. ```
  332. ## navBarButtonFontFamily
  333. Button font family
  334. ```js
  335. topBar: {
  336. rightButtons: [
  337. {
  338. fontFamily: 'Helvetica'
  339. }
  340. ]
  341. }
  342. ```
  343. # iOS only
  344. ## navBarHideOnScroll
  345. Hide TopBar when list is scrolled
  346. ```js
  347. topBar: {
  348. hideOnScroll: true
  349. }
  350. ```
  351. ## navBarTranslucent
  352. Translucent TopBar, Setting `drawBehind: true` is required for this property to work as expected.
  353. ```js
  354. topBar: {
  355. drawBehind: true,
  356. background: {
  357. translucent: true
  358. }
  359. }
  360. ```
  361. ## navBarNoBorder
  362. Remove TopBar border (hair line)
  363. ```js
  364. topBar: {
  365. noBorder: true
  366. }
  367. ```
  368. ## navBarBlur
  369. Blur the area behind the TopBar, Setting `drawBehind: true` and topBar background `transparent: true` is required for this property to work as expected.
  370. ```js
  371. topBar: {
  372. drawBehind: true,
  373. background: {
  374. blur: true,
  375. transparent: true
  376. }
  377. }
  378. ```
  379. ## rootBackgroundImageName
  380. * iOS: name of image in Images.xcassets
  381. * Android: name of drawable
  382. ```js
  383. {
  384. rootBackgroundImage: require('rootBackground.png')
  385. }
  386. ```
  387. ## screenBackgroundImageName
  388. name of image in Images.xcassets
  389. ```js
  390. {
  391. backgroundImage: require('background.png')
  392. }
  393. ```
  394. ## statusBarHideWithNavBar
  395. Hide the StatusBar if the TopBar is also hidden
  396. ```js
  397. statusBar: {
  398. hideWithTopBar: true
  399. }
  400. ```
  401. ## statusBarBlur
  402. Blur the area behind the StatusBar
  403. ```js
  404. statusBar: {
  405. blur: true
  406. }
  407. ```
  408. ## disabledBackGesture
  409. Disable the back (swipe) gesture used to pop screens
  410. ```js
  411. {
  412. popGesture: false
  413. }
  414. ```
  415. ## largeTitle
  416. Use iOS 11 large title
  417. ```js
  418. topBar: {
  419. largeTitle: {
  420. visible: true,
  421. fontSize: 30,
  422. color: 'red',
  423. fontFamily: 'Helvetica'
  424. }
  425. }
  426. ```
  427. # Android Options
  428. ## topBarElevationShadowEnabled
  429. TopBar elevation in dp. Set this value to `0` to disable the TopBar's shadow.
  430. ```js
  431. topBar: {
  432. elevation: 0
  433. }
  434. ```
  435. ## navBarTitleTextCentered
  436. Title alignment
  437. ```js
  438. topBar: {
  439. title: {
  440. alignment: 'center'|'fill'
  441. }
  442. }
  443. ```
  444. ## statusBarColor
  445. StatusBar color
  446. ```js
  447. statusBar: {
  448. backgroundColor: 'red'
  449. }
  450. ```
  451. ## navigationBarColor
  452. NavigationBar color
  453. ```js
  454. navigationBar: {
  455. backgroundColor: 'red'
  456. }
  457. ```
  458. ## drawUnderStatusBar
  459. Draw content behind the StatusBar
  460. ```js
  461. statusBar: {
  462. drawBehind: true
  463. }
  464. ```
  465. ## navBarHeight
  466. TopBar height in dp
  467. ```js
  468. topBar: {
  469. height: 70
  470. }
  471. ```
  472. ## navBarTopPadding
  473. Content top margin
  474. ```js
  475. layout: {
  476. topMargin: 26
  477. }
  478. ```
  479. ## topTabsHeight
  480. TopTabs height
  481. ```js
  482. topTabs: {
  483. height: 70
  484. }
  485. ```
  486. ## topBarBorderColor
  487. TopBar border color
  488. ```js
  489. topBar: {
  490. borderColor: 'red'
  491. }
  492. ```
  493. ## topBarBorderWidth
  494. TopBar border height
  495. ```js
  496. topBar: {
  497. borderHeight: 1.3
  498. }
  499. ```
  500. # Unsupported options
  501. * disabledSimultaneousGesture
  502. * statusBarTextColorSchemeSingleScreen
  503. * navBarButtonFontWeight
  504. * topBarShadowColor
  505. * topBarShadowOpacity
  506. * topBarShadowOffset
  507. * topBarShadowRadius
  508. * preferredContentSize
  509. * navBarSubTitleTextCentered
  510. * collapsingToolBarImage
  511. * collapsingToolBarCollapsedColor
  512. * navBarTextFontBold