-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
04998db
commit fe62b20
Showing
23 changed files
with
203 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* App lib | ||
*/ | ||
|
||
export * from '@/lib/locales' | ||
export * from '@/lib/types' | ||
export * from '@/lib/ui' | ||
export * from '@/lib/utils' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ const Locales = new I18n({ | |
|
||
Locales.enableFallback = true | ||
|
||
export default Locales | ||
export { Locales } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { Colors } from '@/lib/ui' | ||
import { Colors } from '@/lib' | ||
|
||
type Color = keyof typeof Colors.light | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,71 @@ | ||
import { DrawerHeaderProps as BaseProps } from '@react-navigation/drawer' | ||
import { getHeaderTitle } from '@react-navigation/elements' | ||
import { router } from 'expo-router' | ||
import React from 'react' | ||
import { | ||
Appbar, | ||
AppbarProps, | ||
IconButton, | ||
Searchbar, | ||
SearchbarProps, | ||
Tooltip, | ||
} from 'react-native-paper' | ||
|
||
interface DrawerHeaderProps extends AppbarProps { | ||
navProps: BaseProps | ||
withSearchBar?: boolean | ||
searchBarProps?: SearchbarProps | ||
} | ||
|
||
const DrawerHeader = (props: DrawerHeaderProps) => ( | ||
<Appbar.Header {...props}> | ||
{props.withSearchBar ? ( | ||
const DrawerHeader = (props: DrawerHeaderProps) => { | ||
const [query, setQuery] = React.useState('') | ||
|
||
return props.withSearchBar ? ( | ||
<Appbar.Header {...props}> | ||
<Searchbar | ||
value="" | ||
{...props.searchBarProps} | ||
icon="menu" | ||
onPress={() => router.push('/search')} | ||
placeholder="Search Al-Quran" | ||
value={query} | ||
onChangeText={setQuery} | ||
style={{ margin: 8, marginBottom: 16 }} | ||
onIconPress={() => props.navProps.navigation.openDrawer()} | ||
right={(props) => ( | ||
<IconButton | ||
{...props} | ||
icon="cog" | ||
onPress={() => router.push('/settings')} | ||
/> | ||
right={(p) => ( | ||
<Tooltip title="Perform search"> | ||
<IconButton | ||
{...p} | ||
icon="book-search" | ||
onPress={() => | ||
props.searchBarProps?.onChangeText | ||
? props.searchBarProps.onChangeText(query) | ||
: undefined | ||
} | ||
/> | ||
</Tooltip> | ||
)} | ||
/> | ||
) : ( | ||
<> | ||
<Tooltip title="Open drawer"> | ||
<Appbar.Action | ||
icon="menu" | ||
onPress={() => props.navProps.navigation.openDrawer()} | ||
/> | ||
</Tooltip> | ||
|
||
<Appbar.Content | ||
title={getHeaderTitle( | ||
props.navProps.options, | ||
props.navProps.route.name, | ||
)} | ||
</Appbar.Header> | ||
) : ( | ||
<Appbar.Header {...props}> | ||
<Tooltip title="Open drawer"> | ||
<Appbar.Action | ||
icon="menu" | ||
onPress={() => props.navProps.navigation.openDrawer()} | ||
/> | ||
</Tooltip> | ||
|
||
<Appbar.Content | ||
title={getHeaderTitle( | ||
props.navProps.options, | ||
props.navProps.route.name, | ||
)} | ||
/> | ||
|
||
{props.navProps.options.headerRight | ||
? props.navProps.options.headerRight({ | ||
canGoBack: props.navProps.navigation.canGoBack(), | ||
}) | ||
: undefined} | ||
</> | ||
)} | ||
</Appbar.Header> | ||
) | ||
{props.navProps.options.headerRight | ||
? props.navProps.options.headerRight({ | ||
canGoBack: props.navProps.navigation.canGoBack(), | ||
}) | ||
: undefined} | ||
</Appbar.Header> | ||
) | ||
} | ||
|
||
export default DrawerHeader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.