@@ -123,10 +123,15 @@ const Tooltip = ({
123
123
clearTimeout ( hideTooltipTimer . current ) ;
124
124
}
125
125
126
- showTooltipTimer . current = setTimeout ( ( ) => {
126
+ if ( isWeb ) {
127
+ showTooltipTimer . current = setTimeout ( ( ) => {
128
+ touched . current = true ;
129
+ setVisible ( true ) ;
130
+ } , enterTouchDelay ) as unknown as NodeJS . Timeout ;
131
+ } else {
127
132
touched . current = true ;
128
133
setVisible ( true ) ;
129
- } , enterTouchDelay ) as unknown as NodeJS . Timeout ;
134
+ }
130
135
} ;
131
136
132
137
const handleTouchEnd = ( ) => {
@@ -149,6 +154,9 @@ const Tooltip = ({
149
154
return children . props . onPress ?.( ) ;
150
155
}
151
156
} , [ children . props ] ) ,
157
+ onLongPress : ( ) => handleTouchStart ( ) ,
158
+ onPressOut : ( ) => handleTouchEnd ( ) ,
159
+ delayLongPress : enterTouchDelay ,
152
160
} ;
153
161
154
162
const webPressProps = {
@@ -193,17 +201,16 @@ const Tooltip = ({
193
201
</ View >
194
202
</ Portal >
195
203
) }
196
- < View
197
- onTouchStart = { handleTouchStart }
198
- onTouchEnd = { handleTouchEnd }
199
- onTouchCancel = { handleTouchEnd }
204
+ < Pressable
205
+ ref = { childrenWrapperRef }
206
+ style = { isWeb ? styles . webContainer : null }
207
+ { ... ( isWeb ? webPressProps : mobilePressProps ) }
200
208
>
201
209
{ React . cloneElement ( children , {
202
210
...rest ,
203
- ref : childrenWrapperRef ,
204
211
...( isWeb ? webPressProps : mobilePressProps ) ,
205
212
} ) }
206
- </ View >
213
+ </ Pressable >
207
214
</ >
208
215
) ;
209
216
} ;
@@ -222,6 +229,9 @@ const styles = StyleSheet.create({
222
229
hidden : {
223
230
opacity : 0 ,
224
231
} ,
232
+ webContainer : {
233
+ cursor : 'default' ,
234
+ } as ViewStyle ,
225
235
} ) ;
226
236
227
237
export default Tooltip ;
0 commit comments