-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add popovers without overlay #19011
Add popovers without overlay #19011
Changes from 15 commits
2eda49d
6c39e70
2e69592
9fca908
5d48e5b
41226e3
3b6871f
872ad78
4288309
2010c6f
39457e7
11ca1bd
d5330f5
d023e16
138dfcf
2a9c74b
256bb31
06282c3
653f295
41ab963
cd9b7d3
be09f48
f8b9e31
53e2de6
07628c6
e15c660
cb1daff
9a1fd90
1c3bfaa
289e030
ed9fb14
3546860
4a7abaf
c538b02
f033a3e
8655c02
28d8f5a
c526124
bf2120b
58ea8a0
7efadff
362f5d5
75f5ab4
d866919
eaacce0
37da8c4
1c2502d
5cc78c8
d71eff1
80af7e8
5c23bf5
c494ff4
24045e4
ffc460e
d9c9191
d35b4d8
41ba45b
27fcc40
edcc556
74f8e0d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,9 @@ const propTypes = { | |
/** List of betas available to current user */ | ||
betas: PropTypes.arrayOf(PropTypes.string), | ||
|
||
/** Popover anchor ref */ | ||
anchorRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Replaced all instances that I could find. |
||
|
||
...withLocalizePropTypes, | ||
}; | ||
|
||
|
@@ -36,13 +39,15 @@ const defaultProps = { | |
payPalMeData: {}, | ||
shouldShowPaypal: true, | ||
betas: [], | ||
anchorRef: () => {}, | ||
}; | ||
|
||
const AddPaymentMethodMenu = (props) => ( | ||
<PopoverMenu | ||
isVisible={props.isVisible} | ||
onClose={props.onClose} | ||
anchorPosition={props.anchorPosition} | ||
anchorRef={props.anchorRef} | ||
onItemSelected={() => props.onClose()} | ||
menuItems={[ | ||
{ | ||
|
@@ -71,6 +76,7 @@ const AddPaymentMethodMenu = (props) => ( | |
] | ||
: []), | ||
]} | ||
withoutOverlay | ||
/> | ||
); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,6 +99,7 @@ class AvatarWithImagePicker extends React.Component { | |
imageUri: '', | ||
imageType: '', | ||
}; | ||
this.anchorRef = React.createRef(); | ||
} | ||
|
||
componentDidMount() { | ||
|
@@ -256,7 +257,16 @@ class AvatarWithImagePicker extends React.Component { | |
|
||
return ( | ||
<View style={[styles.alignItemsCenter, ...additionalStyles]}> | ||
<Pressable onPress={() => this.setState({isMenuVisible: true})}> | ||
<Pressable | ||
ref={this.anchorRef} | ||
onPress={(e) => { | ||
if (e.nativeEvent.anchorRef && e.nativeEvent.anchorRef.current === this.anchorRef.current) { | ||
return; | ||
} | ||
|
||
this.setState((prev) => ({isMenuVisible: !prev.isMenuVisible})); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's this change for? Screen.Recording.2023-06-05.at.3.32.52.PM.mov |
||
}} | ||
> | ||
<View style={[styles.pRelative, styles.avatarLarge]}> | ||
<Tooltip text={this.props.translate('avatarWithImagePicker.editImage')}> | ||
{this.props.source ? ( | ||
|
@@ -294,6 +304,8 @@ class AvatarWithImagePicker extends React.Component { | |
onItemSelected={() => this.setState({isMenuVisible: false})} | ||
menuItems={this.createMenuItems(openPicker)} | ||
anchorPosition={this.props.anchorPosition} | ||
withoutOverlay | ||
anchorRef={this.anchorRef} | ||
/> | ||
</> | ||
)} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why line removed? unnecessary change