Skip to content

Commit

Permalink
fix(exoflex): fix unable to change inner bar height (#159)
Browse files Browse the repository at this point in the history
* style(exoflex): change progress bar styling

* docs(exoflex): update example
  • Loading branch information
nathaniaelvina committed Nov 1, 2019
1 parent de80fdf commit 0352647
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ let styles = StyleSheet.create({
root: {
padding: 16,
backgroundColor: '#eeeeee',
alignItems: 'center',
},
});

Expand Down
19 changes: 10 additions & 9 deletions packages/exoflex/src/components/ProgressBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { StyleSheet, View, Animated } from 'react-native';
import { StyleSheet, View, Animated, ViewStyle } from 'react-native';
import { ProgressBarProps } from 'react-native-paper';
import { useAnimation } from 'react-native-animation-hooks';
import useTheme from '../helpers/useTheme';
Expand All @@ -20,7 +20,9 @@ export default function ProgressBar(props: Props) {
duration: 500,
});

let height = (style && style.height) || 8;
let flattenedStyle = StyleSheet.flatten<ViewStyle>(style) || {};
let height = flattenedStyle.height || 8;
let borderRadius = flattenedStyle.borderRadius || roundness;

if (!visible) {
return <View style={{ height }} />;
Expand All @@ -31,9 +33,10 @@ export default function ProgressBar(props: Props) {
style={[
styles.container,
{
height,
borderRadius,
borderColor: colors.border,
backgroundColor: colors.surface,
borderRadius: roundness,
},
style,
]}
Expand All @@ -42,8 +45,7 @@ export default function ProgressBar(props: Props) {
style={[
styles.bar,
{
height,
borderRadius: roundness,
borderRadius,
backgroundColor: color || colors.primary,
width: animatedValue.interpolate({
inputRange: [0, 1],
Expand All @@ -62,13 +64,12 @@ ProgressBar.defaultProps = {

const styles = StyleSheet.create({
bar: {
justifyContent: 'center',
position: 'absolute',
flex: 1,
},
container: {
height: 8,
justifyContent: 'center',
overflow: 'hidden',
width: '100%',
height: 8,
borderWidth: 1,
},
});

0 comments on commit 0352647

Please sign in to comment.