mirror of
https://github.com/SrIzan10/featheroom.git
synced 2026-06-06 00:56:49 +00:00
40 lines
908 B
TypeScript
40 lines
908 B
TypeScript
import React from 'react'
|
|
import { Searchbar, Surface } from 'react-native-paper'
|
|
|
|
import Locales from '@/lib/locales'
|
|
import { ScreenInfo, styles } from '@/lib/ui'
|
|
|
|
const Search = () => {
|
|
const [query, setQuery] = React.useState('')
|
|
const [loading, setLoading] = React.useState(false)
|
|
|
|
// Search logic
|
|
React.useEffect(() => {
|
|
if (query !== '') {
|
|
setLoading(true)
|
|
}
|
|
|
|
setTimeout(() => {
|
|
setLoading(false)
|
|
}, 1000)
|
|
}, [query])
|
|
|
|
return (
|
|
<Surface style={{ flex: 1, gap: 16 }}>
|
|
<Searchbar
|
|
value={query}
|
|
loading={loading}
|
|
onChangeText={(v) => setQuery(v)}
|
|
placeholder="Type here to search..."
|
|
style={{ marginTop: 16, marginHorizontal: 16 }}
|
|
/>
|
|
|
|
<Surface style={styles.screen}>
|
|
<ScreenInfo title={Locales.t('search')} path="app/search.tsx" />
|
|
</Surface>
|
|
</Surface>
|
|
)
|
|
}
|
|
|
|
export default Search
|