40 lines
664 B
TypeScript
40 lines
664 B
TypeScript
|
|
/**
|
||
|
|
* Divider 分割线组件
|
||
|
|
* 用于分隔内容
|
||
|
|
*/
|
||
|
|
|
||
|
|
import React from 'react';
|
||
|
|
import { View, StyleSheet, ViewStyle } from 'react-native';
|
||
|
|
import { colors, spacing } from '../../theme';
|
||
|
|
|
||
|
|
interface DividerProps {
|
||
|
|
margin?: number;
|
||
|
|
color?: string;
|
||
|
|
style?: ViewStyle;
|
||
|
|
}
|
||
|
|
|
||
|
|
const Divider: React.FC<DividerProps> = ({
|
||
|
|
margin = spacing.lg,
|
||
|
|
color = colors.divider,
|
||
|
|
style,
|
||
|
|
}) => {
|
||
|
|
return (
|
||
|
|
<View
|
||
|
|
style={[
|
||
|
|
styles.divider,
|
||
|
|
{ marginVertical: margin, backgroundColor: color },
|
||
|
|
style,
|
||
|
|
]}
|
||
|
|
/>
|
||
|
|
);
|
||
|
|
};
|
||
|
|
|
||
|
|
const styles = StyleSheet.create({
|
||
|
|
divider: {
|
||
|
|
height: 1,
|
||
|
|
width: '100%',
|
||
|
|
},
|
||
|
|
});
|
||
|
|
|
||
|
|
export default Divider;
|