xref: /MusicFree/src/components/base/divider.tsx (revision 410a159129b1f6a7a1f44fde7bfad9a46f91e161)
1import React from 'react';
2import {StyleProp, StyleSheet, View, ViewStyle} from 'react-native';
3import useColors from '@/hooks/useColors';
4
5interface IDividerProps {
6    vertical?: boolean;
7    style?: StyleProp<ViewStyle>;
8}
9export default function Divider(props: IDividerProps) {
10    const {vertical, style} = props;
11    const colors = useColors();
12
13    return (
14        <View
15            style={[
16                vertical ? css.dividerVertical : css.divider,
17                {
18                    backgroundColor: colors.divider ?? '#999999',
19                },
20                style,
21            ]}
22        />
23    );
24}
25
26const css = StyleSheet.create({
27    divider: {
28        width: '100%',
29        height: 1,
30    },
31    dividerVertical: {
32        height: '100%',
33        width: 1,
34    },
35});
36