NativeBase uses internal pseudo props to get more customizable components.
Use of internal pseudo props
Let’s take an example of Actionsheet component,
Actionsheet has the following internal pseudo props: _dragIndicator , _dragIndicatorWrapper and _dragIndicatorWrapperOffSet
_dragIndicator - Using _dragIndicator internal pseudo prop, we can customize the style of Actionsheet indicator.
function Example() {
const {
isOpen,
onOpen,
onClose
} = useDisclose();
return <Center>
<Button onPress={onOpen}>Actionsheet</Button>
<Actionsheet isOpen={isOpen} onClose={onClose}>
<Actionsheet.Content _dragIndicator={{
bg: 'blue.500'
}}>
<Box w="100%" h={60} px={4} justifyContent="center">
<Text fontSize="16" color="gray.500" _dark={{
color: 'gray.300'
}}>
Albums
</Text>
</Box>
<Actionsheet.Item>Delete</Actionsheet.Item>
<Actionsheet.Item>Share</Actionsheet.Item>
<Actionsheet.Item>Play</Actionsheet.Item>
<Actionsheet.Item>Favourite</Actionsheet.Item>
<Actionsheet.Item>Cancel</Actionsheet.Item>
</Actionsheet.Content>
</Actionsheet>
</Center>;
}
_dragIndicatorWrapper - Using _dragIndicatorWrapper internal pseudo props, we can customize the style of wrapper around drag indicator.
function Example() {
const {
isOpen,
onOpen,
onClose
} = useDisclose();
return <Center>
<Button onPress={onOpen}>Actionsheet</Button>
<Actionsheet isOpen={isOpen} onClose={onClose}>
<Actionsheet.Content _dragIndicatorWrapper={{
bg: 'blue.500',
py: '4'
}}>
<Box w="100%" h={60} px={4} justifyContent="center">
<Text fontSize="16" color="gray.500" _dark={{
color: 'gray.300'
}}>
Albums
</Text>
</Box>
<Actionsheet.Item>Delete</Actionsheet.Item>
<Actionsheet.Item>Share</Actionsheet.Item>
<Actionsheet.Item>Play</Actionsheet.Item>
<Actionsheet.Item>Favourite</Actionsheet.Item>
<Actionsheet.Item>Cancel</Actionsheet.Item>
</Actionsheet.Content>
</Actionsheet>
</Center>;
}
_dragIndicatorWrapperOffset - Using _dragIndicatorWrapperOffset internal pseudo prop, we can customize styling of scrollable area above Actionsheet.Content.
function Example() {
const {
isOpen,
onOpen,
onClose
} = useDisclose();
return <Center>
<Button onPress={onOpen}>Actionsheet</Button>
<Actionsheet isOpen={isOpen} onClose={onClose}>
<Actionsheet.Content _dragIndicatorWrapperOffSet={{
py: '10'
}}>
<Box w="100%" h={60} px={4} justifyContent="center">
<Text fontSize="16" color="gray.500" _dark={{
color: 'gray.300'
}}>
Albums
</Text>
</Box>
<Actionsheet.Item>Delete</Actionsheet.Item>
<Actionsheet.Item>Share</Actionsheet.Item>
<Actionsheet.Item>Play</Actionsheet.Item>
<Actionsheet.Item>Favourite</Actionsheet.Item>
<Actionsheet.Item>Cancel</Actionsheet.Item>
</Actionsheet.Content>
</Actionsheet>
</Center>;
}
List of internal pseudo props:
NativeBase uses following pseudo props in different components.
Drag indicator in actionsheet.
_dragIndicatorWrapperOffSet
Scrollable area above Actionsheet.Content.
Wrapper around drag indicator.
Backdrop in Modal, Menu and AlertDialog.
Animation prop for backdrop.
Animation prop used in Modal and AlertDialog.
Animation prop used in Modal and AlertDialog.
Used to style image in Avatar.
Used to style avatar in AvatarGroup.
Used to style hidden avatar in AvatarGroup.
Used to style astrick in FormControl.
Used to style title of MenuGroup and Toast.
Used to style ScrollView.
Used to style text line in SkeletonText.
Used to style ScrollView.
Used to style description in Toast.
Used to style interaction box in Checkbox and Radio.
Used to style checkbox in CheckboxGroup.
Used to style alt text in Image.
Used to style radio in RadioGroup.
Used to style SelectItem in Select.
Used to style selected item in Select.
Used to style actionsheet content in Select.
Used to style actionsheet content in Select.
Used to style actionsheet body in Select.