mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-04 23:54:53 +00:00
add toDataURL method for svg elements
Add toDataURL method for svg elements to get data64 data of svg.(iOS) Add example for this.
This commit is contained in:
+17
-2
@@ -1,7 +1,18 @@
|
||||
import React, {Component, PropTypes} from 'react';
|
||||
import {View, requireNativeComponent, StyleSheet} from 'react-native';
|
||||
import React, {
|
||||
Component,
|
||||
PropTypes
|
||||
} from 'react';
|
||||
import {
|
||||
View,
|
||||
requireNativeComponent,
|
||||
StyleSheet,
|
||||
UIManager,
|
||||
findNodeHandle,
|
||||
NativeModules
|
||||
} from 'react-native';
|
||||
import ViewBox from './ViewBox';
|
||||
import _ from 'lodash';
|
||||
const RNSVGSvgViewManager = NativeModules.RNSVGSvgViewManager;
|
||||
|
||||
// Svg - Root node of all Svg elements
|
||||
let id = 0;
|
||||
@@ -45,6 +56,10 @@ class Svg extends Component{
|
||||
this.root.setNativeProps(...args);
|
||||
};
|
||||
|
||||
toDataURL = (callback = _.noop) => {
|
||||
RNSVGSvgViewManager.toDataURL(findNodeHandle(this.root), callback);
|
||||
};
|
||||
|
||||
render() {
|
||||
let {props} = this;
|
||||
let opacity = +props.opacity;
|
||||
|
||||
Reference in New Issue
Block a user