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/README.md CHANGED
@@ -102,7 +102,6 @@ export default function App() {
102
102
  const {event, from, to, resourceId, date} = draft;
103
103
 
104
104
  return prev.map((res: any) => {
105
- // ✅ if this is the new target resource
106
105
  if (res.id === resourceId) {
107
106
  // was the event originally in a different resource?
108
107
  const wasDifferentResource = event.resourceId !== resourceId;
@@ -126,7 +125,6 @@ export default function App() {
126
125
  };
127
126
  }
128
127
 
129
- // ✅ if this is the old resource and event moved away
130
128
  if (res.id === event.resourceId && event.resourceId !== resourceId) {
131
129
  return {
132
130
  ...res,
@@ -134,7 +132,6 @@ export default function App() {
134
132
  };
135
133
  }
136
134
 
137
- // ✅ untouched resources
138
135
  return res;
139
136
  });
140
137
  });
@@ -144,7 +141,7 @@ export default function App() {
144
141
 
145
142
  const eventStyleOverrides = (event: Event) => {
146
143
  const bg = statusColor(event.meta?.status)
147
- return {container: {backgroundColor: bg}};
144
+ return {container: {backgroundColor: bg}, time: {color: "black"}};
148
145
  };
149
146
 
150
147
  const randomPropsGenerator = () => {
package/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import React$1 from 'react';
2
- import { ViewStyle, TextStyle } from 'react-native';
2
+ import { TextStyle, ViewStyle } from 'react-native';
3
+ import { StyleProp } from 'react-native/Libraries/StyleSheet/StyleSheet';
3
4
 
4
5
  type ResourceId = number;
5
6
  type Event = {
@@ -63,6 +64,7 @@ type EventSlots = {
63
64
  }>;
64
65
  };
65
66
  type StyleOverrides = Partial<{
67
+ time: StyleProp<TextStyle>;
66
68
  container: ViewStyle;
67
69
  content: ViewStyle;
68
70
  title: TextStyle;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import React$1 from 'react';
2
- import { ViewStyle, TextStyle } from 'react-native';
2
+ import { TextStyle, ViewStyle } from 'react-native';
3
+ import { StyleProp } from 'react-native/Libraries/StyleSheet/StyleSheet';
3
4
 
4
5
  type ResourceId = number;
5
6
  type Event = {
@@ -63,6 +64,7 @@ type EventSlots = {
63
64
  }>;
64
65
  };
65
66
  type StyleOverrides = Partial<{
67
+ time: StyleProp<TextStyle>;
66
68
  container: ViewStyle;
67
69
  content: ViewStyle;
68
70
  title: TextStyle;
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
  {
@@ -1051,14 +1055,14 @@ var EventBlock = React19__namespace.default.memo(({
1051
1055
  editable: false,
1052
1056
  allowFontScaling: false,
1053
1057
  underlineColorAndroid: "transparent",
1054
- style: {
1058
+ style: [{
1055
1059
  width: "100%",
1056
1060
  fontFamily: timeFace,
1057
1061
  fontSize: getTextSize(hourHeight),
1058
1062
  pointerEvents: "none",
1059
1063
  padding: 0,
1060
1064
  margin: 0
1061
- },
1065
+ }, resolved?.time],
1062
1066
  defaultValue: `${start} - ${end}`
1063
1067
  }
1064
1068
  ), Body ? /* @__PURE__ */ React19__namespace.default.createElement(Body, { event, ctx: { hourHeight } }) : /* @__PURE__ */ React19__namespace.default.createElement(React19__namespace.default.Fragment, null, /* @__PURE__ */ React19__namespace.default.createElement(Row_default, { style: { alignItems: "center", height: 18 } }, /* @__PURE__ */ React19__namespace.default.createElement(
@@ -1170,14 +1174,14 @@ var DraggableEvent = ({
1170
1174
  editable: false,
1171
1175
  allowFontScaling: false,
1172
1176
  underlineColorAndroid: "transparent",
1173
- style: {
1177
+ style: [{
1174
1178
  width: "100%",
1175
1179
  fontFamily: timeFace,
1176
1180
  fontSize: getTextSize(hourHeight),
1177
1181
  pointerEvents: "none",
1178
1182
  padding: 0,
1179
1183
  margin: 0
1180
- },
1184
+ }, resolved?.time],
1181
1185
  defaultValue: initialDisplayTime,
1182
1186
  animatedProps: animatedTimeProps
1183
1187
  }