-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Showing
6 changed files
with
151 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import {Pressable, View} from 'react-native'; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import _ from 'underscore'; | ||
import styles from '../styles/styles'; | ||
import * as StyleUtils from '../styles/StyleUtils'; | ||
import getButtonState from '../libs/getButtonState'; | ||
import variables from '../styles/variables'; | ||
import Tooltip from './Tooltip'; | ||
|
||
const propTypes = { | ||
tooltipText: PropTypes.string.isRequired, | ||
onPress: PropTypes.func.isRequired, | ||
children: PropTypes.oneOf([PropTypes.func, PropTypes.node]).isRequired, | ||
isDelayButtonStateComplete: PropTypes.bool, | ||
}; | ||
|
||
const defaultProps = { | ||
isDelayButtonStateComplete: true, | ||
}; | ||
|
||
const BaseMiniContextMenuItem = props => ( | ||
<Tooltip text={props.tooltipText}> | ||
<Pressable | ||
focusable | ||
onPress={props.onPress} | ||
accessibilityLabel={props.tooltipText} | ||
style={ | ||
({hovered, pressed}) => [ | ||
styles.reportActionContextMenuMiniButton, | ||
StyleUtils.getButtonBackgroundColorStyle(getButtonState(hovered, pressed, props.isDelayButtonStateComplete)), | ||
] | ||
} | ||
> | ||
{pressableState => ( | ||
<View style={[StyleUtils.getWidthAndHeightStyle(variables.iconSizeNormal), styles.alignItemsCenter, styles.justifyContentCenter]}> | ||
{_.isFunction(props.children) ? props.children(pressableState) : props.children} | ||
</View> | ||
)} | ||
</Pressable> | ||
</Tooltip> | ||
); | ||
|
||
BaseMiniContextMenuItem.propTypes = propTypes; | ||
BaseMiniContextMenuItem.defaultProps = defaultProps; | ||
BaseMiniContextMenuItem.displayName = 'BaseMiniContextMenuItem'; | ||
export default BaseMiniContextMenuItem; |
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,53 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import _ from 'underscore'; | ||
import PropTypes from 'prop-types'; | ||
import CONST from '../../CONST'; | ||
import styles from '../../styles/styles'; | ||
import Text from '../Text'; | ||
import * as StyleUtils from '../../styles/StyleUtils'; | ||
import BaseMiniContextMenuItem from '../BaseMiniContextMenuItem'; | ||
|
||
const propTypes = { | ||
onEmojiSelected: PropTypes.func.isRequired, | ||
onPressOpenPicker: PropTypes.func, | ||
}; | ||
|
||
const defaultProps = { | ||
onPressOpenPicker: () => {}, | ||
}; | ||
|
||
const MiniQuickEmojiReactions = props => ( | ||
<View style={{ | ||
flexDirection: 'row', | ||
}} | ||
> | ||
{_.map(CONST.QUICK_REACTIONS, reaction => ( | ||
<BaseMiniContextMenuItem | ||
key={reaction.name} | ||
isDelayButtonStateComplete={false} | ||
tooltipText={`:${reaction.name}:`} | ||
onPress={() => props.onEmojiSelected(reaction)} | ||
> | ||
<Text style={[ | ||
styles.emojiReactionText, | ||
StyleUtils.getEmojiReactionTextStyle(1.3), | ||
]} | ||
> | ||
{reaction.code} | ||
</Text> | ||
</BaseMiniContextMenuItem> | ||
))} | ||
{/* <AddReactionBubble */} | ||
{/* iconSizeScale={1.2} */} | ||
{/* sizeScale={EMOJI_BUBBLE_SCALE} */} | ||
{/* onSelectEmoji={props.onEmojiSelected} */} | ||
{/* onPressOpenPicker={props.onPressOpenPicker} */} | ||
{/* /> */} | ||
</View> | ||
); | ||
|
||
MiniQuickEmojiReactions.displayName = 'MiniQuickEmojiReactions'; | ||
MiniQuickEmojiReactions.propTypes = propTypes; | ||
MiniQuickEmojiReactions.defaultProps = defaultProps; | ||
export default MiniQuickEmojiReactions; |
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