-
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.
Browse files
Browse the repository at this point in the history
[Feat #23130] Add custom status settings to profile
- Loading branch information
Showing
19 changed files
with
718 additions
and
8 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
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,81 @@ | ||
import React, {useRef, useEffect} from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import {View} from 'react-native'; | ||
import styles from '../../styles/styles'; | ||
import CONST from '../../CONST'; | ||
import * as StyleUtils from '../../styles/StyleUtils'; | ||
import getButtonState from '../../libs/getButtonState'; | ||
import * as Expensicons from '../Icon/Expensicons'; | ||
import Tooltip from '../Tooltip'; | ||
import Text from '../Text'; | ||
import Icon from '../Icon'; | ||
import withLocalize, {withLocalizePropTypes} from '../withLocalize'; | ||
import * as EmojiPickerAction from '../../libs/actions/EmojiPickerAction'; | ||
import PressableWithoutFeedback from '../Pressable/PressableWithoutFeedback'; | ||
|
||
const propTypes = { | ||
/** Flag to disable the emoji picker button */ | ||
isDisabled: PropTypes.bool, | ||
|
||
...withLocalizePropTypes, | ||
}; | ||
|
||
const defaultProps = { | ||
isDisabled: false, | ||
}; | ||
|
||
function EmojiPickerButtonDropdown(props) { | ||
const emojiPopoverAnchor = useRef(null); | ||
useEffect(() => EmojiPickerAction.resetEmojiPopoverAnchor, []); | ||
|
||
const onPress = () => | ||
EmojiPickerAction.showEmojiPicker(props.onModalHide, (emoji) => props.onInputChange(emoji), emojiPopoverAnchor.current, { | ||
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT, | ||
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP, | ||
shiftVertical: 4, | ||
}); | ||
|
||
return ( | ||
<Tooltip text={props.translate('reportActionCompose.emoji')}> | ||
<PressableWithoutFeedback | ||
ref={emojiPopoverAnchor} | ||
style={styles.emojiPickerButtonDropdown} | ||
disabled={props.isDisabled} | ||
onPress={onPress} | ||
nativeID="emojiDropdownButton" | ||
accessibilityLabel="statusEmoji" | ||
accessibilityRole="text" | ||
> | ||
{({hovered, pressed}) => ( | ||
<View style={styles.emojiPickerButtonDropdownContainer}> | ||
<Text | ||
style={styles.emojiPickerButtonDropdownIcon} | ||
numberOfLines={1} | ||
> | ||
{props.value} | ||
</Text> | ||
<View style={[styles.popoverMenuIcon, styles.pointerEventsAuto, props.disabled && styles.cursorDisabled, styles.rotate90]}> | ||
<Icon | ||
src={Expensicons.ArrowRight} | ||
fill={StyleUtils.getIconFillColor(getButtonState(hovered, pressed))} | ||
/> | ||
</View> | ||
</View> | ||
)} | ||
</PressableWithoutFeedback> | ||
</Tooltip> | ||
); | ||
} | ||
|
||
EmojiPickerButtonDropdown.propTypes = propTypes; | ||
EmojiPickerButtonDropdown.defaultProps = defaultProps; | ||
EmojiPickerButtonDropdown.displayName = 'EmojiPickerButtonDropdown'; | ||
export default withLocalize( | ||
React.forwardRef((props, ref) => ( | ||
<EmojiPickerButtonDropdown | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...props} | ||
forwardedRef={ref} | ||
/> | ||
)), | ||
); |
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,92 @@ | ||
import _ from 'underscore'; | ||
import React, {useMemo} from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import {ScrollView, View} from 'react-native'; | ||
import headerWithBackButtonPropTypes from './HeaderWithBackButton/headerWithBackButtonPropTypes'; | ||
import HeaderWithBackButton from './HeaderWithBackButton'; | ||
import ScreenWrapper from './ScreenWrapper'; | ||
import styles from '../styles/styles'; | ||
import themeColors from '../styles/themes/default'; | ||
import * as StyleUtils from '../styles/StyleUtils'; | ||
import useWindowDimensions from '../hooks/useWindowDimensions'; | ||
import FixedFooter from './FixedFooter'; | ||
|
||
const propTypes = { | ||
...headerWithBackButtonPropTypes, | ||
|
||
/** Children to display in the lower half of the page (below the header section w/ an animation) */ | ||
children: PropTypes.node.isRequired, | ||
|
||
/** The background color to apply in the upper half of the screen. */ | ||
backgroundColor: PropTypes.string, | ||
|
||
/** A fixed footer to display at the bottom of the page. */ | ||
footer: PropTypes.node, | ||
}; | ||
|
||
const defaultProps = { | ||
backgroundColor: themeColors.appBG, | ||
footer: null, | ||
}; | ||
|
||
function StaticHeaderPageLayout({backgroundColor, children, image: Image, footer, imageContainerStyle, style, ...propsToPassToHeader}) { | ||
const {windowHeight} = useWindowDimensions(); | ||
|
||
const {titleColor, iconFill} = useMemo(() => { | ||
const isColorfulBackground = backgroundColor !== themeColors.appBG; | ||
return { | ||
titleColor: isColorfulBackground ? themeColors.textColorfulBackground : undefined, | ||
iconFill: isColorfulBackground ? themeColors.iconColorfulBackground : undefined, | ||
}; | ||
}, [backgroundColor]); | ||
|
||
return ( | ||
<ScreenWrapper | ||
style={[StyleUtils.getBackgroundColorStyle(backgroundColor)]} | ||
shouldEnablePickerAvoiding={false} | ||
includeSafeAreaPaddingBottom={false} | ||
offlineIndicatorStyle={[StyleUtils.getBackgroundColorStyle(themeColors.appBG)]} | ||
> | ||
{({safeAreaPaddingBottomStyle}) => ( | ||
<> | ||
<HeaderWithBackButton | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...propsToPassToHeader} | ||
titleColor={titleColor} | ||
iconFill={iconFill} | ||
/> | ||
<View style={[styles.flex1, StyleUtils.getBackgroundColorStyle(themeColors.appBG)]}> | ||
<ScrollView | ||
contentContainerStyle={[safeAreaPaddingBottomStyle, style]} | ||
showsVerticalScrollIndicator={false} | ||
> | ||
<View style={styles.overscrollSpacer(backgroundColor, windowHeight)} /> | ||
<View | ||
style={[ | ||
styles.alignItemsCenter, | ||
styles.justifyContentEnd, | ||
StyleUtils.getBackgroundColorStyle(backgroundColor), | ||
imageContainerStyle, | ||
styles.staticHeaderImage, | ||
]} | ||
> | ||
<Image | ||
pointerEvents="none" | ||
style={styles.staticHeaderImage} | ||
/> | ||
</View> | ||
<View style={styles.pt5}>{children}</View> | ||
</ScrollView> | ||
{!_.isNull(footer) && <FixedFooter>{footer}</FixedFooter>} | ||
</View> | ||
</> | ||
)} | ||
</ScreenWrapper> | ||
); | ||
} | ||
|
||
StaticHeaderPageLayout.propTypes = propTypes; | ||
StaticHeaderPageLayout.defaultProps = defaultProps; | ||
StaticHeaderPageLayout.displayName = 'StaticHeaderPageLayout'; | ||
|
||
export default StaticHeaderPageLayout; |
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
Oops, something went wrong.