Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update index.js for making it compatible with latest RN versions #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
View,
Text,
} from 'react-native';
import PropTypes from 'prop-types'; // add this for using it with latest RN versions


const styles = StyleSheet.create({
circle: {
Expand Down Expand Up @@ -50,15 +52,16 @@ const styles = StyleSheet.create({
});

class PercentageCircle extends Component {
propTypes: {
color: React.PropTypes.string,
bgcolor: React.PropTypes.string,
innerColor: React.PropTypes.string,
radius: React.PropTypes.number,
percent: React.PropTypes.number,
borderWidth: React.Proptypes.number,
textStyle: React.Proptypes.array,
disabled: React.PropTypes.bool,
//Made changes here for latest version compatiablity
static propTypes= {
color: PropTypes.string,
bgcolor: PropTypes.string,
innerColor: PropTypes.string,
radius: PropTypes.number,
percent: PropTypes.number,
borderWidth: PropTypes.number,
textStyle: PropTypes.array,
disabled: PropTypes.bool,
}

constructor(props) {
Expand All @@ -82,8 +85,9 @@ class PercentageCircle extends Component {
textStyle: this.props.textStyle ? this.props.textStyle : null
};
}

componentWillReceiveProps(nextProps) {

//Change here
UNSAFE_componentWillReceiveProps(nextProps) {
let percent = nextProps.percent;
let leftTransformerDegree = '0deg';
let rightTransformerDegree = '0deg';
Expand Down