native-pytech 1.0.22 → 1.0.23
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/dist/libs/constants/consts.js +2 -2
- package/dist/libs/constants/formats.js +1 -0
- package/dist/libs/constants/hooks.d.ts +8 -5
- package/dist/libs/constants/hooks.js +14 -5
- package/dist/libs/constants/utils.d.ts +10 -7
- package/dist/libs/constants/utils.js +20 -9
- package/dist/libs/editPage/src/components/Page/index.js +2 -2
- package/dist/libs/editPage/src/context/item.js +2 -2
- package/dist/libs/editPage/src/context/page.js +2 -2
- package/dist/libs/footer/src/Background/index.ios.js +4 -4
- package/dist/libs/footer/src/Background/index.js +4 -4
- package/dist/libs/footer/src/Button/index.ios.js +2 -2
- package/dist/libs/footer/src/Button/index.js +4 -4
- package/dist/libs/providers/App/index.js +5 -5
- package/dist/libs/segmentedControl/src/components/Segmented/index.js +2 -2
- package/dist/libs/segmentedControl/src/components/Wrapper/index.js +2 -2
- package/dist/libs/swiftui/src/List/Editable/index.js +2 -2
- package/dist/libs/table/src/components/Borders.js +2 -2
- package/dist/libs/table/src/components/Delete/index.js +2 -2
- package/dist/libs/table/src/components/OptionComponents/dragIcon.js +1 -1
- package/dist/libs/table/src/components/Table/index.js +2 -2
- package/dist/libs/table/src/context/borders.js +2 -2
- package/dist/libs/table/src/context/delete.js +2 -2
- package/dist/libs/table/src/context/table.js +4 -4
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
|
-
import
|
|
2
|
+
import Utils from './utils';
|
|
3
3
|
import Constants from 'expo-constants';
|
|
4
|
-
export const deviceTier = _getDeviceTier();
|
|
4
|
+
export const deviceTier = Utils._getDeviceTier();
|
|
5
5
|
export const isLowTier = Platform.OS === 'android' && deviceTier === 'low';
|
|
6
6
|
const getExpoEnv = () => {
|
|
7
7
|
const expoEnv = Constants.expoConfig?.extra || {};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
declare const Hooks: {
|
|
2
|
+
useEffectWithoutFirstRender: (effect: () => void, deps: any[]) => void;
|
|
3
|
+
useLayoutEffectWithoutFirstRender: (effect: () => void, deps: any[]) => void;
|
|
4
|
+
useAsyncEffect: (effect: (isMounted: () => boolean) => Promise<void>, deps: any[]) => void;
|
|
5
|
+
useAsyncFocusEffect: (effect: (isMounted: () => boolean) => Promise<void>) => void;
|
|
6
|
+
useAsyncFocusEffectWithoutFirstRender: (effect: (isMounted: () => boolean) => Promise<void>) => void;
|
|
7
|
+
};
|
|
8
|
+
export default Hooks;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useLayoutEffect, useRef } from 'react';
|
|
2
2
|
import { useFocusEffect } from 'expo-router';
|
|
3
|
-
|
|
3
|
+
const useEffectWithoutFirstRender = (effect, deps) => {
|
|
4
4
|
const isFirstRender = useRef(true);
|
|
5
5
|
useEffect(() => {
|
|
6
6
|
if (isFirstRender.current) {
|
|
@@ -10,7 +10,7 @@ export const useEffectWithoutFirstRender = (effect, deps) => {
|
|
|
10
10
|
return effect();
|
|
11
11
|
}, deps);
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
const useLayoutEffectWithoutFirstRender = (effect, deps) => {
|
|
14
14
|
const isFirstRender = useRef(true);
|
|
15
15
|
useLayoutEffect(() => {
|
|
16
16
|
if (isFirstRender.current) {
|
|
@@ -20,7 +20,7 @@ export const useLayoutEffectWithoutFirstRender = (effect, deps) => {
|
|
|
20
20
|
return effect();
|
|
21
21
|
}, deps);
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
const useAsyncEffect = (effect, deps) => {
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
let mounted = true;
|
|
26
26
|
const isMounted = () => mounted;
|
|
@@ -28,7 +28,7 @@ export const useAsyncEffect = (effect, deps) => {
|
|
|
28
28
|
return () => { mounted = false; };
|
|
29
29
|
}, deps);
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
const useAsyncFocusEffect = (effect) => {
|
|
32
32
|
useFocusEffect(useCallback(() => {
|
|
33
33
|
let mounted = true;
|
|
34
34
|
const isMounted = () => mounted;
|
|
@@ -36,7 +36,7 @@ export const useAsyncFocusEffect = (effect) => {
|
|
|
36
36
|
return () => { mounted = false; };
|
|
37
37
|
}, [effect]));
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
const useAsyncFocusEffectWithoutFirstRender = (effect) => {
|
|
40
40
|
const isFirstFocus = useRef(true);
|
|
41
41
|
useFocusEffect(useCallback(() => {
|
|
42
42
|
let mounted = true;
|
|
@@ -48,3 +48,12 @@ export const useAsyncFocusEffectWithoutFirstRender = (effect) => {
|
|
|
48
48
|
return () => { mounted = false; };
|
|
49
49
|
}, [effect]));
|
|
50
50
|
};
|
|
51
|
+
// ------------------- Export -------------------
|
|
52
|
+
const Hooks = {
|
|
53
|
+
useEffectWithoutFirstRender,
|
|
54
|
+
useLayoutEffectWithoutFirstRender,
|
|
55
|
+
useAsyncEffect,
|
|
56
|
+
useAsyncFocusEffect,
|
|
57
|
+
useAsyncFocusEffectWithoutFirstRender,
|
|
58
|
+
};
|
|
59
|
+
export default Hooks;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { StyleProp } from 'react-native';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
declare const Utils: {
|
|
4
|
+
addProps: (element: React.ReactElement | null, additionalStyles?: StyleProp<any>, extraProps?: Record<string, any>) => React.ReactElement | null;
|
|
5
|
+
isValidMail: (mail: string) => boolean;
|
|
6
|
+
applyOpacity: (color: string, opacity: number) => string;
|
|
7
|
+
adjustLightness: (color: string, percentage: number) => string;
|
|
8
|
+
_getDeviceTier: () => "low" | "medium" | "high";
|
|
9
|
+
createCtx: <T>() => readonly [React.Provider<T>, () => T];
|
|
10
|
+
createUseContext: <T>(context: React.Context<T | null>) => T;
|
|
11
|
+
};
|
|
12
|
+
export default Utils;
|
|
@@ -2,7 +2,7 @@ import { Platform } from 'react-native';
|
|
|
2
2
|
import React, { createContext as reactCreateContext, useContext } from 'react';
|
|
3
3
|
import * as Device from 'expo-device';
|
|
4
4
|
import { hsla, parseToHsla, parseToRgba } from 'color2k';
|
|
5
|
-
|
|
5
|
+
const addProps = (element, additionalStyles = [], extraProps = {}) => {
|
|
6
6
|
if (!React.isValidElement(element))
|
|
7
7
|
return null;
|
|
8
8
|
return React.cloneElement(element, {
|
|
@@ -13,10 +13,10 @@ export const addProps = (element, additionalStyles = [], extraProps = {}) => {
|
|
|
13
13
|
...extraProps
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
const isValidMail = (mail) => {
|
|
17
17
|
return mail.includes('@') && mail.endsWith('.com');
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
const applyOpacity = (color, opacity) => {
|
|
20
20
|
try {
|
|
21
21
|
const [r, g, b] = parseToRgba(color); // ignoro alpha original
|
|
22
22
|
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
|
|
@@ -25,8 +25,8 @@ export function applyOpacity(color, opacity) {
|
|
|
25
25
|
console.error('Color inválido:', color);
|
|
26
26
|
return color;
|
|
27
27
|
}
|
|
28
|
-
}
|
|
29
|
-
|
|
28
|
+
};
|
|
29
|
+
const adjustLightness = (color, percentage) => {
|
|
30
30
|
try {
|
|
31
31
|
const [h, s, l, a] = parseToHsla(color);
|
|
32
32
|
// Ajustar luminosidad: percentage puede ser positivo (aclarar) o negativo (oscurecer)
|
|
@@ -38,8 +38,8 @@ export function adjustLightness(color, percentage) {
|
|
|
38
38
|
console.error('Color inválido:', color);
|
|
39
39
|
return color;
|
|
40
40
|
}
|
|
41
|
-
}
|
|
42
|
-
|
|
41
|
+
};
|
|
42
|
+
const _getDeviceTier = () => {
|
|
43
43
|
if (Platform.OS !== 'android')
|
|
44
44
|
return 'high';
|
|
45
45
|
const ramGB = Device.totalMemory
|
|
@@ -51,14 +51,25 @@ export const _getDeviceTier = () => {
|
|
|
51
51
|
return 'medium';
|
|
52
52
|
return 'high';
|
|
53
53
|
};
|
|
54
|
-
|
|
54
|
+
const createCtx = () => {
|
|
55
55
|
const context = reactCreateContext(null);
|
|
56
56
|
const useCtx = () => createUseContext(context);
|
|
57
57
|
return [context.Provider, useCtx];
|
|
58
58
|
};
|
|
59
|
-
|
|
59
|
+
const createUseContext = (context) => {
|
|
60
60
|
const ctx = useContext(context);
|
|
61
61
|
if (!ctx)
|
|
62
62
|
throw new Error('useContext debe usarse dentro de un context.Provider');
|
|
63
63
|
return ctx;
|
|
64
64
|
};
|
|
65
|
+
// ------------------- Export -------------------
|
|
66
|
+
const Utils = {
|
|
67
|
+
addProps,
|
|
68
|
+
isValidMail,
|
|
69
|
+
applyOpacity,
|
|
70
|
+
adjustLightness,
|
|
71
|
+
_getDeviceTier,
|
|
72
|
+
createCtx,
|
|
73
|
+
createUseContext,
|
|
74
|
+
};
|
|
75
|
+
export default Utils;
|
|
@@ -2,7 +2,7 @@ import { Host, List, Section } from '@expo/ui/swift-ui';
|
|
|
2
2
|
import { useObservable, useValue } from '@legendapp/state/react';
|
|
3
3
|
import { Stack, useRouter } from 'expo-router';
|
|
4
4
|
import React, { memo, useCallback, useMemo, useRef } from 'react';
|
|
5
|
-
import
|
|
5
|
+
import Hooks from '../../../../../libs/constants/hooks';
|
|
6
6
|
import { Provider } from '../../context/page';
|
|
7
7
|
import { Provider as ItemProvider } from '../../context/item';
|
|
8
8
|
function Component({ data = [], renderItem, onSave, }) {
|
|
@@ -28,7 +28,7 @@ function Component({ data = [], renderItem, onSave, }) {
|
|
|
28
28
|
}),
|
|
29
29
|
});
|
|
30
30
|
const saveEnabled = useValue(() => store.saveEnabled.get());
|
|
31
|
-
useEffectWithoutFirstRender(() => {
|
|
31
|
+
Hooks.useEffectWithoutFirstRender(() => {
|
|
32
32
|
saveEnabledRef.current = saveEnabled;
|
|
33
33
|
}, [saveEnabled]);
|
|
34
34
|
const textFieldsRefs = useRef({});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export const [Provider, useItem] = createCtx();
|
|
1
|
+
import Utils from '../../../../libs/constants/utils';
|
|
2
|
+
export const [Provider, useItem] = Utils.createCtx();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export const [Provider, usePage] = createCtx();
|
|
1
|
+
import Utils from '../../../../libs/constants/utils';
|
|
2
|
+
export const [Provider, usePage] = Utils.createCtx();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { MeshGradientView } from 'expo-mesh-gradient';
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
import { StyleSheet } from 'react-native';
|
|
4
|
-
import
|
|
4
|
+
import Utils from '../../../../libs/constants/utils';
|
|
5
5
|
export default memo(({ backgroundColorPage }) => {
|
|
6
|
-
const c06 = applyOpacity(backgroundColorPage, 0.6);
|
|
7
|
-
const c08 = applyOpacity(backgroundColorPage, 0.8);
|
|
8
|
-
const c09 = applyOpacity(backgroundColorPage, 0.9);
|
|
6
|
+
const c06 = Utils.applyOpacity(backgroundColorPage, 0.6);
|
|
7
|
+
const c08 = Utils.applyOpacity(backgroundColorPage, 0.8);
|
|
8
|
+
const c09 = Utils.applyOpacity(backgroundColorPage, 0.9);
|
|
9
9
|
return (<MeshGradientView style={[StyleSheet.absoluteFillObject]} columns={2} rows={5} colors={[
|
|
10
10
|
'transparent', 'transparent',
|
|
11
11
|
c06, c06,
|
|
@@ -2,11 +2,11 @@ import MaskedView from '@react-native-masked-view/masked-view';
|
|
|
2
2
|
import { LinearGradient } from 'expo-linear-gradient';
|
|
3
3
|
import { memo } from 'react';
|
|
4
4
|
import { StyleSheet, View } from 'react-native';
|
|
5
|
-
import
|
|
5
|
+
import Utils from '../../../../libs/constants/utils';
|
|
6
6
|
export default memo(({ backgroundColorPage }) => {
|
|
7
|
-
const c06 = applyOpacity(backgroundColorPage, 0.6);
|
|
8
|
-
const c08 = applyOpacity(backgroundColorPage, 0.8);
|
|
9
|
-
const c09 = applyOpacity(backgroundColorPage, 0.9);
|
|
7
|
+
const c06 = Utils.applyOpacity(backgroundColorPage, 0.6);
|
|
8
|
+
const c08 = Utils.applyOpacity(backgroundColorPage, 0.8);
|
|
9
|
+
const c09 = Utils.applyOpacity(backgroundColorPage, 0.9);
|
|
10
10
|
return (<MaskedView style={[StyleSheet.absoluteFillObject]} maskElement={<LinearGradient colors={[
|
|
11
11
|
'transparent',
|
|
12
12
|
c06,
|
|
@@ -3,7 +3,7 @@ import { GlassView } from 'expo-glass-effect';
|
|
|
3
3
|
import { useApp } from "../../../../libs/providers/App";
|
|
4
4
|
import { memo, useCallback, useMemo, useState } from 'react';
|
|
5
5
|
import { ActivityIndicator, Pressable, StyleSheet } from 'react-native';
|
|
6
|
-
import
|
|
6
|
+
import Utils from '../../../../libs/constants/utils';
|
|
7
7
|
import Text from './Text';
|
|
8
8
|
export default memo(({ text, onPress, onSubmit, backgroundColorPage, enabled = true, themeColor = 'default' }) => {
|
|
9
9
|
const { colorScheme } = useApp();
|
|
@@ -23,7 +23,7 @@ export default memo(({ text, onPress, onSubmit, backgroundColorPage, enabled = t
|
|
|
23
23
|
}, [onPress, onSubmit]);
|
|
24
24
|
const backgroundColor = useCallback((pressed) => {
|
|
25
25
|
return enabled ?
|
|
26
|
-
(themeColor === 'default' ? adjustLightness(colors.especiales.azul, -10) : undefined)
|
|
26
|
+
(themeColor === 'default' ? Utils.adjustLightness(colors.especiales.azul, -10) : undefined)
|
|
27
27
|
: Theme.colorButtonFooterDisabled;
|
|
28
28
|
}, [enabled, themeColor]);
|
|
29
29
|
const color = useMemo(() => themeColor === 'default' ? colors.especiales.celeste : Theme.text2, [themeColor]);
|
|
@@ -2,7 +2,7 @@ import colors from '../constants';
|
|
|
2
2
|
import { useApp } from "../../../../libs/providers/App";
|
|
3
3
|
import { memo, useCallback, useMemo, useState } from 'react';
|
|
4
4
|
import { ActivityIndicator, Pressable, StyleSheet } from 'react-native';
|
|
5
|
-
import
|
|
5
|
+
import Utils from '../../../../libs/constants/utils';
|
|
6
6
|
import Text from './Text';
|
|
7
7
|
export default memo(({ text, onPress, onSubmit, backgroundColorPage, enabled = true, themeColor = 'default' }) => {
|
|
8
8
|
const { colorScheme } = useApp();
|
|
@@ -12,10 +12,10 @@ export default memo(({ text, onPress, onSubmit, backgroundColorPage, enabled = t
|
|
|
12
12
|
return enabled ? (pressed ?
|
|
13
13
|
themeColor === 'default' ?
|
|
14
14
|
colors.especiales.azul_pressed :
|
|
15
|
-
colorScheme === 'dark' ? adjustLightness(backgroundColorPage, 10) : backgroundColorPage
|
|
15
|
+
colorScheme === 'dark' ? Utils.adjustLightness(backgroundColorPage, 10) : backgroundColorPage
|
|
16
16
|
: themeColor === 'default' ?
|
|
17
|
-
adjustLightness(colors.especiales.azul, -10) :
|
|
18
|
-
colorScheme === 'dark' ? backgroundColorPage : adjustLightness(backgroundColorPage, -1))
|
|
17
|
+
Utils.adjustLightness(colors.especiales.azul, -10) :
|
|
18
|
+
colorScheme === 'dark' ? backgroundColorPage : Utils.adjustLightness(backgroundColorPage, -1))
|
|
19
19
|
: Theme.colorButtonFooterDisabled;
|
|
20
20
|
}, [enabled, themeColor, backgroundColorPage, colorScheme]);
|
|
21
21
|
const _onPress = useCallback(async () => {
|
|
@@ -5,12 +5,12 @@ import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
|
5
5
|
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native';
|
|
6
6
|
import handleFontObserver from '../../../libs/constants/handleFontObserver';
|
|
7
7
|
handleFontObserver(); // esto intercepta todos los timeouts de fuentes
|
|
8
|
-
import
|
|
8
|
+
import Utils from "../../../libs/constants/utils";
|
|
9
9
|
import LoginSvg from '../../assets/images/login_letras.svg';
|
|
10
10
|
import LoginSvgDark from '../../assets/images/login_letras_dark.svg';
|
|
11
|
-
import
|
|
11
|
+
import Hooks from '../../../libs/constants/hooks';
|
|
12
12
|
import colors from "../constants";
|
|
13
|
-
const [Provider, useApp] = createCtx();
|
|
13
|
+
const [Provider, useApp] = Utils.createCtx();
|
|
14
14
|
export { useApp };
|
|
15
15
|
export default memo(({ listStackNames = [], getBackgroundColor, getSession, renderItemLoading = ({ colorScheme }) => (colorScheme === 'dark' ?
|
|
16
16
|
<LoginSvgDark width={200} height={200}/>
|
|
@@ -24,11 +24,11 @@ export default memo(({ listStackNames = [], getBackgroundColor, getSession, rend
|
|
|
24
24
|
const [isLoading, setIsLoading] = useState(true);
|
|
25
25
|
const hasSessionRef = useRef(false);
|
|
26
26
|
// -------------- Effects --------------
|
|
27
|
-
useEffectWithoutFirstRender(() => {
|
|
27
|
+
Hooks.useEffectWithoutFirstRender(() => {
|
|
28
28
|
if (!isLoading)
|
|
29
29
|
onLoadingRealsed?.({ router, hasSession: hasSessionRef.current });
|
|
30
30
|
}, [isLoading]);
|
|
31
|
-
useAsyncEffect(async (isMounted) => {
|
|
31
|
+
Hooks.useAsyncEffect(async (isMounted) => {
|
|
32
32
|
hasSessionRef.current = (await getSession?.()) ?? true;
|
|
33
33
|
if (!isMounted)
|
|
34
34
|
return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { memo, useState, useRef, useCallback } from 'react';
|
|
2
2
|
import { View, StyleSheet, ScrollView } from 'react-native';
|
|
3
3
|
import { Easing, useSharedValue, withTiming, useDerivedValue } from 'react-native-reanimated';
|
|
4
|
-
import
|
|
4
|
+
import Hooks from '../../../../../libs/constants/hooks';
|
|
5
5
|
import { useShared } from '../../context/shared';
|
|
6
6
|
import { scrollToIndex } from '../../utils';
|
|
7
7
|
import Container from '../Container';
|
|
@@ -50,7 +50,7 @@ export default memo(({ data, selectedIndex, setCurrentSelectedIndex, isScrollabl
|
|
|
50
50
|
widthsShared.value = newWidths;
|
|
51
51
|
}, []);
|
|
52
52
|
// ---------------- Hooks ----------------
|
|
53
|
-
useEffectWithoutFirstRender(() => {
|
|
53
|
+
Hooks.useEffectWithoutFirstRender(() => {
|
|
54
54
|
onPress(selectedIndex);
|
|
55
55
|
}, [selectedIndex]);
|
|
56
56
|
const content = (<>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { memo, useState } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import Hooks from '../../../../../libs/constants/hooks';
|
|
3
3
|
import Segmented from '../Segmented';
|
|
4
4
|
import Provider, { useShared } from '../../context/shared';
|
|
5
5
|
import { getIndex } from '../../utils';
|
|
@@ -7,7 +7,7 @@ export default memo(({ data = [], selectedIndex = 0, onChange, ...props }) => {
|
|
|
7
7
|
const _selectedIndex = getIndex(selectedIndex);
|
|
8
8
|
// Creamos el state interno para activar el onChange
|
|
9
9
|
const [currentSelectedIndex, setCurrentSelectedIndex] = useState(_selectedIndex);
|
|
10
|
-
useEffectWithoutFirstRender(() => {
|
|
10
|
+
Hooks.useEffectWithoutFirstRender(() => {
|
|
11
11
|
onChange?.({ index: currentSelectedIndex, item: data[currentSelectedIndex] });
|
|
12
12
|
}, [currentSelectedIndex]);
|
|
13
13
|
// Nos fijamos si ya está dentro del context.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { List, Section } from "@expo/ui/swift-ui";
|
|
2
2
|
import { listStyle, environment, moveDisabled, tag, deleteDisabled, padding } from "@expo/ui/swift-ui/modifiers";
|
|
3
3
|
import React, { memo, useCallback, useMemo, useState } from "react";
|
|
4
|
-
import
|
|
4
|
+
import Hooks from '../../../../../libs/constants/hooks';
|
|
5
5
|
function Component({ children, data = [], keyExtractor, editMode = false, onDelete, onMove, renderItem, listProps, listForEachProps, listSectionProps, enableMove = false, enableDelete = false, withoutTopPadding = false, }) {
|
|
6
6
|
// ---------------------- Variables ----------------------
|
|
7
7
|
const [_data, setData] = useState(data ?? []);
|
|
8
8
|
// ---------------------- Hooks ----------------------
|
|
9
|
-
useEffectWithoutFirstRender(() => setData(data ?? []), [data]);
|
|
9
|
+
Hooks.useEffectWithoutFirstRender(() => setData(data ?? []), [data]);
|
|
10
10
|
// ---------------------- Modifiers ----------------------
|
|
11
11
|
const modifiersList = useMemo(() => [
|
|
12
12
|
listStyle('inset'),
|
|
@@ -2,7 +2,7 @@ import { useValue } from '@legendapp/state/react';
|
|
|
2
2
|
import React, { memo, useEffect, useState } from 'react';
|
|
3
3
|
import { PixelRatio, View, StyleSheet } from 'react-native';
|
|
4
4
|
import colors from '../constants';
|
|
5
|
-
import
|
|
5
|
+
import Hooks from '../../../../libs/constants/hooks';
|
|
6
6
|
import { useApp } from '../../../../libs/providers/App';
|
|
7
7
|
import { useStore, useTable } from '../context/table';
|
|
8
8
|
import { useBorder } from '../context/borders';
|
|
@@ -59,7 +59,7 @@ const BorderExtended = memo(({ isTop, id, color }) => {
|
|
|
59
59
|
else
|
|
60
60
|
bordersRef.current.bottom = setShow;
|
|
61
61
|
}, []);
|
|
62
|
-
useEffectWithoutFirstRender(() => {
|
|
62
|
+
Hooks.useEffectWithoutFirstRender(() => {
|
|
63
63
|
setShow(showStore);
|
|
64
64
|
}, [showStore]);
|
|
65
65
|
return <Border show={Show} color={color}/>;
|
|
@@ -3,7 +3,7 @@ import { useSelector } from '@legendapp/state/react';
|
|
|
3
3
|
import React, { memo, useCallback, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { Animated, Easing, Platform, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
5
5
|
import Reanimated, { Easing as Reasing, SlideOutLeft } from 'react-native-reanimated';
|
|
6
|
-
import
|
|
6
|
+
import Hooks from '../../../../../libs/constants/hooks';
|
|
7
7
|
import { isLowTier } from '../../../../../libs/constants/consts';
|
|
8
8
|
import colors from '../../constants';
|
|
9
9
|
import { useStore } from '../../context/table';
|
|
@@ -22,7 +22,7 @@ export default memo(({ children, ...props }) => {
|
|
|
22
22
|
const Component = memo(({ children, id, removeWidth, onDelete, onDeleteShown, setDeleted, }) => {
|
|
23
23
|
const store = useStore();
|
|
24
24
|
const is_deleted = useSelector(() => store.deleted.id.get() === id);
|
|
25
|
-
useLayoutEffectWithoutFirstRender(() => {
|
|
25
|
+
Hooks.useLayoutEffectWithoutFirstRender(() => {
|
|
26
26
|
if (is_deleted)
|
|
27
27
|
return;
|
|
28
28
|
onDeleteShown?.(id, false);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ionicons } from '@expo/vector-icons';
|
|
2
2
|
import React, { memo } from 'react';
|
|
3
3
|
import { Pressable } from 'react-native';
|
|
4
|
-
//import { useDrag } from 'libs/ReorderableList'
|
|
4
|
+
//import { useDrag } from '@/libs/ReorderableList'
|
|
5
5
|
import colors from '../../constants';
|
|
6
6
|
import { useApp } from '../../../../../libs/providers/App';
|
|
7
7
|
/**
|
|
@@ -3,7 +3,7 @@ import React, { memo, useMemo } from 'react';
|
|
|
3
3
|
import { Platform, StyleSheet } from 'react-native';
|
|
4
4
|
import Animated, { Easing, FadeIn, FadeOut, LinearTransition } from 'react-native-reanimated';
|
|
5
5
|
import colors from '../../constants';
|
|
6
|
-
import
|
|
6
|
+
import Hooks from '../../../../../libs/constants/hooks';
|
|
7
7
|
import { useApp } from '../../../../../libs/providers/App';
|
|
8
8
|
import { isLowTier } from '../../../../../libs/constants/consts';
|
|
9
9
|
import { BordersProvider, StoreProvider, TableProvider } from '../../context/table';
|
|
@@ -32,7 +32,7 @@ const Table = memo(({ children, title, renderDetail, colorThemeType = 'default',
|
|
|
32
32
|
});
|
|
33
33
|
const layoutAnimation = isLowTier ? LinearTransition.duration(500) : LinearTransition.easing(Easing.bezier(0.2, 0.2, 0, 1)).duration(600);
|
|
34
34
|
// ------------- useEffect -------------
|
|
35
|
-
useEffectWithoutFirstRender(() => store.deleted.keys.set(keys), [keys]);
|
|
35
|
+
Hooks.useEffectWithoutFirstRender(() => store.deleted.keys.set(keys), [keys]);
|
|
36
36
|
const value = useMemo(() => ({ colorThemeType, type, keys, allBorders }), [colorThemeType, type, keys, allBorders]);
|
|
37
37
|
return (<Animated.View key={title || 'title'} layout={Platform.OS === 'web' ? undefined : LinearTransition.duration(100).easing(Easing.bezier(0.1, 0.1, 0, 1))} style={[
|
|
38
38
|
styles.container,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo, useRef } from "react";
|
|
2
|
-
import
|
|
3
|
-
const [Provider, useBorder] = createCtx();
|
|
2
|
+
import Utils from "../../../../libs/constants/utils";
|
|
3
|
+
const [Provider, useBorder] = Utils.createCtx();
|
|
4
4
|
export { useBorder };
|
|
5
5
|
export default ({ children }) => {
|
|
6
6
|
const bordersRef = useRef({});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export const [DeleteProvider, useDelete] = createCtx();
|
|
1
|
+
import Utils from "../../../../libs/constants/utils";
|
|
2
|
+
export const [DeleteProvider, useDelete] = Utils.createCtx();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
export const [StoreProvider, useStore] = createCtx();
|
|
3
|
-
export const [BordersProvider, useBorders] = createCtx();
|
|
4
|
-
export const [TableProvider, useTable] = createCtx();
|
|
1
|
+
import Utils from '../../../../libs/constants/utils';
|
|
2
|
+
export const [StoreProvider, useStore] = Utils.createCtx();
|
|
3
|
+
export const [BordersProvider, useBorders] = Utils.createCtx();
|
|
4
|
+
export const [TableProvider, useTable] = Utils.createCtx();
|