@react-native-aria/overlays 0.3.6 → 0.3.8

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.
@@ -237,19 +237,19 @@ function computePosition(
237
237
  // add the crossOffset from props
238
238
  position[crossAxis] += crossOffset;
239
239
 
240
- // this is button center position - the overlay size + half of the button to align bottom of overlay with button center
241
- let minViablePosition =
242
- childOffset[crossAxis] +
243
- childOffset[crossSize] / 2 -
244
- overlaySize[crossSize];
245
- // this is button position of center, aligns top of overlay with button center
246
- let maxViablePosition = childOffset[crossAxis] + childOffset[crossSize] / 2;
247
-
248
- // clamp it into the range of the min/max positions
249
- position[crossAxis] = Math.min(
250
- Math.max(minViablePosition, position[crossAxis]),
251
- maxViablePosition
252
- );
240
+ // // this is button center position - the overlay size + half of the button to align bottom of overlay with button center
241
+ // let minViablePosition =
242
+ // childOffset[crossAxis] +
243
+ // childOffset[crossSize] / 2 -
244
+ // overlaySize[crossSize];
245
+ // // this is button position of center, aligns top of overlay with button center
246
+ // let maxViablePosition = childOffset[crossAxis] + childOffset[crossSize] / 2;
247
+
248
+ // // clamp it into the range of the min/max positions
249
+ // position[crossAxis] = Math.min(
250
+ // Math.max(minViablePosition, position[crossAxis]),
251
+ // maxViablePosition
252
+ // );
253
253
 
254
254
  // Floor these so the position isn't placed on a partial pixel, only whole pixels. Shouldn't matter if it was floored or ceiled, so chose one.
255
255
  if (placement === axis) {
@@ -280,22 +280,22 @@ function getMaxHeight(
280
280
  ) {
281
281
  return position.top != null
282
282
  ? // We want the distance between the top of the overlay to the bottom of the boundary
283
- Math.max(
284
- 0,
285
- boundaryDimensions.height +
286
- boundaryDimensions.top +
287
- boundaryDimensions.scroll.top - // this is the bottom of the boundary
288
- (containerOffsetWithBoundary.top + position.top) - // this is the top of the overlay
289
- (margins.top + margins.bottom + padding) // save additional space for margin and padding
290
- )
283
+ Math.max(
284
+ 0,
285
+ boundaryDimensions.height +
286
+ boundaryDimensions.top +
287
+ boundaryDimensions.scroll.top - // this is the bottom of the boundary
288
+ (containerOffsetWithBoundary.top + position.top) - // this is the top of the overlay
289
+ (margins.top + margins.bottom + padding) // save additional space for margin and padding
290
+ )
291
291
  : // We want the distance between the top of the trigger to the top of the boundary
292
- Math.max(
293
- 0,
294
- childOffset.top +
295
- containerOffsetWithBoundary.top - // this is the top of the trigger
296
- (boundaryDimensions.top + boundaryDimensions.scroll.top) - // this is the top of the boundary
297
- (margins.top + margins.bottom + padding) // save additional space for margin and padding
298
- );
292
+ Math.max(
293
+ 0,
294
+ childOffset.top +
295
+ containerOffsetWithBoundary.top - // this is the top of the trigger
296
+ (boundaryDimensions.top + boundaryDimensions.scroll.top) - // this is the top of the boundary
297
+ (margins.top + margins.bottom + padding) // save additional space for margin and padding
298
+ );
299
299
  }
300
300
 
301
301
  function getAvailableSpace(
@@ -311,26 +311,26 @@ function getAvailableSpace(
311
311
  return Math.max(
312
312
  0,
313
313
  childOffset[axis] -
314
- boundaryDimensions[axis] -
315
- boundaryDimensions.scroll[axis] +
316
- containerOffsetWithBoundary[axis] -
317
- margins[axis] -
318
- margins[FLIPPED_DIRECTION[axis]] -
319
- padding
314
+ boundaryDimensions[axis] -
315
+ boundaryDimensions.scroll[axis] +
316
+ containerOffsetWithBoundary[axis] -
317
+ margins[axis] -
318
+ margins[FLIPPED_DIRECTION[axis]] -
319
+ padding
320
320
  );
321
321
  }
322
322
 
323
323
  return Math.max(
324
324
  0,
325
325
  boundaryDimensions[size] +
326
- boundaryDimensions[axis] +
327
- boundaryDimensions.scroll[axis] -
328
- containerOffsetWithBoundary[axis] -
329
- childOffset[axis] -
330
- childOffset[size] -
331
- margins[axis] -
332
- margins[FLIPPED_DIRECTION[axis]] -
333
- padding
326
+ boundaryDimensions[axis] +
327
+ boundaryDimensions.scroll[axis] -
328
+ containerOffsetWithBoundary[axis] -
329
+ childOffset[axis] -
330
+ childOffset[size] -
331
+ margins[axis] -
332
+ margins[FLIPPED_DIRECTION[axis]] -
333
+ padding
334
334
  );
335
335
  }
336
336
 
@@ -100,7 +100,8 @@ export function useOverlayPosition(props: AriaPositionProps): PositionAria {
100
100
  shouldUpdatePosition,
101
101
  placement,
102
102
  overlayRef.current,
103
- targetRef.current,
103
+ targetRef.current?.offsetLeft,
104
+ targetRef.current?.offsetTop,
104
105
  scrollRef.current,
105
106
  containerPadding,
106
107
  shouldFlip,