From b9e3f3d35bcdbb3843dcb4fb84a981b93d6c25b3 Mon Sep 17 00:00:00 2001 From: ntolstikova Date: Thu, 28 Apr 2022 22:51:24 +0100 Subject: [PATCH 1/3] add inner borderRadius --- Bar.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Bar.js b/Bar.js index dd8e877..494c8f7 100644 --- a/Bar.js +++ b/Bar.js @@ -11,6 +11,7 @@ export default class ProgressBar extends Component { animated: PropTypes.bool, borderColor: PropTypes.string, borderRadius: PropTypes.number, + progressBorderRadius: PropTypes.number, borderWidth: PropTypes.number, children: PropTypes.node, color: PropTypes.string, @@ -127,6 +128,7 @@ export default class ProgressBar extends Component { style, unfilledColor, width, + progressBorderRadius, ...restProps } = this.props; @@ -142,6 +144,7 @@ export default class ProgressBar extends Component { const progressStyle = { backgroundColor: color, height, + borderRadius: progressBorderRadius, transform: [ { translateX: this.state.animationValue.interpolate({ @@ -176,4 +179,4 @@ export default class ProgressBar extends Component { ); } -} \ No newline at end of file +} From 887222200b153e2a96b3ac0888f4e3a851e88f08 Mon Sep 17 00:00:00 2001 From: ntolstikova Date: Thu, 28 Apr 2022 23:12:11 +0100 Subject: [PATCH 2/3] add inner borderRadius --- Bar.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Bar.js b/Bar.js index 494c8f7..83469f1 100644 --- a/Bar.js +++ b/Bar.js @@ -11,7 +11,6 @@ export default class ProgressBar extends Component { animated: PropTypes.bool, borderColor: PropTypes.string, borderRadius: PropTypes.number, - progressBorderRadius: PropTypes.number, borderWidth: PropTypes.number, children: PropTypes.node, color: PropTypes.string, @@ -128,7 +127,6 @@ export default class ProgressBar extends Component { style, unfilledColor, width, - progressBorderRadius, ...restProps } = this.props; @@ -144,7 +142,7 @@ export default class ProgressBar extends Component { const progressStyle = { backgroundColor: color, height, - borderRadius: progressBorderRadius, + borderRadius, transform: [ { translateX: this.state.animationValue.interpolate({ From 4db63087cb19a1cde4f1bbbf5923bda77c41250c Mon Sep 17 00:00:00 2001 From: ntolstikova Date: Fri, 29 Apr 2022 00:07:03 +0100 Subject: [PATCH 3/3] add inner borderRadius --- Bar.js | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/Bar.js b/Bar.js index 83469f1..41cb55a 100644 --- a/Bar.js +++ b/Bar.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { Animated, Easing, View, I18nManager } from 'react-native'; +import { Animated, Easing, View } from 'react-native'; const INDETERMINATE_WIDTH_FACTOR = 0.3; const BAR_WIDTH_ZERO_POSITION = @@ -142,7 +142,11 @@ export default class ProgressBar extends Component { const progressStyle = { backgroundColor: color, height, - borderRadius, + borderRadius: 1000, + width: this.state.progress.interpolate({ + inputRange: [0, 1], + outputRange: [0.0001, innerWidth] + }), transform: [ { translateX: this.state.animationValue.interpolate({ @@ -150,19 +154,6 @@ export default class ProgressBar extends Component { outputRange: [innerWidth * -INDETERMINATE_WIDTH_FACTOR, innerWidth], }), }, - { - translateX: this.state.progress.interpolate({ - inputRange: [0, 1], - outputRange: [innerWidth / (I18nManager.isRTL ? 2 : -2), 0], - }), - }, - { - // Interpolation a temp workaround for https://github.com/facebook/react-native/issues/6278 - scaleX: this.state.progress.interpolate({ - inputRange: [0, 1], - outputRange: [0.0001, 1], - }), - }, ], };