2016-10-06 53 views
0

在我的原生应用程序中,有一个视图,它显示了一个进度图。这个图形是在SVG(react-native-svg npm)及其特性如Line,Circle和Rect的帮助下动态构建的。制作动态SVG可滚动

对于很少的输入数据,图形变大而不在屏幕上,需要添加滚动,以便用户可以滚动并查看完整的图形。

render() { 
    console.log(this.props.data,'subject analysis'); 
    const {width,height} = getDeviceSize(); 
    let svgWidth = width; 
    let svgHeight = height; 
    .... creation logic goes here ..... 
} 

return (
     <View> 
     <Svg 
      height={height * 0.854} 
      width={width} 
     > 
</Svg> 
</View>); 

回答

0

使用ScrollView,但它会被限制在一个方向。如果您需要在两个方向上滚动/平移,可以使用PanResponder