native-pytech 1.0.1
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 +21 -0
- package/README.md +30 -0
- package/dist/app/assets/components/removeCircle.d.ts +2 -0
- package/dist/app/assets/components/removeCircle.js +2 -0
- package/dist/app/assets/components/reorderThreeOutline.d.ts +2 -0
- package/dist/app/assets/components/reorderThreeOutline.js +2 -0
- package/dist/app/assets/ionicons.d.ts +2 -0
- package/dist/app/assets/ionicons.js +2 -0
- package/dist/app/components/closeButton.d.ts +2 -0
- package/dist/app/components/closeButton.js +2 -0
- package/dist/app/components/gradient.d.ts +2 -0
- package/dist/app/components/gradient.js +2 -0
- package/dist/app/components/link.d.ts +2 -0
- package/dist/app/components/link.js +2 -0
- package/dist/app/components/text.d.ts +2 -0
- package/dist/app/components/text.js +2 -0
- package/dist/app/components/theme.d.ts +2 -0
- package/dist/app/components/theme.js +2 -0
- package/dist/app/constants/colors.d.ts +2 -0
- package/dist/app/constants/colors.js +2 -0
- package/dist/app/constants/consts.d.ts +1 -0
- package/dist/app/constants/consts.js +1 -0
- package/dist/app/constants/handleFontObserver.d.ts +2 -0
- package/dist/app/constants/handleFontObserver.js +2 -0
- package/dist/app/constants/hooks.d.ts +1 -0
- package/dist/app/constants/hooks.js +1 -0
- package/dist/app/constants/utils.d.ts +1 -0
- package/dist/app/constants/utils.js +1 -0
- package/dist/app/footer.d.ts +2 -0
- package/dist/app/footer.js +2 -0
- package/dist/app/login.d.ts +2 -0
- package/dist/app/login.js +2 -0
- package/dist/app/page.d.ts +2 -0
- package/dist/app/page.js +2 -0
- package/dist/app/providers/app.d.ts +2 -0
- package/dist/app/providers/app.js +2 -0
- package/dist/app/segmentedControl.d.ts +2 -0
- package/dist/app/segmentedControl.js +2 -0
- package/dist/app/sql.d.ts +2 -0
- package/dist/app/sql.js +2 -0
- package/dist/app/supabase.d.ts +2 -0
- package/dist/app/supabase.js +2 -0
- package/dist/app/swiftui.d.ts +1 -0
- package/dist/app/swiftui.js +1 -0
- package/dist/app/table.d.ts +2 -0
- package/dist/app/table.js +2 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/libs/assets/components/RemoveCircle.d.ts +6 -0
- package/dist/libs/assets/components/RemoveCircle.js +25 -0
- package/dist/libs/assets/components/ReorderThreeOutline.d.ts +5 -0
- package/dist/libs/assets/components/ReorderThreeOutline.js +15 -0
- package/dist/libs/assets/images/android-icon-background-nuevo.png +0 -0
- package/dist/libs/assets/images/android-icon-background.png +0 -0
- package/dist/libs/assets/images/android-icon-foreground-nuevo.png +0 -0
- package/dist/libs/assets/images/android-icon-foreground-nuevo2.png +0 -0
- package/dist/libs/assets/images/android-icon-foreground.png +0 -0
- package/dist/libs/assets/images/android-icon-monochrome.png +0 -0
- package/dist/libs/assets/images/arrow.png +0 -0
- package/dist/libs/assets/images/check.svg +1 -0
- package/dist/libs/assets/images/favicon.ico +0 -0
- package/dist/libs/assets/images/favicon.png +0 -0
- package/dist/libs/assets/images/flecha-hacia-abajo.png +0 -0
- package/dist/libs/assets/images/icon-viejo.png +0 -0
- package/dist/libs/assets/images/icon.png +0 -0
- package/dist/libs/assets/images/icono_tango.svg +1 -0
- package/dist/libs/assets/images/incoming-call.png +0 -0
- package/dist/libs/assets/images/incoming.png +0 -0
- package/dist/libs/assets/images/login.png +0 -0
- package/dist/libs/assets/images/login_apple.svg +28 -0
- package/dist/libs/assets/images/login_letras.svg +41 -0
- package/dist/libs/assets/images/login_letras_dark.svg +41 -0
- package/dist/libs/assets/images/login_sol.svg +59 -0
- package/dist/libs/assets/images/login_transparente.png +0 -0
- package/dist/libs/assets/images/logo_letras.svg +29 -0
- package/dist/libs/assets/images/logo_letras_dark.svg +29 -0
- package/dist/libs/assets/images/partial-react-logo.png +0 -0
- package/dist/libs/assets/images/pencil.png +0 -0
- package/dist/libs/assets/images/react-logo.png +0 -0
- package/dist/libs/assets/images/react-logo@2x.png +0 -0
- package/dist/libs/assets/images/react-logo@3x.png +0 -0
- package/dist/libs/assets/images/remove-circle.svg +4 -0
- package/dist/libs/assets/images/splash-icon.png +0 -0
- package/dist/libs/assets/images/test.svg +22 -0
- package/dist/libs/assets/ionicons/Ionicons.d.ts +35 -0
- package/dist/libs/assets/ionicons/Ionicons.js +16 -0
- package/dist/libs/assets/ionicons/index.d.ts +6 -0
- package/dist/libs/assets/ionicons/index.js +23 -0
- package/dist/libs/components/CloseButton.d.ts +9 -0
- package/dist/libs/components/CloseButton.js +19 -0
- package/dist/libs/components/Gradient/constants.d.ts +80 -0
- package/dist/libs/components/Gradient/constants.js +34 -0
- package/dist/libs/components/Gradient/index.d.ts +21 -0
- package/dist/libs/components/Gradient/index.js +33 -0
- package/dist/libs/components/Link.d.ts +13 -0
- package/dist/libs/components/Link.js +20 -0
- package/dist/libs/components/Text.d.ts +6 -0
- package/dist/libs/components/Text.js +11 -0
- package/dist/libs/components/Theme.d.ts +9 -0
- package/dist/libs/components/Theme.js +10 -0
- package/dist/libs/constants/colors.d.ts +218 -0
- package/dist/libs/constants/colors.js +170 -0
- package/dist/libs/constants/consts.d.ts +13 -0
- package/dist/libs/constants/consts.js +23 -0
- package/dist/libs/constants/handleFontObserver.d.ts +2 -0
- package/dist/libs/constants/handleFontObserver.js +18 -0
- package/dist/libs/constants/hooks.d.ts +5 -0
- package/dist/libs/constants/hooks.js +50 -0
- package/dist/libs/constants/utils.d.ts +10 -0
- package/dist/libs/constants/utils.js +69 -0
- package/dist/libs/footer/index.d.ts +1 -0
- package/dist/libs/footer/index.js +1 -0
- package/dist/libs/footer/src/Background/index.d.ts +4 -0
- package/dist/libs/footer/src/Background/index.ios.d.ts +4 -0
- package/dist/libs/footer/src/Background/index.ios.js +22 -0
- package/dist/libs/footer/src/Background/index.js +21 -0
- package/dist/libs/footer/src/Button/Text.d.ts +3 -0
- package/dist/libs/footer/src/Button/Text.js +18 -0
- package/dist/libs/footer/src/Button/index.d.ts +3 -0
- package/dist/libs/footer/src/Button/index.ios.d.ts +3 -0
- package/dist/libs/footer/src/Button/index.ios.js +52 -0
- package/dist/libs/footer/src/Button/index.js +55 -0
- package/dist/libs/footer/src/Button/types.d.ts +20 -0
- package/dist/libs/footer/src/Button/types.js +1 -0
- package/dist/libs/footer/src/constants.d.ts +20 -0
- package/dist/libs/footer/src/constants.js +21 -0
- package/dist/libs/footer/src/index.d.ts +3 -0
- package/dist/libs/footer/src/index.js +40 -0
- package/dist/libs/footer/src/types.d.ts +9 -0
- package/dist/libs/footer/src/types.js +1 -0
- package/dist/libs/login/index.d.ts +3 -0
- package/dist/libs/login/index.js +3 -0
- package/dist/libs/login/src/Pages/Home/index.d.ts +3 -0
- package/dist/libs/login/src/Pages/Home/index.js +20 -0
- package/dist/libs/login/src/Pages/Home/types.d.ts +19 -0
- package/dist/libs/login/src/Pages/Home/types.js +1 -0
- package/dist/libs/login/src/Pages/Perfil.d.ts +5 -0
- package/dist/libs/login/src/Pages/Perfil.js +19 -0
- package/dist/libs/login/src/Pages/SignIn/Form/Input.d.ts +9 -0
- package/dist/libs/login/src/Pages/SignIn/Form/Input.js +10 -0
- package/dist/libs/login/src/Pages/SignIn/Form/index.d.ts +6 -0
- package/dist/libs/login/src/Pages/SignIn/Form/index.js +34 -0
- package/dist/libs/login/src/Pages/SignIn/index.d.ts +3 -0
- package/dist/libs/login/src/Pages/SignIn/index.js +149 -0
- package/dist/libs/login/src/Pages/SignIn/types.d.ts +31 -0
- package/dist/libs/login/src/Pages/SignIn/types.js +1 -0
- package/dist/libs/login/src/Pages/index.d.ts +3 -0
- package/dist/libs/login/src/Pages/index.js +3 -0
- package/dist/libs/login/src/Pages/utils.d.ts +20 -0
- package/dist/libs/login/src/Pages/utils.js +49 -0
- package/dist/libs/login/src/Screen/Container.d.ts +4 -0
- package/dist/libs/login/src/Screen/Container.ios.d.ts +4 -0
- package/dist/libs/login/src/Screen/Container.ios.js +20 -0
- package/dist/libs/login/src/Screen/Container.js +25 -0
- package/dist/libs/login/src/Screen/components/Gradient.d.ts +6 -0
- package/dist/libs/login/src/Screen/components/Gradient.js +23 -0
- package/dist/libs/login/src/Screen/components/Input/index.d.ts +4 -0
- package/dist/libs/login/src/Screen/components/Input/index.js +128 -0
- package/dist/libs/login/src/Screen/components/Input/types.d.ts +46 -0
- package/dist/libs/login/src/Screen/components/Input/types.js +1 -0
- package/dist/libs/login/src/Screen/components/SvgLogoPytech.d.ts +4 -0
- package/dist/libs/login/src/Screen/components/SvgLogoPytech.js +11 -0
- package/dist/libs/login/src/Screen/components/SvgPytech.d.ts +4 -0
- package/dist/libs/login/src/Screen/components/SvgPytech.js +11 -0
- package/dist/libs/login/src/Screen/components/index.d.ts +4 -0
- package/dist/libs/login/src/Screen/components/index.js +4 -0
- package/dist/libs/login/src/Screen/index.d.ts +4 -0
- package/dist/libs/login/src/Screen/index.js +59 -0
- package/dist/libs/login/src/Screen/types.d.ts +14 -0
- package/dist/libs/login/src/Screen/types.js +1 -0
- package/dist/libs/login/src/constants.d.ts +98 -0
- package/dist/libs/login/src/constants.js +48 -0
- package/dist/libs/page/index.d.ts +1 -0
- package/dist/libs/page/index.js +1 -0
- package/dist/libs/page/src/components/Page/index.android.d.ts +4 -0
- package/dist/libs/page/src/components/Page/index.android.js +11 -0
- package/dist/libs/page/src/components/Page/index.d.ts +4 -0
- package/dist/libs/page/src/components/Page/index.js +7 -0
- package/dist/libs/page/src/components/PageWrapper/index.d.ts +6 -0
- package/dist/libs/page/src/components/PageWrapper/index.js +13 -0
- package/dist/libs/page/src/components/PageWrapper/types.d.ts +16 -0
- package/dist/libs/page/src/components/PageWrapper/types.js +1 -0
- package/dist/libs/page/src/components/Subtitle.d.ts +5 -0
- package/dist/libs/page/src/components/Subtitle.js +9 -0
- package/dist/libs/page/src/components/WithIcon/index.d.ts +3 -0
- package/dist/libs/page/src/components/WithIcon/index.js +47 -0
- package/dist/libs/page/src/components/WithIcon/types.d.ts +15 -0
- package/dist/libs/page/src/components/WithIcon/types.js +1 -0
- package/dist/libs/page/src/constants.d.ts +12 -0
- package/dist/libs/page/src/constants.js +12 -0
- package/dist/libs/providers/App/index.d.ts +10 -0
- package/dist/libs/providers/App/index.js +62 -0
- package/dist/libs/providers/App/types.d.ts +35 -0
- package/dist/libs/providers/App/types.js +1 -0
- package/dist/libs/providers/constants.d.ts +10 -0
- package/dist/libs/providers/constants.js +10 -0
- package/dist/libs/segmentedControl/index.d.ts +2 -0
- package/dist/libs/segmentedControl/index.js +2 -0
- package/dist/libs/segmentedControl/src/colors.d.ts +15 -0
- package/dist/libs/segmentedControl/src/colors.js +16 -0
- package/dist/libs/segmentedControl/src/components/AnimatedChip/index.d.ts +4 -0
- package/dist/libs/segmentedControl/src/components/AnimatedChip/index.js +79 -0
- package/dist/libs/segmentedControl/src/components/AnimatedChip/types.d.ts +28 -0
- package/dist/libs/segmentedControl/src/components/AnimatedChip/types.js +1 -0
- package/dist/libs/segmentedControl/src/components/Container/index.d.ts +4 -0
- package/dist/libs/segmentedControl/src/components/Container/index.ios.d.ts +4 -0
- package/dist/libs/segmentedControl/src/components/Container/index.ios.js +15 -0
- package/dist/libs/segmentedControl/src/components/Container/index.js +18 -0
- package/dist/libs/segmentedControl/src/components/Container/types.d.ts +16 -0
- package/dist/libs/segmentedControl/src/components/Container/types.js +1 -0
- package/dist/libs/segmentedControl/src/components/Item/index.d.ts +4 -0
- package/dist/libs/segmentedControl/src/components/Item/index.js +26 -0
- package/dist/libs/segmentedControl/src/components/Item/types.d.ts +20 -0
- package/dist/libs/segmentedControl/src/components/Item/types.js +1 -0
- package/dist/libs/segmentedControl/src/components/Segmented/index.d.ts +4 -0
- package/dist/libs/segmentedControl/src/components/Segmented/index.js +93 -0
- package/dist/libs/segmentedControl/src/components/Segmented/types.d.ts +12 -0
- package/dist/libs/segmentedControl/src/components/Segmented/types.js +1 -0
- package/dist/libs/segmentedControl/src/components/Wrapper/index.d.ts +4 -0
- package/dist/libs/segmentedControl/src/components/Wrapper/index.js +21 -0
- package/dist/libs/segmentedControl/src/components/Wrapper/types.d.ts +38 -0
- package/dist/libs/segmentedControl/src/components/Wrapper/types.js +1 -0
- package/dist/libs/segmentedControl/src/context/shared.d.ts +11 -0
- package/dist/libs/segmentedControl/src/context/shared.js +13 -0
- package/dist/libs/segmentedControl/src/utils.d.ts +10 -0
- package/dist/libs/segmentedControl/src/utils.js +29 -0
- package/dist/libs/sql/index.d.ts +4 -0
- package/dist/libs/sql/index.js +4 -0
- package/dist/libs/sql/src/init.d.ts +24 -0
- package/dist/libs/sql/src/init.js +31 -0
- package/dist/libs/sql/src/queryLocal.d.ts +6 -0
- package/dist/libs/sql/src/queryLocal.js +15 -0
- package/dist/libs/sql/src/utils.d.ts +11 -0
- package/dist/libs/sql/src/utils.js +56 -0
- package/dist/libs/supabase/index.d.ts +4 -0
- package/dist/libs/supabase/index.js +2 -0
- package/dist/libs/supabase/src/clients/admin/config.d.ts +2 -0
- package/dist/libs/supabase/src/clients/admin/config.js +18 -0
- package/dist/libs/supabase/src/clients/admin/index.d.ts +8 -0
- package/dist/libs/supabase/src/clients/admin/index.js +7 -0
- package/dist/libs/supabase/src/clients/admin/utils.d.ts +4 -0
- package/dist/libs/supabase/src/clients/admin/utils.js +5 -0
- package/dist/libs/supabase/src/clients/app/config.d.ts +3 -0
- package/dist/libs/supabase/src/clients/app/config.js +30 -0
- package/dist/libs/supabase/src/clients/app/index.d.ts +15 -0
- package/dist/libs/supabase/src/clients/app/index.js +7 -0
- package/dist/libs/supabase/src/clients/app/utils.d.ts +11 -0
- package/dist/libs/supabase/src/clients/app/utils.js +9 -0
- package/dist/libs/supabase/src/utils/index.d.ts +18 -0
- package/dist/libs/supabase/src/utils/index.js +21 -0
- package/dist/libs/supabase/src/utils/types.d.ts +20 -0
- package/dist/libs/supabase/src/utils/types.js +1 -0
- package/dist/libs/swiftui/index.d.ts +7 -0
- package/dist/libs/swiftui/index.js +7 -0
- package/dist/libs/swiftui/src/Icon.d.ts +10 -0
- package/dist/libs/swiftui/src/Icon.js +8 -0
- package/dist/libs/swiftui/src/IconSection/Icon.d.ts +27 -0
- package/dist/libs/swiftui/src/IconSection/Icon.js +31 -0
- package/dist/libs/swiftui/src/IconSection/Section.d.ts +7 -0
- package/dist/libs/swiftui/src/IconSection/Section.js +16 -0
- package/dist/libs/swiftui/src/IconSection/index.d.ts +7 -0
- package/dist/libs/swiftui/src/IconSection/index.js +5 -0
- package/dist/libs/swiftui/src/List/Editable/index.d.ts +5 -0
- package/dist/libs/swiftui/src/List/Editable/index.js +51 -0
- package/dist/libs/swiftui/src/List/Editable/types.d.ts +76 -0
- package/dist/libs/swiftui/src/List/Editable/types.js +1 -0
- package/dist/libs/swiftui/src/List/index.d.ts +16 -0
- package/dist/libs/swiftui/src/List/index.js +21 -0
- package/dist/libs/swiftui/src/NavigationLink/Trailing.d.ts +4 -0
- package/dist/libs/swiftui/src/NavigationLink/Trailing.js +14 -0
- package/dist/libs/swiftui/src/NavigationLink/index.d.ts +4 -0
- package/dist/libs/swiftui/src/NavigationLink/index.js +20 -0
- package/dist/libs/swiftui/src/NavigationLink/types.d.ts +27 -0
- package/dist/libs/swiftui/src/NavigationLink/types.js +1 -0
- package/dist/libs/swiftui/src/Picker.d.ts +11 -0
- package/dist/libs/swiftui/src/Picker.js +11 -0
- package/dist/libs/swiftui/src/Text.d.ts +6 -0
- package/dist/libs/swiftui/src/Text.js +7 -0
- package/dist/libs/swiftui/src/TextSubtitle.d.ts +22 -0
- package/dist/libs/swiftui/src/TextSubtitle.js +9 -0
- package/dist/libs/table/index.d.ts +5 -0
- package/dist/libs/table/index.js +5 -0
- package/dist/libs/table/src/components/Borders.d.ts +6 -0
- package/dist/libs/table/src/components/Borders.js +83 -0
- package/dist/libs/table/src/components/Delete/index.d.ts +4 -0
- package/dist/libs/table/src/components/Delete/index.js +141 -0
- package/dist/libs/table/src/components/Delete/types.d.ts +27 -0
- package/dist/libs/table/src/components/Delete/types.js +1 -0
- package/dist/libs/table/src/components/Detail.d.ts +4 -0
- package/dist/libs/table/src/components/Detail.js +11 -0
- package/dist/libs/table/src/components/Option/index.d.ts +6 -0
- package/dist/libs/table/src/components/Option/index.js +106 -0
- package/dist/libs/table/src/components/Option/types.d.ts +61 -0
- package/dist/libs/table/src/components/Option/types.js +1 -0
- package/dist/libs/table/src/components/OptionComponents/deleteIcon.d.ts +6 -0
- package/dist/libs/table/src/components/OptionComponents/deleteIcon.js +14 -0
- package/dist/libs/table/src/components/OptionComponents/dragIcon.d.ts +6 -0
- package/dist/libs/table/src/components/OptionComponents/dragIcon.js +18 -0
- package/dist/libs/table/src/components/OptionComponents/icon.d.ts +10 -0
- package/dist/libs/table/src/components/OptionComponents/icon.js +12 -0
- package/dist/libs/table/src/components/OptionComponents/image.d.ts +9 -0
- package/dist/libs/table/src/components/OptionComponents/image.js +12 -0
- package/dist/libs/table/src/components/OptionComponents/index.d.ts +8 -0
- package/dist/libs/table/src/components/OptionComponents/index.js +8 -0
- package/dist/libs/table/src/components/OptionComponents/text.d.ts +16 -0
- package/dist/libs/table/src/components/OptionComponents/text.js +20 -0
- package/dist/libs/table/src/components/OptionComponents/textInput.d.ts +25 -0
- package/dist/libs/table/src/components/OptionComponents/textInput.js +49 -0
- package/dist/libs/table/src/components/OptionComponents/textInputCurrency.d.ts +9 -0
- package/dist/libs/table/src/components/OptionComponents/textInputCurrency.js +17 -0
- package/dist/libs/table/src/components/OptionComponents/textView.d.ts +14 -0
- package/dist/libs/table/src/components/OptionComponents/textView.js +18 -0
- package/dist/libs/table/src/components/OptionWrapper/index.d.ts +3 -0
- package/dist/libs/table/src/components/OptionWrapper/index.js +9 -0
- package/dist/libs/table/src/components/OptionWrapper/types.d.ts +35 -0
- package/dist/libs/table/src/components/OptionWrapper/types.js +1 -0
- package/dist/libs/table/src/components/Table/index.d.ts +3 -0
- package/dist/libs/table/src/components/Table/index.js +90 -0
- package/dist/libs/table/src/components/Table/types.d.ts +70 -0
- package/dist/libs/table/src/components/Table/types.js +1 -0
- package/dist/libs/table/src/components/Wrapper.d.ts +4 -0
- package/dist/libs/table/src/components/Wrapper.js +49 -0
- package/dist/libs/table/src/constants.d.ts +108 -0
- package/dist/libs/table/src/constants.js +107 -0
- package/dist/libs/table/src/context/borders.d.ts +10 -0
- package/dist/libs/table/src/context/borders.js +11 -0
- package/dist/libs/table/src/context/delete.d.ts +1 -0
- package/dist/libs/table/src/context/delete.js +2 -0
- package/dist/libs/table/src/context/table.d.ts +21 -0
- package/dist/libs/table/src/context/table.js +4 -0
- package/package.json +73 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { batch } from '@legendapp/state';
|
|
2
|
+
import { useSelector } from '@legendapp/state/react';
|
|
3
|
+
import React, { memo, useCallback, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { Animated, Easing, Platform, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
5
|
+
import Reanimated, { Easing as Reasing, SlideOutLeft } from 'react-native-reanimated';
|
|
6
|
+
import { useLayoutEffectWithoutFirstRender } from '../../../../../libs/constants/hooks';
|
|
7
|
+
import { isLowTier } from '../../../../../libs/constants/consts';
|
|
8
|
+
import colors from '../../constants';
|
|
9
|
+
import { useStore } from '../../context/table';
|
|
10
|
+
import { DeleteProvider } from '../../context/delete';
|
|
11
|
+
const anim = {
|
|
12
|
+
duration: 600,
|
|
13
|
+
easing: Easing.bezier(0.2, 0.2, 0, 1),
|
|
14
|
+
useNativeDriver: true,
|
|
15
|
+
};
|
|
16
|
+
export default memo(({ children, ...props }) => {
|
|
17
|
+
const [deleted, setDeleted] = useState(false);
|
|
18
|
+
if (deleted)
|
|
19
|
+
return null;
|
|
20
|
+
return <Component {...props} setDeleted={setDeleted}>{children}</Component>;
|
|
21
|
+
});
|
|
22
|
+
const Component = memo(({ children, id, removeWidth, onDelete, onDeleteShown, setDeleted, }) => {
|
|
23
|
+
const store = useStore();
|
|
24
|
+
const is_deleted = useSelector(() => store.deleted.id.get() === id);
|
|
25
|
+
useLayoutEffectWithoutFirstRender(() => {
|
|
26
|
+
if (is_deleted)
|
|
27
|
+
return;
|
|
28
|
+
onDeleteShown?.(id, false);
|
|
29
|
+
removeStateValue.stopAnimation();
|
|
30
|
+
Animated.timing(removeStateValue, { toValue: 0, ...anim }).start();
|
|
31
|
+
}, [is_deleted]);
|
|
32
|
+
const removeStateValue = useRef(new Animated.Value(0)).current;
|
|
33
|
+
const [widthRemove, setWidthRemove] = useState(removeWidth ? removeWidth + (12 * 2) : 0);
|
|
34
|
+
const animatedRemoveStyle = {
|
|
35
|
+
opacity: removeStateValue.interpolate({
|
|
36
|
+
inputRange: [0, 1],
|
|
37
|
+
outputRange: [0, 1]
|
|
38
|
+
}),
|
|
39
|
+
transform: [
|
|
40
|
+
{
|
|
41
|
+
translateX: removeStateValue.interpolate({
|
|
42
|
+
inputRange: [0, 1],
|
|
43
|
+
outputRange: [-widthRemove, 0]
|
|
44
|
+
})
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
scale: removeStateValue.interpolate({
|
|
48
|
+
inputRange: [0, 1],
|
|
49
|
+
outputRange: [0, 1]
|
|
50
|
+
}),
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
};
|
|
54
|
+
const animatedStyle = {
|
|
55
|
+
transform: [{
|
|
56
|
+
translateX: removeStateValue.interpolate({
|
|
57
|
+
inputRange: [0, 1],
|
|
58
|
+
outputRange: [0, -widthRemove]
|
|
59
|
+
})
|
|
60
|
+
}]
|
|
61
|
+
};
|
|
62
|
+
const onLayputProps = removeWidth ? {} : { onLayout: (e) => setWidthRemove(e.nativeEvent.layout.width) };
|
|
63
|
+
const styleWidthRemove = removeWidth ? { width: removeWidth } : {};
|
|
64
|
+
// Función que los children pueden llamar para iniciar el delete
|
|
65
|
+
const startDelete = useCallback(() => {
|
|
66
|
+
if (store.deleted.setted.peek())
|
|
67
|
+
return;
|
|
68
|
+
store.deleted.id.set(id);
|
|
69
|
+
removeStateValue.stopAnimation();
|
|
70
|
+
Animated.timing(removeStateValue, { toValue: 1, ...anim }).start();
|
|
71
|
+
onDeleteShown?.(id, true);
|
|
72
|
+
}, []);
|
|
73
|
+
const exitingAnimation = isLowTier ? SlideOutLeft.duration(200) : SlideOutLeft.easing(Reasing.bezier(0.2, 0.2, 0, 1)).duration(300);
|
|
74
|
+
// Valor del contexto
|
|
75
|
+
const contextValue = useMemo(() => startDelete, [startDelete]);
|
|
76
|
+
const start = useCallback(() => {
|
|
77
|
+
if (store.deleted.id.peek() === null)
|
|
78
|
+
return;
|
|
79
|
+
store.deleted.setted.set(true);
|
|
80
|
+
store.deleted.id.set(null);
|
|
81
|
+
}, []);
|
|
82
|
+
const end = useCallback(() => { store.deleted.setted.set(false); }, []);
|
|
83
|
+
const viewProps = useMemo(() => (Platform.OS === 'web' ?
|
|
84
|
+
{
|
|
85
|
+
onPointerDown: start,
|
|
86
|
+
onPointerUp: end,
|
|
87
|
+
} : {
|
|
88
|
+
onTouchStart: start,
|
|
89
|
+
onTouchEnd: end,
|
|
90
|
+
}), []);
|
|
91
|
+
return (<>
|
|
92
|
+
<Pressable style={[styles.pressableRemove]} {...onLayputProps} onPress={() => {
|
|
93
|
+
removeStateValue.stopAnimation();
|
|
94
|
+
setDeleted(true);
|
|
95
|
+
onDelete?.(id);
|
|
96
|
+
const oldKeys = store.deleted.keys.peek();
|
|
97
|
+
const newKeys = oldKeys?.filter((key) => key !== id);
|
|
98
|
+
batch(() => {
|
|
99
|
+
store.deleted.keys.set(newKeys);
|
|
100
|
+
store.deleted.id.set(null);
|
|
101
|
+
});
|
|
102
|
+
}}>
|
|
103
|
+
<Animated.View style={[animatedRemoveStyle, styles.containerRemove, styleWidthRemove]}>
|
|
104
|
+
<Text style={styles.text}>Eliminar</Text>
|
|
105
|
+
</Animated.View>
|
|
106
|
+
</Pressable>
|
|
107
|
+
|
|
108
|
+
<Animated.View style={[{ position: 'relative' }, animatedStyle]}>
|
|
109
|
+
<Reanimated.View exiting={exitingAnimation}>
|
|
110
|
+
<View {...viewProps}>
|
|
111
|
+
<DeleteProvider value={contextValue}>
|
|
112
|
+
{children}
|
|
113
|
+
</DeleteProvider>
|
|
114
|
+
</View>
|
|
115
|
+
</Reanimated.View>
|
|
116
|
+
</Animated.View>
|
|
117
|
+
</>);
|
|
118
|
+
}, (prev, next) => prev.id === next.id);
|
|
119
|
+
const styles = StyleSheet.create({
|
|
120
|
+
pressableRemove: {
|
|
121
|
+
position: 'absolute',
|
|
122
|
+
right: 0,
|
|
123
|
+
top: 0,
|
|
124
|
+
bottom: 0,
|
|
125
|
+
flex: 1
|
|
126
|
+
},
|
|
127
|
+
containerRemove: {
|
|
128
|
+
paddingHorizontal: 12,
|
|
129
|
+
backgroundColor: colors.especiales.rojo,
|
|
130
|
+
margin: 6,
|
|
131
|
+
marginHorizontal: 10,
|
|
132
|
+
flex: 1,
|
|
133
|
+
borderRadius: 16,
|
|
134
|
+
justifyContent: 'center',
|
|
135
|
+
alignItems: 'center'
|
|
136
|
+
},
|
|
137
|
+
text: {
|
|
138
|
+
fontSize: 13,
|
|
139
|
+
color: 'white'
|
|
140
|
+
}
|
|
141
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface DeleteProps {
|
|
3
|
+
/**
|
|
4
|
+
Opcion que se renderiza dentro del context.
|
|
5
|
+
*/
|
|
6
|
+
children: React.ReactElement | React.ReactElement[] | null;
|
|
7
|
+
/**
|
|
8
|
+
Id de la opción.
|
|
9
|
+
*/
|
|
10
|
+
id: string;
|
|
11
|
+
/**
|
|
12
|
+
Ancho del botón de eliminar.
|
|
13
|
+
*/
|
|
14
|
+
removeWidth?: number;
|
|
15
|
+
/**
|
|
16
|
+
Función que se ejecuta al eliminar la opción.
|
|
17
|
+
*/
|
|
18
|
+
onDelete?: ((key: string) => void) | undefined;
|
|
19
|
+
/**
|
|
20
|
+
Función que se ejecuta para indicar que el componente se ha eliminado.
|
|
21
|
+
*/
|
|
22
|
+
onDeleteShown?: ((id: string, isDeleted: boolean) => void) | undefined;
|
|
23
|
+
/**
|
|
24
|
+
Función que se ejecuta para indicar que el componente se ha eliminado.
|
|
25
|
+
*/
|
|
26
|
+
setDeleted: (deleted: boolean) => void;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { memo } from "react";
|
|
2
|
+
import { Text } from "react-native";
|
|
3
|
+
import { useApp } from '../../../../libs/providers/App';
|
|
4
|
+
import colors from "../constants";
|
|
5
|
+
export default memo(({ text }) => {
|
|
6
|
+
const { colorScheme } = useApp();
|
|
7
|
+
const Theme = colors.theme[colorScheme];
|
|
8
|
+
return (<Text style={{ color: Theme.text2, fontSize: 13, lineHeight: 16 }}>
|
|
9
|
+
{text}
|
|
10
|
+
</Text>);
|
|
11
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Props from './types';
|
|
3
|
+
export declare const left = 16;
|
|
4
|
+
export declare const right = 16;
|
|
5
|
+
declare const _default: React.MemoExoticComponent<({ children, childrenLeft, childrenRight, onPress, style, backgroundColorPressed, LinearGradientProps, colorScheme, hasTextView, }: Props) => React.JSX.Element>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { LinearGradient } from 'expo-linear-gradient';
|
|
2
|
+
import React, { memo, useCallback, useMemo } from 'react';
|
|
3
|
+
import { Pressable, StyleSheet, View } from 'react-native';
|
|
4
|
+
import colors from '../../constants';
|
|
5
|
+
import Table from '../Table';
|
|
6
|
+
import { useTable } from '../../context/table';
|
|
7
|
+
export const left = 16;
|
|
8
|
+
export const right = 16;
|
|
9
|
+
const flattenChildren = (children) => {
|
|
10
|
+
return React.Children.toArray(children).flatMap((child) => {
|
|
11
|
+
if (React.isValidElement(child) && child.type === React.Fragment) {
|
|
12
|
+
const props = child.props;
|
|
13
|
+
return flattenChildren(props.children);
|
|
14
|
+
}
|
|
15
|
+
return [child];
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
const AddTextView = memo(({ children, hasTextView }) => {
|
|
19
|
+
const hasTextView_ = hasTextView ?? flattenChildren(children).some((child) => React.isValidElement(child) && child.type === Table.Option.Components.TextView);
|
|
20
|
+
const viewChildren = useCallback((children) => <View style={styles.izq}>{children}</View>, []);
|
|
21
|
+
if (hasTextView_)
|
|
22
|
+
return viewChildren(children);
|
|
23
|
+
return (viewChildren(<Table.Option.Components.TextView>
|
|
24
|
+
{children}
|
|
25
|
+
</Table.Option.Components.TextView>));
|
|
26
|
+
});
|
|
27
|
+
export default memo(({ children, childrenLeft, childrenRight, onPress, style, backgroundColorPressed, LinearGradientProps, colorScheme, hasTextView, }) => {
|
|
28
|
+
// Component
|
|
29
|
+
const content = <>
|
|
30
|
+
{childrenLeft && <AddTextView hasTextView={hasTextView}>{childrenLeft}</AddTextView>}
|
|
31
|
+
{childrenRight && <View style={styles.der}>{childrenRight}</View>}
|
|
32
|
+
{children}
|
|
33
|
+
</>;
|
|
34
|
+
const styleView = useMemo(() => [styles.Item_View, style], [style]);
|
|
35
|
+
const childrenOption = onPress === undefined ? <View style={styleView}>{content}</View>
|
|
36
|
+
: (backgroundColorPressed ? (<Pressable onPress={onPress} style={({ pressed }) => !pressed ? styleView : [styleView, { backgroundColor: backgroundColorPressed }]}>
|
|
37
|
+
{content}
|
|
38
|
+
</Pressable>) : (<PressableView onPress={onPress} colorScheme={colorScheme} styleView={styleView}>
|
|
39
|
+
{content}
|
|
40
|
+
</PressableView>));
|
|
41
|
+
return (LinearGradientProps ?
|
|
42
|
+
<LinearGradient {...LinearGradientProps}>
|
|
43
|
+
{childrenOption}
|
|
44
|
+
</LinearGradient>
|
|
45
|
+
: childrenOption);
|
|
46
|
+
});
|
|
47
|
+
const PressableView = memo(({ children, onPress, colorScheme, styleView }) => {
|
|
48
|
+
const { colorThemeType } = useTable();
|
|
49
|
+
const backgroundColorPressed = colors.table[colorThemeType][colorScheme].background_pressed;
|
|
50
|
+
return (<Pressable onPress={onPress} style={({ pressed }) => !pressed ? styleView : [styleView, { backgroundColor: backgroundColorPressed }]}>
|
|
51
|
+
{children}
|
|
52
|
+
</Pressable>);
|
|
53
|
+
});
|
|
54
|
+
/*
|
|
55
|
+
const pressableChildren = useCallback(({ pressed }: { pressed: boolean }) => (
|
|
56
|
+
<>
|
|
57
|
+
{!pressed ?
|
|
58
|
+
<NotPressedView /> :
|
|
59
|
+
<OnPressView backgroundColorPressed={backgroundColorPressed} colorScheme={colorScheme} />
|
|
60
|
+
}
|
|
61
|
+
{content}
|
|
62
|
+
</>
|
|
63
|
+
), [backgroundColorPressed, content, colorScheme])
|
|
64
|
+
|
|
65
|
+
const NotPressedView = memo(() => <View style={styles.onPressView} />)
|
|
66
|
+
const OnPressView = memo(({ backgroundColorPressed, colorScheme }: { backgroundColorPressed: OptionProps['backgroundColorPressed'], colorScheme: ColorSchemeType }) => {
|
|
67
|
+
const { colorThemeType } = useTable()
|
|
68
|
+
return <View style={[styles.onPressView, { backgroundColor: backgroundColorPressed ? backgroundColorPressed : Colors.table[colorThemeType][colorScheme].background_pressed }]} />
|
|
69
|
+
|
|
70
|
+
})
|
|
71
|
+
*/
|
|
72
|
+
//(20.3 - 0.5) / 2 = 9.9
|
|
73
|
+
//const paddingVertical = (24.1 - paddingTopItem - gap) / 2
|
|
74
|
+
const styles = StyleSheet.create({
|
|
75
|
+
Item_View: {
|
|
76
|
+
flex: 1,
|
|
77
|
+
paddingLeft: left,
|
|
78
|
+
paddingRight: right,
|
|
79
|
+
flexDirection: 'row',
|
|
80
|
+
alignItems: 'center',
|
|
81
|
+
justifyContent: 'center',
|
|
82
|
+
gap: 10
|
|
83
|
+
},
|
|
84
|
+
izq: {
|
|
85
|
+
marginRight: 'auto',
|
|
86
|
+
flex: 1,
|
|
87
|
+
flexDirection: 'row',
|
|
88
|
+
alignItems: 'center',
|
|
89
|
+
gap: 11,
|
|
90
|
+
//paddingBottom: 2,
|
|
91
|
+
},
|
|
92
|
+
der: {
|
|
93
|
+
marginLeft: 'auto',
|
|
94
|
+
flexDirection: 'row',
|
|
95
|
+
alignItems: 'center',
|
|
96
|
+
gap: 11
|
|
97
|
+
},
|
|
98
|
+
onPressView: {
|
|
99
|
+
position: 'absolute',
|
|
100
|
+
top: -1,
|
|
101
|
+
left: 0,
|
|
102
|
+
right: 0,
|
|
103
|
+
bottom: 0,
|
|
104
|
+
backgroundColor: 'transparent'
|
|
105
|
+
}
|
|
106
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { LinearGradientProps } from 'expo-linear-gradient';
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { GestureResponderEvent, StyleProp, ViewStyle } from "react-native";
|
|
4
|
+
import { LinearTransition } from "react-native-reanimated";
|
|
5
|
+
import { type ColorSchemeType } from "../../constants";
|
|
6
|
+
type Props = {
|
|
7
|
+
/**
|
|
8
|
+
Lo que se va a renderizar dentro de la opción.
|
|
9
|
+
*/
|
|
10
|
+
children?: React.ReactElement;
|
|
11
|
+
/**
|
|
12
|
+
Lo que se va a renderizar dentro de la view de la izquierda.
|
|
13
|
+
*/
|
|
14
|
+
childrenLeft?: React.ReactElement | null;
|
|
15
|
+
/**
|
|
16
|
+
Lo que se va a renderizar dentro de la view de la derecha.
|
|
17
|
+
*/
|
|
18
|
+
childrenRight?: React.ReactElement | null;
|
|
19
|
+
/**
|
|
20
|
+
Función que se ejecuta al presionar la opción.
|
|
21
|
+
*/
|
|
22
|
+
onPress?: ((event: GestureResponderEvent) => void) | undefined;
|
|
23
|
+
/**
|
|
24
|
+
Función que se ejecuta al eliminar la opción.
|
|
25
|
+
*/
|
|
26
|
+
onDelete?: ((key: string) => void) | undefined;
|
|
27
|
+
/**
|
|
28
|
+
Función que se ejecuta para indicar que el componente se ha eliminado.
|
|
29
|
+
*/
|
|
30
|
+
onDeleteShown?: ((id: string, isDeleted: boolean) => void) | undefined;
|
|
31
|
+
/**
|
|
32
|
+
Ancho del botón de eliminar.
|
|
33
|
+
*/
|
|
34
|
+
removeWidth?: number;
|
|
35
|
+
/**
|
|
36
|
+
Estilos de la opción.
|
|
37
|
+
Es un Animated.View.
|
|
38
|
+
*/
|
|
39
|
+
style?: StyleProp<ViewStyle>;
|
|
40
|
+
/**
|
|
41
|
+
Color de fondo de la opción cuando está presionada.
|
|
42
|
+
*/
|
|
43
|
+
backgroundColorPressed?: string;
|
|
44
|
+
/**
|
|
45
|
+
Props para el LinearGradient.
|
|
46
|
+
*/
|
|
47
|
+
LinearGradientProps?: LinearGradientProps;
|
|
48
|
+
/**
|
|
49
|
+
LayoutAnimation de la opción.
|
|
50
|
+
*/
|
|
51
|
+
layoutAnimation?: LinearTransition;
|
|
52
|
+
/**
|
|
53
|
+
Indica si la opción tiene un TextView en el childrenLeft.
|
|
54
|
+
*/
|
|
55
|
+
hasTextView?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Color del tema de la opción.
|
|
58
|
+
*/
|
|
59
|
+
colorScheme: ColorSchemeType;
|
|
60
|
+
};
|
|
61
|
+
export default Props;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { Pressable } from 'react-native';
|
|
3
|
+
import { useDelete } from '../../context/delete';
|
|
4
|
+
import RemoveCircle from '../../../../../libs/assets/components/RemoveCircle';
|
|
5
|
+
import colors from '../../constants';
|
|
6
|
+
/**
|
|
7
|
+
Icono de eliminar.
|
|
8
|
+
*/
|
|
9
|
+
export default memo(() => {
|
|
10
|
+
const startDelete = useDelete();
|
|
11
|
+
return (<Pressable onPress={() => startDelete()}>
|
|
12
|
+
<RemoveCircle size={30} color={colors.especiales.rojo} insideColor='white'/>
|
|
13
|
+
</Pressable>);
|
|
14
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
2
|
+
import React, { memo } from 'react';
|
|
3
|
+
import { Pressable } from 'react-native';
|
|
4
|
+
//import { useDrag } from 'libs/ReorderableList'
|
|
5
|
+
import colors from '../../constants';
|
|
6
|
+
import { useApp } from '../../../../../libs/providers/App';
|
|
7
|
+
/**
|
|
8
|
+
Icono de drag.
|
|
9
|
+
*/
|
|
10
|
+
export default memo(() => {
|
|
11
|
+
const { colorScheme } = useApp();
|
|
12
|
+
const Theme = colors.theme[colorScheme];
|
|
13
|
+
//const pressableProps = useDrag() as unknown as PressableProps
|
|
14
|
+
const pressableProps = {};
|
|
15
|
+
return (<Pressable {...pressableProps}>
|
|
16
|
+
<Ionicons name='menu-outline' size={28} color={Theme.borderColorContCliente}/>
|
|
17
|
+
</Pressable>);
|
|
18
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
Pone el color según el tema.
|
|
5
|
+
*/
|
|
6
|
+
declare const _default: React.MemoExoticComponent<({ name, size }: {
|
|
7
|
+
name: keyof typeof Ionicons.glyphMap;
|
|
8
|
+
size: number;
|
|
9
|
+
}) => React.JSX.Element>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
2
|
+
import React, { memo } from 'react';
|
|
3
|
+
import colors from '../../constants';
|
|
4
|
+
import { useApp } from '../../../../../libs/providers/App';
|
|
5
|
+
/**
|
|
6
|
+
Pone el color según el tema.
|
|
7
|
+
*/
|
|
8
|
+
export default memo(({ name, size = 30 }) => {
|
|
9
|
+
const { colorScheme } = useApp();
|
|
10
|
+
const Theme = colors.theme[colorScheme];
|
|
11
|
+
return (<Ionicons name={name} size={size} color={Theme.icon}/>);
|
|
12
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ImageSourcePropType } from 'react-native';
|
|
3
|
+
/**
|
|
4
|
+
Pone el tintColor según el tema.
|
|
5
|
+
*/
|
|
6
|
+
declare const _default: React.MemoExoticComponent<({ source }: {
|
|
7
|
+
source: ImageSourcePropType;
|
|
8
|
+
}) => React.JSX.Element>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { Image } from 'react-native';
|
|
3
|
+
import colors from '../../constants';
|
|
4
|
+
import { useApp } from '../../../../../libs/providers/App';
|
|
5
|
+
/**
|
|
6
|
+
Pone el tintColor según el tema.
|
|
7
|
+
*/
|
|
8
|
+
export default memo(({ source }) => {
|
|
9
|
+
const { colorScheme } = useApp();
|
|
10
|
+
const Theme = colors.theme[colorScheme];
|
|
11
|
+
return (<Image source={source} style={{ width: 12.1, height: 12.1 }} tintColor={Theme.icon}/>);
|
|
12
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as DeleteIcon } from './deleteIcon';
|
|
2
|
+
export { default as DragIcon } from './dragIcon';
|
|
3
|
+
export { default as Icon } from './icon';
|
|
4
|
+
export { default as Image } from './image';
|
|
5
|
+
export { default as Text } from './text';
|
|
6
|
+
export { default as TextInput } from './textInput';
|
|
7
|
+
export { default as TextInputCurrency } from './textInputCurrency';
|
|
8
|
+
export { default as TextView } from './textView';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as DeleteIcon } from './deleteIcon';
|
|
2
|
+
export { default as DragIcon } from './dragIcon';
|
|
3
|
+
export { default as Icon } from './icon';
|
|
4
|
+
export { default as Image } from './image';
|
|
5
|
+
export { default as Text } from './text';
|
|
6
|
+
export { default as TextInput } from './textInput';
|
|
7
|
+
export { default as TextInputCurrency } from './textInputCurrency';
|
|
8
|
+
export { default as TextView } from './textView';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, TextProps, TextStyle } from 'react-native';
|
|
3
|
+
import { type ColorSchemeType } from '../../constants';
|
|
4
|
+
/**
|
|
5
|
+
Pone el color del texto según el tema.
|
|
6
|
+
*/
|
|
7
|
+
type Props = {
|
|
8
|
+
text: string;
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
fontScale?: string;
|
|
11
|
+
style: StyleProp<TextStyle>;
|
|
12
|
+
};
|
|
13
|
+
declare const _default: React.MemoExoticComponent<({ ...props }: Props & {
|
|
14
|
+
colorScheme?: ColorSchemeType;
|
|
15
|
+
} & TextProps) => React.JSX.Element>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { memo, useMemo } from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import colors from '../../constants';
|
|
4
|
+
import Text$ from '../../../../../libs/components/Text';
|
|
5
|
+
import ThemeComponent from '../../../../../libs/components/Theme';
|
|
6
|
+
export default memo(({ ...props }) => {
|
|
7
|
+
return <ThemeComponent component={Component} {...props}/>;
|
|
8
|
+
});
|
|
9
|
+
const Component = memo(({ text, enabled = true, style = {}, colorScheme, fontScale, ...props }) => {
|
|
10
|
+
const Theme = colors.theme[colorScheme];
|
|
11
|
+
const textStyle = useMemo(() => [styles.text, { color: enabled ? Theme.text : Theme.text2 }, style], [enabled, Theme, style]);
|
|
12
|
+
return (<Text$ fontScale={fontScale} style={textStyle} {...props}>
|
|
13
|
+
{text}
|
|
14
|
+
</Text$>);
|
|
15
|
+
});
|
|
16
|
+
const styles = StyleSheet.create({
|
|
17
|
+
text: {
|
|
18
|
+
fontSize: 17,
|
|
19
|
+
}
|
|
20
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BlurEvent, FocusEvent, TextInput, TextInputProps } from 'react-native';
|
|
3
|
+
export declare const selectAll: (input: TextInput | any, value: string | null) => void;
|
|
4
|
+
/**
|
|
5
|
+
Pone el color del texto según el tema y agrega unos estilos para que ocupen todo el ancho.
|
|
6
|
+
*/
|
|
7
|
+
declare const _default: React.MemoExoticComponent<({ value, numberOfLines, onFocus, onBlur, onChangeText, mask, ...props }: {
|
|
8
|
+
/**
|
|
9
|
+
Valor inicial del input.
|
|
10
|
+
*/
|
|
11
|
+
value?: any;
|
|
12
|
+
/**
|
|
13
|
+
Por default es 1.
|
|
14
|
+
*/
|
|
15
|
+
numberOfLines?: number;
|
|
16
|
+
onFocus?: ((e: FocusEvent) => void) | undefined;
|
|
17
|
+
onBlur?: ((e: BlurEvent) => void) | undefined;
|
|
18
|
+
onChangeText?: ((text: string) => void) | undefined;
|
|
19
|
+
/**
|
|
20
|
+
Función para aplicar una máscara al valor del input.
|
|
21
|
+
Ejemplo: {(value) => value ? formatPeso(value) : formatPeso(0)}
|
|
22
|
+
*/
|
|
23
|
+
mask?: ((value: any) => string) | undefined;
|
|
24
|
+
} & TextInputProps) => React.JSX.Element>;
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, { memo, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Platform, StyleSheet, TextInput } from 'react-native';
|
|
3
|
+
import colors from '../../constants';
|
|
4
|
+
import { useApp } from '../../../../../libs/providers/App';
|
|
5
|
+
export const selectAll = (input, value) => {
|
|
6
|
+
if (value === null)
|
|
7
|
+
return;
|
|
8
|
+
if (Platform.OS !== 'web')
|
|
9
|
+
input.setSelection(0, value.toString().length);
|
|
10
|
+
else
|
|
11
|
+
input.select();
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
Pone el color del texto según el tema y agrega unos estilos para que ocupen todo el ancho.
|
|
15
|
+
*/
|
|
16
|
+
export default memo(({ value, numberOfLines = 1, onFocus, onBlur, onChangeText, mask, ...props }) => {
|
|
17
|
+
const { colorScheme } = useApp();
|
|
18
|
+
const Theme = colors.theme[colorScheme];
|
|
19
|
+
const inputRef = useRef(null);
|
|
20
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
21
|
+
const [rawValue, setRawValue] = useState(value);
|
|
22
|
+
// Determinar el valor visual basado en el estado de foco
|
|
23
|
+
const displayValue = rawValue == null ? null :
|
|
24
|
+
isFocused || !mask
|
|
25
|
+
? rawValue.toString()
|
|
26
|
+
: mask(rawValue);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (isFocused)
|
|
29
|
+
selectAll(inputRef.current, rawValue);
|
|
30
|
+
}, [isFocused]);
|
|
31
|
+
return (<TextInput style={[styles.textInput, { color: Theme.text }]} ref={inputRef} numberOfLines={numberOfLines} multiline={Platform.OS === 'android'} value={displayValue == null ? '' : displayValue} selectTextOnFocus={true} onFocus={(e) => {
|
|
32
|
+
setIsFocused(true);
|
|
33
|
+
onFocus?.(e);
|
|
34
|
+
}} onBlur={(e) => {
|
|
35
|
+
setIsFocused(false);
|
|
36
|
+
onBlur?.(e);
|
|
37
|
+
}} onChangeText={(text) => {
|
|
38
|
+
setRawValue(text === '' ? null : text);
|
|
39
|
+
onChangeText?.(text);
|
|
40
|
+
}} clearButtonMode='while-editing' {...props}/>);
|
|
41
|
+
});
|
|
42
|
+
const styles = StyleSheet.create({
|
|
43
|
+
textInput: {
|
|
44
|
+
fontSize: 17,
|
|
45
|
+
flex: 1,
|
|
46
|
+
outlineStyle: 'none', // Le tuve que poner el "as any" porque no existe esta propiedad en dispositivos.
|
|
47
|
+
textAlign: 'right',
|
|
48
|
+
},
|
|
49
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextInputProps } from 'react-native';
|
|
3
|
+
export declare function formatPeso(value: number): string;
|
|
4
|
+
/**
|
|
5
|
+
Se utiliza específicamente para formatear el valor del input a pesos.
|
|
6
|
+
Utiliza el componente de TextInputOption.
|
|
7
|
+
*/
|
|
8
|
+
declare const _default: React.MemoExoticComponent<({ ...props }: TextInputProps) => React.JSX.Element>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import TextInputOption from './textInput';
|
|
3
|
+
export function formatPeso(value) {
|
|
4
|
+
return new Intl.NumberFormat('es-AR', {
|
|
5
|
+
style: 'currency',
|
|
6
|
+
currency: 'ARS',
|
|
7
|
+
minimumFractionDigits: 0, // <- no obliga decimales
|
|
8
|
+
maximumFractionDigits: 2 // <- si vienen, los respeta
|
|
9
|
+
}).format(Number(value));
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
Se utiliza específicamente para formatear el valor del input a pesos.
|
|
13
|
+
Utiliza el componente de TextInputOption.
|
|
14
|
+
*/
|
|
15
|
+
export default memo(({ ...props }) => {
|
|
16
|
+
return (<TextInputOption keyboardType='numeric' autoCapitalize='none' autoCorrect={false} placeholder={'$0'} mask={(value) => value ? formatPeso(value) : formatPeso(0)} {...props}/>);
|
|
17
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
|
3
|
+
import Text from './text';
|
|
4
|
+
type TextType = (React.ReactElement<typeof Text>);
|
|
5
|
+
type Props = {
|
|
6
|
+
children: TextType | TextType[] | React.ReactNode;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
isSingleLine?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
Pone el padding según el typeOption.
|
|
12
|
+
*/
|
|
13
|
+
declare const _default: React.MemoExoticComponent<({ children, style, isSingleLine, ...props }: Props & ViewProps) => React.JSX.Element>;
|
|
14
|
+
export default _default;
|