GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing docs.nativebase.io — Center | NativeBase | Universal Components for React and React Native

Center | NativeBase | Universal Components for React and React Native

NativeBase
3.4.x
🎉 Prompt to React Native UI
→
Search
⌘
K
Hire us
NativeBase
Introduction
Getting Started
Installation
Setup NativeBase Provider
Migration
Upgrading to v3
Upgrading to 3.2.0 from 3.x
Upgrading to 3.4.0 from 3.3.x
Components Migration
ActionSheet
Badge
Button
Card
Checkbox
DatePicker
DeckSwiper
Drawer
FABs
FooterTab
Form
Header
Icon
Layout
Picker
Radio Button
Searchbar
Segment
Spinner
SwipeList
Tabs
Thumbnail
Toast
Typography
Resources
Contribution
Creating a Universal App with NativeBase and Solito
Core Concepts
Utility First
Utility Props Specificity
Design Tokens
Pseudo Props: Overview
Pseudo Props: Dos & Don'ts
Internal Pseudo Props
Responsive
Features
Utility Props
Color mode (Dark Mode)
NativeBase Factory
SafeAreaView Props
Strict Mode
Accessibility
Theme
Default Theme
Customizing Theme
Customizing Fonts
Customizing Components
Making components dark mode compatible
Breakpoints
Using Theme
TypeScript
Layout
AspectRatio
Box
Center
Container
Flex
HStack / Row
Stack
VStack / Column
ZStack
Forms
Button
Pressable
Checkbox
FormControl
IconButton
Input
Link
Radio
Select
Slider
Switch
TextArea
Data Display
Badge
Divider
Feedback
Alert
Progress
Skeleton
Spinner
Toast
Typography
Text
Heading
Overlay
AlertDialog
Menu
Modal
Popover
Tooltip
Disclosure
ActionSheet
Media and Icons
Avatar
Icon
Image
Transition
PresenceTransition
Slide
Stagger
Others
Fab
Hidden
ReactNative Components
ScrollView
View
KeyboardAvoidingView
StatusBar
FlatList
SectionList
Hooks
useDisclose
useBreakpointValue
useClipboard
useMediaQuery
useTheme
useToken
useColorMode
useColorModeValue
useContrastText
useAccessibleColors
Examples
Todo-List
Kitchen Sink
Recipes
Designs
AppBar
Card
Drawer Navigation
Tab View
Swipe List
Forms
Form with Validation
Login/Signup Forms
SearchBar
Layout
App Drawer
Footer
More
Changelog
Testing
FAQ's
More Props
If you are starting a new project, please try gluestack-ui for better performance and new design.
Center
Center aligns its contents to the center within itself. It is a layout component.
Show Code
Playground
function Example() {
return <Center bg="primary.400" _text={{
color: 'white',
fontWeight: 'bold'
}} height="32" width="40" shadow={2}>
Center
</Center>;
}
Import
Copy
import { Center, Square, Circle } from 'native-base';
Center: Centers its child, pass width and height
Square: Center but we need to pass size (width and height)
Circle: Center with round borderRadius, pass size (width and height)
Examples
Basic
Put any child element inside it, give it any width or/and height. It'll ensure the child is centered.
Playground
function Example() {
return <Center>
<Center bg="primary.400" _text={{
color: "white",
fontWeight: "bold"
}} height={200} width={{
base: 200,
lg: 250
}}>
This is the Center
</Center>
</Center>;
}
Icon frames
Center can be used to nicely position icons in the center and add frames around them.
Playground
function Example() {
return <HStack space={1}>
<Center w="40px" h="40px" bg="primary.400">
<Icon as={<MaterialIcons name="audiotrack" />} color="white" size={6} />
</Center>
<Center w="40px" h="40px" bg="secondary.400">
<Box _text={{
fontWeight: "bold",
fontSize: "lg",
color: "white"
}}>
20
</Box>
</Center>
</HStack>;
}
Square and Circle
Square and Circle automatically center their children.
Playground
function Example() {
return <HStack space={3}>
<Circle size="40px" bg="secondary.400">
<Icon as={<MaterialIcons name="audiotrack" />} color="white" size={5} />
</Circle>
<Square size="40px" bg="primary.400">
<Box _text={{
fontWeight: "bold",
fontSize: "lg",
color: "white"
}}>
20
</Box>
</Square>
</HStack>;
}
Props
Center implements
View
,
SafeAreaProps
,
PlatformProps
,
FlexProps
,
ColorProps
,
LayoutProps
,
BorderProps
,
TypographyProps
,
ShadowProps
,
PositionProps
Previous
Box
Next
Container
Quick Nav
Import
Examples
Basic
Icon frames
Square and Circle
Props
MadeWithNativeBase
gluestack-ui
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.