feat: added percent visiblity callback#45
Merged
Merged
Conversation
Owner
JairajJangle
commented
Aug 26, 2025
- feat: added percent visiblity callback
- Add isMountedRef to track component lifecycle - Check mounted state before calling setRectDimensions in measure callback - Prevent React warnings about state updates on unmounted components
- Add measurement state tracking with enum (IDLE, MEASURING, MEASURED) - Prevent concurrent measure() calls from overlapping - Fix incorrect visibility reports during fast scrolling in lists - Ensure only one measurement executes at a time per component
- Use useWindowDimensions hook to track viewport changes - Reset measurement state when dimensions change to force remeasurement - Fixes visibility calculations after device rotation or split-view changes
- Add immediate measurement on component mount to report initial visibility - Convert measureInnerView to useCallback to prevent unnecessary re-renders
…-inview into beta
# [1.4.0-beta.1](v1.3.22...v1.4.0-beta.1) (2025-08-23) ### Bug Fixes * add window dimension change listener to handle orientation changes ([5f640db](5f640db)) * handle initial visibility state and improve measurement timing ([f5e4de7](f5e4de7)) * prevent race conditions during rapid mount/unmount cycles ([de6cb59](de6cb59)) * prevent state updates on unmounted components ([6c9786a](6c9786a)) ### Features * added percent visiblity callback requested in [#44](#44) ([e78fa27](e78fa27)) ### Performance Improvements * conserved percent calc. if view is not visible - [#44](#44) ([81d0036](81d0036))
…-inview into beta
# [1.4.0-beta.2](v1.4.0-beta.1...v1.4.0-beta.2) (2025-08-23) ### Bug Fixes * added missing state dependencies in visiblity calculations ([af0161c](af0161c))
…-inview into beta
…st percent is already 0
# [1.4.0-beta.3](v1.4.0-beta.2...v1.4.0-beta.3) (2025-08-26) ### Bug Fixes * **perf:** reduced unnecessary onPercentChange callback calls when last percent is already 0 ([39e8aa8](39e8aa8))
|
🎉 This PR is included in version 1.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.