question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Progress bar fill width starts somewhere in the middle

See original GitHub issue

Hello, my first question here, I am using the Progress.Bar, but the fill starts somewhere in the middle.

screen shot 2019-01-29 at 11 06 28 am

I have the progress on 0.1, when I set this on 1 the fill is complete.

the code: <ProgressBar color={Colors.bright_red_mct} unfilledColor={Colors.grey_gainsboro} borderWidth={3} height={6} borderColor={Colors.grey_gainsboro} borderRadius={8} progress={0.1} style={{ flex:1 }} />

I guess the problem is the flex, hope you can help me, thanks…

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:12

github_iconTop GitHub Comments

7reactions
ahmadsyamimcommented, Jan 9, 2020

I solved this using

import {Dimensions} from "react-native";
import ProgressBar from "react-native-progress/Bar";
const barWidth = Dimensions.get("screen").width;
<ProgressBar progress={0.1} width={barWidth} height={2} borderRadius={0}/>
1reaction
jozedavidcommented, May 3, 2019

We had to make our own component to achieve what we wanted, here is the code:

`render() { var value = false var valueBalloon = false var infoText = null;

switch (this.props.valueStyle) {
  case 'icon':
    valueIcon = (
      <View style={styles.flexBox}>
        <View style={[{flex:this.state.progress}]}>
          <View style={styles.progressBar__balloon}>
            {this.state.progress > 0 && 
              <Text style={styles.progressBar__balloonVal}>{this.state.progress}%</Text> 
            }
            <Image source={require('assets/marker-truck-icon-progressbar.png')} style={styles.progressIcon} />
          </View>
        </View>
        <View style={[{flex:100 - this.state.progress}]}></View>
      </View>
    )
    break
  default:
    break
}

infoText = (
  <Text>{this.state.text}</Text> 
)

var chart = (
  <View>
    {this.state.text && 
      infoText
    }
    <View style={[styles.flexBox, styles.progressBar]}>
      <View style={[styles.progressBar_left, {flex:this.state.progress}]} />
      <View style={[styles.progressBar_right, {flex:100 - this.state.progress}]}></View>
    </View>
    {valueIcon}
  </View>
)
return chart

}`

result:

Screen Shot 2019-05-03 at 10 22 50 AM

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make CSS steps progress bar use full width of available space
I need to get rid of this extra space, to use all of the available space. How can I achieve this? Instead of...
Read more >
Creating an Animated Progress Bar in React - Medium
The bar's value will start from 0 and when it receives the percent prop, it will update the actual value to be percentage...
Read more >
Building a Progress Bar component using ReactJS & Styled ...
To control the width of the progress bar, we can select the progress bar using the progress[value] selector and assign the width for...
Read more >
Building Progress Bars for the Web with Django and Celery
Progress bars are one of the most common, familiar UI components in our ... It's just a little bar filling up across a...
Read more >
shinybusy: Busy Indicators and Notifications for 'Shiny ...
Description Add indicators (spinner, progress bar, gif) in your 'shiny' ... How to remove the start-up page: "timeout", "auto" or "manual", ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found