Skip to content

Instantly share code, notes, and snippets.

@akinolu52
Created October 28, 2021 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akinolu52/825117c3abb25e5b6f6bfc65983a4dd6 to your computer and use it in GitHub Desktop.
Save akinolu52/825117c3abb25e5b6f6bfc65983a4dd6 to your computer and use it in GitHub Desktop.
import styled from 'styled-components/native';
const ProgressBar = ({progress, height = 8, outerBackgroundColor, innerBackgroundColor, padded = true}) => (
<Container
height={height}
padded={padded}
outerBackgroundColor={outerBackgroundColor}
 >
<Content 
height={height}
padded={padded}
progress={progress} 
innerBackgroundColor={innerBackgroundColor}
/>
 </Container>
);
const Container = styled.View`
width: "100%";
borderRadius: 16;
alignItems: flex-start;
justifyContent: center;
height: ${props => props.height};
backgroundColor: ${props => props.outerBackgroundColor};
paddingHorizontal: ${props => props.padded ? 3 : 0};
`;
const Content = styled.View`
borderRadius: 16;
height: ${props => props.padded ? (props.height / 2) : props.height};
backgroundColor: ${props => props.innerBackgroundColor};
width: ${props => props.progress}%;
`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment