Top Related Projects
React Native component for creating animated, circular progress with ReactART
Quick Overview
React Native Progress is a library that provides a collection of customizable progress indicators for React Native applications. It offers various types of progress components, including circular progress, bar progress, and pie progress, allowing developers to easily integrate visually appealing loading and progress indicators into their mobile apps.
Pros
- Wide variety of progress indicator types (circular, bar, pie)
- Highly customizable with props for colors, sizes, and animations
- Smooth animations and good performance
- Compatible with both iOS and Android platforms
Cons
- Limited documentation for advanced customization
- Some reported issues with TypeScript definitions
- Occasional rendering inconsistencies across different React Native versions
- Lack of frequent updates and maintenance
Code Examples
- Basic Circle Progress
import * as Progress from 'react-native-progress';
<Progress.Circle size={50} indeterminate={true} />
This code creates a simple indeterminate circular progress indicator.
- Bar Progress with Custom Colors
<Progress.Bar
progress={0.7}
width={200}
color={'#3498db'}
unfilledColor={'#ecf0f1'}
borderWidth={0}
/>
This example shows a progress bar with 70% completion and custom colors.
- Pie Progress with Animation
<Progress.Pie
size={100}
progress={0.4}
animated={true}
animationDuration={1000}
/>
This code creates an animated pie progress indicator that fills to 40% over 1 second.
Getting Started
-
Install the library:
npm install react-native-progress
-
Import and use in your React Native component:
import * as Progress from 'react-native-progress'; function MyComponent() { return ( <View> <Progress.Circle size={30} indeterminate={true} /> <Progress.Bar progress={0.5} width={200} /> </View> ); }
-
Customize the progress indicators using props as needed.
Competitor Comparisons
React Native component for creating animated, circular progress with ReactART
Pros of react-native-circular-progress
- Specialized in circular progress indicators, offering more customization options for this specific type
- Provides additional features like rotation and fill color animation
- Smaller package size, focused on circular progress functionality
Cons of react-native-circular-progress
- Limited to circular progress indicators, less versatile for other progress types
- May require additional libraries for non-circular progress needs
- Less frequently updated compared to react-native-progress
Code Comparison
react-native-circular-progress:
<AnimatedCircularProgress
size={120}
width={15}
fill={75}
tintColor="#00e0ff"
onAnimationComplete={() => console.log('onAnimationComplete')}
backgroundColor="#3d5875"
/>
react-native-progress:
<Progress.Circle
size={120}
progress={0.75}
showsText={true}
color="#00e0ff"
unfilledColor="#3d5875"
/>
Both libraries offer similar functionality for circular progress, but react-native-circular-progress provides more specific customization options. react-native-progress offers a wider range of progress types, making it more versatile for various use cases. The choice between the two depends on the specific requirements of your project and whether you need additional progress types beyond circular indicators.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
react-native-progress
Progress indicators and spinners for React Native using React Native SVG.
Installation
$ npm install react-native-progress --save
React Native SVG based components
To use the Pie
or Circle
components, you need to install React Native SVG in your project.
Usage
Note: If you don't want the React Native SVG based components and it's dependencies, do a deep require instead: import ProgressBar from 'react-native-progress/Bar';
.
import * as Progress from 'react-native-progress';
<Progress.Bar progress={0.3} width={200} />
<Progress.Pie progress={0.4} size={50} />
<Progress.Circle size={30} indeterminate={true} />
<Progress.CircleSnail color={['red', 'green', 'blue']} />
Properties for all progress components
Prop | Description | Default |
---|---|---|
animated | Whether or not to animate changes to progress . | true |
indeterminate | If set to true, the indicator will spin and progress prop will be ignored. | false |
indeterminateAnimationDuration | Sets animation duration in milliseconds when indeterminate is set. | 1000 |
progress | Progress of whatever the indicator is indicating. A number between 0 and 1. | 0 |
color | Fill color of the indicator. | rgba(0, 122, 255, 1) |
unfilledColor | Color of the remaining progress. | None |
borderWidth | Width of outer border, set to 0 to remove. | 1 |
borderColor | Color of outer border. | color |
Progress.Bar
All of the props under Properties in addition to the following:
Prop | Description | Default |
---|---|---|
width | Full width of the progress bar, set to null to use automatic flexbox sizing. | 150 |
height | Height of the progress bar. | 6 |
borderRadius | Rounding of corners, set to 0 to disable. | 4 |
useNativeDriver | Use native driver for the animations. | false |
animationConfig | Config that is passed into the Animated function. | { bounciness: 0 } |
animationType | Animation type to animate the progress, one of: decay , timing , spring . | spring |
Progress.Circle
All of the props under Properties in addition to the following:
Prop | Description | Default |
---|---|---|
size | Diameter of the circle. | 40 |
endAngle | Determines the endAngle of the circle. A number between 0 and 1 . The final endAngle would be the number multiplied by 2Ï | 0.9 |
thickness | Thickness of the inner circle. | 3 |
showsText | Whether or not to show a text representation of current progress. | false |
formatText(progress) | A function returning a string to be displayed for the textual representation. | See source |
textStyle | Styles for progress text, defaults to a same color as circle and fontSize proportional to size prop. | None |
allowFontScaling | Whether or not to respect device font scale setting. | true |
direction | Direction of the circle clockwise or counter-clockwise . | clockwise |
strokeCap | Stroke Cap style for the circle butt , square or round . | butt |
fill | Fill color of the inner circle. | None (transparent) |
Progress.Pie
All of the props under Properties in addition to the following:
Prop | Description | Default |
---|---|---|
size | Diameter of the pie. | 40 |
Progress.CircleSnail
Prop | Description | Default |
---|---|---|
animating | If the circle should animate. | true |
hidesWhenStopped | If the circle should be removed when not animating. | false |
size | Diameter of the circle. | 40 |
color | Color of the circle, use an array of colors for rainbow effect. | rgba(0, 122, 255, 1) |
thickness | Thickness of the circle. | 3 |
duration | Duration of animation. | 1000 |
spinDuration | Duration of spin (orbit) animation. | 5000 |
strokeCap | Stroke Cap style for the circle butt , square or round . | round |
Examples
Changelog
Thanks
To Mandarin Drummond for giving me the NPM name.
License
MIT License. © Joel Arvidsson 2015-
Top Related Projects
React Native component for creating animated, circular progress with ReactART
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot