我尝试在 Android 手机的 react-native build 中使用 ART 库,但无论我在 Shape 中放入什么,都无法渲染黑色图像,如下所示:
我的代码:
import React from 'react';
import {
ART,
StyleSheet,
View,
Button,
} from 'react-native';
const {
Group,
Shape,
Surface,
} = ART;
export default class App extends React.Component {
render() {
return (
<View style={styles.container}>
<Surface width={500} height={500}>
<Group x={0} y={0}>
<Shape
d="M10 80 C 40 10, 65 10, 95 80 S 150 150, 180 80"
stroke="#555"
strokeWidth={1}
/>
</Group>
</Surface>
</View>
);
}
}
最佳答案
React Native 中的 ART 库对 Android 的支持不是很好。有很多问题。我认为以下是一个很好地链接到您的示例:
https://github.com/facebook/react-native/issues/17565
https://github.com/facebook/react-native/issues/17565#issuecomment-430897843
我会说尝试上面链接中的一些解决方案。希望这对您有所帮助!
关于android - ART 库在 native react 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53302552/