1 | import * as React from 'react';
|
2 | import { StyleSheet, StyleProp, TextStyle } from 'react-native';
|
3 | import color from 'color';
|
4 | import Text from '../Typography/Text';
|
5 | import { withTheme } from '../../core/theming';
|
6 |
|
7 | type Props = React.ComponentProps<typeof Text> & {
|
8 | |
9 |
|
10 |
|
11 | theme: ReactNativePaper.Theme;
|
12 | |
13 |
|
14 |
|
15 | style?: StyleProp<TextStyle>;
|
16 | };
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | const ListSubheader = ({ style, theme, ...rest }: Props) => {
|
32 | const { colors, fonts } = theme;
|
33 | const font = fonts.medium;
|
34 | const textColor = color(colors.text).alpha(0.54).rgb().string();
|
35 |
|
36 | return (
|
37 | <Text
|
38 | numberOfLines={1}
|
39 | {...rest}
|
40 | style={[styles.container, { color: textColor, ...font }, style]}
|
41 | />
|
42 | );
|
43 | };
|
44 |
|
45 | ListSubheader.displayName = 'List.Subheader';
|
46 |
|
47 | const styles = StyleSheet.create({
|
48 | container: {
|
49 | paddingHorizontal: 16,
|
50 | paddingVertical: 13,
|
51 | },
|
52 | });
|
53 |
|
54 | export default withTheme(ListSubheader);
|