NativeBase Cheat Sheet
0.1. Basic Layout
Component | Description | Replacing Component |
---|---|---|
<Container> | Complete section of screen | React Native View |
<Header> | Header or Navbar of screen | React Native View |
<Content> | Body element of screen | React Native KeyboardAwareScrollView |
0.2. Components
Component | Description | Replacing Component |
---|---|---|
<Accordion> | Toggle the visibility of content across items of your screen | - |
|
Array of data chunks to render iteratively | |
|
Index of accordion set open | |
|
Style accordion header | |
|
Style accordion content | |
|
Icon when accordion is closed | |
|
Icon when accordion is open | |
|
Icon style when accordion is closed | |
|
Icon style when accordion is open | |
|
Custom design of Accordion header | |
|
Custom design of Accordion content | |
<ActionSheet> | Flexible and extensible content container | React Native Modal |
|
List of button titles | |
|
index of cancel button in 'options' | |
|
index of destructive button in 'options' | |
|
a title to show above the ActionSheet | |
|
show ActionSheet | |
|
hide ActionSheet | |
<Badge> |
Numerical indicators used to notify an element |
React Native View |
|
blue background color | |
|
green background color | |
|
light blue background color | |
|
yellow background color | |
|
red background color | |
<Button> | Submit or reset a form, Navigate etc |
React Native - TouchableOpacity (iOS) TouchableNativeFeedback (Android) |
|
state of button | |
|
renders child element of button | |
|
outline button style | |
|
button with slightly round shaped edges | |
|
block level button | |
|
full width button | |
|
disables click option for button | |
|
small size button | |
|
large size button | |
|
aligns icon to the left in button | |
|
aligns icon to the right in button | |
|
light white background color | |
|
blue background color | |
|
green background color | |
|
light blue background color | |
|
yellow background color | |
|
red background color | |
<Card> | Flexible and extensible content container | React Native View |
|
iOS - no card shadow Android - no elevation |
|
|
array of data chunks to render iteratively | |
|
Flag indicating whether empty section headers should be rendered | |
<CardItem> | Child component of <Card> | React Native TouchableOpacity / View |
|
renders text as header for cards | |
|
body section for card | |
|
renders text as footer for cards | |
|
navigate on click of a card item | |
|
adds border to card item | |
|
custom card border radius | |
|
custom card border radius | |
<CheckBox> | Multiple selections from a set of choices | React Native TouchableOpacity |
|
represents the state value of an item | |
|
background color of checkbox | |
|
Handler to be called when checkbox is tapped | |
<Content> | Renders as body element of your screen | React Native KeyboardAwareScrollView |
|
applies margin at all sides to Content section | |
|
disables automatic scroll on focus | |
|
lets the user enable or disable automatic resetScrollToCoords | |
|
lets the user style the Content component. |
|
<DatePicker> | Select a date from a time range | React Native DatePickerIOS |
|
Sets default date in calendar | |
|
Sets minimum date that can be set in calendar | |
|
Sets maximum date that can be set in calender | |
|
can take either of values 'default','calendar','spinner' | |
|
can take either of values 'fade','slide','none' | |
|
Prevent user from making selection of date | |
|
Icon style when accordion is closed | |
|
Icon style when accordion is open | |
|
Custom design of Accordion header | |
|
Custom design of Accordion content | |
|
allows the modal to be rotated to any of the specified orientations | |
<DeckSwiper> | Swipes the card to left and right | React Native <View> |
|
Chunk of data(object) | |
|
Callback called when all cards are swiped & dataSource empty | |
|
Callback takes a chunk of data & returns a component | |
|
Callback takes a chunk of data & returns a top layer component | |
|
Callback takes a chunk of data & returns a bottom layer component | |
|
Loop through the data | |
|
Callback called when Card is swiped Right | |
|
Callback called when Card is swiped Left | |
<Fab> | Provides special type of promoted action. | React Native <Animated> |
|
toggle status of FAB | |
|
direction of buttons that popup on click of FAB | |
|
position of FAB on screen | |
|
padding options to render FAB | |
<FooterTab> | Tabs at Footer which is horizontal region of buttons or links for navigation. | React Native <View> |
|
button prop, sets a footer button active |
|
|
button prop, set to true if using Badges. |
|
|
button prop, vertically align footer elements.
| |
<Form> | Includes group of related input components | React Native <View> |
|
component for inputting text | React Native <TextInput> |
|
wrap around component with specific styles | React Native <TouchableOpacity> |
|
component for displaying text | React Native <Text> |
|
label is fixed to the left of the Input | |
|
label that animates upwards/downwards when input is selected/erased | |
|
label placed to the left of the input element | |
|
places the label on top of input element which appears like a stack | |
|
includes border with the textbox | |
|
includes rounded border with the textbox | |
|
includes rectangular border with the textbox | |
|
includes underline border with the textbox | |
|
disables inputting data | |
|
renders the same way the TextInput does with the form styling of NativeBase | |
|
string that will be rendered before text input has been entered | |
|
color of the Input placeholder | |
|
style the Form Item for the last Item of the Form | |
|
border color of textbox for invalid input | |
|
border color of textbox for valid input | |
<Header> | Renders as Header for your screen | React Native <View> |
|
components render to the left in Header | |
|
components render at the centre in Header | |
|
components render to the right in Header | |
|
set iOS barStyle | |
|
set background color for status bar in android | |
|
set background color | |
|
removes elevation from android | |
|
add searchBar to header or not | |
|
make Header searchBar rounded | |
|
add subtitle to the Header component | |
|
add Segments to Header component | |
|
add Tabs to Header component | |
|
button prop, add padding to Left for Text Button (iOS) |
|
|
eliminates Left, moves Title to left (Android) | |
|
doubles the header sizet | |
|
No Border, shadow, elevation | |
<Icon> | High definition icons and pixel ideal fonts | React Native Vector Icons <Icon> |
|
name of icon | |
|
name of the icon for iOS devices | |
|
name of the icon for Android devices | |
|
renders filled icon | |
|
color for icon | |
|
size of icon | |
|
Specify icon family | |
<Grid> | Cellular structure composed of Rows and Cols | React Native <View> |
<Col> | Column component for grid | React Native <View> |
<Row> | Row component for grid | React Native <View> |
<List> | Specifying lists of information | React Native <View> |
|
array of data chunks to render iteratively. | |
|
Callback which takes a chunk of data from dataArray and returns as a component. | |
<ListItem> | Child component of <List> |
React Native <TouchableOpacity> - iOS <TouchableNativeFeedback> - Android |
|
navigate on click of a list item | |
|
highlights the selected item | |
|
flag indicating whether empty section headers should be rendered | |
|
organize and group the list items | |
|
style the item as the header for the ListItes | |
|
adds style of first ListItem | |
|
adds style of last ListItem | |
|
to have list styling of icons | |
|
style the list to have Avatars | |
|
style the list to have Thumbnails | |
|
removes margin from left | |
<Picker> | Native picker component | React Native <Picker> |
|
makes component that appears as header of the Picker | |
|
custom style to be given to Header | |
|
custom text for the header back button | |
|
custom text style for the header back button | |
|
custom title style for the header title | |
|
icon with picker dropdown | |
|
custom text for the header title | |
|
text style of header | |
|
style of items in the Picker | |
|
text style of item component in Picker | |
|
allows the modal to be rotated to any of the specified orientations | |
|
default placeholder when no value is selected in iOS | |
|
Custom style for placeholder text in iOS | |
|
Set placeholder icon color in iOS | |
<Radio> | Single selection from a set of choices | React Native <TouchableOpacity> |
|
represents the state value of an item | |
|
inactive radio color | |
|
active radio color | |
Searchbar | Includes search bar in the <Header> section | React Native <View> |
|
wraps the search bar with predefined border options | |
<Segment> | Best used as an alternative for tabs | React Native <View> |
<Spinner> | Page loader | React Native <ActivityIndicator> |
|
color of Spinner. | |
<Swipeable List> (Multiple Rows) |
Swipeable List are ListItems that swipe open and close | |
|
data chunks to render iteratively | |
|
Callback which takes a chunk of data from dataSource and returns as a body component, which is visible | |
|
Callback which takes a chunk of data from dataSource and returns as a left component, which is hidden | |
|
Callback which takes a chunk of data from dataSource and returns as a right component, which is hidden | |
|
TranslateX value for opening the row to the left (Positive Value) | |
|
TranslateX value for opening the row to the right (Negative Value) | |
|
Open row be closed as soon as a row begin to swipe open | |
|
Swipe percent of left/right component's width to trigger the row opening | |
|
Disable ability to swipe the row left | |
|
Disable ability to swipe the row right | |
|
Callback function which triggers when a swipe row is animating open/close | |
|
Callback function which triggers when a swipe row has animated open/close | |
<Swipeable List> (Single Row) |
Single Swipable ListItem (Outside List) | |
|
Native Base or React Native component(Visible Component) | |
|
Native Base or React Native component(Left hidden Component) | |
|
Native Base or React Native component(Right hidden Component) | |
|
TranslateX value for opening the row to the left (Positive Value) | |
|
TranslateX value for opening the row to the right (Negative Value) | |
|
TranslateX value to stop the row to the swipe left (Positive number) | |
|
TranslateX value to stop the row to the swipe right (Negative number) | |
|
Swipe percent of left/right component's width to trigger the row opening | |
|
Disable ability to swipe the row left | |
|
Disable ability to swipe the row right | |
|
Callback function which triggers when a swipe row is animating open/close | |
|
Dynamically toggle SwipeRow | |
|
Style body | |
<Tabs> | Horizontal page swiper | react-native-scrollable-tab-view <ScrollableTabView> |
|
disable swipe | |
|
set default active tab | |
|
set selected tab | |
|
set position of Tabs | |
|
style of the default tab bar's underline | |
|
function to call when tab changes | |
|
function to call when pages are sliding | |
<Tab>,<TabHeading> | Individual Tab | react-native-scrollable-tab-view <ScrollableTabView> |
|
Label String, or Component | |
|
Style for TabHeading Component | |
|
Style for tab bar | |
|
Style for active tab bar | |
|
Style for text | |
|
Style for active text | |
<ScrollableTab> | Horizontal scrolling of tabs | react-native-scrollable-tab-view <ScrollableTabView> |
|
Style for ScrollableTab | |
|
Style for tabs within ScrollableTab | |
|
Style of the Scrollable Tab's underline | |
|
Function to call when pages are sliding | |
<Thumbnail> | Showcase an image with variuos dimensions and shapes | React Native <Image> |
|
size of icon | |
|
shape of thumbnail (default) | |
|
shape of thumbnail | |
|
small thumbnail with width and height of 36px | |
|
large thumbnail with width and height of 80px | |
<Toast> | Display quick warning or error messages | React Native <View> |
|
text content to be shown in the toast | |
|
style text content for toast | |
|
text to be displayed inside the button | |
|
style button text for toast | |
|
style button for toast | |
|
sets position for the Toast | |
|
sets context to the Toast | |
|
milliseconds after which Toast disappers | |
|
called just before the toast hides | |
Typography | Heading Tags | React Native <Text> |
|
font-size: 27 | |
|
font-size: 24 | |
|
font-size: 21 |