-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from software-mansion-labs/ideal-nav-merge-sea…
…rch-bar Ideal nav merge search bar
- Loading branch information
Showing
20 changed files
with
218 additions
and
92 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -100,4 +100,5 @@ function Icon({ | |
|
||
Icon.displayName = 'Icon'; | ||
|
||
export type {IconProps}; | ||
export default Icon; |
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,30 @@ | ||
import React from 'react'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import CONST from '@src/CONST'; | ||
import * as Expensicons from './Icon/Expensicons'; | ||
import {PressableWithFeedback} from './Pressable'; | ||
import SubscriptAvatar from './SubscriptAvatar'; | ||
|
||
function WorkspaceSwitcherButton() { | ||
const {translate} = useLocalize(); | ||
|
||
return ( | ||
<PressableWithFeedback | ||
accessibilityRole={CONST.ROLE.BUTTON} | ||
accessibilityLabel={translate('common.workspaces')} | ||
accessible | ||
onPress={() => {}} | ||
> | ||
<SubscriptAvatar | ||
mainAvatar={{source: Expensicons.ExpensifyAppIcon, name: 'Expensify', type: CONST.ICON_TYPE_AVATAR}} | ||
subscriptIcon={{source: Expensicons.DownArrow, width: 8, height: 8}} | ||
showTooltip={false} | ||
noMargin | ||
/> | ||
</PressableWithFeedback> | ||
); | ||
} | ||
|
||
WorkspaceSwitcherButton.displayName = 'WorkspaceSwitcherButton'; | ||
|
||
export default WorkspaceSwitcherButton; |
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
61 changes: 61 additions & 0 deletions
61
src/libs/Navigation/AppNavigator/createCustomBottomTabNavigator/TopBar.js
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,61 @@ | ||
import PropTypes from 'prop-types'; | ||
import React, {useCallback} from 'react'; | ||
import {View} from 'react-native'; | ||
import * as Expensicons from '@components/Icon/Expensicons'; | ||
import PressableWithFeedback from '@components/Pressable/PressableWithFeedback'; | ||
import Search from '@components/Search'; | ||
import SubscriptAvatar from '@components/SubscriptAvatar'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import Navigation from '@libs/Navigation/Navigation'; | ||
import SignInOrAvatarWithOptionalStatus from '@pages/home/sidebar/SignInOrAvatarWithOptionalStatus'; | ||
import * as Session from '@userActions/Session'; | ||
import CONST from '@src/CONST'; | ||
import ROUTES from '@src/ROUTES'; | ||
|
||
// TODO-IDEAL: isCreateMenuOpen wasn't used before | ||
function TopBar({isCreateMenuOpen = false}) { | ||
const styles = useThemeStyles(); | ||
const {translate} = useLocalize(); | ||
|
||
const showSearchPage = useCallback(() => { | ||
if (isCreateMenuOpen) { | ||
// Prevent opening Search page when click Search icon quickly after clicking FAB icon | ||
return; | ||
} | ||
|
||
Navigation.navigate(ROUTES.SEARCH); | ||
}, [isCreateMenuOpen]); | ||
|
||
return ( | ||
<View | ||
style={[styles.gap6, styles.flexRow, styles.ph5, styles.pv3, styles.justifyContentBetween, styles.alignItemsCenter]} | ||
dataSet={{dragArea: true}} | ||
> | ||
<PressableWithFeedback role={CONST.ROLE.BUTTON}> | ||
<SubscriptAvatar | ||
mainAvatar={{source: Expensicons.ExpensifyAppIcon, name: 'Expensify', type: CONST.ICON_TYPE_AVATAR}} | ||
subscriptIcon={{source: Expensicons.DownArrow, width: 8, height: 8}} | ||
showTooltip={false} | ||
noMargin | ||
/> | ||
</PressableWithFeedback> | ||
<Search | ||
placeholder={translate('sidebarScreen.buttonSearch')} | ||
onPress={Session.checkIfActionIsAllowed(showSearchPage)} | ||
style={{flex: 1}} | ||
/> | ||
<SignInOrAvatarWithOptionalStatus isCreateMenuOpen={isCreateMenuOpen} /> | ||
</View> | ||
); | ||
} | ||
|
||
TopBar.displayName = 'TopBar'; | ||
TopBar.propTypes = { | ||
isCreateMenuOpen: PropTypes.bool, | ||
}; | ||
TopBar.defaultProps = { | ||
isCreateMenuOpen: false, | ||
}; | ||
|
||
export default TopBar; |
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
Oops, something went wrong.