gpt4 book ai didi

swift - 如何导入fabric-webpack到react-native?

转载 作者:行者123 更新时间:2023-11-30 12:48:37 28 4
gpt4 key购买 nike

我有现有的 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 应用程序中?

最佳答案

任何使用 html/css/DOM 的库都不适用于 React Native。这是一个 html5 库,可以与 React 配合使用,但不能与 React Native 配合使用。

关于swift - 如何导入fabric-webpack到react-native?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41303170/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com