Skip to content

Commit 4a5d2ba

Browse files
committed
Better names for variables
1 parent ff588df commit 4a5d2ba

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/components/CollapsibleHeaderOnKeyboard/index.native.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ function CollapsibleHeaderOnKeyboard({children, collapsibleHeaderOffset = 0}: Co
7070
const prevKeyboardProgress = previous?.keyboardProgress ?? 0;
7171
const naturalHeightValue = naturalHeight.get();
7272

73+
const isKeyboardFullyClosed = keyboardProgress < 0.01;
7374
// Keyboard fully closed — restore header (guard avoids redundant withTiming calls
7475
// during the first few frames of keyboard opening when keyboardProgress is still < 0.01).
75-
if (keyboardProgress < 0.01) {
76+
if (isKeyboardFullyClosed) {
7677
if (animatedHeight.get() < naturalHeightValue) {
7778
animatedHeight.set(withTiming(naturalHeightValue, {duration: RESTORE_DURATION}));
7879
}
@@ -87,10 +88,10 @@ function CollapsibleHeaderOnKeyboard({children, collapsibleHeaderOffset = 0}: Co
8788
}
8889

8990
// Only act at the two transition points described above, not on every intermediate frame.
90-
const keyboardJustStartedOpening = prevKeyboardProgress < 0.01;
91-
const keyboardJustFullyOpened = keyboardProgress > 0.99 && prevKeyboardProgress <= 0.99;
91+
const isKeyboardStartingOpening = prevKeyboardProgress < 0.01;
92+
const isKeyboardFullyOpened = keyboardProgress > 0.99 && prevKeyboardProgress <= 0.99;
9293

93-
if (!keyboardJustStartedOpening && !keyboardJustFullyOpened) {
94+
if (!isKeyboardStartingOpening && !isKeyboardFullyOpened) {
9495
return;
9596
}
9697

0 commit comments

Comments
 (0)