未找到名称为“ARTShape"的视图组件 [英] No component found for view with name "ARTShape"
问题描述
只是尝试为在 React Native 中使用 ART 对象生成一个 hello-world,我得到了上述异常,就好像库的一部分没有链接一样.我刚刚添加了以下代码:
Just trying to produce an hello-world for using the ART object in React Native, I get the above exception as if part of the library were not linked. I just added the following code:
import {
AppRegistry,
StyleSheet,
Text,
View,
ART
} from 'react-native';
...
<代码><文本样式={styles.instructions}>按 Cmd+R 重新加载,{'\n'}Cmd+D 或震动开发菜单</文本><艺术形状填充={黑色"}d="M10,10 L 30,30"}/></查看>...
到 index.ios.js
在 react-native init my-app
之后.那么我做错了什么?我是否必须使用 rnpm
链接某个包?
to index.ios.js
after react-native init my-app
. So what am I doing wrong? Do I have to link some package with rnpm
?
react-native-cli: 0.2.0
反应原生:0.27.0
react-native-cli: 0.2.0
react-native: 0.27.0
推荐答案
你必须用 Surface
元素包装你的所有 ART
组件.
You have to get all your ART
components wrapped with the Surface
element.
const { Surface, Shape } = ART;
...
<Surface width={ 100 } height={100}>
<Shape></Shape>
</Surface>
这篇关于未找到名称为“ARTShape"的视图组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!