diff --git a/src/components/Hoverable/index.js b/src/components/Hoverable/index.js index 2cbfd4b583d0..d14e055fbb13 100644 --- a/src/components/Hoverable/index.js +++ b/src/components/Hoverable/index.js @@ -1,6 +1,8 @@ import _ from 'underscore'; import React, {Component} from 'react'; +import {View} from 'react-native'; import {propTypes, defaultProps} from './hoverablePropTypes'; +import * as DeviceCapabilities from '../../libs/DeviceCapabilities'; /** * It is necessary to create a Hoverable component instead of relying solely on Pressable support for hover state, @@ -15,6 +17,7 @@ class Hoverable extends Component { }; this.wrapperView = null; + this.hasHoverSupport = DeviceCapabilities.hasHoverSupport(); } componentDidMount() { @@ -73,6 +76,11 @@ class Hoverable extends Component { child = this.props.children[0]; } + if (!this.hasHoverSupport) { + const childrenWithHoverState = _.isFunction(child) ? child(false) : child; + return {childrenWithHoverState}; + } + if (_.isFunction(child)) { child = child(this.state.isHovered); }