Skip to content

Commit f80c8c5

Browse files
improve hex keyboard
1 parent 6f06201 commit f80c8c5

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

components/HexKeyboard.js

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const HexKeyboard = ({ onKeyPress }) => {
77
['4', '5', '6', '7'],
88
['8', '9', 'A', 'B'],
99
['C', 'D', 'E', 'F'],
10-
['del', 'clear', 'copy', 'paste']
1110
];
11+
const specialKeys = ['del', 'clear', 'copy', 'paste'];
1212

1313
return (
1414
<View style={styles.keyboard}>
@@ -21,19 +21,33 @@ const HexKeyboard = ({ onKeyPress }) => {
2121
))}
2222
</View>
2323
))}
24+
<View style={styles.specialRow}>
25+
{specialKeys.map((key) => (
26+
<TouchableOpacity key={key} style={[styles.key, styles.specialKey]} onPress={() => onKeyPress(key)}>
27+
<Text style={styles.specialKeyText}>{key}</Text>
28+
</TouchableOpacity>
29+
))}
30+
</View>
2431
</View>
2532
);
2633
};
2734

2835
const styles = StyleSheet.create({
2936
keyboard: {
30-
paddingHorizontal: 16,
31-
paddingVertical: 8
37+
paddingHorizontal: 8,
38+
paddingVertical: 8,
39+
width: '100%',
40+
alignSelf: 'center',
3241
},
3342
row: {
3443
flexDirection: 'row',
3544
justifyContent: 'space-between',
36-
marginBottom: 8
45+
marginBottom: 8,
46+
},
47+
specialRow: {
48+
flexDirection: 'row',
49+
justifyContent: 'space-between',
50+
marginBottom: 0,
3751
},
3852
key: {
3953
flex: 1,
@@ -44,12 +58,23 @@ const styles = StyleSheet.create({
4458
borderWidth: 1,
4559
borderColor: 'gray',
4660
borderRadius: 8,
47-
marginHorizontal: 4
61+
marginHorizontal: 2,
62+
minWidth: 0,
4863
},
4964
keyText: {
5065
fontSize: 24,
51-
fontWeight: 'bold'
52-
}
66+
fontWeight: 'bold',
67+
},
68+
specialKey: {
69+
backgroundColor: '#f0f0f0',
70+
borderColor: '#888',
71+
height: 40,
72+
},
73+
specialKeyText: {
74+
fontSize: 16,
75+
fontWeight: '600',
76+
color: '#333',
77+
},
5378
});
5479

5580
export default HexKeyboard;

0 commit comments

Comments
 (0)