forked from yoonzm/react-native-alphabet-flat-list
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSectionListItem.js
51 lines (49 loc) · 1.05 KB
/
SectionListItem.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* Created by JetBrains WebStorm.
* Author: yoon
* Date: 19-1-8
* Time: 下午4:55
* Desc: 滚动列表字母项
*/
import React from 'react';
import PropTypes from 'prop-types';
import { View, Text } from 'react-native';
export function SectionListItem({ title, height, active = false }) {
return (
<View
style={{
height,
width: 30,
justifyContent: 'center',
alignItems: 'center'
}}
>
<View
style={{
width: 18,
height: 18,
borderRadius: 9,
backgroundColor: active ? '#0ea8ff' : 'transparent',
justifyContent: 'center',
alignItems: 'center'
}}
>
<Text
style={{
fontSize: 11,
color: active ? 'white' : '#333',
textAlign: 'center',
fontWeight: 'bold'
}}
>
{title}
</Text>
</View>
</View>
);
}
SectionListItem.propTypes = {
title: PropTypes.string,
height: PropTypes.number,
active: PropTypes.bool
};