我有现有的iOS Swift应用程序。我将其集成到反应。但是,当我添加" react-fabricjs''import {canvas,circle,image,path};";我有错误在此处输入图像描述
我的软件包
{
"name": "uploader",
"version": "1.0.0",
"private": true,
"description": "Uploader",
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
},
"dependencies": {
"react": "~15.3.0",
"react-dom": "~15.3.0",
"react-fabricjs": "^0.1.6",
"react-native": "~0.34.0",
"jsdom": "~9.9.1"
}
}
我的index.ios.js
'use strict';
// 1
import React from 'react';
import {Canvas,Circle, Image, Path } from 'react-fabricjs';
import ReactNative, {
AppRegistry,
StyleSheet,
Text,
View,
} from 'react-native';
// 2
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'yellow',
},
welcome: {
fontSize: 35,
color: 'green',
},
});
// 3
class AddRatingApp extends React.Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>See you later alligator !</Text>
</View>
)
}
}
// 4
AppRegistry.registerComponent('AddRatingApp', () => AddRatingApp);
我如何将任何React库导入React-Native应用程序?
使用HTML/CSS/DOM的任何库都无法与React Native一起使用。这是一个HTML5库,它将与React一起使用,但不能与本机相关。