react-native-resource-calendar 1.0.16 → 1.0.17
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 +6 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -381,18 +381,22 @@ var TimeLabels = React19__namespace.forwardRef(({
|
|
|
381
381
|
const intervalId = setInterval(update, 300);
|
|
382
382
|
return () => clearInterval(intervalId);
|
|
383
383
|
}, [timezone]);
|
|
384
|
+
const lastScrolledDateRef = React19.useRef(null);
|
|
384
385
|
React19.useEffect(() => {
|
|
386
|
+
if (!layout) return;
|
|
387
|
+
const dateKey = date.getTime();
|
|
388
|
+
if (lastScrolledDateRef.current === dateKey) return;
|
|
385
389
|
reactNative.InteractionManager.runAfterInteractions(() => {
|
|
386
390
|
let pos = isToday ? currentTimeYPosition - 240 : timeToYPosition(startMinutes, hourHeight);
|
|
387
391
|
if (ref.current) {
|
|
388
392
|
ref.current.scrollTo({
|
|
389
393
|
y: Math.round(pos / APPOINTMENT_BLOCK_HEIGHT) * APPOINTMENT_BLOCK_HEIGHT,
|
|
390
|
-
// Offset by 240px to give a little margin above the red line
|
|
391
394
|
animated: true
|
|
392
395
|
});
|
|
396
|
+
lastScrolledDateRef.current = dateKey;
|
|
393
397
|
}
|
|
394
398
|
});
|
|
395
|
-
}, [date, isToday, APPOINTMENT_BLOCK_HEIGHT, startMinutes, hourHeight]);
|
|
399
|
+
}, [layout, date, isToday, APPOINTMENT_BLOCK_HEIGHT, startMinutes, hourHeight, currentTimeYPosition]);
|
|
396
400
|
return /* @__PURE__ */ React19__namespace.createElement(React19__namespace.Fragment, null, /* @__PURE__ */ React19__namespace.createElement(Col_default, null, Array.from({ length: 24 }).map((_, index) => /* @__PURE__ */ React19__namespace.createElement(reactNative.View, { key: index, style: [styles.timeLabel, { height: hourHeight }] }, /* @__PURE__ */ React19__namespace.createElement(
|
|
397
401
|
reactNative.Text,
|
|
398
402
|
{
|