MCPcopy Create free account
hub / github.com/callstack/react-native-paper / SearchExample

Function SearchExample

example/src/Examples/SearchbarExample.tsx:21–239  ·  view source on GitHub ↗
({ navigation }: Props)

Source from the content-addressed store, hash-verified

19};
20
21const SearchExample = ({ navigation }: Props) => {
22 const [isVisible, setIsVisible] = React.useState(false);
23 const [searchQueries, setSearchQuery] = React.useState({
24 searchBarMode: '',
25 traileringIcon: '',
26 traileringIconWithRightItem: '',
27 rightItem: '',
28 loadingBarMode: '',
29 searchViewMode: '',
30 searchWithoutBottomLine: '',
31 loadingViewMode: '',
32 clickableBack: '',
33 clickableDrawer: '',
34 clickableLoading: '',
35 });
36
37 const { isV3, colors } = useExampleTheme();
38
39 return (
40 <>
41 <ScreenWrapper>
42 {!isV3 && (
43 <Searchbar
44 placeholder="Search"
45 onChangeText={(query) =>
46 setSearchQuery({ ...searchQueries, searchBarMode: query })
47 }
48 value={searchQueries.searchBarMode}
49 style={styles.searchbar}
50 />
51 )}
52 {isV3 && (
53 <List.Section title="Bar mode">
54 <Searchbar
55 placeholder="Search"
56 onChangeText={(query) =>
57 setSearchQuery({ ...searchQueries, searchBarMode: query })
58 }
59 value={searchQueries.searchBarMode}
60 style={styles.searchbar}
61 mode="bar"
62 />
63 <Searchbar
64 placeholder="Trailering icon"
65 onChangeText={(query) =>
66 setSearchQuery({ ...searchQueries, traileringIcon: query })
67 }
68 value={searchQueries.traileringIcon}
69 traileringIcon={'microphone'}
70 traileringIconColor={
71 isVisible ? MD3Colors.error40 : colors.onSurfaceVariant
72 }
73 traileringIconAccessibilityLabel={'microphone button'}
74 onTraileringIconPress={() => setIsVisible(true)}
75 style={styles.searchbar}
76 mode="bar"
77 />
78 <Searchbar

Callers

nothing calls this directly

Calls 1

useExampleThemeFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…