UNPKG

media_player_wrapper

Version:
56 lines (50 loc) 1.05 kB
import React, { Component } from "react"; import { Text } from "react-native"; //insert fonts const defaultFont = ""; const bold = ""; const semiBold = ""; const medium = ""; const thin = ""; const light = ""; class CustText extends Component { constructor(props) { super(props); } render() { return ( <Text {...this.props} style={[this.conditionalStyles(), this.props.style]}> {this.props.text} </Text> ); } conditionalStyles() { var weight = this.props.weight; if (weight == "bold") { return { fontWeight: "bold" }; } else if (weight == "semi-bold") { return { fontFamily: semiBold }; } else if (weight == "medium") { return { fontFamily: medium }; } else if (weight == "thin") { return { fontFamily: thin }; } else if (weight == "light") { return { fontFamily: light }; } else { return { fontFamily: defaultFont }; } } } module.exports = CustText;