umhan35/react-native-search-bar
关于
适用于 React Native 的高质量 iOS 原生搜索栏。
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文React Native Search Bar
The high-quality native search bar for react native.
Getting Started
This is a native library. It does not work with expo or create-react-native-app.
Installation
# npm
npm install react-native-search-bar --save
# yarn
yarn add react-native-search-bar
Pods
If using CocoaPods or React Native version >= 0.60.0
cd ios && pod install && cd ..
Linking
For React Native <= 0.59 only
react-native link react-native-search-bar
If linking fails, follow the manual linking steps
Usage
import SearchBar from 'react-native-search-bar';
<SearchBar
ref="searchBar"
placeholder="Search"
onChangeText={...}
onSearchButtonPress={...}
onCancelButtonPress={...}
/>
Managing the keyboard
- Show -
this.refs.searchBar.focus(); - Hide
this.refs.searchBar.blur();- uses the iOSendEditing:truemethod on the underlyingUISearchBarview.this.refs.searchBar.unFocus();- callsresignFirstResponderon theUITextFieldused by theUISearchBar.
Examples
- Show the keyboard when the view loads:
componentDidMount() {
this.refs.searchBar.focus();
}
- Hide the keyboard when the user searches:
...
onSearchButtonPress={this.refs.searchBar.unFocus}
...
For a full list of props check out the typescript definitions file.
There is also an example project in the example directory.
Contribution
For now, only some of the features of UISearchBar are implemented.
Feel free to send a pull request to the next branch. To get started, you can read the "Native UI Components (iOS)" guide on the React Native website.
Along with code contribution, you are welcomed to answer questions asked in the Issues.
License
MIT
探索相关项目
加载中…