英文:
How to fix pointer event error ? React Native
问题
我一直在使用Mac M1笔记本电脑遇到这个错误,而我的其他设备没有出现这个问题。
我一直卡在这里,无法解决这些错误,请帮帮我。
另外还有这个错误:"需要模块“node_modules/@react-navigation/drawer/src/views/modern/Drawer.tsx”。我甚至没有在其他设备上安装抽屉,它也能正常工作。
还要注意,当我全局搜索 <View pointerEvents='auto' ...>
// pointerEvents 时,没有这样的东西,因为我从未将它添加到我的视图中。
英文:
I've been getting this error in mac M1 laptop , meanwhile it is fine with my other device
I've been stuck here and cant fix these error , please help
Also there is this error "Requiring module "node_modules/@react-navigation/drawer/src/views/modern/Drawer.tsx"
I don't even install drawer in other device and it is fine
Note also when I search globaly for <View pointerEvents='auto' ...>
// pointerEvents , there is no such thing , since I never added that too to my view
答案1
得分: 2
你可以在抽屉版本 "6.1.4" 中修复相同的问题。请在 yarn.lock 文件中验证版本。
英文:
i was facing the same issue , you can fix it in drawer version "6.1.4". please verify the version on yarn.lock
答案2
得分: 1
我在这个路径下的@react-navigation库中将pointerEvents: 'auto'注释掉了
./node_modules/@react-navigation/drawer/src/views/modern/Overlay.tsx
错误消失了。我安装了最新版本的库。
英文:
I commented the pointerEvents: 'auto' from the @react-navigation library on this path
./node_modules/@react-navigation/drawer/src/views/modern/Overlay.tsx
error went away. I have the latest version of lib installed.
答案3
得分: 1
@react-navigation/drawer
v6.5.7 仍然存在相同的问题。我不知道哪个版本有问题。但对我来说,降级到 v6.5.0 可以解决。
英文:
@react-navigation/drawer
v6.5.7 still has same issue. I don't know which version is buggy. But for me, lowering down to v6.5.0 did the work.
答案4
得分: 0
错误是正确的 - pointerEvents 不是一个有效的样式属性。它是 View 的一个属性。不要将它添加到你的样式中,直接在 View 上设置它:
<View pointerEvents='auto' ...>
查看文档以获取有关如何使用 pointerEvents 的更多信息。auto 是默认值,不需要指定。
英文:
The error is correct - pointerEvents is not a valid style property. It's a prop of View. Don't add it to your styles, set it directly on the View:
<View pointerEvents='auto' ...>
See the docs for more on how to use pointerEvents. Auto is the default and doesn't need to be specified.
答案5
得分: 0
如果您正在使用@react-navigation/drawer
并遇到此错误,您可以将@react-navigation/drawer
版本更新到最新版本,即7.0.0-alpha.1
,或者您可以创建一个补丁来从样式中移除指针事件。
前往下面的位置,找到pressable样式,并移除pointerEvents
,然后将pointerEvents
添加到覆盖层的Animated.View
中。
位置:/node_modules/@react-navigation/drawer/src/views/modern/Overlay.tsx
英文:
If you are using @react-navigation/drawer
and getting this error, you can either update the @react-navigation/drawer
version to the latest that is 7.0.0-alpha.1
, or you create a patch to remove the pointer event from the style.
Go to the below location and find pressable style and remove the pointerEvents
And add the pointerEvents
to the overlay Animated.View
location: /node_modules/@react-navigation/drawer/src/views/modern/Overlay.tsx
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论