UNPKG

react-native-sortables

Version:

Powerful Sortable Components for Flexible Content Reordering in React Native

44 lines (43 loc) 1.52 kB
"use strict"; import React from "react"; import { LayoutAnimationConfig } from 'react-native-reanimated'; import { useItemDecorationStyles, usePortalContext, useTeleportedItemStyles } from '../../../providers'; import ItemCell from './ItemCell'; import { jsx as _jsx } from "react/jsx-runtime"; export default function TeleportedItemCell({ activationAnimationProgress, baseCellStyle, children, isActive, itemKey, itemsOverridesStyle, onMeasure, teleportedItemId }) { const { notifyRendered } = usePortalContext() ?? {}; const teleportedItemStyles = useTeleportedItemStyles(itemKey, isActive, activationAnimationProgress); const decorationStyles = useItemDecorationStyles(itemKey, isActive, activationAnimationProgress); if (!notifyRendered) { return null; } return /*#__PURE__*/_jsx(ItemCell, { cellStyle: [baseCellStyle, teleportedItemStyles], decorationStyles: decorationStyles, itemsOverridesStyle: itemsOverridesStyle, onMeasure: (width, height) => { onMeasure(width, height); // Mark the teleported item as rendered only after it appeared // on the screen and its layout calculation is completed // (see useTeleportedItemStyles in which we set display property // to 'none' when the animated style is not ready) notifyRendered(teleportedItemId); }, children: /*#__PURE__*/_jsx(LayoutAnimationConfig, { skipEntering: true, children: children }) }); } //# sourceMappingURL=TeleportedItemCell.js.map