diff --git a/src/components/SelectionList/BaseSelectionList.js b/src/components/SelectionList/BaseSelectionList.js index 213c55e8d8b9..88c4018f823c 100644 --- a/src/components/SelectionList/BaseSelectionList.js +++ b/src/components/SelectionList/BaseSelectionList.js @@ -76,8 +76,7 @@ function BaseSelectionList({ const activeElement = useActiveElement(); const isFocused = useIsFocused(); const [maxToRenderPerBatch, setMaxToRenderPerBatch] = useState(shouldUseDynamicMaxToRenderPerBatch ? 0 : CONST.MAX_TO_RENDER_PER_BATCH.DEFAULT); - const [isInitialRender, setIsInitialRender] = useState(true); - const wrapperStyles = useMemo(() => ({opacity: isInitialRender ? 0 : 1}), [isInitialRender]); + const [isInitialSectionListRender, setIsInitialSectionListRender] = useState(true); /** * Iterates through the sections and items inside each section, and builds 3 arrays along the way: @@ -331,13 +330,13 @@ function BaseSelectionList({ setMaxToRenderPerBatch((Math.ceil(listHeight / itemHeight) || 0) + CONST.MAX_TO_RENDER_PER_BATCH.DEFAULT); } - if (!isInitialRender) { + if (!isInitialSectionListRender) { return; } scrollToIndex(focusedIndex, false); - setIsInitialRender(false); + setIsInitialSectionListRender(false); }, - [focusedIndex, isInitialRender, scrollToIndex, shouldUseDynamicMaxToRenderPerBatch], + [focusedIndex, isInitialSectionListRender, scrollToIndex, shouldUseDynamicMaxToRenderPerBatch], ); const updateAndScrollToFocusedIndex = useCallback( @@ -365,7 +364,7 @@ function BaseSelectionList({ useEffect(() => { // do not change focus on the first render, as it should focus on the selected item - if (isInitialRender) { + if (isInitialSectionListRender) { return; } @@ -401,7 +400,7 @@ function BaseSelectionList({ {/* */} {({safeAreaPaddingBottomStyle}) => ( - + {shouldShowTextInput && ( {children}