Repository navigation
perf: wrap FAB popover content in Activity to deprioritize hidden updates #86866
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
Changes from all commits
c368fe2
ad3bf2d
b60a645
c851447
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 |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import React, {useState} from 'react'; | ||
| import type {RefObject} from 'react'; | ||
| import React, {Activity, useState} from 'react'; | ||
| import type {ActivityProps, RefObject} from 'react'; | ||
| import {View} from 'react-native'; | ||
| import FocusTrapForModal from '@components/FocusTrap/FocusTrapForModal'; | ||
| import PopoverWithMeasuredContent from '@components/PopoverWithMeasuredContent'; | ||
|
|
@@ -40,6 +40,7 @@ function FABPopoverMenu({isVisible, onClose, onItemSelected, anchorRef, animatio | |
| const {shouldUseNarrowLayout} = useResponsiveLayout(); | ||
| const {windowHeight} = useWindowDimensions(); | ||
| const anchorPosition = styles.createMenuPositionSidebar(windowHeight); | ||
| const [contentActivityMode, setContentActivityMode] = useState<ActivityProps['mode']>(isVisible ? 'visible' : 'hidden'); | ||
|
|
||
| const [registeredSet, setRegisteredSet] = useState<ReadonlySet<string>>(new Set()); | ||
|
|
||
|
|
@@ -112,6 +113,8 @@ function FABPopoverMenu({isVisible, onClose, onItemSelected, anchorRef, animatio | |
| }} | ||
| onClose={handleClose} | ||
| isVisible={isVisible} | ||
| onModalWillShow={() => setContentActivityMode('visible')} | ||
| onModalHide={() => setContentActivityMode('hidden')} | ||
| fromSidebarMediumScreen={!shouldUseNarrowLayout} | ||
| animationIn="fadeIn" | ||
| animationOut="fadeOut" | ||
|
|
@@ -125,9 +128,11 @@ function FABPopoverMenu({isVisible, onClose, onItemSelected, anchorRef, animatio | |
| active={isVisible} | ||
| shouldReturnFocus | ||
| > | ||
| <View style={shouldUseNarrowLayout ? styles.flexGrow1 : [styles.createMenuContainer, styles.pv0, styles.flex1]}> | ||
| <View style={styles.pv4}>{children}</View> | ||
| </View> | ||
| <Activity mode={contentActivityMode}> | ||
|
Contributor
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. We're not using
Contributor
Author
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.
correct. |
||
| <View style={shouldUseNarrowLayout ? styles.flexGrow1 : [styles.createMenuContainer, styles.pv0, styles.flex1]}> | ||
| <View style={styles.pv4}>{children}</View> | ||
| </View> | ||
| </Activity> | ||
| </FocusTrapForModal> | ||
| </PopoverWithMeasuredContent> | ||
| </FABMenuContext.Provider> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.