-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBookmark.jsx
31 lines (29 loc) · 1.02 KB
/
Bookmark.jsx
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
import React from 'react';
import { TouchableOpacity, StyleSheet, View } from 'react-native';
export default ({ size = 10, color = '#222', ...rest }) => {
const tristyle = { borderRightWidth: size / 2, borderTopWidth: size / 2, borderTopColor: color };
const Component = rest.onPress ? TouchableOpacity : View;
return (
<Component {...rest} style={[styles.container, { height: size + size / 2 }]}>
<View style={{ transform: [{ scale: 0.3 }] }}>
<View style={{ width: size, height: size, backgroundColor: color }} />
<View style={{ flexDirection: 'row' }}>
<View style={[styles.triangleCorner, tristyle]} />
<View style={[styles.triangleCorner, tristyle, { transform: [{ rotate: '90deg' }] }]} />
</View>
</View>
</Component>
);
};
const styles = StyleSheet.create({
triangleCorner: {
width: 0,
height: 0,
backgroundColor: 'transparent',
borderStyle: 'solid',
borderRightColor: 'transparent',
},
container: {
transform: [{ scale: 3 }],
},
});