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 — Pressable | NativeBase | Universal Components for React and React Native

Pressable | 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.
Pressable
Pressable is a lower level primitive if you need more flexibility than a button and access to hover, pressed and focus events.
Show Code
Playground
function Example() {
return <Pressable>
{({
isHovered,
isFocused,
isPressed
}) => {
return <Box maxW="96" borderWidth="1" borderColor="coolGray.300" shadow="3" bg={isPressed ? 'coolGray.200' : isHovered ? 'coolGray.200' : 'coolGray.100'} p="5" rounded="8" style={{
transform: [{
scale: isPressed ? 0.96 : 1
}]
}}>
<HStack alignItems="center">
<Badge colorScheme="darkBlue" _text={{
color: 'white'
}} variant="solid" rounded="4">
Business
</Badge>
<Spacer />
<Text fontSize={10} color="coolGray.800">
1 month ago
</Text>
</HStack>
<Text color="coolGray.800" mt="3" fontWeight="medium" fontSize="xl">
Marketing License
</Text>
<Text mt="2" fontSize="sm" color="coolGray.700">
Unlock powerfull time-saving tools for creating email delivery and
collecting marketing data
</Text>
<Flex>
{isFocused ? <Text mt="2" fontSize={12} fontWeight="medium" textDecorationLine="underline" color="darkBlue.600" alignSelf="flex-start">
Read More
</Text> : <Text mt="2" fontSize={12} fontWeight="medium" color="darkBlue.600">
Read More
</Text>}
</Flex>
</Box>;
}}
</Pressable>;
}
Examples
Basic
Pressable accepts most of the utility style system props.
Playground
function Example() {
return <Box alignItems="center">
<Pressable onPress={() => console.log("I'm Pressed")} rounded="8" overflow="hidden" borderWidth="1" borderColor="coolGray.300" maxW="96" shadow="3" bg="coolGray.100" p="5">
<Box>
<HStack alignItems="center">
<Badge colorScheme="darkBlue" _text={{
color: "white"
}} variant="solid" rounded="4">
Business
</Badge>
<Spacer />
<Text fontSize={10} color="coolGray.800">
1 month ago
</Text>
</HStack>
<Text color="coolGray.800" mt="3" fontWeight="medium" fontSize="xl">
Marketing License
</Text>
<Text mt="2" fontSize="sm" color="coolGray.700">
Unlock powerfull time-saving tools for creating email delivery and
collecting marketing data
</Text>
<Flex>
<Text mt="2" fontSize={12} fontWeight="medium" color="darkBlue.600">
Read More
</Text>
</Flex>
</Box>
</Pressable>
</Box>;
}
Accessing events (hover, focus and pressed)
Pressable accepts a render prop children, which receives isHovered, isFocused and isPressed props.
Playground
function Example() {
return <Box alignItems="center">
<Pressable maxW="96">
{({
isHovered,
isFocused,
isPressed
}) => {
return <Box bg={isPressed ? "coolGray.200" : isHovered ? "coolGray.200" : "coolGray.100"} style={{
transform: [{
scale: isPressed ? 0.96 : 1
}]
}} p="5" rounded="8" shadow={3} borderWidth="1" borderColor="coolGray.300">
<HStack alignItems="center">
<Badge colorScheme="darkBlue" _text={{
color: "white"
}} variant="solid" rounded="4">
Business
</Badge>
<Spacer />
<Text fontSize={10} color="coolGray.800">
1 month ago
</Text>
</HStack>
<Text color="coolGray.800" mt="3" fontWeight="medium" fontSize="xl">
Marketing License
</Text>
<Text mt="2" fontSize="sm" color="coolGray.700">
Unlock powerfull time-saving tools for creating email delivery
and collecting marketing data
</Text>
<Flex>
{isFocused ? <Text mt="2" fontSize={12} fontWeight="medium" textDecorationLine="underline" color="darkBlue.600" alignSelf="flex-start">
Read More
</Text> : <Text mt="2" fontSize={12} fontWeight="medium" color="darkBlue.600">
Read More
</Text>}
</Flex>
</Box>;
}}
</Pressable>
</Box>;
}
Props
Pressable
Pressable implements
Pressable
,
View
,
FlexProps
,
ColorProps
,
LayoutProps
,
BorderProps
,
TypographyProps
,
ShadowProps
,
PositionProps
,
BackgroundProps
,
PlatformProps
onHoverIn
Called when a mouse enters the Pressable
Type: () => void
onHoverOut
Called when a mouse leaves the Pressable
Type: () => void
onFocus
Called when Pressable receives focus
Type: () => void
onBlur
Called when Pressable loses focus
Type: () => void
_hover
Style props to be applied when hovered
Type: Omit<Partial<IPressableProps>, "_hover">
_pressed
Style props to be applied when pressed
Type: Omit<Partial<IPressableProps>, "_pressed">
_focus
Style props to be applied when focus
Type: Omit<Partial<IPressableProps>, "_focus">
_disabled
Style props to be applied when disabled
Type: Omit<Partial<IPressableProps>, "_disabled">
isDisabled
If true, the p will be disabled.
Type: boolean
isHovered
If true, the p will be hovered.
Type: boolean
isPressed
If true, the p will be pressed.
Type: boolean
isFocused
If true, the p will be focused.
Type: boolean
isFocusVisible
If true, the focus ring will be visible .
Type: boolean
_focusVisible
Style props to be applied when focus visible. These styles will be only applied when user is interacting the app using a keyboard. (Web only)
Type: Omit<Partial<IPressableProps>, "_focusVisible">
children
Either children or a render prop that receives a boolean reflecting whether the component is currently pressed.
Type: ReactNode | (({ isPressed, isHovered, isFocused, }: { isPressed: boolean; isHovered: boolean; isFocused: boolean; }) => any)
Previous
Button
Next
Checkbox
Quick Nav
Examples
Basic
Accessing events (hover, focus and pressed)
Props
Pressable
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.