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 progress starting from center

See original GitHub issue

Progress.Bar is rendering with the progress beginning from near the middle of the bar, then expanding to fill the bar at 100% as demonstrated in this screenshot:

image

Any ideas what’s going on here? I’ve experimented with various styles and Progress.Bar properties and nothing seems to change the behavior.

This is with “react-native”: “0.61.4”, running in the iOS Simulator (iPad 7, OS 13.3)

Here’s a subset of my code that at least demonstrates how I’m using the progress bar in the layout and it’s styling, although this code isn’t functional as I quickly extracted the rest of my non-relevant view code:

import React, { Component } from 'react';
import {
  StyleSheet,
  SafeAreaView,
} from 'react-native';
import { WebView } from 'react-native-webview';
import * as Progress from 'react-native-progress';
import type { WebBrowser } from './WebBrowser';

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  webView: {
    flex: 1,
  },
  progressBar: {
    position: 'absolute',
    flex: 1,
    top: 0,
    height: 6,
    width: '100%',
    borderRadius: 0,
  },
});

/**
 * View for content reading.
 */
export default
class ContentReaderView extends Component<{
  viewModel: ContentReaderViewModel,
}>
  render() {
    const { viewModel } = this.props;
    return (
      <SafeAreaView style={styles.container}>
        <WebView
          style={styles.webView}
        />
        { viewModel.isLoading && (
          <Progress.Bar
            style={styles.progressBar}
            progress={viewModel.loadProgress}
          />
        }
      </SafeAreaView>
    );
  }
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

6reactions
kunalmhatrecommented, Feb 16, 2020

@HolySamosa, can you please try setting width as null instead of handling it via CSS?

<Progress.Bar
    width={null}
    style={styles.progressBar}
    progress={viewModel.loadProgress}
/>

Reference: https://github.com/oblador/react-native-progress#progressbar

For width property:

Full width of the progress bar, set to null to use automatic flexbox sizing.

I hope that solves your problem; if not, please let me know. 😃

2reactions
HolySamosacommented, Mar 3, 2020

Whoops. Somehow I missed the earlier notifications for this thread. @kunalmhatre, I’ll give your suggestion a try. @hardikramoliya, did you have the same issue and did this solve your problem?

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

bootstrap center progressbar on div - Stack Overflow
I'm trying to use a Bootstrap progress ...
Read more >
Progress - Bootstrap
Documentation and examples for using Bootstrap custom progress bars featuring support for stacked bars, animated backgrounds, and text labels.
Read more >
How can i align center progress bar ? | Sololearn
You can wrap the <progress> in a <div> whose 'align' attribute set to "center". copied the code from w3schools.
Read more >
W3.CSS Progress Bars - W3Schools
Add text inside a w3-container element to add a label to the progress bar. Use the w3-center class to center the label. If...
Read more >
The Progress Indicator element - HTML - MDN Web Docs
It must be a valid floating point number between 0 and max , or between 0 and 1 if max is omitted. If...
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