pytech-ui 1.0.8 → 1.0.11
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/build/constants/colors.d.ts +217 -0
- package/build/constants/colors.js +172 -0
- package/build/constants/colors.json +88 -0
- package/build/constants/consts.d.ts +7 -0
- package/build/constants/consts.js +16 -0
- package/build/constants/formats.d.ts +9 -0
- package/build/constants/formats.js +112 -0
- package/build/constants/hooks.d.ts +6 -0
- package/build/constants/hooks.js +72 -0
- package/build/constants/index.d.ts +5 -0
- package/build/constants/index.js +21 -0
- package/build/constants/utils.d.ts +9 -0
- package/build/constants/utils.js +107 -0
- package/build/contexts/alert/components/Alert/index.d.ts +3 -0
- package/build/contexts/alert/components/Alert/index.js +85 -0
- package/build/contexts/alert/components/Alert/types.d.ts +7 -0
- package/build/contexts/alert/components/Alert/types.js +2 -0
- package/build/contexts/alert/components/Button/index.d.ts +3 -0
- package/build/contexts/alert/components/Button/index.js +52 -0
- package/build/contexts/alert/components/Button/types.d.ts +7 -0
- package/build/contexts/alert/components/Button/types.js +2 -0
- package/build/contexts/alert/components/Provider/index.d.ts +4 -0
- package/build/contexts/alert/components/Provider/index.ios.d.ts +4 -0
- package/build/contexts/alert/components/Provider/index.ios.js +12 -0
- package/build/contexts/alert/components/Provider/index.js +17 -0
- package/build/contexts/alert/context/provider.d.ts +6 -0
- package/build/contexts/alert/context/provider.js +6 -0
- package/build/contexts/alert/index.d.ts +3 -0
- package/build/contexts/alert/index.js +10 -0
- package/build/contexts/app/context.d.ts +6 -0
- package/build/contexts/app/context.js +35 -0
- package/build/contexts/app/index.d.ts +5 -0
- package/build/contexts/app/index.js +14 -0
- package/build/contexts/app/src/components/Head/index.d.ts +3 -0
- package/build/contexts/app/src/components/Head/index.js +3 -0
- package/build/contexts/app/src/components/Head/index.web.d.ts +3 -0
- package/build/contexts/app/src/components/Head/index.web.js +29 -0
- package/build/contexts/app/src/components/Head/types.d.ts +24 -0
- package/build/contexts/app/src/components/Head/types.js +2 -0
- package/build/contexts/app/src/components/Loading.d.ts +4 -0
- package/build/contexts/app/src/components/Loading.js +4 -0
- package/build/contexts/app/src/components/Wrapper/index.d.ts +4 -0
- package/build/contexts/app/src/components/Wrapper/index.js +68 -0
- package/build/contexts/app/src/components/Wrapper/types.d.ts +20 -0
- package/build/contexts/app/src/components/Wrapper/types.js +2 -0
- package/build/contexts/app/src/index.d.ts +10 -0
- package/build/contexts/app/src/index.js +12 -0
- package/build/contexts/app/types.d.ts +6 -0
- package/build/contexts/app/types.js +2 -0
- package/build/contexts/index.d.ts +4 -0
- package/build/contexts/index.js +26 -0
- package/build/contexts/pathname.d.ts +19 -0
- package/build/contexts/pathname.js +24 -0
- package/build/contexts/router/index.d.ts +6 -0
- package/build/contexts/router/index.js +35 -0
- package/build/contexts/router/types.d.ts +12 -0
- package/build/contexts/router/types.js +2 -0
- package/build/contexts/router/utils.d.ts +2 -0
- package/build/contexts/router/utils.js +13 -0
- package/build/universal/Column/index.android.d.ts +3 -0
- package/build/universal/Column/index.android.js +8 -0
- package/build/universal/Column/index.d.ts +3 -0
- package/build/universal/Column/index.ios.d.ts +3 -0
- package/build/universal/Column/index.ios.js +7 -0
- package/build/universal/Column/index.js +19 -0
- package/build/universal/Column/types.d.ts +16 -0
- package/build/universal/Column/types.js +2 -0
- package/build/universal/Row/index.android.d.ts +3 -0
- package/build/universal/Row/index.android.js +8 -0
- package/build/universal/Row/index.d.ts +3 -0
- package/build/universal/Row/index.ios.d.ts +3 -0
- package/build/universal/Row/index.ios.js +7 -0
- package/build/universal/Row/index.js +19 -0
- package/build/universal/Row/types.d.ts +16 -0
- package/build/universal/Row/types.js +2 -0
- package/build/universal/index.d.ts +4 -0
- package/build/universal/index.js +5 -1
- package/package.json +84 -70
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAsyncFocusEffectWithoutFirstRender = exports.useAsyncFocusEffect = exports.useAsyncEffectWithoutFirstRender = exports.useAsyncEffect = exports.useLayoutEffectWithoutFirstRender = exports.useEffectWithoutFirstRender = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const expo_router_1 = require("expo-router");
|
|
6
|
+
const useEffectWithoutFirstRender = (effect, deps) => {
|
|
7
|
+
const isFirstRender = (0, react_1.useRef)(true);
|
|
8
|
+
(0, react_1.useEffect)(() => {
|
|
9
|
+
if (isFirstRender.current) {
|
|
10
|
+
isFirstRender.current = false;
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
return void effect();
|
|
14
|
+
}, deps);
|
|
15
|
+
};
|
|
16
|
+
exports.useEffectWithoutFirstRender = useEffectWithoutFirstRender;
|
|
17
|
+
const useLayoutEffectWithoutFirstRender = (effect, deps) => {
|
|
18
|
+
const isFirstRender = (0, react_1.useRef)(true);
|
|
19
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
20
|
+
if (isFirstRender.current) {
|
|
21
|
+
isFirstRender.current = false;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
return void effect();
|
|
25
|
+
}, deps);
|
|
26
|
+
};
|
|
27
|
+
exports.useLayoutEffectWithoutFirstRender = useLayoutEffectWithoutFirstRender;
|
|
28
|
+
const useAsyncEffect = (effect, deps) => {
|
|
29
|
+
(0, react_1.useEffect)(() => {
|
|
30
|
+
let mounted = true;
|
|
31
|
+
const isMounted = () => mounted;
|
|
32
|
+
void effect(isMounted);
|
|
33
|
+
return () => { mounted = false; };
|
|
34
|
+
}, deps);
|
|
35
|
+
};
|
|
36
|
+
exports.useAsyncEffect = useAsyncEffect;
|
|
37
|
+
const useAsyncEffectWithoutFirstRender = (effect, deps) => {
|
|
38
|
+
const isFirstRender = (0, react_1.useRef)(true);
|
|
39
|
+
(0, react_1.useEffect)(() => {
|
|
40
|
+
if (isFirstRender.current) {
|
|
41
|
+
isFirstRender.current = false;
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
let mounted = true;
|
|
45
|
+
const isMounted = () => mounted;
|
|
46
|
+
void effect(isMounted);
|
|
47
|
+
return () => { mounted = false; };
|
|
48
|
+
}, deps);
|
|
49
|
+
};
|
|
50
|
+
exports.useAsyncEffectWithoutFirstRender = useAsyncEffectWithoutFirstRender;
|
|
51
|
+
const useAsyncFocusEffect = (effect) => {
|
|
52
|
+
(0, expo_router_1.useFocusEffect)((0, react_1.useCallback)(() => {
|
|
53
|
+
let mounted = true;
|
|
54
|
+
const isMounted = () => mounted;
|
|
55
|
+
void effect(isMounted);
|
|
56
|
+
return () => { mounted = false; };
|
|
57
|
+
}, [effect]));
|
|
58
|
+
};
|
|
59
|
+
exports.useAsyncFocusEffect = useAsyncFocusEffect;
|
|
60
|
+
const useAsyncFocusEffectWithoutFirstRender = (effect) => {
|
|
61
|
+
const isFirstFocus = (0, react_1.useRef)(true);
|
|
62
|
+
(0, expo_router_1.useFocusEffect)((0, react_1.useCallback)(() => {
|
|
63
|
+
let mounted = true;
|
|
64
|
+
const isMounted = () => mounted;
|
|
65
|
+
if (isFirstFocus.current)
|
|
66
|
+
isFirstFocus.current = false;
|
|
67
|
+
else
|
|
68
|
+
void effect(isMounted);
|
|
69
|
+
return () => { mounted = false; };
|
|
70
|
+
}, [effect]));
|
|
71
|
+
};
|
|
72
|
+
exports.useAsyncFocusEffectWithoutFirstRender = useAsyncFocusEffectWithoutFirstRender;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./colors"), exports);
|
|
18
|
+
__exportStar(require("./consts"), exports);
|
|
19
|
+
__exportStar(require("./formats"), exports);
|
|
20
|
+
__exportStar(require("./hooks"), exports);
|
|
21
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StyleProp } from 'react-native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare const addProps: (element: React.ReactElement | null, additionalStyles?: StyleProp<any>, extraProps?: Record<string, any>) => React.ReactElement | null;
|
|
4
|
+
export declare const isValidMail: (mail: string) => boolean;
|
|
5
|
+
export declare const applyOpacity: (color: string, opacity: number) => string;
|
|
6
|
+
export declare const adjustLightness: (color: string, percentage: number) => string;
|
|
7
|
+
export declare const getDeviceTier: () => "low" | "medium" | "high";
|
|
8
|
+
export declare const createCtx: <T>() => readonly [React.Provider<T>, () => T];
|
|
9
|
+
export declare const createUseContext: <T>(context: React.Context<T | null>) => T;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.createUseContext = exports.createCtx = exports.getDeviceTier = exports.adjustLightness = exports.applyOpacity = exports.isValidMail = exports.addProps = void 0;
|
|
37
|
+
const react_native_1 = require("react-native");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const color2k_1 = require("color2k");
|
|
40
|
+
const Device = __importStar(require("expo-device"));
|
|
41
|
+
const addProps = (element, additionalStyles = [], extraProps = {}) => {
|
|
42
|
+
if (!react_1.default.isValidElement(element))
|
|
43
|
+
return null;
|
|
44
|
+
return react_1.default.cloneElement(element, {
|
|
45
|
+
style: [
|
|
46
|
+
element.props.style,
|
|
47
|
+
...additionalStyles
|
|
48
|
+
],
|
|
49
|
+
...extraProps
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
exports.addProps = addProps;
|
|
53
|
+
const isValidMail = (mail) => {
|
|
54
|
+
return mail.includes('@') && mail.endsWith('.com');
|
|
55
|
+
};
|
|
56
|
+
exports.isValidMail = isValidMail;
|
|
57
|
+
const applyOpacity = (color, opacity) => {
|
|
58
|
+
try {
|
|
59
|
+
const [r, g, b] = (0, color2k_1.parseToRgba)(color); // ignoro alpha original
|
|
60
|
+
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
console.error('Color inválido:', color);
|
|
64
|
+
return color;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
exports.applyOpacity = applyOpacity;
|
|
68
|
+
const adjustLightness = (color, percentage) => {
|
|
69
|
+
try {
|
|
70
|
+
const [h, s, l, a] = (0, color2k_1.parseToHsla)(color);
|
|
71
|
+
// Ajustar luminosidad: percentage puede ser positivo (aclarar) o negativo (oscurecer)
|
|
72
|
+
// l está en rango 0-1, percentage es de -100 a +100
|
|
73
|
+
const newL = Math.max(0, Math.min(1, l + (percentage / 100)));
|
|
74
|
+
return (0, color2k_1.hsla)(h, s, newL, a);
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
console.error('Color inválido:', color);
|
|
78
|
+
return color;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
exports.adjustLightness = adjustLightness;
|
|
82
|
+
const getDeviceTier = () => {
|
|
83
|
+
if (react_native_1.Platform.OS !== 'android')
|
|
84
|
+
return 'high';
|
|
85
|
+
const ramGB = Device.totalMemory
|
|
86
|
+
? Device.totalMemory / 1024 / 1024 / 1024
|
|
87
|
+
: 0;
|
|
88
|
+
if (ramGB > 0 && ramGB <= 4)
|
|
89
|
+
return 'low';
|
|
90
|
+
if (ramGB <= 6)
|
|
91
|
+
return 'medium';
|
|
92
|
+
return 'high';
|
|
93
|
+
};
|
|
94
|
+
exports.getDeviceTier = getDeviceTier;
|
|
95
|
+
const createCtx = () => {
|
|
96
|
+
const context = (0, react_1.createContext)(null);
|
|
97
|
+
const useCtx = () => (0, exports.createUseContext)(context);
|
|
98
|
+
return [context.Provider, useCtx];
|
|
99
|
+
};
|
|
100
|
+
exports.createCtx = createCtx;
|
|
101
|
+
const createUseContext = (context) => {
|
|
102
|
+
const ctx = (0, react_1.useContext)(context);
|
|
103
|
+
if (!ctx)
|
|
104
|
+
throw new Error('useContext debe usarse dentro de un context.Provider');
|
|
105
|
+
return ctx;
|
|
106
|
+
};
|
|
107
|
+
exports.createUseContext = createUseContext;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const react_native_1 = require("react-native");
|
|
8
|
+
const app_1 = require("@/contexts/app");
|
|
9
|
+
const colors_json_1 = __importDefault(require("@/constants/colors.json"));
|
|
10
|
+
const provider_1 = require("../../context/provider");
|
|
11
|
+
const Button_1 = __importDefault(require("../Button"));
|
|
12
|
+
exports.default = (0, react_1.memo)(({ title, message, buttons = [{ text: 'Aceptar', isPreferred: true }] }) => {
|
|
13
|
+
const { showAlert } = (0, provider_1.useAlert)();
|
|
14
|
+
const { colorScheme } = (0, app_1.useApp)();
|
|
15
|
+
const schemeColors = colors_json_1.default['scheme'][colorScheme];
|
|
16
|
+
return (<react_native_1.Pressable style={styles.container} onPress={() => showAlert()}>
|
|
17
|
+
<react_native_1.Pressable style={[
|
|
18
|
+
styles.content,
|
|
19
|
+
{
|
|
20
|
+
backgroundColor: schemeColors.secondarySystemGroupedBackground,
|
|
21
|
+
borderColor: colorScheme === 'dark' ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)',
|
|
22
|
+
}
|
|
23
|
+
]}>
|
|
24
|
+
<react_native_1.View style={styles.contentTexts}>
|
|
25
|
+
{title && (<react_native_1.Text style={[
|
|
26
|
+
styles.title,
|
|
27
|
+
{ color: schemeColors.label }
|
|
28
|
+
]}>
|
|
29
|
+
{title}
|
|
30
|
+
</react_native_1.Text>)}
|
|
31
|
+
{message && (<react_native_1.Text style={[
|
|
32
|
+
styles.message,
|
|
33
|
+
!title ? {
|
|
34
|
+
color: schemeColors.label
|
|
35
|
+
} : {
|
|
36
|
+
color: schemeColors.secondaryLabel
|
|
37
|
+
}
|
|
38
|
+
]}>
|
|
39
|
+
{message}
|
|
40
|
+
</react_native_1.Text>)}
|
|
41
|
+
</react_native_1.View>
|
|
42
|
+
|
|
43
|
+
<react_native_1.View style={[styles.buttons, buttons.length > 2 && { flexDirection: 'column' }]}>
|
|
44
|
+
{buttons.map((props) => (<Button_1.default key={props.text} {...props}/>))}
|
|
45
|
+
</react_native_1.View>
|
|
46
|
+
</react_native_1.Pressable>
|
|
47
|
+
</react_native_1.Pressable>);
|
|
48
|
+
});
|
|
49
|
+
const styles = react_native_1.StyleSheet.create({
|
|
50
|
+
container: {
|
|
51
|
+
backgroundColor: 'rgba(0, 0, 0, 0.2)',
|
|
52
|
+
position: 'fixed',
|
|
53
|
+
width: '100%',
|
|
54
|
+
height: '100%',
|
|
55
|
+
justifyContent: 'center',
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
top: 0,
|
|
58
|
+
left: 0,
|
|
59
|
+
zIndex: 1,
|
|
60
|
+
},
|
|
61
|
+
content: {
|
|
62
|
+
borderRadius: 24,
|
|
63
|
+
borderWidth: 1,
|
|
64
|
+
padding: 14,
|
|
65
|
+
gap: 16,
|
|
66
|
+
minWidth: 350,
|
|
67
|
+
zIndex: 2,
|
|
68
|
+
cursor: 'default',
|
|
69
|
+
},
|
|
70
|
+
contentTexts: {
|
|
71
|
+
gap: 5,
|
|
72
|
+
padding: 8,
|
|
73
|
+
},
|
|
74
|
+
title: {
|
|
75
|
+
fontSize: 18,
|
|
76
|
+
fontWeight: '600',
|
|
77
|
+
},
|
|
78
|
+
message: {
|
|
79
|
+
fontSize: 16,
|
|
80
|
+
},
|
|
81
|
+
buttons: {
|
|
82
|
+
flexDirection: 'row',
|
|
83
|
+
gap: 8,
|
|
84
|
+
},
|
|
85
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const react_native_1 = require("react-native");
|
|
8
|
+
const app_1 = require("@/contexts/app");
|
|
9
|
+
const colors_json_1 = __importDefault(require("@/constants/colors.json"));
|
|
10
|
+
const provider_1 = require("../../context/provider");
|
|
11
|
+
exports.default = (0, react_1.memo)(({ text, onPress, isPreferred, style, }) => {
|
|
12
|
+
const { showAlert } = (0, provider_1.useAlert)();
|
|
13
|
+
const { colorScheme } = (0, app_1.useApp)();
|
|
14
|
+
const schemeColors = colors_json_1.default['scheme'][colorScheme];
|
|
15
|
+
const _onPress = () => {
|
|
16
|
+
onPress?.();
|
|
17
|
+
showAlert();
|
|
18
|
+
};
|
|
19
|
+
const backgroundColor = (0, react_1.useMemo)(() => (isPreferred ? schemeColors.systemBlue
|
|
20
|
+
: schemeColors.tertiarySystemGroupedBackground), [isPreferred, schemeColors]);
|
|
21
|
+
const textColor = (0, react_1.useMemo)(() => (isPreferred ? 'white'
|
|
22
|
+
: style === 'destructive' ? schemeColors.systemRed
|
|
23
|
+
: schemeColors.label), [isPreferred, style, schemeColors]);
|
|
24
|
+
return (<react_native_1.Pressable onPress={_onPress} style={[
|
|
25
|
+
styles.button,
|
|
26
|
+
{
|
|
27
|
+
backgroundColor: backgroundColor,
|
|
28
|
+
},
|
|
29
|
+
]}>
|
|
30
|
+
<react_native_1.Text style={[
|
|
31
|
+
styles.text,
|
|
32
|
+
{
|
|
33
|
+
color: textColor,
|
|
34
|
+
},
|
|
35
|
+
]}>
|
|
36
|
+
{text}
|
|
37
|
+
</react_native_1.Text>
|
|
38
|
+
</react_native_1.Pressable>);
|
|
39
|
+
});
|
|
40
|
+
const styles = react_native_1.StyleSheet.create({
|
|
41
|
+
button: {
|
|
42
|
+
flex: 1,
|
|
43
|
+
paddingHorizontal: 16,
|
|
44
|
+
paddingVertical: 13,
|
|
45
|
+
borderRadius: 100,
|
|
46
|
+
},
|
|
47
|
+
text: {
|
|
48
|
+
fontSize: 16,
|
|
49
|
+
margin: 'auto',
|
|
50
|
+
textAlign: 'center',
|
|
51
|
+
},
|
|
52
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
const provider_1 = require("../../context/provider");
|
|
6
|
+
exports.default = (0, react_1.memo)(({ children }) => {
|
|
7
|
+
const showAlert = ({ title, message, buttons }) => react_native_1.Alert.alert(title ?? '', message, buttons);
|
|
8
|
+
const value = (0, react_1.useMemo)(() => ({ showAlert }), []);
|
|
9
|
+
return (<provider_1.Provider value={value}>
|
|
10
|
+
{children}
|
|
11
|
+
</provider_1.Provider>);
|
|
12
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const provider_1 = require("../../context/provider");
|
|
8
|
+
const Alert_1 = __importDefault(require("../Alert"));
|
|
9
|
+
exports.default = (0, react_1.memo)(({ children }) => {
|
|
10
|
+
const [alert, setAlert] = (0, react_1.useState)();
|
|
11
|
+
const showAlert = (props) => setAlert(props);
|
|
12
|
+
const value = (0, react_1.useMemo)(() => ({ showAlert }), []);
|
|
13
|
+
return (<provider_1.Provider value={value}>
|
|
14
|
+
{alert && <Alert_1.default {...alert}/>}
|
|
15
|
+
{children}
|
|
16
|
+
</provider_1.Provider>);
|
|
17
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useAlert = exports.Provider = void 0;
|
|
5
|
+
const constants_1 = require("@/constants");
|
|
6
|
+
_a = (0, constants_1.createCtx)(), exports.Provider = _a[0], exports.useAlert = _a[1];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useAlert = exports.default = void 0;
|
|
7
|
+
var Provider_1 = require("./components/Provider");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(Provider_1).default; } });
|
|
9
|
+
var provider_1 = require("./context/provider");
|
|
10
|
+
Object.defineProperty(exports, "useAlert", { enumerable: true, get: function () { return provider_1.useAlert; } });
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AppProps } from './src';
|
|
2
|
+
import { AppContext } from './types';
|
|
3
|
+
import './src/styles.css';
|
|
4
|
+
export declare const Provider: import("react").Provider<AppContext>, useApp: () => AppContext;
|
|
5
|
+
declare const _default: import("react").MemoExoticComponent<({ children, ...props }: AppProps) => import("react").JSX.Element>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
var _a;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.useApp = exports.Provider = void 0;
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const react_native_1 = require("react-native");
|
|
10
|
+
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
11
|
+
const expo_router_1 = require("expo-router");
|
|
12
|
+
const constants_1 = require("@/constants");
|
|
13
|
+
const router_1 = __importDefault(require("@/contexts/router"));
|
|
14
|
+
const pathname_1 = __importDefault(require("@/contexts/pathname"));
|
|
15
|
+
const src_1 = __importDefault(require("./src"));
|
|
16
|
+
require("./src/styles.css");
|
|
17
|
+
_a = (0, constants_1.createCtx)(), exports.Provider = _a[0], exports.useApp = _a[1];
|
|
18
|
+
exports.default = (0, react_1.memo)(({ children, ...props }) => {
|
|
19
|
+
const colorScheme = (0, react_native_1.useColorScheme)();
|
|
20
|
+
const { fontScale } = (0, react_native_1.useWindowDimensions)();
|
|
21
|
+
const value = (0, react_1.useMemo)(() => ({ colorScheme, fontScale }), [colorScheme, fontScale]);
|
|
22
|
+
return (<pathname_1.default>
|
|
23
|
+
<router_1.default>
|
|
24
|
+
<react_native_safe_area_context_1.SafeAreaProvider>
|
|
25
|
+
<expo_router_1.ThemeProvider value={colorScheme === 'dark' ? expo_router_1.DarkTheme : expo_router_1.DefaultTheme}>
|
|
26
|
+
<exports.Provider value={value}>
|
|
27
|
+
<src_1.default {...props}>
|
|
28
|
+
{children}
|
|
29
|
+
</src_1.default>
|
|
30
|
+
</exports.Provider>
|
|
31
|
+
</expo_router_1.ThemeProvider>
|
|
32
|
+
</react_native_safe_area_context_1.SafeAreaProvider>
|
|
33
|
+
</router_1.default>
|
|
34
|
+
</pathname_1.default>);
|
|
35
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useAlert = exports.useRouter = exports.useApp = exports.default = void 0;
|
|
7
|
+
var context_1 = require("./context");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(context_1).default; } });
|
|
9
|
+
var context_2 = require("./context");
|
|
10
|
+
Object.defineProperty(exports, "useApp", { enumerable: true, get: function () { return context_2.useApp; } });
|
|
11
|
+
var router_1 = require("@/contexts/router");
|
|
12
|
+
Object.defineProperty(exports, "useRouter", { enumerable: true, get: function () { return router_1.useRouter; } });
|
|
13
|
+
var alert_1 = require("@/contexts/alert");
|
|
14
|
+
Object.defineProperty(exports, "useAlert", { enumerable: true, get: function () { return alert_1.useAlert; } });
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const head_1 = __importDefault(require("expo-router/head"));
|
|
7
|
+
const expo_router_1 = require("expo-router");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const react_native_1 = require("react-native");
|
|
10
|
+
exports.default = ({ title = 'Application', description, ogDescription, siteUrl, ogImage }) => {
|
|
11
|
+
const pathname = (0, expo_router_1.usePathname)();
|
|
12
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
13
|
+
if (react_native_1.Platform.OS === 'web')
|
|
14
|
+
document.title = title;
|
|
15
|
+
}, [pathname, title]);
|
|
16
|
+
return (<head_1.default>
|
|
17
|
+
<title>{title}</title>
|
|
18
|
+
<meta name="description" content={description}/>
|
|
19
|
+
<meta property="og:type" content="website"/>
|
|
20
|
+
<meta property="og:title" content={title}/>
|
|
21
|
+
<meta property="og:description" content={ogDescription}/>
|
|
22
|
+
<meta property="og:url" content={siteUrl}/>
|
|
23
|
+
<meta property="og:image" content={ogImage}/>
|
|
24
|
+
<meta name="twitter:card" content="summary_large_image"/>
|
|
25
|
+
<meta name="twitter:title" content={title}/>
|
|
26
|
+
<meta name="twitter:description" content={ogDescription}/>
|
|
27
|
+
<meta name="twitter:image" content={ogImage}/>
|
|
28
|
+
</head_1.default>);
|
|
29
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
/**
|
|
3
|
+
Title of the page.
|
|
4
|
+
@default 'Application'
|
|
5
|
+
*/
|
|
6
|
+
title?: string;
|
|
7
|
+
/**
|
|
8
|
+
Description of the page.
|
|
9
|
+
*/
|
|
10
|
+
description?: string;
|
|
11
|
+
/**
|
|
12
|
+
Description of the page for the Open Graph protocol.
|
|
13
|
+
*/
|
|
14
|
+
ogDescription?: string;
|
|
15
|
+
/**
|
|
16
|
+
URL of the site.
|
|
17
|
+
*/
|
|
18
|
+
siteUrl?: string;
|
|
19
|
+
/**
|
|
20
|
+
Image of the page for the Open Graph protocol.
|
|
21
|
+
*/
|
|
22
|
+
ogImage?: string;
|
|
23
|
+
};
|
|
24
|
+
export default Props;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Props from './types';
|
|
3
|
+
declare const _default: React.MemoExoticComponent<({ children, getSession, onLoadingRealsed }: Props) => string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>> | React.JSX.Element>;
|
|
4
|
+
export default _default;
|