我有现有的iOS swift应用程序。我将其集成到本机。但是当我添加“从'react-fabricjs'导入{画布,圆,图像,路径}时”;我有错误
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一起使用。这是一个可与React一起使用的html5库,但不适用于React Native。

10-05 20:41
查看更多