@rific/scroll-view 0.6.2 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1072,11 +1072,13 @@ var ScrollViewFooter = ({ children, style }) => {
1072
1072
  const { blur, footerAboveKeyboard, footerHeight, footerFixed, footerOffset, headerHeightShared, pullSearchHeightShared, scrollPosition, setFooterHeight, snapBackFooterShared, tabBarHeight } = (0, import_react13.useContext)(ScrollViewContext);
1073
1073
  const insets = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
1074
1074
  const keyboardHeight = useKeyboardInset();
1075
+ const setFooterHeightRef = (0, import_react13.useRef)(setFooterHeight);
1076
+ setFooterHeightRef.current = setFooterHeight;
1075
1077
  (0, import_react13.useEffect)(
1076
1078
  () => () => {
1077
- setFooterHeight(null);
1079
+ setFooterHeightRef.current(null);
1078
1080
  },
1079
- [setFooterHeight]
1081
+ []
1080
1082
  );
1081
1083
  const handleLayout = ({
1082
1084
  nativeEvent: {
package/dist/index.mjs CHANGED
@@ -1005,7 +1005,7 @@ var ScrollView = memo3(ScrollViewInner);
1005
1005
 
1006
1006
  // src/ScrollViewFooter.tsx
1007
1007
  import { BlurView as BlurView2 } from "@rific/auto-paper";
1008
- import { useContext as useContext10, useEffect as useEffect4 } from "react";
1008
+ import { useContext as useContext10, useEffect as useEffect4, useRef as useRef7 } from "react";
1009
1009
  import { StyleSheet as StyleSheet5, View as View5 } from "react-native";
1010
1010
  import Animated5, { useAnimatedStyle as useAnimatedStyle4 } from "react-native-reanimated";
1011
1011
  import { useSafeAreaInsets as useSafeAreaInsets3 } from "react-native-safe-area-context";
@@ -1014,11 +1014,13 @@ var ScrollViewFooter = ({ children, style }) => {
1014
1014
  const { blur, footerAboveKeyboard, footerHeight, footerFixed, footerOffset, headerHeightShared, pullSearchHeightShared, scrollPosition, setFooterHeight, snapBackFooterShared, tabBarHeight } = useContext10(ScrollViewContext);
1015
1015
  const insets = useSafeAreaInsets3();
1016
1016
  const keyboardHeight = useKeyboardInset();
1017
+ const setFooterHeightRef = useRef7(setFooterHeight);
1018
+ setFooterHeightRef.current = setFooterHeight;
1017
1019
  useEffect4(
1018
1020
  () => () => {
1019
- setFooterHeight(null);
1021
+ setFooterHeightRef.current(null);
1020
1022
  },
1021
- [setFooterHeight]
1023
+ []
1022
1024
  );
1023
1025
  const handleLayout = ({
1024
1026
  nativeEvent: {
@@ -1153,7 +1155,7 @@ var styles7 = StyleSheet6.create({
1153
1155
 
1154
1156
  // src/ScrollViewProvider.tsx
1155
1157
  import { useBlur } from "@rific/auto-paper";
1156
- import { useCallback as useCallback7, useContext as useContext12, useEffect as useEffect5, useMemo as useMemo5, useRef as useRef7, useState as useState5 } from "react";
1158
+ import { useCallback as useCallback7, useContext as useContext12, useEffect as useEffect5, useMemo as useMemo5, useRef as useRef8, useState as useState5 } from "react";
1157
1159
  import { Dimensions as Dimensions3 } from "react-native";
1158
1160
  import { useSharedValue as useSharedValue7 } from "react-native-reanimated";
1159
1161
  import { jsx as jsx10 } from "react/jsx-runtime";
@@ -1169,7 +1171,7 @@ var ScrollViewProvider = ({ blur, children, fixed = false, footerAboveKeyboard =
1169
1171
  const [progressing, setProgressing] = useState5(false);
1170
1172
  const scrollPosition = useSharedValue7(0);
1171
1173
  const listGeneration = useSharedValue7(0);
1172
- const jsListGeneration = useRef7(0);
1174
+ const jsListGeneration = useRef8(0);
1173
1175
  const headerHeightShared = useSharedValue7(0);
1174
1176
  const footerHeightShared = useSharedValue7(0);
1175
1177
  const headerOffset = useSharedValue7(0);
@@ -1240,13 +1242,13 @@ var ScrollViewSettingsProvider = ({ children, onChange, initialValue }) => {
1240
1242
  };
1241
1243
 
1242
1244
  // src/SectionList.tsx
1243
- import { memo as memo4, useCallback as useCallback10, useContext as useContext14, useEffect as useEffect6, useLayoutEffect as useLayoutEffect6, useMemo as useMemo7, useRef as useRef9 } from "react";
1245
+ import { memo as memo4, useCallback as useCallback10, useContext as useContext14, useEffect as useEffect6, useLayoutEffect as useLayoutEffect6, useMemo as useMemo7, useRef as useRef10 } from "react";
1244
1246
  import { Dimensions as Dimensions4, Platform as Platform5, SectionList as RNSectionList, View as View7 } from "react-native";
1245
1247
  import { Gesture as Gesture4, GestureDetector as GestureDetector4 } from "react-native-gesture-handler";
1246
1248
  import Animated7, { runOnUI as runOnUI3, useSharedValue as useSharedValue9 } from "react-native-reanimated";
1247
1249
 
1248
1250
  // src/internal/useStickyHeaders.ts
1249
- import { useCallback as useCallback9, useContext as useContext13, useLayoutEffect as useLayoutEffect5, useRef as useRef8, useState as useState7 } from "react";
1251
+ import { useCallback as useCallback9, useContext as useContext13, useLayoutEffect as useLayoutEffect5, useRef as useRef9, useState as useState7 } from "react";
1250
1252
  import { runOnJS as runOnJS4, useAnimatedReaction as useAnimatedReaction2, useAnimatedStyle as useAnimatedStyle6, useSharedValue as useSharedValue8 } from "react-native-reanimated";
1251
1253
  import { useSafeAreaInsets as useSafeAreaInsets5 } from "react-native-safe-area-context";
1252
1254
  function useStickyHeaders(headerFixed, enabled) {
@@ -1259,8 +1261,8 @@ function useStickyHeaders(headerFixed, enabled) {
1259
1261
  useLayoutEffect5(() => {
1260
1262
  contentIndexShared.value = activeIndex;
1261
1263
  }, [activeIndex, contentIndexShared]);
1262
- const positionsCache = useRef8([]);
1263
- const heightsCache = useRef8([]);
1264
+ const positionsCache = useRef9([]);
1265
+ const heightsCache = useRef9([]);
1264
1266
  useAnimatedReaction2(
1265
1267
  () => {
1266
1268
  if (!enabled) return -1;
@@ -1363,7 +1365,7 @@ function useStickyHeaders(headerFixed, enabled) {
1363
1365
  import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
1364
1366
  var AnimatedSectionList = Animated7.createAnimatedComponent(RNSectionList);
1365
1367
  var SectionListInner = ({ chipProps, chipThreshold, contentContainerStyle: externalContentContainerStyle, initialNumToRender = 20, maxToRenderPerBatch = 50, renderFilters, footerFixed: footerFixedProp, gesture, headerFixed: headerFixedProp, keyboardAware, ListHeaderComponent: externalListHeaderComponent, onChipPress, onMomentumScrollEnd: externalMomentumScrollEnd, onRefresh, onContentSizeChange, onScrollBeginDrag: externalScrollBeginDrag, onScrollEndDrag: externalScrollEndDrag, pullSearchHeight, refreshing, removeClippedSubviews = false, sections, showsVerticalScrollIndicator, style, ref: externalRef, windowSize = 100, ...props }) => {
1366
- const scrollView = useRef9(null);
1368
+ const scrollView = useRef10(null);
1367
1369
  const { stickySectionHeadersEnabled = true, renderSectionHeader, ...passThroughProps } = props;
1368
1370
  const { chipHidden, chipStyle, containerStyle, contentInset, contentOffset, contentPadding, footerFixed, headerFixed, headerHeight } = useScrollList({ footerFixed: footerFixedProp, headerFixed: headerFixedProp, hideUntilMeasured: true, keyboardAware, pullSearchHeight, style });
1369
1371
  const { listGeneration, onListUnmount } = useContext14(ScrollViewContext);
@@ -1384,7 +1386,7 @@ var SectionListInner = ({ chipProps, chipThreshold, contentContainerStyle: exter
1384
1386
  useLayoutEffect6(() => {
1385
1387
  if (usesCustomSticky) resetPositions(sections.length);
1386
1388
  }, [sections, usesCustomSticky, resetPositions, headerHeight]);
1387
- const sectionViewRefs = useRef9(/* @__PURE__ */ new Map());
1389
+ const sectionViewRefs = useRef10(/* @__PURE__ */ new Map());
1388
1390
  const wrappedRenderSectionHeader = useMemo7(() => {
1389
1391
  if (!usesCustomSticky) return renderSectionHeader ?? void 0;
1390
1392
  return (info) => {
@@ -1433,7 +1435,7 @@ var SectionListInner = ({ chipProps, chipThreshold, contentContainerStyle: exter
1433
1435
  renderFilters
1434
1436
  ] });
1435
1437
  }, [pullSearchHeader, renderFilters]);
1436
- const pullSearchSettled = useRef9(false);
1438
+ const pullSearchSettled = useRef10(false);
1437
1439
  useEffect6(() => {
1438
1440
  if (!usesCustomSticky || activeListHeader == null || pullSearchSettled.current) return;
1439
1441
  pullSearchSettled.current = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rific/scroll-view",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "Blur styled scroll system for React Native. Floating headers/footers, keyboard awareness, and scroll-away chrome",
5
5
  "keywords": [
6
6
  "react-native",
@@ -60,7 +60,7 @@
60
60
  },
61
61
  "devDependencies": {
62
62
  "@reduxjs/toolkit": "^2.12.0",
63
- "@rific/auto-paper": "^0.8.0",
63
+ "@rific/auto-paper": "^0.9.2",
64
64
  "@testing-library/dom": "^10.4.1",
65
65
  "@testing-library/react": "^16.3.2",
66
66
  "@types/jest": "^30.0.0",
@@ -93,7 +93,7 @@
93
93
  "typescript-eslint": "^8.59.3"
94
94
  },
95
95
  "peerDependencies": {
96
- "@rific/auto-paper": "^0.8.0",
96
+ "@rific/auto-paper": "^0.9.2",
97
97
  "react": ">=19.0.0",
98
98
  "react-native": ">=0.83.0",
99
99
  "react-native-gesture-handler": ">=2.0.0 <3.0.0",
@@ -1,5 +1,5 @@
1
1
  import { BlurView } from '@rific/auto-paper'
2
- import { type ReactNode, useContext, useEffect } from 'react'
2
+ import { type ReactNode, useContext, useEffect, useRef } from 'react'
3
3
  import { type LayoutChangeEvent, StyleSheet, View, type ViewStyle } from 'react-native'
4
4
  import Animated, { useAnimatedStyle } from 'react-native-reanimated'
5
5
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
@@ -16,11 +16,21 @@ export const ScrollViewFooter = ({ children, style }: ScrollViewFooterProps) =>
16
16
  const { blur, footerAboveKeyboard, footerHeight, footerFixed, footerOffset, headerHeightShared, pullSearchHeightShared, scrollPosition, setFooterHeight, snapBackFooterShared, tabBarHeight } = useContext(ScrollViewContext)
17
17
  const insets = useSafeAreaInsets()
18
18
  const keyboardHeight = useKeyboardInset()
19
+ // setFooterHeight's own identity changes on every real measurement (ScrollViewProvider's
20
+ // useCallback closes over `footerHeight` itself, so setting it recreates the callback). Depending
21
+ // on it directly here re-ran this effect on every measurement too — tearing down the PREVIOUS
22
+ // closure as a "cleanup" and calling ITS setFooterHeight(null) right after the real height had
23
+ // just been set, permanently clobbering it back to null with no further layout event left to
24
+ // recover it (the DOM node's true size never changed, so onLayout never fires again). Reading
25
+ // through a ref sidesteps that: the effect itself only ever runs once, on mount/unmount, so its
26
+ // cleanup fires exactly when it's meant to (a real unmount) rather than after every measurement.
27
+ const setFooterHeightRef = useRef(setFooterHeight)
28
+ setFooterHeightRef.current = setFooterHeight
19
29
  useEffect(
20
30
  () => () => {
21
- setFooterHeight(null)
31
+ setFooterHeightRef.current(null)
22
32
  },
23
- [setFooterHeight]
33
+ []
24
34
  )
25
35
  const handleLayout = ({
26
36
  nativeEvent: {