diff --git a/index.js b/index.js index 9dddd96..85badcb 100644 --- a/index.js +++ b/index.js @@ -1,10 +1,10 @@ import React, { PureComponent } from 'react'; -import { View, StyleSheet, ART, Text } from 'react-native'; +import { View, StyleSheet, Text } from 'react-native'; import PropTypes from 'prop-types'; import barcodes from 'jsbarcode/src/barcodes'; -const { Surface, Shape } = ART; +import {Surface, Shape} from '@react-native-community/art'; export default class Barcode extends PureComponent { static propTypes = { @@ -48,9 +48,9 @@ export default class Barcode extends PureComponent { }; } - componentWillUpdate(nextProps) { - if (nextProps.value !== this.props.value) { - this.update(nextProps); + componentDidUpdate(prevProps) { + if (prevProps.value !== this.props.value) { + this.update(this.props); } } diff --git a/package.json b/package.json index 60df84a..f6f1992 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "keywords": ["react-native", "barcode"], "author": "WonSikin ", "dependencies": { - "jsbarcode": "^3.8.0" + "jsbarcode": "^3.8.0", + "@react-native-community/art": "^1.2.0" }, "peerDependencies": { "prop-types": "^15.5.0"