【发布时间】:2016-12-24 00:15:40
【问题描述】:
我有现有的 iOS swift 应用程序。我将它集成到 react-native。但是当我添加“从'react-fabricjs'导入{Canvas,Circle,Image,Path};”时我有错误 enter image description here
我的 package.json
{
"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 应用程序?
【问题讨论】:
标签: swift reactjs react-native