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 |
---|---|---|
<ActionSheet> | Flexible and extensible content container | React Native Modal |
<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 | |
<DeckSwiper> | Swipes the card to left and right | React Native <View> |
<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 | |
|
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 | |
|
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> | ListItems that swipe open and close | |
<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 | |
<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 |