Skip to content
This repository was archived by the owner on Dec 3, 2024. It is now read-only.

Commit b844914

Browse files
Merge pull request #21 from summerkiflain/master
feat: Added search input text font family option
2 parents a763349 + 6d910c6 commit b844914

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

react-navigation-addon-search-layout.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ declare module 'react-navigation-addon-search-layout' {
2020
/** Color of text that the user enters into the search box **/
2121
textColor?: string;
2222

23+
/** FontFamily of text that the user enters into the search box and for the text shown as cancel button **/
24+
textFontFamily?: string;
25+
2326
/** Underline color of the text input on Android **/
2427
searchInputUnderlineColorAndroid?: string;
2528

src/SearchBar.ios.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ class SearchBar extends React.PureComponent {
109109
if (this.props.textColor) {
110110
searchInputStyle.color = this.props.textColor;
111111
}
112+
if (this.props.textFontFamily) {
113+
searchInputStyle.fontFamily = this.props.textFontFamily;
114+
}
112115

113116
return (
114117
<View style={styles.container}>
@@ -151,6 +154,7 @@ class SearchBar extends React.PureComponent {
151154
style={{
152155
fontSize: 17,
153156
color: this.props.tintColor || '#007AFF',
157+
...(this.props.textFontFamily && { fontFamily: this.props.textFontFamily }),
154158
}}>
155159
{this.props.cancelButtonText || 'Cancel'}
156160
</Text>

src/SearchBar.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ class SearchBar extends React.PureComponent {
1919
if (this.props.textColor) {
2020
searchInputStyle.color = this.props.textColor;
2121
}
22+
if (this.props.textFontFamily) {
23+
searchInputStyle.fontFamily = this.props.textFontFamily;
24+
}
2225

2326
return (
2427
<View style={styles.container}>

src/SearchLayout.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export default class SearchLayout extends React.Component {
4343
onSubmit={this._handleSubmit}
4444
placeholderTextColor={this.props.searchInputPlaceholderTextColor}
4545
textColor={this.props.searchInputTextColor}
46+
textFontFamily={this.props.searchInputTextFontFamily}
4647
selectionColor={this.props.searchInputSelectionColor}
4748
underlineColorAndroid={
4849
this.props.searchInputUnderlineColorAndroid ||

0 commit comments

Comments
 (0)