When using the React Native Pressable
component, it doesn't work on the web. I'm using expo
and react-native-web
. Is there something I'm supposed to do with react-native-web to make it work on web?
If not, is there an expo or react-native-web alternative for Pressable
? I know Button
can work but there are issues styling it on mobile as far as I know. Also TouchableHighlight
and TouchableOpacity
seem to work but it doesn't have the same APIs and seems to not be as future-proof in the documentation. Is Pressable
simply not web-compatible at this point?
Currently, when I run expo start
and run the app on the web, Pressable
doesn't work on the web.
import React from 'react';
import { Text, View, StyleSheet, Pressable } from 'react-native';
export Button = (props) => {
const { onPress } = props;
return (
<Pressable style={styles.button} onPress={onPress}>
<Text style={styles.text}>Save</Text>
</Pressable>
);
}
Pressable works on the web. What error are you getting?