react-native-onboarding-screens
Version:
Delightful Onboarding for your React-Native App
37 lines (32 loc) • 683 B
JavaScript
import React from 'react';
import { View } from 'react-native';
import PropTypes from 'prop-types';
const Dot = ({ isLight, selected }) => {
let backgroundColor;
if (isLight) {
backgroundColor = selected ? 'rgba(0, 0, 0, 0.8)' : 'rgba(0, 0, 0, 0.3)';
} else {
backgroundColor = selected ? '#fff' : 'rgba(255, 255, 255, 0.5)';
}
return (
<View
style={{
...styles.dot,
backgroundColor,
}}
/>
);
};
Dot.propTypes = {
isLight: PropTypes.bool.isRequired,
selected: PropTypes.bool.isRequired,
};
const styles = {
dot: {
width: 6,
height: 6,
borderRadius: 3,
marginHorizontal: 3,
},
};
export default Dot;