Repository navigation
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe PR updates CSS easing, transition playback, and duration-scaling documentation. It also renames a private easing lookup helper. Runtime behavior and public declarations remain unchanged. ChangesCSS animation updates
Estimated code review effort: 1 (Trivial) | ~3 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
dd83fb4 to
98b66be
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@packages/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/css/CSSEasing.kt`:
- Line 26: Rename the Kotlin helper firstSmallerOrEqual and its corresponding
C++ helper to lastIndexAtOrBefore, updating all declarations and call sites
while preserving the existing returned-index behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: ee65557b-4a73-4e92-a702-bbefc65df96a
📒 Files selected for processing (1)
packages/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/css/CSSEasing.kt
| * x values resolves to its last entry rather than an arbitrary one. | ||
| */ | ||
| private fun lastIndexAtOrBefore( | ||
| private fun firstSmallerOrEqual( |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
fd -i '^algorithms\.cpp$' packages/react-native-reanimated -x \
rg -n -C 12 '\b(firstSmallerOrEqual|lastIndexAtOrBefore)\b' {}Repository: software-mansion/react-native-reanimated
Length of output: 534
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- Kotlin helper and call sites ---'
rg -n -C 14 '\b(firstSmallerOrEqual|lastIndexAtOrBefore)\b' \
packages/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/css/CSSEasing.kt
printf '%s\n' '--- C++ declaration and related references ---'
rg -n -C 8 '\bfirstSmallerOrEqual\b|\blastIndexAtOrBefore\b' \
packages/react-native-reanimated/common/cpp \
packages/react-native-reanimated/android \
packages/react-native-reanimated/ios 2>/dev/null || true
printf '%s\n' '--- Documentation describing the helper ---'
rg -n -i -C 5 'smaller|upper.?bound|binary search|easing' \
packages/react-native-reanimated/common/cpp \
packages/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/css \
2>/dev/null | head -240Repository: software-mansion/react-native-reanimated
Length of output: 21098
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- all matching declarations and uses ---'
rg -n -C 6 '\bfirstSmallerOrEqual\b|\blastIndexAtOrBefore\b' packages/react-native-reanimated || true
printf '%s\n' '--- algorithm files ---'
fd -i 'algorithms\.(h|cpp)$' packages/react-native-reanimated -x sh -c '
echo "### $1"
cat -n "$1"
' sh {}
printf '%s\n' '--- point-array construction and interpolation inputs ---'
rg -n -C 8 'pointsX|easingPointsX|LinearStopsInterpolator|StepsInterpolator|linear\(' \
packages/react-native-reanimated/common \
packages/react-native-reanimated/android/src/main/java \
2>/dev/null | head -300Repository: software-mansion/react-native-reanimated
Length of output: 23814
🏁 Script executed:
python3 - <<'PY'
from bisect import bisect_right
def kotlin_equivalent(x, points):
low, high = 0, len(points)
while low < high:
mid = (low + high) >> 1
if points[mid] <= x:
low = mid + 1
else:
high = mid
return 0 if low == 0 else low - 1
cases = [
([-1.0, 0.0, 0.5, 1.0], -2.0),
([-1.0, 0.0, 0.5, 1.0], -1.0),
([-1.0, 0.0, 0.5, 1.0], 0.5),
([-1.0, 0.0, 0.5, 1.0], 2.0),
([0.0, 0.5, 0.5, 1.0], 0.5),
]
for points, x in cases:
actual = kotlin_equivalent(x, points)
expected_upper_bound = bisect_right(points, x) - 1
expected_with_fallback = max(0, expected_upper_bound)
print({
"points": points,
"x": x,
"returned": actual,
"last_index_at_or_before": expected_upper_bound,
"implementation_with_below-first-fallback": expected_with_fallback,
})
assert actual == expected_with_fallback
PYRepository: software-mansion/react-native-reanimated
Length of output: 860
Rename the helper to match its returned index.
For x >= pointsX[0], firstSmallerOrEqual returns the last index at or before x, including the last duplicate. Rename the Kotlin and C++ helpers to lastIndexAtOrBefore.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@packages/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/css/CSSEasing.kt`
at line 26, Rename the Kotlin helper firstSmallerOrEqual and its corresponding
C++ helper to lastIndexAtOrBefore, updating all declarations and call sites
while preserving the existing returned-index behavior.
Every start waiting for its View to mount posted its own Choreographer callback each frame. Waiting starts now share a single callback that walks them and reschedules only while any remain. Keying them by transition also removes the start tokens: a newer start for a key replaces the pending entry, so a superseded request cannot begin.
Drops comments that restate the code and shortens those carrying a second sentence the first already implied. The Kotlin binary search is renamed to firstSmallerOrEqual so it and its C++ counterpart turn up in the same grep, which the comment pointing across languages was doing instead. Kept the notes that would otherwise be re-derived: the easing type mirroring PlatformEasing::Type, resolveView throwing rather than returning null, and overrideDurationScale being @hide.
e3de810 to
73aee14
Compare
98b66be to
cd745da
Compare
73aee14 to
05c9697
Compare
Drops comments that restate the code and shortens those carrying a second sentence the first already implied.
The Kotlin binary search in
CSSEasingis renamed fromlastIndexAtOrBeforetofirstSmallerOrEqual, matching its C++ counterpart inCSS/utils/algorithms.cpp, so both turn up in one grep. That is what the comment pointing across languages was there for. They cannot share a file -ObjectAnimatorcallsTimeInterpolator.getInterpolationfrom Java every frame, so the curve has to be evaluated Java-side rather than over JNI.Kept the notes that would otherwise be re-derived: the easing type mirroring
PlatformEasing::Type,resolveViewthrowing rather than returning null, andoverrideDurationScalebeing@hide.