Skip to content

Conversation

@koplyarov
Copy link
Contributor

Overview

This pull request adds an invalidate() call to RNCMaskedView.onDescendantInvalidated

This addresses the following issue: sometimes, the MaskedView would display a stale content even though React re-render happened in one of the children

Details

As far as I understand, the issue was happening because in RNCMaskedView.dispatchDraw we would render the content of the masked view into an off-screen buffer (link) before the children would have been re-drawn (link), and later the offscreen buffer would be used by the hardware rendering even though it contains a stale snapshot of the children.

A simple solution is to invalidate the masked view whenever a child is invalidated. This causes an additional draw() call to be scheduled for the parent view, and it gets handled at the point where the children have been already updated.

Pros: It's simple and it works. 🙂
Cons: It triggers an additional draw where we basically re-render all children into the off-screen buffer. Though it seems that it was being redrawn even more often before #98, so I guess it's acceptable. 🤷‍♂️

Test Plan

Video: https://youtu.be/4XI00oGdgQ0
Before the change: Sometimes, the MaskedView would display a stale content even though React re-render happened in one of the children
After the change: Now the MaskedView displays the updated children correctly

@FonDorn
Copy link
Collaborator

FonDorn commented Dec 10, 2023

Hey @Naturalclar. Can you merge these changes and make a new version?

Copy link
Contributor

@Naturalclar Naturalclar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Naturalclar Naturalclar merged commit acaf238 into callstack:master Dec 11, 2023
@Naturalclar
Copy link
Contributor

Released v0.3.1 🚀

renovate bot referenced this pull request in valora-inc/wallet Dec 14, 2023
… ^0.3.1 (#4636)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[@react-native-masked-view/masked-view](https://togithub.com/react-native-masked-view/masked-view)
| [`^0.3.0` ->
`^0.3.1`](https://renovatebot.com/diffs/npm/@react-native-masked-view%2fmasked-view/0.3.0/0.3.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@react-native-masked-view%2fmasked-view/0.3.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@react-native-masked-view%2fmasked-view/0.3.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@react-native-masked-view%2fmasked-view/0.3.0/0.3.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@react-native-masked-view%2fmasked-view/0.3.0/0.3.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>react-native-masked-view/masked-view
(@&#8203;react-native-masked-view/masked-view)</summary>

###
[`v0.3.1`](https://togithub.com/react-native-masked-view/masked-view/releases/tag/v0.3.1)

[Compare
Source](https://togithub.com/react-native-masked-view/masked-view/compare/v0.3.0...v0.3.1)

#### What's Changed

- Calling invalidate in RNCMaskedView by
[@&#8203;koplyarov](https://togithub.com/koplyarov) in
[https://github.com/react-native-masked-view/masked-view/pull/214](https://togithub.com/react-native-masked-view/masked-view/pull/214)

#### New Contributors

- [@&#8203;koplyarov](https://togithub.com/koplyarov) made their first
contribution in
[https://github.com/react-native-masked-view/masked-view/pull/214](https://togithub.com/react-native-masked-view/masked-view/pull/214)

**Full Changelog**:
callstack/masked-view@v0.3.0...v0.3.1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone
America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone
America/Los_Angeles.

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/valora-inc/wallet).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44Ny4yIiwidXBkYXRlZEluVmVyIjoiMzcuODcuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: valora-bot <[email protected]>
@retyui
Copy link

retyui commented Apr 3, 2024

@koplyarov thx for fixing it !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants