LabelLinkView.js 1.49 KB
import React, {Component} from 'react';
import {
    View,
    Text,
    TouchableOpacity
} from 'react-native';
const defaultHeight = (30);
const HPading = (16);
const VPading = (6);
export default class LabelLinkView extends Component {

    constructor(props) {
        super(props);
        this.state = {}

        this.attrData = this.props.attrData;
    }

    render() {
        let {name, code, type, uom, description, isRequired, isPreview} = this.attrData;
        let {placeholder, hyperlink} = JSON.parse(this.attrData.data);
        return (
            <TouchableOpacity
                style={{
                    width: '100%',
                    backgroundColor: 'rgba(245, 245, 245, 1)',
                    flexDirection: 'row',
                    alignItems: 'center',
                    paddingVertical: VPading,
                    paddingHorizontal: HPading,
                    height: defaultHeight
                }}
                activeOpacity={0.8}
                onPress={() => {
                    if (!!hyperlink && hyperlink.length > 0) {
                        this.props.navigation.navigate("CommonWebView", {url: hyperlink})
                    }
                }}
            >
                {/*{isRequired&&<Text style={{ color: "#FF3030" }}>* {" "}</Text>}*/}
                {/*{!isRequired&&<Text style={{ color: "#fff" }}>* {" "}</Text>}*/}
                <Text style={{fontSize: 14, color: '#999'}}>{placeholder}</Text>
            </TouchableOpacity>
        );
    }
}