react-native-resource-calendar 1.0.15 → 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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React19 from 'react';
2
- import React19__default, { createContext, useState, useEffect, useMemo, useContext, useRef, useCallback } from 'react';
2
+ import React19__default, { createContext, useState, useEffect, useRef, useMemo, useContext, useCallback } from 'react';
3
3
  import { Gesture, GestureDetector } from 'react-native-gesture-handler';
4
4
  import Animated2, { useSharedValue, useAnimatedRef, runOnJS, withSpring, useFrameCallback, scrollTo, useAnimatedScrollHandler, useAnimatedStyle, useAnimatedProps } from 'react-native-reanimated';
5
5
  import { InteractionManager, View, StyleSheet, Text, TouchableOpacity, TextInput, useWindowDimensions, Platform, Dimensions, Image } from 'react-native';
@@ -355,18 +355,22 @@ var TimeLabels = React19.forwardRef(({
355
355
  const intervalId = setInterval(update, 300);
356
356
  return () => clearInterval(intervalId);
357
357
  }, [timezone]);
358
+ const lastScrolledDateRef = useRef(null);
358
359
  useEffect(() => {
360
+ if (!layout) return;
361
+ const dateKey = date.getTime();
362
+ if (lastScrolledDateRef.current === dateKey) return;
359
363
  InteractionManager.runAfterInteractions(() => {
360
364
  let pos = isToday ? currentTimeYPosition - 240 : timeToYPosition(startMinutes, hourHeight);
361
365
  if (ref.current) {
362
366
  ref.current.scrollTo({
363
367
  y: Math.round(pos / APPOINTMENT_BLOCK_HEIGHT) * APPOINTMENT_BLOCK_HEIGHT,
364
- // Offset by 240px to give a little margin above the red line
365
368
  animated: true
366
369
  });
370
+ lastScrolledDateRef.current = dateKey;
367
371
  }
368
372
  });
369
- }, [date, isToday, APPOINTMENT_BLOCK_HEIGHT, startMinutes, hourHeight]);
373
+ }, [layout, date, isToday, APPOINTMENT_BLOCK_HEIGHT, startMinutes, hourHeight, currentTimeYPosition]);
370
374
  return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(Col_default, null, Array.from({ length: 24 }).map((_, index) => /* @__PURE__ */ React19.createElement(View, { key: index, style: [styles.timeLabel, { height: hourHeight }] }, /* @__PURE__ */ React19.createElement(
371
375
  Text,
372
376
  {
@@ -1025,14 +1029,14 @@ var EventBlock = React19__default.memo(({
1025
1029
  editable: false,
1026
1030
  allowFontScaling: false,
1027
1031
  underlineColorAndroid: "transparent",
1028
- style: {
1032
+ style: [{
1029
1033
  width: "100%",
1030
1034
  fontFamily: timeFace,
1031
1035
  fontSize: getTextSize(hourHeight),
1032
1036
  pointerEvents: "none",
1033
1037
  padding: 0,
1034
1038
  margin: 0
1035
- },
1039
+ }, resolved?.time],
1036
1040
  defaultValue: `${start} - ${end}`
1037
1041
  }
1038
1042
  ), Body ? /* @__PURE__ */ React19__default.createElement(Body, { event, ctx: { hourHeight } }) : /* @__PURE__ */ React19__default.createElement(React19__default.Fragment, null, /* @__PURE__ */ React19__default.createElement(Row_default, { style: { alignItems: "center", height: 18 } }, /* @__PURE__ */ React19__default.createElement(
@@ -1144,14 +1148,14 @@ var DraggableEvent = ({
1144
1148
  editable: false,
1145
1149
  allowFontScaling: false,
1146
1150
  underlineColorAndroid: "transparent",
1147
- style: {
1151
+ style: [{
1148
1152
  width: "100%",
1149
1153
  fontFamily: timeFace,
1150
1154
  fontSize: getTextSize(hourHeight),
1151
1155
  pointerEvents: "none",
1152
1156
  padding: 0,
1153
1157
  margin: 0
1154
- },
1158
+ }, resolved?.time],
1155
1159
  defaultValue: initialDisplayTime,
1156
1160
  animatedProps: animatedTimeProps
1157
1161
  }