chenshuai2144 / f2-demo

f2 react-native demo
26 stars 9 forks source link

正常运行需要以下步骤 #4

Open Clearwyx opened 5 years ago

Clearwyx commented 5 years ago

1.安装 antv/f2 npm install @antv/f2 --save

2.安装 react-native-canvas npm install react-native-canvas

3.安装 react-native-webview npm install react-native-webview --save react-native link react-native-webview

carl0804 commented 4 years ago

最新版的rn,无法正常运行demo

"dependencies": { "@antv/f2": "^3.5.0-beta.1", "react": "16.9.0", "react-native": "0.61.5", "react-native-canvas": "^0.1.34", "react-native-webview": "^7.6.0" },

image

vvizden commented 3 years ago

最新版的rn,无法正常运行demo

"dependencies": { "@antv/f2": "^3.5.0-beta.1", "react": "16.9.0", "react-native": "0.61.5", "react-native-canvas": "^0.1.34", "react-native-webview": "^7.6.0" },

image

Hi, you can use the getContext('2d'), like this:

const context = await canvas.getContext('2d')
new F2.Chart({
  context: context
})

await is necessary, as it has been written in the react-native-canvas readme.

Although it works now. But when i requie the @antv/f2/lib/interaction/interaction/, another problem occurred: document is not defined.

So, i might need to try another chart library.