Skip to content

Commit 7421de1

Browse files
authored
fix: [IOAPPX-500] IOScrollView interpolated opacity check of NaN values (#7094)
## Short description This PR refactors the `opacityTransition` logic in the `IOScrollView` component to improve robustness and handle edge cases where the interpolated opacity could result in `NaN`. (Thanks @shadowsheep1) Without this fix, opening the IO app via the `ioit://main/wallet` deeplink can cause a crash. ## List of changes proposed in this pull request * Updated the `opacityTransition` to explicitly check if `interpolatedOpacity` is `NaN` and default to `0` in such cases, ensuring the opacity value is always valid. ## How to test Ensure that opening the app via the `ioit://main/wallet` deeplink does not cause the app to crash. ## Preview |Before|After| |-|-| |<video src="https://github.com/user-attachments/assets/0077ad95-0356-4906-acec-05e70718a98a" />|<video src="https://github.com/user-attachments/assets/107c01b4-0b50-463b-a622-2359f2a27417" />
1 parent 679395a commit 7421de1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ts/components/ui/IOScrollView.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,9 @@ export const IOScrollView = ({
230230
const scrollPercentage = scrollPosition / maxScrollHeight;
231231

232232
scrollPositionAbsolute.value = scrollPosition;
233-
scrollPositionPercentage.value = scrollPercentage;
233+
scrollPositionPercentage.value = Number.isNaN(scrollPercentage)
234+
? 0
235+
: scrollPercentage;
234236
}
235237
);
236238

0 commit comments

Comments
 (0)