@estuary-solutions/rn-core-ui 0.0.3
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/LICENSE +20 -0
- package/README.md +743 -0
- package/dist/Accordion/Accordion.d.ts +5 -0
- package/dist/Accordion/Accordion.d.ts.map +1 -0
- package/dist/Accordion/Accordion.js +19 -0
- package/dist/Accordion/AccordionContext.d.ts +7 -0
- package/dist/Accordion/AccordionContext.d.ts.map +1 -0
- package/dist/Accordion/AccordionContext.js +3 -0
- package/dist/Accordion/AccordionGroup.d.ts +7 -0
- package/dist/Accordion/AccordionGroup.d.ts.map +1 -0
- package/dist/Accordion/AccordionGroup.js +32 -0
- package/dist/Accordion/AccordionItem.d.ts +5 -0
- package/dist/Accordion/AccordionItem.d.ts.map +1 -0
- package/dist/Accordion/AccordionItem.js +12 -0
- package/dist/Accordion/AccordionTree.d.ts +6 -0
- package/dist/Accordion/AccordionTree.d.ts.map +1 -0
- package/dist/Accordion/AccordionTree.js +4 -0
- package/dist/Accordion/AccordionTreeInternal.d.ts +5 -0
- package/dist/Accordion/AccordionTreeInternal.d.ts.map +1 -0
- package/dist/Accordion/AccordionTreeInternal.js +36 -0
- package/dist/Accordion/AccordionTreeWithGroup.d.ts +8 -0
- package/dist/Accordion/AccordionTreeWithGroup.d.ts.map +1 -0
- package/dist/Accordion/AccordionTreeWithGroup.js +11 -0
- package/dist/Accordion/index.d.ts +5 -0
- package/dist/Accordion/index.d.ts.map +1 -0
- package/dist/Accordion/index.js +4 -0
- package/dist/Accordion/types/AccordionTypes.d.ts +65 -0
- package/dist/Accordion/types/AccordionTypes.d.ts.map +1 -0
- package/dist/Accordion/types/AccordionTypes.js +1 -0
- package/dist/Avatars/Avatar.d.ts +20 -0
- package/dist/Avatars/Avatar.d.ts.map +1 -0
- package/dist/Avatars/Avatar.js +63 -0
- package/dist/Badges/Badge.d.ts +25 -0
- package/dist/Badges/Badge.d.ts.map +1 -0
- package/dist/Badges/Badge.js +75 -0
- package/dist/Breadcrumbs/Breadcrumb.d.ts +13 -0
- package/dist/Breadcrumbs/Breadcrumb.d.ts.map +1 -0
- package/dist/Breadcrumbs/Breadcrumb.js +63 -0
- package/dist/Button/Button.d.ts +7 -0
- package/dist/Button/Button.d.ts.map +1 -0
- package/dist/Button/Button.js +62 -0
- package/dist/Button/ButtonGradient.d.ts +5 -0
- package/dist/Button/ButtonGradient.d.ts.map +1 -0
- package/dist/Button/ButtonGradient.js +61 -0
- package/dist/Button/index.d.ts +4 -0
- package/dist/Button/index.d.ts.map +1 -0
- package/dist/Button/index.js +3 -0
- package/dist/Button/types/ButtonGradientTypes.d.ts +80 -0
- package/dist/Button/types/ButtonGradientTypes.d.ts.map +1 -0
- package/dist/Button/types/ButtonGradientTypes.js +1 -0
- package/dist/Button/types/ButtonTypes.d.ts +65 -0
- package/dist/Button/types/ButtonTypes.d.ts.map +1 -0
- package/dist/Button/types/ButtonTypes.js +1 -0
- package/dist/Buttons/Button.d.ts +23 -0
- package/dist/Buttons/Button.d.ts.map +1 -0
- package/dist/Buttons/Button.js +66 -0
- package/dist/Cards/Card.d.ts +22 -0
- package/dist/Cards/Card.d.ts.map +1 -0
- package/dist/Cards/Card.js +26 -0
- package/dist/Cards/CardActionArea.d.ts +13 -0
- package/dist/Cards/CardActionArea.d.ts.map +1 -0
- package/dist/Cards/CardActionArea.js +30 -0
- package/dist/Cards/CardActions.d.ts +14 -0
- package/dist/Cards/CardActions.d.ts.map +1 -0
- package/dist/Cards/CardActions.js +41 -0
- package/dist/Cards/CardContent.d.ts +13 -0
- package/dist/Cards/CardContent.d.ts.map +1 -0
- package/dist/Cards/CardContent.js +19 -0
- package/dist/Cards/CardHeader.d.ts +16 -0
- package/dist/Cards/CardHeader.d.ts.map +1 -0
- package/dist/Cards/CardHeader.js +61 -0
- package/dist/Cards/CardMedia.d.ts +23 -0
- package/dist/Cards/CardMedia.d.ts.map +1 -0
- package/dist/Cards/CardMedia.js +16 -0
- package/dist/Cards/Paper.d.ts +13 -0
- package/dist/Cards/Paper.d.ts.map +1 -0
- package/dist/Cards/Paper.js +42 -0
- package/dist/DraggableFlatList/CellDecorators.d.ts +21 -0
- package/dist/DraggableFlatList/CellDecorators.d.ts.map +1 -0
- package/dist/DraggableFlatList/CellDecorators.js +66 -0
- package/dist/DraggableFlatList/CellRendererComponent.d.ts +20 -0
- package/dist/DraggableFlatList/CellRendererComponent.d.ts.map +1 -0
- package/dist/DraggableFlatList/CellRendererComponent.js +146 -0
- package/dist/DraggableFlatList/DraggableFlatList.d.ts +9 -0
- package/dist/DraggableFlatList/DraggableFlatList.d.ts.map +1 -0
- package/dist/DraggableFlatList/DraggableFlatList.js +282 -0
- package/dist/DraggableFlatList/DraggableFlatList.web.d.ts +4 -0
- package/dist/DraggableFlatList/DraggableFlatList.web.d.ts.map +1 -0
- package/dist/DraggableFlatList/DraggableFlatList.web.js +248 -0
- package/dist/DraggableFlatList/NestableDraggableFlatList.d.ts +9 -0
- package/dist/DraggableFlatList/NestableDraggableFlatList.d.ts.map +1 -0
- package/dist/DraggableFlatList/NestableDraggableFlatList.js +66 -0
- package/dist/DraggableFlatList/NestableScrollContainer.d.ts +5 -0
- package/dist/DraggableFlatList/NestableScrollContainer.d.ts.map +1 -0
- package/dist/DraggableFlatList/NestableScrollContainer.js +28 -0
- package/dist/DraggableFlatList/PlaceholderItem.d.ts +8 -0
- package/dist/DraggableFlatList/PlaceholderItem.d.ts.map +1 -0
- package/dist/DraggableFlatList/PlaceholderItem.js +44 -0
- package/dist/DraggableFlatList/RowItem.d.ts +13 -0
- package/dist/DraggableFlatList/RowItem.d.ts.map +1 -0
- package/dist/DraggableFlatList/RowItem.js +45 -0
- package/dist/DraggableFlatList/ScrollOffsetListener.d.ts +8 -0
- package/dist/DraggableFlatList/ScrollOffsetListener.d.ts.map +1 -0
- package/dist/DraggableFlatList/ScrollOffsetListener.js +13 -0
- package/dist/Flex/Flex.d.ts +12 -0
- package/dist/Flex/Flex.d.ts.map +1 -0
- package/dist/Flex/Flex.js +28 -0
- package/dist/Flex/Flex.types.d.ts +10 -0
- package/dist/Flex/Flex.types.d.ts.map +1 -0
- package/dist/Flex/Flex.types.js +1 -0
- package/dist/Flex/index.d.ts +4 -0
- package/dist/Flex/index.d.ts.map +1 -0
- package/dist/Flex/index.js +3 -0
- package/dist/LICENSE +20 -0
- package/dist/README.md +743 -0
- package/dist/SvgIcon/SvgIcon.d.ts +9 -0
- package/dist/SvgIcon/SvgIcon.d.ts.map +1 -0
- package/dist/SvgIcon/SvgIcon.js +39 -0
- package/dist/SvgIcon/components/IconAlertCircle.d.ts +4 -0
- package/dist/SvgIcon/components/IconAlertCircle.d.ts.map +1 -0
- package/dist/SvgIcon/components/IconAlertCircle.js +6 -0
- package/dist/SvgIcon/components/IconAngleLeft.d.ts +4 -0
- package/dist/SvgIcon/components/IconAngleLeft.d.ts.map +1 -0
- package/dist/SvgIcon/components/IconAngleLeft.js +6 -0
- package/dist/SvgIcon/components/IconAngleRight.d.ts +4 -0
- package/dist/SvgIcon/components/IconAngleRight.d.ts.map +1 -0
- package/dist/SvgIcon/components/IconAngleRight.js +6 -0
- package/dist/SvgIcon/components/IconCheckBox.d.ts +4 -0
- package/dist/SvgIcon/components/IconCheckBox.d.ts.map +1 -0
- package/dist/SvgIcon/components/IconCheckBox.js +6 -0
- package/dist/SvgIcon/components/IconCheckBoxOutlineBlank.d.ts +4 -0
- package/dist/SvgIcon/components/IconCheckBoxOutlineBlank.d.ts.map +1 -0
- package/dist/SvgIcon/components/IconCheckBoxOutlineBlank.js +6 -0
- package/dist/SvgIcon/components/IconCheckBoxWithBg.d.ts +4 -0
- package/dist/SvgIcon/components/IconCheckBoxWithBg.d.ts.map +1 -0
- package/dist/SvgIcon/components/IconCheckBoxWithBg.js +6 -0
- package/dist/SvgIcon/components/IconChevronDown.d.ts +4 -0
- package/dist/SvgIcon/components/IconChevronDown.d.ts.map +1 -0
- package/dist/SvgIcon/components/IconChevronDown.js +6 -0
- package/dist/SvgIcon/components/IconChevronUp.d.ts +4 -0
- package/dist/SvgIcon/components/IconChevronUp.d.ts.map +1 -0
- package/dist/SvgIcon/components/IconChevronUp.js +6 -0
- package/dist/SvgIcon/components/IconHome.d.ts +4 -0
- package/dist/SvgIcon/components/IconHome.d.ts.map +1 -0
- package/dist/SvgIcon/components/IconHome.js +6 -0
- package/dist/SvgIcon/components/IconPerson.d.ts +4 -0
- package/dist/SvgIcon/components/IconPerson.d.ts.map +1 -0
- package/dist/SvgIcon/components/IconPerson.js +6 -0
- package/dist/SvgIcon/components/IconPlayCircle.d.ts +4 -0
- package/dist/SvgIcon/components/IconPlayCircle.d.ts.map +1 -0
- package/dist/SvgIcon/components/IconPlayCircle.js +9 -0
- package/dist/SvgIcon/components/IconPlus.d.ts +4 -0
- package/dist/SvgIcon/components/IconPlus.d.ts.map +1 -0
- package/dist/SvgIcon/components/IconPlus.js +6 -0
- package/dist/SvgIcon/components/index.d.ts +13 -0
- package/dist/SvgIcon/components/index.d.ts.map +1 -0
- package/dist/SvgIcon/components/index.js +12 -0
- package/dist/SvgIcon/types/SvgIconTypes.d.ts +46 -0
- package/dist/SvgIcon/types/SvgIconTypes.d.ts.map +1 -0
- package/dist/SvgIcon/types/SvgIconTypes.js +1 -0
- package/dist/TextFields/TextField.d.ts +34 -0
- package/dist/TextFields/TextField.d.ts.map +1 -0
- package/dist/TextFields/TextField.js +400 -0
- package/dist/TextFields/index.d.ts +2 -0
- package/dist/TextFields/index.d.ts.map +1 -0
- package/dist/TextFields/index.js +1 -0
- package/dist/Texts/Text.d.ts +21 -0
- package/dist/Texts/Text.d.ts.map +1 -0
- package/dist/Texts/Text.js +49 -0
- package/dist/constants/DraggableFlatList/constants.d.ts +28 -0
- package/dist/constants/DraggableFlatList/constants.d.ts.map +1 -0
- package/dist/constants/DraggableFlatList/constants.js +25 -0
- package/dist/constants/DraggableFlatList/types.d.ts +65 -0
- package/dist/constants/DraggableFlatList/types.d.ts.map +1 -0
- package/dist/constants/DraggableFlatList/types.js +1 -0
- package/dist/constants/DraggableFlatList/types.web.d.ts +7 -0
- package/dist/constants/DraggableFlatList/types.web.d.ts.map +1 -0
- package/dist/constants/DraggableFlatList/types.web.js +1 -0
- package/dist/constants/consts.d.ts +16 -0
- package/dist/constants/consts.d.ts.map +1 -0
- package/dist/constants/consts.js +15 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +2 -0
- package/dist/constants/types.d.ts +22 -0
- package/dist/constants/types.d.ts.map +1 -0
- package/dist/constants/types.js +21 -0
- package/dist/context/DraggableFlatList/animatedValueContext.d.ts +29 -0
- package/dist/context/DraggableFlatList/animatedValueContext.d.ts.map +1 -0
- package/dist/context/DraggableFlatList/animatedValueContext.js +154 -0
- package/dist/context/DraggableFlatList/cellContext.d.ts +10 -0
- package/dist/context/DraggableFlatList/cellContext.d.ts.map +1 -0
- package/dist/context/DraggableFlatList/cellContext.js +18 -0
- package/dist/context/DraggableFlatList/draggableFlatListContext.d.ts +13 -0
- package/dist/context/DraggableFlatList/draggableFlatListContext.d.ts.map +1 -0
- package/dist/context/DraggableFlatList/draggableFlatListContext.js +19 -0
- package/dist/context/DraggableFlatList/nestableScrollContainerContext.d.ts +23 -0
- package/dist/context/DraggableFlatList/nestableScrollContainerContext.d.ts.map +1 -0
- package/dist/context/DraggableFlatList/nestableScrollContainerContext.js +36 -0
- package/dist/context/DraggableFlatList/propsContext.d.ts +9 -0
- package/dist/context/DraggableFlatList/propsContext.d.ts.map +1 -0
- package/dist/context/DraggableFlatList/propsContext.js +25 -0
- package/dist/context/DraggableFlatList/refContext.d.ts +20 -0
- package/dist/context/DraggableFlatList/refContext.d.ts.map +1 -0
- package/dist/context/DraggableFlatList/refContext.js +55 -0
- package/dist/hooks/DraggableFlatList/useAutoScroll.d.ts +2 -0
- package/dist/hooks/DraggableFlatList/useAutoScroll.d.ts.map +1 -0
- package/dist/hooks/DraggableFlatList/useAutoScroll.js +77 -0
- package/dist/hooks/DraggableFlatList/useCellTranslate.d.ts +9 -0
- package/dist/hooks/DraggableFlatList/useCellTranslate.d.ts.map +1 -0
- package/dist/hooks/DraggableFlatList/useCellTranslate.js +72 -0
- package/dist/hooks/DraggableFlatList/useNestedAutoScroll.d.ts +12 -0
- package/dist/hooks/DraggableFlatList/useNestedAutoScroll.d.ts.map +1 -0
- package/dist/hooks/DraggableFlatList/useNestedAutoScroll.js +77 -0
- package/dist/hooks/DraggableFlatList/useOnCellActiveAnimation.d.ts +15 -0
- package/dist/hooks/DraggableFlatList/useOnCellActiveAnimation.d.ts.map +1 -0
- package/dist/hooks/DraggableFlatList/useOnCellActiveAnimation.js +29 -0
- package/dist/hooks/DraggableFlatList/useStableCallback.d.ts +2 -0
- package/dist/hooks/DraggableFlatList/useStableCallback.d.ts.map +1 -0
- package/dist/hooks/DraggableFlatList/useStableCallback.js +11 -0
- package/dist/hooks/useTheme.d.ts +17 -0
- package/dist/hooks/useTheme.d.ts.map +1 -0
- package/dist/hooks/useTheme.js +12 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/themes/colors.d.ts +9 -0
- package/dist/themes/colors.d.ts.map +1 -0
- package/dist/themes/colors.js +201 -0
- package/dist/themes/elevationOverlay.d.ts +2 -0
- package/dist/themes/elevationOverlay.d.ts.map +1 -0
- package/dist/themes/elevationOverlay.js +12 -0
- package/dist/themes/fontSize.d.ts +23 -0
- package/dist/themes/fontSize.d.ts.map +1 -0
- package/dist/themes/fontSize.js +22 -0
- package/dist/themes/index.d.ts +5 -0
- package/dist/themes/index.d.ts.map +1 -0
- package/dist/themes/index.js +4 -0
- package/dist/themes/types/colorTypes.d.ts +665 -0
- package/dist/themes/types/colorTypes.d.ts.map +1 -0
- package/dist/themes/types/colorTypes.js +1 -0
- package/dist/utils/DraggableFlatList/typedMemo.d.ts +2 -0
- package/dist/utils/DraggableFlatList/typedMemo.d.ts.map +1 -0
- package/dist/utils/DraggableFlatList/typedMemo.js +2 -0
- package/dist/utils/cleanTagHTML.d.ts +22 -0
- package/dist/utils/cleanTagHTML.d.ts.map +1 -0
- package/dist/utils/cleanTagHTML.js +36 -0
- package/dist/utils/colors/color.d.ts +2 -0
- package/dist/utils/colors/color.d.ts.map +1 -0
- package/dist/utils/colors/color.js +6 -0
- package/dist/utils/colors/elevation.d.ts +7 -0
- package/dist/utils/colors/elevation.d.ts.map +1 -0
- package/dist/utils/colors/elevation.js +29 -0
- package/dist/utils/colors/index.d.ts +9 -0
- package/dist/utils/colors/index.d.ts.map +1 -0
- package/dist/utils/colors/index.js +7 -0
- package/dist/utils/converter.d.ts +47 -0
- package/dist/utils/converter.d.ts.map +1 -0
- package/dist/utils/converter.js +54 -0
- package/dist/utils/debounce.d.ts +36 -0
- package/dist/utils/debounce.d.ts.map +1 -0
- package/dist/utils/debounce.js +54 -0
- package/dist/utils/filters.d.ts +3 -0
- package/dist/utils/filters.d.ts.map +1 -0
- package/dist/utils/filters.js +10 -0
- package/dist/utils/fixedDistance.d.ts +16 -0
- package/dist/utils/fixedDistance.d.ts.map +1 -0
- package/dist/utils/fixedDistance.js +17 -0
- package/dist/utils/formatMoney.d.ts +30 -0
- package/dist/utils/formatMoney.d.ts.map +1 -0
- package/dist/utils/formatMoney.js +33 -0
- package/dist/utils/getOS.d.ts +6 -0
- package/dist/utils/getOS.d.ts.map +1 -0
- package/dist/utils/getOS.js +6 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +12 -0
- package/dist/utils/limitedString.d.ts +15 -0
- package/dist/utils/limitedString.d.ts.map +1 -0
- package/dist/utils/limitedString.js +19 -0
- package/dist/utils/resolutions.d.ts +65 -0
- package/dist/utils/resolutions.d.ts.map +1 -0
- package/dist/utils/resolutions.js +79 -0
- package/dist/utils/scale.d.ts +141 -0
- package/dist/utils/scale.d.ts.map +1 -0
- package/dist/utils/scale.js +141 -0
- package/documents/build.js +102 -0
- package/documents/buildFromRoot.js +49 -0
- package/documents/buildFromSample.js +40 -0
- package/documents/buildV2.js +98 -0
- package/documents/copyPackageToExample.js +31 -0
- package/example/RNCoreUISample/.eslintrc.js +10 -0
- package/example/RNCoreUISample/.prettierrc.js +7 -0
- package/example/RNCoreUISample/App.js +26 -0
- package/example/RNCoreUISample/README.md +104 -0
- package/example/RNCoreUISample/android/app/debug.keystore +0 -0
- package/example/RNCoreUISample/babel.config.js +29 -0
- package/example/RNCoreUISample/documents/storybook/manager.js +5 -0
- package/example/RNCoreUISample/fix_node_modules.js +12 -0
- package/example/RNCoreUISample/index.js +20 -0
- package/example/RNCoreUISample/jest.config.js +3 -0
- package/example/RNCoreUISample/metro.config.js +30 -0
- package/package.json +101 -0
- package/src/constants/DraggableFlatList/draggable.d.ts +12 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { View, Text, StyleSheet, } from 'react-native';
|
|
4
|
+
import { colors } from '../themes';
|
|
5
|
+
const CardHeader = React.forwardRef(({ avatar, action, title, subheader, disableTypography = false, style, contentStyle, titleStyle, subheaderStyle, }, ref) => {
|
|
6
|
+
const renderTitle = () => {
|
|
7
|
+
if (title == null)
|
|
8
|
+
return null;
|
|
9
|
+
if (disableTypography || React.isValidElement(title))
|
|
10
|
+
return title;
|
|
11
|
+
return (_jsx(Text, { numberOfLines: 1, style: [styles.title, !!avatar && styles.titleWithAvatar, titleStyle], children: title }));
|
|
12
|
+
};
|
|
13
|
+
const renderSubheader = () => {
|
|
14
|
+
if (subheader == null)
|
|
15
|
+
return null;
|
|
16
|
+
if (disableTypography || React.isValidElement(subheader))
|
|
17
|
+
return subheader;
|
|
18
|
+
return (_jsx(Text, { numberOfLines: 2, style: [
|
|
19
|
+
styles.subheader,
|
|
20
|
+
!!avatar && styles.subheaderWithAvatar,
|
|
21
|
+
subheaderStyle,
|
|
22
|
+
], children: subheader }));
|
|
23
|
+
};
|
|
24
|
+
return (_jsxs(View, { ref: ref, style: [styles.root, style], children: [avatar && _jsx(View, { style: styles.avatar, children: avatar }), _jsxs(View, { style: [styles.content, contentStyle], children: [renderTitle(), renderSubheader()] }), action && _jsx(View, { style: styles.action, children: action })] }));
|
|
25
|
+
});
|
|
26
|
+
CardHeader.displayName = 'CardHeader';
|
|
27
|
+
const styles = StyleSheet.create({
|
|
28
|
+
root: {
|
|
29
|
+
flexDirection: 'row',
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
padding: 16,
|
|
32
|
+
},
|
|
33
|
+
avatar: {
|
|
34
|
+
marginRight: 16,
|
|
35
|
+
},
|
|
36
|
+
content: {
|
|
37
|
+
flex: 1,
|
|
38
|
+
justifyContent: 'center',
|
|
39
|
+
},
|
|
40
|
+
action: {
|
|
41
|
+
marginLeft: 8,
|
|
42
|
+
alignSelf: 'flex-start',
|
|
43
|
+
},
|
|
44
|
+
title: {
|
|
45
|
+
fontSize: 16,
|
|
46
|
+
fontWeight: '600',
|
|
47
|
+
color: colors.black,
|
|
48
|
+
},
|
|
49
|
+
titleWithAvatar: {
|
|
50
|
+
fontSize: 14,
|
|
51
|
+
},
|
|
52
|
+
subheader: {
|
|
53
|
+
marginTop: 2,
|
|
54
|
+
fontSize: 14,
|
|
55
|
+
color: colors.gray_727272,
|
|
56
|
+
},
|
|
57
|
+
subheaderWithAvatar: {
|
|
58
|
+
fontSize: 13,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
export default CardHeader;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ImageResizeMode, ImageSourcePropType, StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { ImageStyle, ResizeMode as FastImageResizeMode, Source } from 'react-native-fast-image';
|
|
4
|
+
export type CardMediaComponent = 'image' | 'background';
|
|
5
|
+
interface BaseProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export interface CardMediaImageProps extends BaseProps {
|
|
9
|
+
component?: 'image';
|
|
10
|
+
source: number | Source | undefined;
|
|
11
|
+
resizeMode?: FastImageResizeMode;
|
|
12
|
+
style?: StyleProp<ImageStyle>;
|
|
13
|
+
}
|
|
14
|
+
export interface CardMediaBackgroundProps extends BaseProps {
|
|
15
|
+
component: 'background';
|
|
16
|
+
source: ImageSourcePropType;
|
|
17
|
+
resizeMode?: ImageResizeMode;
|
|
18
|
+
style?: StyleProp<ViewStyle>;
|
|
19
|
+
}
|
|
20
|
+
export type CardMediaProps = CardMediaImageProps | CardMediaBackgroundProps;
|
|
21
|
+
declare const CardMedia: React.FC<CardMediaProps>;
|
|
22
|
+
export default CardMedia;
|
|
23
|
+
//# sourceMappingURL=CardMedia.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardMedia.d.ts","sourceRoot":"","sources":["../../src/Cards/CardMedia.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,eAAe,EACf,mBAAmB,EACnB,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAkB,EAChB,UAAU,EACV,UAAU,IAAI,mBAAmB,EACjC,MAAM,EACP,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,YAAY,CAAC;AAExD,UAAU,SAAS;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACpC,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,KAAK,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,wBAAyB,SAAQ,SAAS;IACzD,SAAS,EAAE,YAAY,CAAC;IACxB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,MAAM,MAAM,cAAc,GACtB,mBAAmB,GACnB,wBAAwB,CAAC;AAE7B,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CA4BvC,CAAC;AAIF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ImageBackground, } from 'react-native';
|
|
3
|
+
import FastImage from 'react-native-fast-image';
|
|
4
|
+
const CardMedia = (props) => {
|
|
5
|
+
const { children } = props;
|
|
6
|
+
if (props.component === 'background') {
|
|
7
|
+
const { source, resizeMode = 'cover', style } = props;
|
|
8
|
+
return (_jsx(ImageBackground, { source: source, resizeMode: resizeMode, style: [{ width: '100%' }, style], children: children }));
|
|
9
|
+
}
|
|
10
|
+
const { source, resizeMode = 'cover', style } = props;
|
|
11
|
+
if (!source)
|
|
12
|
+
return null;
|
|
13
|
+
return (_jsx(FastImage, { source: source, resizeMode: resizeMode, style: [{ width: '100%' }, style] }));
|
|
14
|
+
};
|
|
15
|
+
CardMedia.displayName = 'CardMedia';
|
|
16
|
+
export default CardMedia;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, ViewProps, StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export type PaperVariant = 'elevation' | 'outlined';
|
|
4
|
+
export type PaperElevation = 0 | 1 | 2 | 3 | 4 | 6 | 8 | 12 | 16 | 24;
|
|
5
|
+
export interface PaperProps extends ViewProps {
|
|
6
|
+
elevation?: PaperElevation;
|
|
7
|
+
square?: boolean;
|
|
8
|
+
variant?: PaperVariant;
|
|
9
|
+
style?: StyleProp<ViewStyle>;
|
|
10
|
+
}
|
|
11
|
+
declare const Paper: React.ForwardRefExoticComponent<PaperProps & React.RefAttributes<View>>;
|
|
12
|
+
export default Paper;
|
|
13
|
+
//# sourceMappingURL=Paper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Paper.d.ts","sourceRoot":"","sources":["../../src/Cards/Paper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,IAAI,EACJ,SAAS,EACT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAKtB,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,UAAU,CAAC;AAEpD,MAAM,MAAM,cAAc,GACtB,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAE7C,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,KAAK,yEA4CT,CAAC;AAIH,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { View, } from 'react-native';
|
|
15
|
+
import { useTheme } from '../hooks/useTheme';
|
|
16
|
+
import { colorsUtils } from '../utils';
|
|
17
|
+
const Paper = React.forwardRef(function Paper(_a, ref) {
|
|
18
|
+
var { elevation = 1, square = false, variant = 'elevation', style } = _a, rest = __rest(_a, ["elevation", "square", "variant", "style"]);
|
|
19
|
+
const { colors, isDark } = useTheme();
|
|
20
|
+
const { shadowStyle, overlayColor } = variant === 'elevation'
|
|
21
|
+
? colorsUtils.getElevationStyle(elevation, isDark)
|
|
22
|
+
: { shadowStyle: {} };
|
|
23
|
+
const baseStyle = {
|
|
24
|
+
backgroundColor: colors.surface,
|
|
25
|
+
borderRadius: square ? 0 : 8,
|
|
26
|
+
};
|
|
27
|
+
const outlinedStyle = variant === 'outlined'
|
|
28
|
+
? {
|
|
29
|
+
borderWidth: 1,
|
|
30
|
+
borderColor: colors.outline,
|
|
31
|
+
}
|
|
32
|
+
: {};
|
|
33
|
+
return (_jsx(View, Object.assign({ ref: ref, style: [
|
|
34
|
+
baseStyle,
|
|
35
|
+
shadowStyle,
|
|
36
|
+
outlinedStyle,
|
|
37
|
+
overlayColor ? { backgroundColor: overlayColor } : undefined,
|
|
38
|
+
style,
|
|
39
|
+
] }, rest)));
|
|
40
|
+
});
|
|
41
|
+
Paper.displayName = 'Paper';
|
|
42
|
+
export default Paper;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type ScaleProps = {
|
|
3
|
+
activeScale?: number;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
};
|
|
6
|
+
export declare const ScaleDecorator: ({ activeScale, children }: ScaleProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
type ShadowProps = {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
elevation?: number;
|
|
10
|
+
radius?: number;
|
|
11
|
+
color?: string;
|
|
12
|
+
opacity?: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const ShadowDecorator: ({ elevation, color, opacity, radius, children, }: ShadowProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
type OpacityProps = {
|
|
16
|
+
activeOpacity?: number;
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
};
|
|
19
|
+
export declare const OpacityDecorator: ({ activeOpacity, children, }: OpacityProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=CellDecorators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CellDecorators.d.ts","sourceRoot":"","sources":["../../src/DraggableFlatList/CellDecorators.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,KAAK,UAAU,GAAG;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,2BAAiC,UAAU,4CAkCzE,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,kDAM7B,WAAW,4CAqCb,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,8BAG9B,YAAY,4CA+Bd,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
import Animated, { interpolate, useAnimatedStyle, } from "react-native-reanimated";
|
|
4
|
+
import { useDraggableFlatListContext } from "../context/DraggableFlatList/draggableFlatListContext";
|
|
5
|
+
import { useOnCellActiveAnimation } from "../hooks/DraggableFlatList/useOnCellActiveAnimation";
|
|
6
|
+
import { WEB } from "../utils";
|
|
7
|
+
export const ScaleDecorator = ({ activeScale = 1.1, children }) => {
|
|
8
|
+
const { isActive, onActiveAnim } = useOnCellActiveAnimation({
|
|
9
|
+
animationConfig: { mass: 0.1, restDisplacementThreshold: 0.0001 },
|
|
10
|
+
});
|
|
11
|
+
const { horizontal } = useDraggableFlatListContext();
|
|
12
|
+
if (WEB) {
|
|
13
|
+
const scale = isActive ? activeScale : 1;
|
|
14
|
+
return (_jsx("div", { style: Object.assign({ transform: `scale(${scale})`, transition: "transform 0.2s ease" }, (horizontal && { display: "inline-block" })), children: children }));
|
|
15
|
+
}
|
|
16
|
+
const style = useAnimatedStyle(() => {
|
|
17
|
+
const animScale = interpolate(onActiveAnim.value, [0, 1], [1, activeScale]);
|
|
18
|
+
const scale = isActive ? animScale : 1;
|
|
19
|
+
return {
|
|
20
|
+
transform: [{ scaleX: scale }, { scaleY: scale }],
|
|
21
|
+
};
|
|
22
|
+
}, [isActive]);
|
|
23
|
+
return (_jsx(Animated.View, { style: [style, horizontal && styles.horizontal], children: children }));
|
|
24
|
+
};
|
|
25
|
+
export const ShadowDecorator = ({ elevation = 10, color = "black", opacity = 0.25, radius = 5, children, }) => {
|
|
26
|
+
const { isActive, onActiveAnim } = useOnCellActiveAnimation();
|
|
27
|
+
const { horizontal } = useDraggableFlatListContext();
|
|
28
|
+
if (WEB) {
|
|
29
|
+
const shadowOpacity = isActive ? opacity : 0;
|
|
30
|
+
const boxShadow = isActive
|
|
31
|
+
? `0px ${elevation}px ${radius}px rgba(0, 0, 0, ${shadowOpacity})`
|
|
32
|
+
: "none";
|
|
33
|
+
return (_jsx("div", { style: Object.assign({ boxShadow, transition: "box-shadow 0.2s ease" }, (horizontal && { display: "inline-block" })), children: children }));
|
|
34
|
+
}
|
|
35
|
+
const style = useAnimatedStyle(() => {
|
|
36
|
+
const shadowOpacity = onActiveAnim.value * opacity;
|
|
37
|
+
return {
|
|
38
|
+
elevation: isActive ? elevation : 0,
|
|
39
|
+
shadowRadius: isActive ? radius : 0,
|
|
40
|
+
shadowColor: isActive ? color : "transparent",
|
|
41
|
+
shadowOpacity: isActive ? shadowOpacity : 0,
|
|
42
|
+
};
|
|
43
|
+
}, [isActive, onActiveAnim]);
|
|
44
|
+
return (_jsx(Animated.View, { style: [style, horizontal && styles.horizontal], children: children }));
|
|
45
|
+
};
|
|
46
|
+
export const OpacityDecorator = ({ activeOpacity = 0.25, children, }) => {
|
|
47
|
+
const { isActive, onActiveAnim } = useOnCellActiveAnimation();
|
|
48
|
+
const { horizontal } = useDraggableFlatListContext();
|
|
49
|
+
if (WEB) {
|
|
50
|
+
const opacity = isActive ? activeOpacity : 1;
|
|
51
|
+
return (_jsx("div", { style: Object.assign({ opacity, transition: "opacity 0.2s ease" }, (horizontal && { display: "inline-block" })), children: children }));
|
|
52
|
+
}
|
|
53
|
+
const style = useAnimatedStyle(() => {
|
|
54
|
+
const opacity = interpolate(onActiveAnim.value, [0, 1], [1, activeOpacity]);
|
|
55
|
+
return {
|
|
56
|
+
opacity: isActive ? opacity : 1,
|
|
57
|
+
};
|
|
58
|
+
}, [isActive]);
|
|
59
|
+
return (_jsx(Animated.View, { style: [style, horizontal && styles.horizontal], children: children }));
|
|
60
|
+
};
|
|
61
|
+
const styles = StyleSheet.create({
|
|
62
|
+
horizontal: {
|
|
63
|
+
flexDirection: "row",
|
|
64
|
+
flex: 1,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { LayoutChangeEvent, StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
type Props<T> = {
|
|
4
|
+
item: T;
|
|
5
|
+
index: number;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
onLayout?: (e: LayoutChangeEvent) => void;
|
|
8
|
+
style?: StyleProp<ViewStyle>;
|
|
9
|
+
};
|
|
10
|
+
declare function CellRendererComponent<T>(props: Props<T>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare const _default: typeof CellRendererComponent;
|
|
12
|
+
export default _default;
|
|
13
|
+
declare global {
|
|
14
|
+
namespace NodeJS {
|
|
15
|
+
interface Global {
|
|
16
|
+
RNDFLLayoutAnimationConfigStash: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=CellRendererComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CellRendererComponent.d.ts","sourceRoot":"","sources":["../../src/DraggableFlatList/CellRendererComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,iBAAiB,EAEjB,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAgBtB,KAAK,KAAK,CAAC,CAAC,IAAI;IACd,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC1C,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAEF,iBAAS,qBAAqB,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,2CAqIhD;;AAED,wBAAgD;AAEhD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM,CAAC;QACf,UAAU,MAAM;YACd,+BAA+B,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SAC1D;KACF;CACF"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import React from "react";
|
|
14
|
+
import { findNodeHandle, } from "react-native";
|
|
15
|
+
import Animated, { runOnUI, useAnimatedStyle, useSharedValue, } from "react-native-reanimated";
|
|
16
|
+
import { typedMemo } from "../utils/DraggableFlatList/typedMemo";
|
|
17
|
+
import { WEB } from "../utils";
|
|
18
|
+
import { CellProvider } from "../context/DraggableFlatList/cellContext";
|
|
19
|
+
import { useRefs } from "../context/DraggableFlatList/refContext";
|
|
20
|
+
import { useDraggableFlatListContext } from "../context/DraggableFlatList/draggableFlatListContext";
|
|
21
|
+
import { useAnimatedValues } from "../context/DraggableFlatList/animatedValueContext";
|
|
22
|
+
import { useStableCallback } from "../hooks/DraggableFlatList/useStableCallback";
|
|
23
|
+
import { useCellTranslate } from "../hooks/DraggableFlatList/useCellTranslate";
|
|
24
|
+
function CellRendererComponent(props) {
|
|
25
|
+
const { item, index, onLayout, children } = props, rest = __rest(props, ["item", "index", "onLayout", "children"]);
|
|
26
|
+
const viewRef = React.useRef(null);
|
|
27
|
+
const { cellDataRef, propsRef, containerRef } = useRefs();
|
|
28
|
+
const { horizontalAnim, scrollOffset } = useAnimatedValues();
|
|
29
|
+
const { activeKey, keyExtractor, horizontal, layoutAnimationDisabled } = useDraggableFlatListContext();
|
|
30
|
+
const key = keyExtractor(item, index);
|
|
31
|
+
const offset = useSharedValue(-1);
|
|
32
|
+
const size = useSharedValue(-1);
|
|
33
|
+
const heldTanslate = useSharedValue(0);
|
|
34
|
+
const translate = useCellTranslate({
|
|
35
|
+
cellOffset: offset,
|
|
36
|
+
cellSize: size,
|
|
37
|
+
cellIndex: index,
|
|
38
|
+
});
|
|
39
|
+
const isActive = activeKey === key;
|
|
40
|
+
const animStyle = useAnimatedStyle(() => {
|
|
41
|
+
// When activeKey becomes null at the end of a drag and the list reorders,
|
|
42
|
+
// the animated style may apply before the next paint, causing a flicker.
|
|
43
|
+
// Solution is to hold over the last animated value until the next onLayout.
|
|
44
|
+
// (Not required in web)
|
|
45
|
+
if (translate.value && !WEB) {
|
|
46
|
+
heldTanslate.value = translate.value;
|
|
47
|
+
}
|
|
48
|
+
const t = activeKey ? translate.value : heldTanslate.value;
|
|
49
|
+
return {
|
|
50
|
+
transform: [horizontalAnim.value ? { translateX: t } : { translateY: t }],
|
|
51
|
+
};
|
|
52
|
+
}, [translate, activeKey]);
|
|
53
|
+
const updateCellMeasurements = useStableCallback(() => {
|
|
54
|
+
const onSuccess = (x, y, w, h) => {
|
|
55
|
+
if (WEB && horizontal)
|
|
56
|
+
x += scrollOffset.value;
|
|
57
|
+
const cellOffset = horizontal ? x : y;
|
|
58
|
+
const cellSize = horizontal ? w : h;
|
|
59
|
+
cellDataRef.current.set(key, {
|
|
60
|
+
measurements: { size: cellSize, offset: cellOffset },
|
|
61
|
+
});
|
|
62
|
+
size.value = cellSize;
|
|
63
|
+
offset.value = cellOffset;
|
|
64
|
+
};
|
|
65
|
+
const onFail = () => {
|
|
66
|
+
var _a;
|
|
67
|
+
if ((_a = propsRef.current) === null || _a === void 0 ? void 0 : _a.debug) {
|
|
68
|
+
console.log(`## on measure fail, index: ${index}`);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const containerNode = containerRef.current;
|
|
72
|
+
const viewNode = viewRef.current;
|
|
73
|
+
const nodeHandle = containerNode;
|
|
74
|
+
if (viewNode && nodeHandle) {
|
|
75
|
+
//@ts-ignore
|
|
76
|
+
viewNode.measureLayout(nodeHandle, onSuccess, onFail);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const onCellLayout = useStableCallback((e) => {
|
|
80
|
+
heldTanslate.value = 0;
|
|
81
|
+
updateCellMeasurements();
|
|
82
|
+
if (onLayout && e)
|
|
83
|
+
onLayout(e);
|
|
84
|
+
});
|
|
85
|
+
React.useEffect(() => {
|
|
86
|
+
if (WEB) {
|
|
87
|
+
// onLayout isn't called on web when the cell index changes, so we manually re-measure
|
|
88
|
+
requestAnimationFrame(() => {
|
|
89
|
+
onCellLayout();
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}, [index, onCellLayout]);
|
|
93
|
+
const baseStyle = React.useMemo(() => {
|
|
94
|
+
return {
|
|
95
|
+
elevation: isActive ? 1 : 0,
|
|
96
|
+
zIndex: isActive ? 999 : 0,
|
|
97
|
+
flexDirection: horizontal ? "row" : "column",
|
|
98
|
+
};
|
|
99
|
+
}, [isActive, horizontal]);
|
|
100
|
+
const { itemEnteringAnimation, itemExitingAnimation, itemLayoutAnimation } = propsRef.current;
|
|
101
|
+
React.useEffect(() => {
|
|
102
|
+
// NOTE: Keep an eye on reanimated LayoutAnimation refactor:
|
|
103
|
+
// https://github.com/software-mansion/react-native-reanimated/pull/3332/files
|
|
104
|
+
// We might have to change the way we register/unregister LayouAnimations:
|
|
105
|
+
// - get native module: https://github.com/software-mansion/react-native-reanimated/blob/cf59766460d05eb30357913455318d8a95909468/src/reanimated2/NativeReanimated/NativeReanimated.ts#L18
|
|
106
|
+
// - register layout animation for tag: https://github.com/software-mansion/react-native-reanimated/blob/cf59766460d05eb30357913455318d8a95909468/src/reanimated2/NativeReanimated/NativeReanimated.ts#L99
|
|
107
|
+
if (!propsRef.current.enableLayoutAnimationExperimental)
|
|
108
|
+
return;
|
|
109
|
+
const tag = findNodeHandle(viewRef.current);
|
|
110
|
+
runOnUI((t, _layoutDisabled) => {
|
|
111
|
+
"worklet";
|
|
112
|
+
if (!t)
|
|
113
|
+
return;
|
|
114
|
+
const config = global.LayoutAnimationRepository.configs[t];
|
|
115
|
+
if (config)
|
|
116
|
+
stashConfig(t, config);
|
|
117
|
+
const stashedConfig = getStashedConfig(t);
|
|
118
|
+
if (_layoutDisabled) {
|
|
119
|
+
global.LayoutAnimationRepository.removeConfig(t);
|
|
120
|
+
}
|
|
121
|
+
else if (stashedConfig) {
|
|
122
|
+
global.LayoutAnimationRepository.registerConfig(t, stashedConfig);
|
|
123
|
+
}
|
|
124
|
+
})(tag, layoutAnimationDisabled);
|
|
125
|
+
}, [layoutAnimationDisabled]);
|
|
126
|
+
return (_jsx(Animated.View, Object.assign({}, rest, { ref: viewRef, onLayout: onCellLayout, entering: itemEnteringAnimation, exiting: itemExitingAnimation, layout: propsRef.current.enableLayoutAnimationExperimental
|
|
127
|
+
? itemLayoutAnimation
|
|
128
|
+
: undefined, style: [props.style, baseStyle, animStyle], pointerEvents: activeKey ? "none" : "auto", children: _jsx(CellProvider, { isActive: isActive, children: children }) })));
|
|
129
|
+
}
|
|
130
|
+
export default typedMemo(CellRendererComponent);
|
|
131
|
+
runOnUI(() => {
|
|
132
|
+
"worklet";
|
|
133
|
+
global.RNDFLLayoutAnimationConfigStash = {};
|
|
134
|
+
})();
|
|
135
|
+
function stashConfig(tag, config) {
|
|
136
|
+
"worklet";
|
|
137
|
+
if (!global.RNDFLLayoutAnimationConfigStash)
|
|
138
|
+
global.RNDFLLayoutAnimationConfigStash = {};
|
|
139
|
+
global.RNDFLLayoutAnimationConfigStash[tag] = config;
|
|
140
|
+
}
|
|
141
|
+
function getStashedConfig(tag) {
|
|
142
|
+
"worklet";
|
|
143
|
+
if (!global.RNDFLLayoutAnimationConfigStash)
|
|
144
|
+
return null;
|
|
145
|
+
return global.RNDFLLayoutAnimationConfigStash[tag];
|
|
146
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FlatList } from "react-native-gesture-handler";
|
|
3
|
+
import { DraggableFlatListProps } from "../constants/DraggableFlatList/types";
|
|
4
|
+
declare function DraggableFlatList<T>(props: DraggableFlatListProps<T>, ref?: React.ForwardedRef<FlatList<T>> | null): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare const _default: <T>(props: DraggableFlatListProps<T> & {
|
|
6
|
+
ref?: React.ForwardedRef<FlatList<T>>;
|
|
7
|
+
}) => ReturnType<typeof DraggableFlatList>;
|
|
8
|
+
export default _default;
|
|
9
|
+
//# sourceMappingURL=DraggableFlatList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DraggableFlatList.d.ts","sourceRoot":"","sources":["../../src/DraggableFlatList/DraggableFlatList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EACL,QAAQ,EAGT,MAAM,8BAA8B,CAAC;AAiBtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AA0Y3E,iBAAS,iBAAiB,CAAC,CAAC,EAC1B,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,EAChC,GAAG,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,2CA8C7C;wBAMqD,CAAC,CAAC,EACtD,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;CAAE,KACzE,UAAU,CAAC,OAAO,iBAAiB,CAAC;AAFzC,wBAE0C"}
|