Skip to content

Commit

Permalink
fix: correct displaying progress bar on Android (#2916)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewalczak authored Oct 20, 2021
1 parent 072e40b commit 452c163
Showing 1 changed file with 51 additions and 49 deletions.
100 changes: 51 additions & 49 deletions src/components/ProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,55 +168,57 @@ const ProgressBar = ({
style,
]}
>
<Animated.View
style={[
styles.progressBar,
{
backgroundColor: tintColor,
width,
transform: [
{
translateX: timer.interpolate(
indeterminate
? {
inputRange: [0, 0.5, 1],
outputRange: [
(isRTL ? 1 : -1) * 0.5 * width,
(isRTL ? 1 : -1) *
0.5 *
INDETERMINATE_MAX_WIDTH *
width,
(isRTL ? -1 : 1) * 0.7 * width,
],
}
: {
inputRange: [0, 1],
outputRange: [(isRTL ? 1 : -1) * 0.5 * width, 0],
}
),
},
{
// Workaround for workaround for https://github.com/facebook/react-native/issues/6278
scaleX: timer.interpolate(
indeterminate
? {
inputRange: [0, 0.5, 1],
outputRange: [
0.0001,
INDETERMINATE_MAX_WIDTH,
0.0001,
],
}
: {
inputRange: [0, 1],
outputRange: [0.0001, 1],
}
),
},
],
},
]}
/>
{width ? (
<Animated.View
style={[
styles.progressBar,
{
width,
backgroundColor: tintColor,
transform: [
{
translateX: timer.interpolate(
indeterminate
? {
inputRange: [0, 0.5, 1],
outputRange: [
(isRTL ? 1 : -1) * 0.5 * width,
(isRTL ? 1 : -1) *
0.5 *
INDETERMINATE_MAX_WIDTH *
width,
(isRTL ? -1 : 1) * 0.7 * width,
],
}
: {
inputRange: [0, 1],
outputRange: [(isRTL ? 1 : -1) * 0.5 * width, 0],
}
),
},
{
// Workaround for workaround for https://github.com/facebook/react-native/issues/6278
scaleX: timer.interpolate(
indeterminate
? {
inputRange: [0, 0.5, 1],
outputRange: [
0.0001,
INDETERMINATE_MAX_WIDTH,
0.0001,
],
}
: {
inputRange: [0, 1],
outputRange: [0.0001, 1],
}
),
},
],
},
]}
/>
) : null}
</Animated.View>
</View>
);
Expand Down

0 comments on commit 452c163

Please sign in to comment.