我的代码顶部有这些导入:
import React from 'react'
import { StyleSheet, View, Button, Dimensions, TouchableOpacity, Text} from 'react-native'
import { LineChart, Grid } from 'react-native-svg-charts'
import * as shape from 'd3-shape'
import { Circle, G, Line, Rect, Text } from 'react-native-svg'我想同时使用react本地的文本节点和can本机的文本节点-svg,这能做到吗?
我得到的错误是重复声明文本,我可以理解为什么。但我希望在我的代码中使用这两种方法,如:
<G y={ 50 }>
<Rect
height={ 40 }
width={ 75 }
stroke={ 'grey' }
fill={ 'white' }
ry={ 10 }
rx={ 10 }
/>
<Text
x={ 75 / 2 }
dy={ 20 }
alignmentBaseline={ 'middle' }
textAnchor={ 'middle' }
stroke={ 'rgb(134, 65, 244)' }
>
{ `${data[5]}ºC` }
</Text>
</G>再往下看我的代码:
<TouchableOpacity style={{height: '100%', justifyContent:'center'}}>
<Text style={{color: '#fff'}}>back</Text>
</TouchableOpacity>发布于 2018-10-05 13:40:32
您可以使用as <MyName>符号重命名您想要的导入。
import { Circle, G, Line, Rect, Text as TextSvg } from 'react-native-svg'应该能工作。
然后使用<TextSvg />
https://stackoverflow.com/questions/52666878
复制相似问题