@@ -194,6 +194,42 @@ const ProgressBar = ({
194194 const trackTintColor = theme . isV3
195195 ? theme . colors . surfaceVariant
196196 : setColor ( tintColor ) . alpha ( 0.38 ) . rgb ( ) . string ( ) ;
197+ const progressBarStyle = indeterminate
198+ ? {
199+ width,
200+ backgroundColor : tintColor ,
201+ transform : [
202+ {
203+ translateX : timer . interpolate ( {
204+ inputRange : [ 0 , 0.5 , 1 ] ,
205+ outputRange : [
206+ ( isRTL ? 1 : - 1 ) * 0.5 * width ,
207+ ( isRTL ? 1 : - 1 ) * 0.5 * INDETERMINATE_MAX_WIDTH * width ,
208+ ( isRTL ? - 1 : 1 ) * 0.7 * width ,
209+ ] ,
210+ } ) ,
211+ } ,
212+ {
213+ // Workaround for workaround for https://github.com/facebook/react-native/issues/6278
214+ scaleX : timer . interpolate ( {
215+ inputRange : [ 0 , 0.5 , 1 ] ,
216+ outputRange : [ 0.0001 , INDETERMINATE_MAX_WIDTH , 0.0001 ] ,
217+ } ) ,
218+ } ,
219+ ] ,
220+ }
221+ : {
222+ width,
223+ backgroundColor : tintColor ,
224+ transform : [
225+ {
226+ translateX : timer . interpolate ( {
227+ inputRange : [ 0 , 1 ] ,
228+ outputRange : [ ( isRTL ? 1 : - 1 ) * width , 0 ] ,
229+ } ) ,
230+ } ,
231+ ] ,
232+ } ;
197233
198234 return (
199235 < View
@@ -220,54 +256,7 @@ const ProgressBar = ({
220256 { width ? (
221257 < Animated . View
222258 testID = { `${ testID } -fill` }
223- style = { [
224- styles . progressBar ,
225- {
226- width,
227- backgroundColor : tintColor ,
228- transform : [
229- {
230- translateX : timer . interpolate (
231- indeterminate
232- ? {
233- inputRange : [ 0 , 0.5 , 1 ] ,
234- outputRange : [
235- ( isRTL ? 1 : - 1 ) * 0.5 * width ,
236- ( isRTL ? 1 : - 1 ) *
237- 0.5 *
238- INDETERMINATE_MAX_WIDTH *
239- width ,
240- ( isRTL ? - 1 : 1 ) * 0.7 * width ,
241- ] ,
242- }
243- : {
244- inputRange : [ 0 , 1 ] ,
245- outputRange : [ ( isRTL ? 1 : - 1 ) * 0.5 * width , 0 ] ,
246- }
247- ) ,
248- } ,
249- {
250- // Workaround for workaround for https://github.com/facebook/react-native/issues/6278
251- scaleX : timer . interpolate (
252- indeterminate
253- ? {
254- inputRange : [ 0 , 0.5 , 1 ] ,
255- outputRange : [
256- 0.0001 ,
257- INDETERMINATE_MAX_WIDTH ,
258- 0.0001 ,
259- ] ,
260- }
261- : {
262- inputRange : [ 0 , 1 ] ,
263- outputRange : [ 0.0001 , 1 ] ,
264- }
265- ) ,
266- } ,
267- ] ,
268- } ,
269- fillStyle ,
270- ] }
259+ style = { [ styles . progressBar , progressBarStyle , fillStyle ] }
271260 />
272261 ) : null }
273262 </ Animated . View >
0 commit comments