Reputation: 123
I am developing an app using expo and was trying to style my button. However, it was suggested in another stack overflow question to switch to TouchableOpacity and on the react-native TouchableOpacity page they suggest to switch to a future proof solution called Pressable. Now I am trying to implement the Pressable component in my component like they have on the react-native Pressable page and my code looks like this:
import { View, Text, Button, Pressable } from 'react-native';
export default function OrderDetail( {someProps} ){
.
.
.
<Pressable
onPress={() => {
setCategoryName('information')
}}
style={({ pressed }) => [
{
backgroundColor: pressed
? 'rgb(210, 230, 255)'
: 'white'
},
styles.wrapperCustom
]}>
{({ pressed }) => (
<Text style={styles.text}>
{pressed ? 'Pressed!' : 'Press Me'}
</Text>
)}
</Pressable>
.
.
.
}
Upvotes: 2
Views: 786
Reputation: 1989
Pressable is not available in Expo yet, because expo does not support React Native v0.63 (yet).
Upvotes: 4