mirror of
https://github.com/zhigang1992/react-native-paper.git
synced 2026-06-12 09:08:12 +08:00
refactor: rename SearchBar -> Searchbar for consistency
This commit is contained in:
@@ -17,7 +17,7 @@ import ProgressBarExample from './ProgressBarExample';
|
||||
import RadioButtonExample from './RadioButtonExample';
|
||||
import RadioButtonGroupExample from './RadioButtonGroupExample';
|
||||
import RippleExample from './RippleExample';
|
||||
import SearchBarExample from './SearchBarExample';
|
||||
import SearchbarExample from './SearchbarExample';
|
||||
import SwitchExample from './SwitchExample';
|
||||
import TextExample from './TextExample';
|
||||
import TextInputExample from './TextInputExample';
|
||||
@@ -43,7 +43,7 @@ export const examples = {
|
||||
radio: RadioButtonExample,
|
||||
radioGroup: RadioButtonGroupExample,
|
||||
ripple: RippleExample,
|
||||
searchbar: SearchBarExample,
|
||||
searchbar: SearchbarExample,
|
||||
switch: SwitchExample,
|
||||
text: TextExample,
|
||||
textInput: TextInputExample,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import * as React from 'react';
|
||||
import { StyleSheet, View } from 'react-native';
|
||||
import { Colors, Caption, SearchBar, withTheme } from 'react-native-paper';
|
||||
import { Colors, Caption, Searchbar, withTheme } from 'react-native-paper';
|
||||
import type { Theme } from 'react-native-paper/types';
|
||||
|
||||
type Props = {
|
||||
@@ -33,20 +33,20 @@ class SearchExample extends React.Component<Props, State> {
|
||||
} = this.props;
|
||||
return (
|
||||
<View style={[styles.container, { backgroundColor: background }]}>
|
||||
<SearchBar
|
||||
<Searchbar
|
||||
placeholder="Search"
|
||||
onChangeText={query => this.setState({ firstQuery: query })}
|
||||
value={this.state.firstQuery}
|
||||
/>
|
||||
<Caption style={styles.caption}>Clickable icon</Caption>
|
||||
<SearchBar
|
||||
<Searchbar
|
||||
placeholder="Search"
|
||||
onChangeText={query => this.setState({ secondQuery: query })}
|
||||
value={this.state.secondQuery}
|
||||
onIconPress={() => this.props.navigation.goBack()}
|
||||
icon="arrow-back"
|
||||
/>
|
||||
<SearchBar
|
||||
<Searchbar
|
||||
placeholder="Search"
|
||||
onChangeText={query => this.setState({ thirdQuery: query })}
|
||||
value={this.state.thirdQuery}
|
||||
@@ -40,16 +40,16 @@ type Props = {
|
||||
};
|
||||
|
||||
/**
|
||||
* SearchBar is a simple input box where users can type search queries.
|
||||
* Searchbar is a simple input box where users can type search queries.
|
||||
*
|
||||
* <div class="screenshots">
|
||||
* <img class="medium" src="screenshots/searchbar.png" />
|
||||
* <img class="medium" src="screenshots/Searchbar.png" />
|
||||
* </div>
|
||||
*
|
||||
* ## Usage
|
||||
* ```js
|
||||
* import React from 'react';
|
||||
* import { SearchBar } from 'react-native-paper';
|
||||
* import { Searchbar } from 'react-native-paper';
|
||||
*
|
||||
* export default class MyComponent extends React.Component {
|
||||
* state = {
|
||||
@@ -59,7 +59,7 @@ type Props = {
|
||||
* render() {
|
||||
* const { firstQuery } = this.state;
|
||||
* return (
|
||||
* <SearchBar
|
||||
* <Searchbar
|
||||
* placeholder="Search"
|
||||
* onChangeText={query => { this.setState({ firstQuery: query }); }}
|
||||
* value={firstQuery}
|
||||
@@ -69,7 +69,7 @@ type Props = {
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
class SearchBar extends React.Component<Props> {
|
||||
class Searchbar extends React.Component<Props> {
|
||||
_handleClearPress = () => {
|
||||
this.clear();
|
||||
this.props.onChangeText && this.props.onChangeText('');
|
||||
@@ -189,4 +189,4 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
});
|
||||
|
||||
export default withTheme(SearchBar);
|
||||
export default withTheme(Searchbar);
|
||||
@@ -35,7 +35,8 @@ export { default as Paper } from './components/Paper';
|
||||
export { default as ProgressBar } from './components/ProgressBar/ProgressBar';
|
||||
export { default as RadioButton } from './components/RadioButton';
|
||||
export { default as RadioButtonGroup } from './components/RadioButtonGroup';
|
||||
export { default as SearchBar } from './components/SearchBar';
|
||||
export { default as Searchbar } from './components/Searchbar';
|
||||
export { default as SearchBar } from './components/Searchbar';
|
||||
export { default as Switch } from './components/Switch';
|
||||
export { default as Toolbar } from './components/Toolbar/Toolbar';
|
||||
export { default as ToolbarAction } from './components/Toolbar/ToolbarAction';
|
||||
|
||||
Reference in New Issue
Block a user