当前位置: 移动技术网 > IT编程>开发语言>其他编程 > Error while updating property ‘stroke‘ in shadow node of type: ARTShape

Error while updating property ‘stroke‘ in shadow node of type: ARTShape

2020年08月10日  | 移动技术网IT编程  | 我要评论
一、问题发现好多人跟我一样踩坑react-native-progress与最新版本的react-native不兼容,或者使用到了react-native-community/art的Shape等组件,出现Errorwhile updating property ‘stroke’ in shadow node of type:ARTShape问题,这里给大家分享下。当然没踩坑的可以略过,给自己留点宝贵的时间去做点别的事情。二、解决方案如下,github issue上我也贴过了,地址:https

一、问题

发现好多人跟我一样踩坑react-native-progress与最新版本的react-native不兼容,或者使用到了react-native-community/art的Shape等组件,出现Error
while updating property ‘stroke’ in shadow node of type:
ARTShape问题,这里给大家分享下。
当然没踩坑的可以略过,给自己留点宝贵的时间去做点别的事情。

二、解决方案

如下,github issue上我也贴过了,地址:https://github.com/oblador/react-native-progress/issues/179
在这里插入图片描述

这个主要是两点: 1,新版需要额外导入react-native-community/art的package
2,不要忘记将ARTPackage注册到MainApplication中

三、facebook源码解析

3.1,这个单纯使用旧版react-native没问题。

旧版art路径为node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/art

在这里插入图片描述
并且可以明显看到这里使用的stroke与fill属性都是ReadableArray数据结构

3.2,新版已经开始对art进行调整,并且会逐渐从react-native从剥离

新版路径为/android/src/main/java/com/reactnativecommunity/art/ARTShapeShadowNode.java

在这里插入图片描述
要注意到这里stroke边界色值属性已经调整为String。
react-native对包的加载顺序是先加载自己的源代码(react-native包下的内容),再加载用户的插件支持模块。所以如果没有注册到MainApplication中则会使用之前react-native包下的art,自然产生了兼容性问题,ios端无此问题。
Over

本文地址:https://blog.csdn.net/liuxingyuzaixian/article/details/107881876

如您对本文有疑问或者有任何想说的,请 点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网