Skip to content

Commit 63e2892

Browse files
committed
add search icon navigation button
1 parent fbcbde3 commit 63e2892

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

modules/navigation-buttons/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export {CloseScreenButton} from './close-screen'
33
export {OpenSettingsButton} from './open-settings'
44
export {FavoriteButton} from './favorite'
55
export {DebugNoticeButton} from './debug'
6+
export {SearchButton} from './search'
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import * as React from 'react'
2+
import {Platform, StyleSheet, Text} from 'react-native'
3+
import Icon from 'react-native-vector-icons/Ionicons'
4+
import {Touchable} from '@frogpond/touchable'
5+
import {useTheme} from '@frogpond/app-theme'
6+
import {commonStyles, rightButtonStyles as styles} from './styles'
7+
8+
type Props = {
9+
onPress: () => void
10+
title?: string
11+
}
12+
13+
export function SearchButton(props: Props): JSX.Element {
14+
let {colors} = useTheme()
15+
16+
return (
17+
<Touchable highlight={false} onPress={props.onPress} style={styles.button}>
18+
{props.title ? (
19+
<Text
20+
style={[
21+
commonStyles.text,
22+
searchStyles.text,
23+
{color: colors.primary},
24+
]}
25+
>
26+
{props.title}
27+
</Text>
28+
) : (
29+
<Icon
30+
name={
31+
Platform.OS === 'ios' ? 'ios-search-outline' : 'md-search-outline'
32+
}
33+
style={styles.icon}
34+
/>
35+
)}
36+
</Touchable>
37+
)
38+
}
39+
40+
const searchStyles = StyleSheet.create({
41+
text: {
42+
...Platform.select({
43+
ios: {
44+
fontWeight: '600',
45+
},
46+
android: {
47+
fontWeight: '400',
48+
},
49+
}),
50+
},
51+
})

0 commit comments

Comments
 (0)