fix: preview is displayed cutted off when adding expense#78971
fix: preview is displayed cutted off when adding expense#78971srikarparsi merged 8 commits intoExpensify:mainfrom
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@abzokhattab Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
just found that @linhvovan29546 raised an upstream PR facebook/react-native#54871 for an issue that is similar to this one... @linhvovan29546 can you please let us know if it will also fix the current issue? |
|
I did a quick review and I don't think it's the same issue |
|
@abzokhattab It seems I can't reproduce this bug on the main branch. Could you please check it again? |
There was a problem hiding this comment.
More of a design improvement. No product review required.
|
@abzokhattab i updated this PR to use the new solution. Could you please check again? |
|
@daledah The mweb-ios video you provided doesn't follow the test steps ... when I tried it locally, it appears that the bugs still exists Screen.Recording.2026-02-28.at.02.35.16.mov
|
|
The root cause i found was that the original I found this solution to be working ... but can you please check it in all platforms and see if it causes any regressions or performance issues ... if you have other solutions we can also discuss them const prevTransactionCountForScroll = useRef(carouselTransactions.length);
const [carouselKey, setCarouselKey] = useState(0);
useEffect(() => {
if (carouselTransactions.length > 0 && prevTransactionCountForScroll.current === 0) {
setCurrentIndex(0);
setOptimisticIndex(undefined);
setCarouselKey((prev) => prev + 1);
}
prevTransactionCountForScroll.current = carouselTransactions.length;
}, [carouselTransactions.length]); |
|
thanks @abzokhattab, i tested well and updated. Please check again |
| // undefined makes arrow buttons react on currentIndex changes when scrolling manually | ||
| const [optimisticIndex, setOptimisticIndex] = useState<number | undefined>(undefined); | ||
| const carouselRef = useRef<FlashListRef<Transaction> | null>(null); | ||
| const prevTransactionCountForScroll = useRef(carouselTransactions.length); |
There was a problem hiding this comment.
i see we have this ref prevCarouselTransactionLength that does the same ... can it be used instead?
There was a problem hiding this comment.
@abzokhattab i think they serve different purposes. prevCarouselTransactionLength starts at 0 and updates in the cleanup of its effect, while prevTransactionCountForScroll starts at carouselTransactions.length and updates at the end of its effect.
|
@daledah can you please remerge from main .. i see afailing eslint check lets tackle it if its still not fixed after the merge ... i see the fix is simple |
|
@abzokhattab all looks good now |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-02-28.at.02.01.59.movAndroid: mWeb ChromeScreen.Recording.2026-02-28.at.03.03.07.moviOS: HybridAppScreen.Recording.2026-02-28.at.02.05.42.moviOS: mWeb SafariScreen.Recording.2026-02-28.at.02.54.22.movMacOS: Chrome / SafariScreen.Recording.2026-02-28.at.03.04.36.mov |
|
🚧 @srikarparsi has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/srikarparsi in version: 9.3.36-0 🚀
|
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.3.36-10 🚀
|

Explanation of Change
Fixed Issues
$ #78603
PROPOSAL: #78603 (comment)
Tests
Prerequisite: Account has at least one workspace.
Offline tests
Same as tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
a.mov
Android: mWeb Chrome
android.mov
iOS: Native
ios.mov
iOS: mWeb Safari
ios.mov
MacOS: Chrome / Safari
web.mov