Skip to content

Commit 994e229

Browse files
lidord-wixethanshar
authored andcommitted
support RTL in progressBar (#1724)
1 parent 1ad7232 commit 994e229

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/components/progressBar/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class ProgressBar extends PureComponent<Props, State> {
115115
const {fullWidth, progressColor} = this.props;
116116
const borderRadius = fullWidth ? styles.fullWidthProgressBorderRadius : styles.inlineBorderRadius;
117117
const progressStyle = {
118-
right: this.state.containerWidth,
118+
right: Constants.isRTL ? undefined : this.state.containerWidth,
119119
backgroundColor: progressColor || DEFAULT_COLOR
120120
};
121121

@@ -137,10 +137,11 @@ class ProgressBar extends PureComponent<Props, State> {
137137

138138
render() {
139139
const {style, testID} = this.props;
140-
const {containerWidth} = this.state;
140+
const {containerWidth = 0} = this.state;
141+
const outputRange = Constants.isRTL ? [containerWidth, 0] : [0, containerWidth];
141142
const newProgress = this.progressAnimation.interpolate({
142143
inputRange: [0, 100],
143-
outputRange: [0, containerWidth || 0]
144+
outputRange
144145
});
145146

146147
return (

0 commit comments

Comments
 (0)