react-native-resource-calendar 1.0.16 → 1.0.18

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
@@ -216,11 +216,11 @@ var minutesToTime = (totalMinutes) => {
216
216
  return `${hours12}:${paddedMins}`;
217
217
  };
218
218
  function computeStackedEventLayout(events, containerWidthPx, {
219
- indentPx = 12,
219
+ indentPx = 6,
220
220
  // how much to nudge each overlap to the right
221
221
  rightPadPx = 0,
222
222
  // visual breathing room on the right
223
- minWidthPx = 30,
223
+ minWidthPx = 25,
224
224
  // never let an event become thinner than this
225
225
  capIndentLevels = 4
226
226
  // after N levels, stop indenting (just stack via z-index)
@@ -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
  {
@@ -1014,7 +1018,7 @@ var EventBlock = React19__namespace.default.memo(({
1014
1018
  left: frame.leftPx + 1,
1015
1019
  width: frame.widthPx - 3,
1016
1020
  zIndex: frame.zIndex,
1017
- opacity: selectedAppointment ? 0.5 : 1,
1021
+ opacity: selectedAppointment || disabled ? 0.5 : 1,
1018
1022
  borderWidth: selected ? 2 : 1,
1019
1023
  borderColor: selected ? "#4d959c" : "rgba(0,0,0,0.12)"
1020
1024
  };
@@ -1037,14 +1041,6 @@ var EventBlock = React19__namespace.default.memo(({
1037
1041
  onLongPress && onLongPress(event);
1038
1042
  }
1039
1043
  },
1040
- /* @__PURE__ */ React19__namespace.default.createElement(Hidden_default, { isHidden: !disabled }, /* @__PURE__ */ React19__namespace.default.createElement(reactNative.View, { style: {
1041
- position: "absolute",
1042
- top: 0,
1043
- width: "150%",
1044
- height: "150%",
1045
- zIndex: 1,
1046
- backgroundColor: "rgba(255, 255, 255, 0.5)"
1047
- } })),
1048
1044
  /* @__PURE__ */ React19__namespace.default.createElement(Col_default, { style: [{ position: "relative" }, resolved?.content] }, /* @__PURE__ */ React19__namespace.default.createElement(
1049
1045
  reactNative.TextInput,
1050
1046
  {