I'm using React Native Web in combination with Typescript and I would like to use the React Native Web Pressable component from the lib.
However, I faced a problem when the VSCode blames the React Native Web prop types like onHoverIn. The main issue in this situation is that the React Native prop types definition doesn't contain the enhanced props from RNWeb
Could someone, please, give to me a tip on how it could be solved in the right way?
I wouldn't like to disable TS checking in every file where I'd like to use Pressable
Here is the Error message:
type '{
children: Element;
accessibilityRole: "button";
delayLongPress: number;
disabled: false;
onHoverIn: () => void;
onHoverOut: () => void;
onKeyDown: () => void;
onLongPress: () => void;
onPress: () => void;
onPressIn: () => void;
onPressOut: () => void; }' is not assignable to type
'IntrinsicAttributes & PressableProps & RefAttributes<View>'.
Property 'onHoverIn' does not exist on type
'IntrinsicAttributes & PressableProps & RefAttributes<View>'.ts(2322)
The code example:
import React from 'react';
import {
Text, Button, ScrollView, StyleSheet, View, Pressable
} from 'react-native'; // in webpack conf I have an alias that fetches data from the React Native Web
....
<Pressable
accessibilityRole="button"
delayLongPress={750}
disabled={false}
onHoverIn={() => {
console.log('onHoverIn');
}}
onHoverOut={() => {
console.log('onHoverOut');
}}
>
<Text>Pressable</Text>
</Pressable>
Thanks for any help!