{"size": 997, "ext": "js", "max_stars_repo_path": "src/svg/Svg.js", "max_stars_repo_name": "wuxiii/wellchat", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/svg/Svg.js", "max_issues_repo_name": "wuxiii/wellchat", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/svg/Svg.js", "max_forks_repo_name": "wuxiii/wellchat", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.2368421053, "max_line_length": 87, "alphanum_fraction": 0.5285857573}
// Svg.js
import React, {Component} from 'react';
import {TouchableOpacity} from 'react-native'
import SvgUri from './SvgUri';
import svgs from './List';

export default class Svg extends Component {
    static defaultProps = {
        icon: '',
        color: '',
        size: 0,
        onPress: undefined,
        style: null
    }
    constructor(props) {
        super(props);
    }
    render() {
        let svgXmlData = svgs[this.props.icon];

        if (!svgXmlData) {
            let err_msg = `can not find svg "${this.props.icon}", use node getSvg.js `;
            throw new Error(err_msg);
        }
        return <TouchableOpacity
            style={this.props.style}
            onPress={() => {
            this.props.onPress && this
                .props
                .onPress()
        }}><SvgUri
            width={this.props.size}
            height={this.props.size}
            svgXmlData={svgXmlData}
            fill={this.props.color}/></TouchableOpacity>
    }
}
