react-native-story-component
Version:
Story component for React Native.
44 lines • 1.12 kB
JavaScript
import React from 'react';
import { Animated, View, StyleSheet } from 'react-native';
import { getStatusBarHeight } from 'react-native-safearea-height';
const AnimationBar = _ref => {
let {
stories,
currStoryIndex,
progress
} = _ref;
return /*#__PURE__*/React.createElement(View, {
style: styles.container
}, stories.map((_, index) => {
return /*#__PURE__*/React.createElement(View, {
key: index,
style: styles.background
}, /*#__PURE__*/React.createElement(Animated.View, {
style: {
flex: currStoryIndex === index ? progress : stories[index].finished ? 1 : 0,
...styles.active
}
}));
}));
};
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
paddingTop: 10,
paddingHorizontal: 10
},
background: {
height: 2,
flex: 1,
flexDirection: 'row',
backgroundColor: 'rgba(117, 117, 117, 0.5)',
marginHorizontal: 2,
marginTop: getStatusBarHeight(true)
},
active: {
height: 2,
backgroundColor: '#FFF'
}
});
export default AnimationBar;
//# sourceMappingURL=AnimationBar.js.map