我在 React-Native App 中使用 styled-components
。
假设我有链接组件:
import styled from 'styled-components/native';
const Link = styled.Text`
color: 'red';
&:hover {
color: 'blue';
}
`
之后,我用 react-native-web ‘编译’我的 React-Native 代码.
一切都很好,但悬停不起作用。 (文本颜色在悬停时保持 红色
。)
我的猜测是 https://github.com/styled-components/css-to-react-native正在删除 hover
定义。
知道如何解决这个问题吗?
最佳答案
对于原生移动开发,悬停没有定义,这是因为屏幕上没有像桌面设备上那样的光标。由于 React Native for web 模拟了 RN 的工作方式,:hover 选择器失去了它的意义
关于javascript - 样式组件 :hover with react-native and react-native-web,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45981897/