From af22ac4c3d8fc8eaa69324012d4155fbbcbb5e3b Mon Sep 17 00:00:00 2001 From: Raven Date: Thu, 15 Mar 2018 15:17:33 +0800 Subject: [PATCH 1/2] Display text prop under barcode image if it exists. center aligned. --- index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.js b/index.js index 428d90b..8e5ba1e 100644 --- a/index.js +++ b/index.js @@ -168,6 +168,9 @@ export default class Barcode extends PureComponent { + if (typeof(this.props.text) != "undefined") { + {this.props.text} + } ); } From cbed105a9f63e0027b7845857355326f4f52edfb Mon Sep 17 00:00:00 2001 From: Raven Date: Thu, 15 Mar 2018 15:29:27 +0800 Subject: [PATCH 2/2] Ability to set text color independently. Fix missing Text import bug. --- index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 8e5ba1e..7e8c563 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ import React, { PureComponent } from 'react'; -import { View, StyleSheet, ART } from 'react-native'; +import { View, StyleSheet, ART, Text } from 'react-native'; import PropTypes from 'prop-types'; import barcodes from 'jsbarcode/src/barcodes'; @@ -18,8 +18,10 @@ export default class Barcode extends PureComponent { width: PropTypes.number, /* The height of the barcode. */ height: PropTypes.number, - /* Set the color of the bars and the text. */ + /* Set the color of the bars */ lineColor: PropTypes.string, + /* Set the color of the text. */ + textColor: PropTypes.string, /* Set the background of the barcode. */ background: PropTypes.string, /* Handle error for invalid barcode of selected format */ @@ -33,6 +35,7 @@ export default class Barcode extends PureComponent { width: 2, height: 100, lineColor: '#000000', + textColor: '#000000', background: '#ffffff', onError: undefined }; @@ -169,7 +172,7 @@ export default class Barcode extends PureComponent { if (typeof(this.props.text) != "undefined") { - {this.props.text} + {this.props.text} } );