@codeleap/mobile 1.3.1 → 1.4.0
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/.eslintignore +2 -0
- package/.eslintrc.js +3 -0
- package/.vscode/settings.json +11 -0
- package/CodeLeap-Mobile-Packages.code-workspace +8 -0
- package/dist/components/ActivityIndicator.js +9 -6
- package/dist/components/ActivityIndicator.js.map +1 -1
- package/dist/components/Animated.d.ts +1 -89
- package/dist/components/Animated.js +2 -2
- package/dist/components/Animated.js.map +1 -1
- package/dist/components/Button.d.ts +107 -98
- package/dist/components/Button.js +29 -9
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Checkbox/index.d.ts +1 -1
- package/dist/components/Checkbox/index.js +7 -8
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Checkbox/styles.d.ts +47 -43
- package/dist/components/Checkbox/styles.js +8 -8
- package/dist/components/Checkbox/styles.js.map +1 -1
- package/dist/components/ContentView.js +4 -2
- package/dist/components/ContentView.js.map +1 -1
- package/dist/components/FileInput.d.ts +10 -3
- package/dist/components/FileInput.js +94 -32
- package/dist/components/FileInput.js.map +1 -1
- package/dist/components/Icon.d.ts +4 -6
- package/dist/components/Icon.js +25 -11
- package/dist/components/Icon.js.map +1 -1
- package/dist/components/Image.d.ts +7 -6
- package/dist/components/Image.js +4 -4
- package/dist/components/Image.js.map +1 -1
- package/dist/components/List.d.ts +11 -0
- package/dist/components/List.js +77 -0
- package/dist/components/List.js.map +1 -0
- package/dist/components/Modal/index.d.ts +2 -1
- package/dist/components/Modal/index.js +23 -30
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/styles.d.ts +51 -47
- package/dist/components/Modal/styles.js +13 -18
- package/dist/components/Modal/styles.js.map +1 -1
- package/dist/components/Navigation/Navigation.d.ts +3 -0
- package/dist/components/Navigation/Navigation.js +76 -0
- package/dist/components/Navigation/Navigation.js.map +1 -0
- package/dist/components/Navigation/constants.d.ts +5 -0
- package/dist/components/Navigation/constants.js +11 -0
- package/dist/components/Navigation/constants.js.map +1 -0
- package/dist/components/Navigation/index.d.ts +3 -0
- package/dist/components/Navigation/index.js +16 -0
- package/dist/components/Navigation/index.js.map +1 -0
- package/dist/components/Navigation/types.d.ts +26 -0
- package/dist/components/Navigation/types.js +8 -0
- package/dist/components/Navigation/types.js.map +1 -0
- package/dist/components/Navigation/utils.d.ts +3 -0
- package/dist/components/Navigation/utils.js +67 -0
- package/dist/components/Navigation/utils.js.map +1 -0
- package/dist/components/Overlay.d.ts +5 -5
- package/dist/components/Overlay.js +13 -15
- package/dist/components/Overlay.js.map +1 -1
- package/dist/components/Pager/index.d.ts +19 -0
- package/dist/components/Pager/index.js +164 -0
- package/dist/components/Pager/index.js.map +1 -0
- package/dist/components/Pager/styles.d.ts +51 -0
- package/dist/components/Pager/styles.js +44 -0
- package/dist/components/Pager/styles.js.map +1 -0
- package/dist/components/RadioInput/index.d.ts +1 -0
- package/dist/components/RadioInput/index.js +13 -19
- package/dist/components/RadioInput/index.js.map +1 -1
- package/dist/components/RadioInput/styles.d.ts +48 -44
- package/dist/components/RadioInput/styles.js +4 -4
- package/dist/components/RadioInput/styles.js.map +1 -1
- package/dist/components/Scroll.d.ts +3 -2
- package/dist/components/Scroll.js +11 -8
- package/dist/components/Scroll.js.map +1 -1
- package/dist/components/Sections.d.ts +11 -0
- package/dist/components/Sections.js +77 -0
- package/dist/components/Sections.js.map +1 -0
- package/dist/components/Select/index.d.ts +5 -2
- package/dist/components/Select/index.js +118 -5
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/styles.d.ts +9 -0
- package/dist/components/Select/styles.js +57 -0
- package/dist/components/Select/styles.js.map +1 -0
- package/dist/components/Select/types.d.ts +33 -0
- package/dist/components/Select/types.js +3 -0
- package/dist/components/Select/types.js.map +1 -0
- package/dist/components/Slider/Mark.d.ts +3 -0
- package/dist/components/Slider/Mark.js +32 -0
- package/dist/components/Slider/Mark.js.map +1 -0
- package/dist/components/Slider/Thumb.d.ts +7 -0
- package/dist/components/Slider/Thumb.js +30 -0
- package/dist/components/Slider/Thumb.js.map +1 -0
- package/dist/components/Slider/index.d.ts +3 -0
- package/dist/components/Slider/index.js +94 -0
- package/dist/components/Slider/index.js.map +1 -0
- package/dist/components/{Slider.d.ts → Slider/types.d.ts} +12 -7
- package/dist/components/Slider/types.js +3 -0
- package/dist/components/Slider/types.js.map +1 -0
- package/dist/components/Switch.d.ts +2 -2
- package/dist/components/Switch.js +6 -7
- package/dist/components/Switch.js.map +1 -1
- package/dist/components/Text.js +5 -5
- package/dist/components/Text.js.map +1 -1
- package/dist/components/TextInput.d.ts +108 -94
- package/dist/components/TextInput.js +28 -25
- package/dist/components/TextInput.js.map +1 -1
- package/dist/components/Touchable.d.ts +1 -0
- package/dist/components/Touchable.js +9 -11
- package/dist/components/Touchable.js.map +1 -1
- package/dist/components/View.d.ts +97 -175
- package/dist/components/View.js +4 -4
- package/dist/components/View.js.map +1 -1
- package/dist/components/{index.d.ts → components.d.ts} +3 -0
- package/dist/components/{index.js → components.js} +4 -1
- package/dist/components/components.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/modules/documentPicker.d.ts +3 -1
- package/dist/modules/documentPicker.js +6 -4
- package/dist/modules/documentPicker.js.map +1 -1
- package/dist/modules/fastImage.js +1 -1
- package/dist/modules/fastImage.js.map +1 -1
- package/dist/modules/reactNavigation.d.ts +3 -0
- package/dist/modules/reactNavigation.js +11 -0
- package/dist/modules/reactNavigation.js.map +1 -0
- package/dist/modules/types/fileTypes.d.ts +138 -0
- package/dist/modules/types/fileTypes.js +3 -0
- package/dist/modules/types/fileTypes.js.map +1 -0
- package/dist/types/utility.d.ts +1 -1
- package/dist/utils/OSAlert.d.ts +3 -3
- package/dist/utils/OSAlert.js.map +1 -1
- package/dist/utils/misc.d.ts +2 -0
- package/dist/utils/misc.js +26 -0
- package/dist/utils/misc.js.map +1 -0
- package/dist/utils/styles.js +1 -1
- package/dist/utils/styles.js.map +1 -1
- package/package.json +6 -3
- package/src/components/ActivityIndicator.tsx +38 -28
- package/src/components/Animated.tsx +22 -19
- package/src/components/Button.tsx +67 -34
- package/src/components/Checkbox/index.tsx +60 -48
- package/src/components/Checkbox/styles.ts +39 -30
- package/src/components/ContentView.tsx +24 -18
- package/src/components/FileInput.tsx +161 -52
- package/src/components/Icon.tsx +36 -23
- package/src/components/Image.tsx +42 -36
- package/src/components/List.tsx +100 -0
- package/src/components/Modal/index.tsx +109 -94
- package/src/components/Modal/styles.ts +62 -66
- package/src/components/Navigation/Navigation.tsx +51 -0
- package/src/components/Navigation/constants.ts +8 -0
- package/src/components/Navigation/index.tsx +3 -0
- package/src/components/Navigation/types.ts +37 -0
- package/src/components/Navigation/utils.tsx +54 -0
- package/src/components/Overlay.tsx +68 -64
- package/src/components/Pager/index.tsx +241 -0
- package/src/components/Pager/styles.ts +51 -0
- package/src/components/RadioInput/index.tsx +76 -52
- package/src/components/RadioInput/styles.ts +23 -18
- package/src/components/Scroll.tsx +84 -73
- package/src/components/Select/index.tsx +179 -6
- package/src/components/Select/styles.ts +81 -0
- package/src/components/Select/types.ts +41 -0
- package/src/components/Slider/Mark.tsx +46 -0
- package/src/components/Slider/Thumb.tsx +29 -0
- package/src/components/Slider/index.tsx +123 -0
- package/src/components/Slider/types.ts +25 -0
- package/src/components/Switch.tsx +63 -54
- package/src/components/Text.tsx +22 -23
- package/src/components/TextInput.tsx +195 -198
- package/src/components/Touchable.tsx +43 -30
- package/src/components/View.tsx +32 -29
- package/src/components/components.ts +26 -0
- package/src/index.ts +6 -3
- package/src/modules/documentPicker.ts +8 -2
- package/src/modules/fastImage.ts +2 -2
- package/src/modules/index.d.ts +496 -0
- package/src/modules/reactNavigation.ts +4 -0
- package/src/modules/types/documentPicker.d.ts +215 -0
- package/src/modules/types/fileTypes.ts +138 -0
- package/src/types/utility.ts +2 -2
- package/src/utils/OSAlert.ts +35 -33
- package/src/utils/misc.ts +24 -0
- package/src/utils/styles.ts +14 -17
- package/dist/components/Drawer.d.ts +0 -23
- package/dist/components/Drawer.js +0 -78
- package/dist/components/Drawer.js.map +0 -1
- package/dist/components/Navigation.d.ts +0 -30
- package/dist/components/Navigation.js +0 -126
- package/dist/components/Navigation.js.map +0 -1
- package/dist/components/Slider.js +0 -130
- package/dist/components/Slider.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/modules/cropPicker.d.ts +0 -1
- package/dist/modules/cropPicker.js +0 -10
- package/dist/modules/cropPicker.js.map +0 -1
- package/src/components/Navigation.tsx +0 -125
- package/src/components/Slider.tsx +0 -198
- package/src/components/index.ts +0 -23
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { RouteConfig } from '@react-navigation/native';
|
|
3
|
-
import { NativeStackScreenProps } from '@react-navigation/native-stack';
|
|
4
|
-
import { AnyFunction } from '@codeleap/common';
|
|
5
|
-
import { Paths } from '@codeleap/common/dist/types/pathMapping';
|
|
6
|
-
export declare type AppScenes = {
|
|
7
|
-
[x: string]: {
|
|
8
|
-
[y: string]: AnyFunction | (Partial<Pick<RouteConfig<any, any, any, any, any>, 'options'>> & {
|
|
9
|
-
render: AnyFunction;
|
|
10
|
-
icon?: any;
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
declare const Navigators: {
|
|
15
|
-
drawer: any;
|
|
16
|
-
stack: any;
|
|
17
|
-
tab: any;
|
|
18
|
-
};
|
|
19
|
-
declare type NavigationType = keyof typeof Navigators;
|
|
20
|
-
declare type NavigationProps<T extends NavigationType> = {
|
|
21
|
-
scenes: AppScenes;
|
|
22
|
-
type: T;
|
|
23
|
-
} & React.ComponentPropsWithoutRef<(typeof Navigators)[T]['Navigator']>;
|
|
24
|
-
export declare const Navigation: <T extends "tab" | "drawer" | "stack", P extends NavigationProps<T> = NavigationProps<T>>({ type, scenes, ...props }: P) => JSX.Element;
|
|
25
|
-
export declare type NavigationScreenProps<S extends AppScenes, T extends NativeStackScreenProps<any, any> = NativeStackScreenProps<any, any>> = Omit<T, 'navigation'> & {
|
|
26
|
-
navigation: Omit<T['navigation'], 'navigate'> & {
|
|
27
|
-
navigate: (to: Exclude<Paths<S, 1>, keyof S>) => void;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
export {};
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
-
if (mod && mod.__esModule) return mod;
|
|
27
|
-
var result = {};
|
|
28
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
-
__setModuleDefault(result, mod);
|
|
30
|
-
return result;
|
|
31
|
-
};
|
|
32
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
33
|
-
var t = {};
|
|
34
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
35
|
-
t[p] = s[p];
|
|
36
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
37
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
38
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
39
|
-
t[p[i]] = s[p[i]];
|
|
40
|
-
}
|
|
41
|
-
return t;
|
|
42
|
-
};
|
|
43
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
-
exports.Navigation = void 0;
|
|
45
|
-
// @ts-nocheck
|
|
46
|
-
var React = __importStar(require("react"));
|
|
47
|
-
var native_stack_1 = require("@react-navigation/native-stack");
|
|
48
|
-
var common_1 = require("@codeleap/common");
|
|
49
|
-
var drawer_1 = require("@react-navigation/drawer");
|
|
50
|
-
var bottom_tabs_1 = require("@react-navigation/bottom-tabs");
|
|
51
|
-
var Icon_1 = require("./Icon");
|
|
52
|
-
var parseModulePages = function (pageModule, _a) {
|
|
53
|
-
var _b;
|
|
54
|
-
var pageName = _a[0], Component = _a[1];
|
|
55
|
-
var name = "".concat(pageModule, ".").concat(pageName);
|
|
56
|
-
var props = {
|
|
57
|
-
name: name,
|
|
58
|
-
key: name,
|
|
59
|
-
options: {
|
|
60
|
-
title: pageName,
|
|
61
|
-
},
|
|
62
|
-
component: null,
|
|
63
|
-
};
|
|
64
|
-
switch (typeof Component) {
|
|
65
|
-
case 'function':
|
|
66
|
-
props.component = Component;
|
|
67
|
-
case 'object':
|
|
68
|
-
props = __assign(__assign({}, props), Component);
|
|
69
|
-
if (typeof Component.default === 'function') {
|
|
70
|
-
props.component = Component.default;
|
|
71
|
-
}
|
|
72
|
-
if (Component.render) {
|
|
73
|
-
props.component = typeof Component.render === 'function' ? Component.render : (_b = Component === null || Component === void 0 ? void 0 : Component.render) === null || _b === void 0 ? void 0 : _b.default;
|
|
74
|
-
}
|
|
75
|
-
default:
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
return props;
|
|
79
|
-
};
|
|
80
|
-
var flattenScenes = function (_a) {
|
|
81
|
-
var scenes = _a.scenes, Theme = _a.Theme;
|
|
82
|
-
return Object.entries(scenes).reduce(function (acc, _a) {
|
|
83
|
-
var pageModule = _a[0], pages = _a[1];
|
|
84
|
-
var thisModulePages = {};
|
|
85
|
-
for (var _i = 0, _b = Object.entries(pages); _i < _b.length; _i++) {
|
|
86
|
-
var pageData = _b[_i];
|
|
87
|
-
var parsedData = parseModulePages(pageModule, pageData);
|
|
88
|
-
thisModulePages[parsedData.name] = parsedData;
|
|
89
|
-
}
|
|
90
|
-
return __assign(__assign({}, acc), thisModulePages);
|
|
91
|
-
}, {});
|
|
92
|
-
};
|
|
93
|
-
var Navigators = {
|
|
94
|
-
drawer: (0, drawer_1.createDrawerNavigator)(),
|
|
95
|
-
stack: (0, native_stack_1.createNativeStackNavigator)(),
|
|
96
|
-
tab: (0, bottom_tabs_1.createBottomTabNavigator)(),
|
|
97
|
-
};
|
|
98
|
-
var Navigation = function (_a) {
|
|
99
|
-
var type = _a.type, scenes = _a.scenes, props = __rest(_a, ["type", "scenes"]);
|
|
100
|
-
var Navigator = Navigators[type];
|
|
101
|
-
var Theme = (0, common_1.useStyle)().Theme;
|
|
102
|
-
var flatScenes = flattenScenes({
|
|
103
|
-
Theme: Theme,
|
|
104
|
-
scenes: scenes,
|
|
105
|
-
});
|
|
106
|
-
var otherProps = props;
|
|
107
|
-
// @ts-ignore
|
|
108
|
-
var screenOptions = function (_a) {
|
|
109
|
-
var route = _a.route, navigation = _a.navigation;
|
|
110
|
-
var propOptions = typeof ((otherProps === null || otherProps === void 0 ? void 0 : otherProps.screenOptions) || {}) === 'function' ?
|
|
111
|
-
otherProps.screenOptions({ route: route, navigation: navigation }) :
|
|
112
|
-
otherProps === null || otherProps === void 0 ? void 0 : otherProps.screenOptions;
|
|
113
|
-
return __assign(__assign({}, propOptions), { tabBarIcon: function (style) {
|
|
114
|
-
var _a, _b;
|
|
115
|
-
if ((_a = flatScenes === null || flatScenes === void 0 ? void 0 : flatScenes[route.name]) === null || _a === void 0 ? void 0 : _a.icon) {
|
|
116
|
-
return <Icon_1.Icon name={(_b = flatScenes === null || flatScenes === void 0 ? void 0 : flatScenes[route.name]) === null || _b === void 0 ? void 0 : _b.icon} style={style}/>;
|
|
117
|
-
}
|
|
118
|
-
return null;
|
|
119
|
-
} });
|
|
120
|
-
};
|
|
121
|
-
return <Navigator.Navigator {...otherProps} screenOptions={screenOptions}>
|
|
122
|
-
{Object.values(flatScenes).map(function (props) { return <Navigator.Screen {...props}/>; })}
|
|
123
|
-
</Navigator.Navigator>;
|
|
124
|
-
};
|
|
125
|
-
exports.Navigation = Navigation;
|
|
126
|
-
//# sourceMappingURL=Navigation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Navigation.js","sourceRoot":"","sources":["../../src/components/Navigation.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,2CAA8B;AAE9B,+DAAmG;AACnG,2CAAwF;AACxF,mDAAgE;AAChE,6DAAwE;AACxE,+BAA6B;AAY7B,IAAM,gBAAgB,GAAG,UAAC,UAAiB,EAAE,EAAqB;;QAApB,QAAQ,QAAA,EAAE,SAAS,QAAA;IAC/D,IAAM,IAAI,GAAI,UAAG,UAAU,cAAI,QAAQ,CAAE,CAAA;IAEzC,IAAI,KAAK,GAAG;QACV,IAAI,MAAA;QACJ,GAAG,EAAE,IAAI;QACT,OAAO,EAAE;YACP,KAAK,EAAE,QAAQ;SAChB;QACD,SAAS,EAAE,IAAI;KAChB,CAAA;IAED,QAAQ,OAAO,SAAS,EAAC;QACvB,KAAK,UAAU;YACb,KAAK,CAAC,SA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A,CACE,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,CAAC,SAAS,CAAC,MAAM,CAAC,IAAK,KAAa,CAAC,EAAE,EAAvC,CAAuC,CAAC,CAErF;EAAA,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;AAExB,CAAC,CAAA;AAhCa,QAAA,UAAU,cAgCvB"}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
22
|
-
var t = {};
|
|
23
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
24
|
-
t[p] = s[p];
|
|
25
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
26
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
27
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
28
|
-
t[p[i]] = s[p[i]];
|
|
29
|
-
}
|
|
30
|
-
return t;
|
|
31
|
-
};
|
|
32
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.Slider = void 0;
|
|
34
|
-
var React = __importStar(require("react"));
|
|
35
|
-
var react_native_slider_1 = require("@miblanchard/react-native-slider");
|
|
36
|
-
var react_1 = require("react");
|
|
37
|
-
var react_native_1 = require("react-native");
|
|
38
|
-
var Text_1 = require("./Text");
|
|
39
|
-
var View_1 = require("./View");
|
|
40
|
-
var common_1 = require("@codeleap/common");
|
|
41
|
-
var TextInput_1 = require("./TextInput");
|
|
42
|
-
var SliderMark = function (_a) {
|
|
43
|
-
var index = _a.index, sliderProps = _a.sliderProps, styles = _a.styles, variantStyles = _a.variantStyles;
|
|
44
|
-
var _b = sliderProps.labels, labels = _b === void 0 ? [] : _b, showMarks = sliderProps.showMarks;
|
|
45
|
-
var l = (labels === null || labels === void 0 ? void 0 : labels[index]) || '';
|
|
46
|
-
var isFirst = index === 0;
|
|
47
|
-
var isLast = index === labels.length - 1;
|
|
48
|
-
var centerAdjustWord = -(l.length * 2);
|
|
49
|
-
var markStyles = {};
|
|
50
|
-
var labelStyles = {};
|
|
51
|
-
if (!isFirst && !isLast) {
|
|
52
|
-
labelStyles.left = centerAdjustWord;
|
|
53
|
-
}
|
|
54
|
-
if (isLast) {
|
|
55
|
-
labelStyles.right = -20;
|
|
56
|
-
markStyles.right = -10;
|
|
57
|
-
}
|
|
58
|
-
return <>
|
|
59
|
-
{showMarks ? (<View_1.View style={[
|
|
60
|
-
markStyles,
|
|
61
|
-
variantStyles.mark,
|
|
62
|
-
styles.mark,
|
|
63
|
-
]}/>) : null}
|
|
64
|
-
{l ?
|
|
65
|
-
(<Text_1.Text style={[
|
|
66
|
-
labelStyles,
|
|
67
|
-
variantStyles.trackLabels,
|
|
68
|
-
styles.trackLabels,
|
|
69
|
-
]} text={l}/>) : null}
|
|
70
|
-
</>;
|
|
71
|
-
};
|
|
72
|
-
var ThumbTooltip = function (_a) {
|
|
73
|
-
var children = _a.children, visible = _a.visible, styles = _a.styles, variantStyles = _a.variantStyles;
|
|
74
|
-
return <View_1.View style={[
|
|
75
|
-
react_native_1.StyleSheet.flatten([variantStyles.tooltip, styles.tooltip]),
|
|
76
|
-
visible ?
|
|
77
|
-
react_native_1.StyleSheet.flatten([variantStyles['tooltip:visible'], styles['tooltip:visible']]) :
|
|
78
|
-
react_native_1.StyleSheet.flatten([variantStyles['tooltip:hidden'], styles['tooltip:hidden']])
|
|
79
|
-
]}>
|
|
80
|
-
<Text_1.Text style={[variantStyles.tooltipText, styles.tooltipText]} text={children}/>
|
|
81
|
-
<View_1.View style={[variantStyles.tooltipArrow, styles.tooltipArrow,]}/>
|
|
82
|
-
</View_1.View>;
|
|
83
|
-
};
|
|
84
|
-
var Slider = function (sliderProps) {
|
|
85
|
-
var _a;
|
|
86
|
-
var _b = React.useState(false), tooltipVisible = _b[0], setTooltipVisible = _b[1];
|
|
87
|
-
var debounce = sliderProps.debounce, onValueChange = sliderProps.onValueChange, labels = sliderProps.labels, value = sliderProps.value, label = sliderProps.label, valueOverThumb = sliderProps.valueOverThumb, formatTooltip = sliderProps.formatTooltip, _c = sliderProps.styles, styles = _c === void 0 ? {} : _c, style = sliderProps.style, variants = sliderProps.variants, props = __rest(sliderProps, ["debounce", "onValueChange", "labels", "value", "label", "valueOverThumb", "formatTooltip", "styles", "style", "variants"]);
|
|
88
|
-
var changeDebounce = typeof debounce === 'number' ? debounce : 100;
|
|
89
|
-
var debounceTimeout = (0, react_1.useRef)(null);
|
|
90
|
-
var toggleTooltipTimeout = (0, react_1.useRef)(null);
|
|
91
|
-
var valueRef = (0, react_1.useRef)(value);
|
|
92
|
-
var variantStyles = (0, common_1.useComponentStyle)('Slider', {
|
|
93
|
-
variants: variants
|
|
94
|
-
});
|
|
95
|
-
function setValue() {
|
|
96
|
-
onValueChange(valueRef.current);
|
|
97
|
-
}
|
|
98
|
-
function onChange(val) {
|
|
99
|
-
var eventValue = val;
|
|
100
|
-
if (Array.isArray(val)) {
|
|
101
|
-
eventValue = val[0];
|
|
102
|
-
}
|
|
103
|
-
if (eventValue === value)
|
|
104
|
-
return;
|
|
105
|
-
valueRef.current = eventValue;
|
|
106
|
-
if (debounceTimeout.current)
|
|
107
|
-
clearTimeout(debounceTimeout.current);
|
|
108
|
-
debounceTimeout.current = setTimeout(function () {
|
|
109
|
-
setValue();
|
|
110
|
-
}, changeDebounce);
|
|
111
|
-
}
|
|
112
|
-
return <View_1.View style={[variantStyles.wrapper, style]}>
|
|
113
|
-
<TextInput_1.InputLabel label={label} style={[variantStyles.label, styles.label]}/>
|
|
114
|
-
<react_native_slider_1.Slider value={value} onSlidingStart={function () {
|
|
115
|
-
if (toggleTooltipTimeout.current)
|
|
116
|
-
clearTimeout(toggleTooltipTimeout.current);
|
|
117
|
-
setTooltipVisible(true);
|
|
118
|
-
}} onSlidingComplete={function () {
|
|
119
|
-
toggleTooltipTimeout.current = setTimeout(function () { return setTooltipVisible(false); }, 830);
|
|
120
|
-
}} onValueChange={onChange} renderAboveThumbComponent={function (idx) {
|
|
121
|
-
if (!valueOverThumb || typeof value !== 'number')
|
|
122
|
-
return null;
|
|
123
|
-
return <ThumbTooltip visible={tooltipVisible} variantStyles={variantStyles} styles={styles}>
|
|
124
|
-
{formatTooltip ? formatTooltip(value) : value.toString()}
|
|
125
|
-
</ThumbTooltip>;
|
|
126
|
-
}} renderTrackMarkComponent={function (idx) { return <SliderMark index={idx} sliderProps={sliderProps} styles={styles} variantStyles={variantStyles}/>; }} maximumValue={labels ? labels.length - 1 : 10} trackMarks={labels ? Object.keys(labels).map(function (z) { return parseInt(z); }) : []} containerStyle={[variantStyles.inputContainer, styles.inputContainer]} thumbStyle={react_native_1.StyleSheet.flatten([variantStyles.handle, styles.handle])} trackStyle={[variantStyles.track, styles.track]} minimumTrackTintColor={(_a = react_native_1.StyleSheet.flatten([variantStyles.selectedTrack, styles.selectedTrack])) === null || _a === void 0 ? void 0 : _a.backgroundColor} {...props}/>
|
|
127
|
-
</View_1.View>;
|
|
128
|
-
};
|
|
129
|
-
exports.Slider = Slider;
|
|
130
|
-
//# sourceMappingURL=Slider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Slider.js","sourceRoot":"","sources":["../../src/components/Slider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA8B;AAC9B,wEAEyC;AAEzC,+BAA8B;AAC9B,6CAAoD;AACpD,+BAA6B;AAC7B,+BAAwC;AACxC,2CAAwH;AACxH,yCAAwC;AA0BxC,IAAM,UAAU,GAA6B,UAAC,EAAyC;QAAxC,KAAK,WAAA,EAAE,WAAW,iBAAA,EAAC,MAAM,YAAA,EAAC,aAAa,mBAAA;IAC1E,IAAA,KAA0B,WAAW,OAA1B,EAAX,MAAM,mBAAG,EAAE,KAAA,EAAE,SAAS,GAAI,WAAW,UAAf,CAAe;IAE7C,IAAM,CAAC,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,KAAK,CAAC,KAAI,EAAE,CAAA;IAE/B,IAAM,OAAO,GAAG,KAAK,KAAK,CAAC,CAAA;IAC3B,IAAM,MAAM,GAAG,KAAK,KAAK,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;IAG1C,IAAM,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAExC,IAAM,UAAU,GAAkB,EAAE,CAAA;IAEpC,IAAM,WAAW,GAAkB,EAAE,CAAA;IAErC,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,EAAC;QACtB,WAAW,CAAC,IAAI,GAAG,gBAAgB,CAAA;KAEpC;IAED,IAAI,MAAM,EAAC;QACT,WAAW,CAAC,KAAK,GAAG,CAAC,EAAE,CAAA;QACvB,UA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MAAM,UAmGlB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAsB;AACtB,yCAAsB;AACtB,8CAA4B;AAC5B,yCAAuB;AACvB,0CAAwB;AACxB,6CAA2B;AAC3B,8CAA4B;AAC5B,+CAA6B;AAC7B,2CAAyB;AACzB,gDAA6B;AAE7B,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,+CAA6B;AAC7B,2CAAwB;AACxB,sDAAmC;AACnC,2CAAwB;AACxB,gDAA6B;AAC7B,4CAAyB;AACzB,0CAAuB;AAEvB,+CAA6B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as ImagePicker } from 'react-native-image-crop-picker';
|
|
@@ -1,10 +0,0 @@
|
|
|
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.ImagePicker = void 0;
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
var react_native_image_crop_picker_1 = require("react-native-image-crop-picker");
|
|
9
|
-
Object.defineProperty(exports, "ImagePicker", { enumerable: true, get: function () { return __importDefault(react_native_image_crop_picker_1).default; } });
|
|
10
|
-
//# sourceMappingURL=cropPicker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cropPicker.js","sourceRoot":"","sources":["../../src/modules/cropPicker.ts"],"names":[],"mappings":";;;;;;AAAA,aAAa;AACb,iFAAqE;AAA7D,8IAAA,OAAO,OAAe"}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import * as React from 'react'
|
|
3
|
-
import { RouteConfig } from '@react-navigation/native'
|
|
4
|
-
import { createNativeStackNavigator, NativeStackScreenProps } from '@react-navigation/native-stack'
|
|
5
|
-
import { AnyFunction, EnhancedTheme, IconPlaceholder, useStyle } from '@codeleap/common'
|
|
6
|
-
import { createDrawerNavigator } from '@react-navigation/drawer'
|
|
7
|
-
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'
|
|
8
|
-
import { Icon } from './Icon'
|
|
9
|
-
import { Paths } from '@codeleap/common/dist/types/pathMapping'
|
|
10
|
-
|
|
11
|
-
export type AppScenes = {
|
|
12
|
-
[x:string] : {
|
|
13
|
-
[y:string] : AnyFunction | ( Partial<Pick<RouteConfig<any, any, any, any, any>, 'options'>> & {
|
|
14
|
-
render: AnyFunction,
|
|
15
|
-
icon?: any
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const parseModulePages = (pageModule:string, [pageName, Component]) => {
|
|
21
|
-
const name = `${pageModule}.${pageName}`
|
|
22
|
-
|
|
23
|
-
let props = {
|
|
24
|
-
name,
|
|
25
|
-
key: name,
|
|
26
|
-
options: {
|
|
27
|
-
title: pageName,
|
|
28
|
-
},
|
|
29
|
-
component: null,
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
switch (typeof Component){
|
|
33
|
-
case 'function':
|
|
34
|
-
props.component = Component
|
|
35
|
-
case 'object':
|
|
36
|
-
props = {
|
|
37
|
-
...props,
|
|
38
|
-
...Component,
|
|
39
|
-
}
|
|
40
|
-
if (typeof Component.default === 'function'){
|
|
41
|
-
props.component = Component.default
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (Component.render){
|
|
45
|
-
props.component = typeof Component.render === 'function' ? Component.render : Component?.render?.default
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
default:
|
|
49
|
-
break
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return props
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
type FlattenScenesArgs = {
|
|
56
|
-
scenes:AppScenes,
|
|
57
|
-
Theme: EnhancedTheme<any>
|
|
58
|
-
}
|
|
59
|
-
const flattenScenes = ({
|
|
60
|
-
scenes,
|
|
61
|
-
Theme,
|
|
62
|
-
}:FlattenScenesArgs) => {
|
|
63
|
-
|
|
64
|
-
return Object.entries(scenes).reduce((acc, [pageModule, pages]) => {
|
|
65
|
-
const thisModulePages = {}
|
|
66
|
-
for (const pageData of Object.entries(pages)){
|
|
67
|
-
const parsedData = parseModulePages(pageModule, pageData)
|
|
68
|
-
|
|
69
|
-
thisModulePages[parsedData.name] = parsedData
|
|
70
|
-
}
|
|
71
|
-
return {...acc, ...thisModulePages}
|
|
72
|
-
}, {})
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const Navigators = {
|
|
76
|
-
drawer: createDrawerNavigator(),
|
|
77
|
-
stack: createNativeStackNavigator(),
|
|
78
|
-
tab: createBottomTabNavigator(),
|
|
79
|
-
}
|
|
80
|
-
type NavigationType = keyof typeof Navigators
|
|
81
|
-
type NavigationProps<T extends NavigationType> = {
|
|
82
|
-
scenes: AppScenes
|
|
83
|
-
type: T
|
|
84
|
-
} & React.ComponentPropsWithoutRef<(typeof Navigators)[T]['Navigator']>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
export const Navigation = <T extends NavigationType, P extends NavigationProps<T> = NavigationProps<T>>({type, scenes, ...props}:P) => {
|
|
88
|
-
const Navigator:(typeof Navigators)[T] = Navigators[type]
|
|
89
|
-
const { Theme } = useStyle()
|
|
90
|
-
const flatScenes = flattenScenes({
|
|
91
|
-
Theme,
|
|
92
|
-
scenes,
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
const otherProps = props as any
|
|
96
|
-
// @ts-ignore
|
|
97
|
-
const screenOptions:P['screenOptions'] = ({route, navigation}) => {
|
|
98
|
-
const propOptions = typeof (otherProps?.screenOptions || {}) === 'function' ?
|
|
99
|
-
otherProps.screenOptions({route, navigation}) :
|
|
100
|
-
otherProps?.screenOptions
|
|
101
|
-
|
|
102
|
-
return {
|
|
103
|
-
...propOptions,
|
|
104
|
-
tabBarIcon: (style) => {
|
|
105
|
-
if (flatScenes?.[route.name]?.icon){
|
|
106
|
-
return <Icon name={flatScenes?.[route.name]?.icon} style={style}/>
|
|
107
|
-
}
|
|
108
|
-
return null
|
|
109
|
-
},
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return <Navigator.Navigator {...otherProps} screenOptions={screenOptions} >
|
|
114
|
-
{
|
|
115
|
-
Object.values(flatScenes).map((props) => <Navigator.Screen {...(props as any)}/>)
|
|
116
|
-
}
|
|
117
|
-
</Navigator.Navigator>
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
export type NavigationScreenProps<S extends AppScenes, T extends NativeStackScreenProps<any, any> = NativeStackScreenProps<any, any>> = Omit<T, 'navigation'> & {
|
|
121
|
-
navigation: Omit<T['navigation'],'navigate'> & {
|
|
122
|
-
navigate: (to: Exclude<Paths<S, 1>, keyof S>) => void
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
}
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
Slider as RNSlider
|
|
4
|
-
} from '@miblanchard/react-native-slider'
|
|
5
|
-
import { SliderProps as RNSliderProps} from '@miblanchard/react-native-slider/lib/types'
|
|
6
|
-
import { useRef } from 'react'
|
|
7
|
-
import { StyleProp, StyleSheet } from 'react-native'
|
|
8
|
-
import { Text } from './Text'
|
|
9
|
-
import { View, ViewProps } from './View'
|
|
10
|
-
import { ComponentVariants, Form, SliderComposition, SliderStyles, useComponentStyle, useStyle } from '@codeleap/common'
|
|
11
|
-
import { InputLabel } from './TextInput'
|
|
12
|
-
import { StylesOf } from '../types/utility'
|
|
13
|
-
|
|
14
|
-
type SliderProps = Partial<Omit<RNSliderProps,'value'|'onValueChange'>> & {
|
|
15
|
-
|
|
16
|
-
debounce?: number
|
|
17
|
-
labels: string[]
|
|
18
|
-
value: number
|
|
19
|
-
valueOverThumb?: boolean
|
|
20
|
-
showMarks?: boolean
|
|
21
|
-
onValueChange:(val:number) => void
|
|
22
|
-
label: Form.Label
|
|
23
|
-
formatTooltip?:(val:number) => React.ReactNode
|
|
24
|
-
variants?: ComponentVariants<typeof SliderStyles>['variants']
|
|
25
|
-
styles?: StylesOf<SliderComposition>
|
|
26
|
-
style?: ViewProps['style']
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
type SliderMarkProps = {
|
|
30
|
-
sliderProps: SliderProps
|
|
31
|
-
index: number
|
|
32
|
-
styles:SliderProps['styles']
|
|
33
|
-
variantStyles:SliderProps['styles']
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const SliderMark:React.FC<SliderMarkProps> = ({index, sliderProps,styles,variantStyles}) => {
|
|
38
|
-
const { labels = [], showMarks} = sliderProps
|
|
39
|
-
|
|
40
|
-
const l = labels?.[index] || ''
|
|
41
|
-
|
|
42
|
-
const isFirst = index === 0
|
|
43
|
-
const isLast = index === labels.length - 1
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const centerAdjustWord = -(l.length * 2)
|
|
47
|
-
|
|
48
|
-
const markStyles:StyleProp<any> = {}
|
|
49
|
-
|
|
50
|
-
const labelStyles:StyleProp<any> = {}
|
|
51
|
-
|
|
52
|
-
if (!isFirst && !isLast){
|
|
53
|
-
labelStyles.left = centerAdjustWord
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (isLast){
|
|
58
|
-
labelStyles.right = -20
|
|
59
|
-
markStyles.right = -10
|
|
60
|
-
}
|
|
61
|
-
return <>
|
|
62
|
-
{
|
|
63
|
-
showMarks ? (
|
|
64
|
-
|
|
65
|
-
<View style={[
|
|
66
|
-
markStyles,
|
|
67
|
-
variantStyles.mark,
|
|
68
|
-
styles.mark,
|
|
69
|
-
]}/>) : null
|
|
70
|
-
}
|
|
71
|
-
{l ?
|
|
72
|
-
(<Text
|
|
73
|
-
|
|
74
|
-
style={[
|
|
75
|
-
labelStyles,
|
|
76
|
-
variantStyles.trackLabels,
|
|
77
|
-
styles.trackLabels,
|
|
78
|
-
]}
|
|
79
|
-
text={l}
|
|
80
|
-
/>) : null
|
|
81
|
-
}
|
|
82
|
-
</>
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const ThumbTooltip = ({children,visible, styles, variantStyles}) => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return <View style={[
|
|
89
|
-
StyleSheet.flatten([variantStyles.tooltip, styles.tooltip ]),
|
|
90
|
-
visible ?
|
|
91
|
-
StyleSheet.flatten([variantStyles['tooltip:visible'], styles['tooltip:visible'] ]) :
|
|
92
|
-
StyleSheet.flatten([variantStyles['tooltip:hidden'], styles['tooltip:hidden'] ])
|
|
93
|
-
]}>
|
|
94
|
-
<Text style={[variantStyles.tooltipText,styles.tooltipText]} text={children} />
|
|
95
|
-
<View style={[variantStyles.tooltipArrow,styles.tooltipArrow,]}/>
|
|
96
|
-
</View>
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export const Slider:React.FC<SliderProps> = (sliderProps) => {
|
|
100
|
-
const [tooltipVisible, setTooltipVisible] = React.useState(false)
|
|
101
|
-
|
|
102
|
-
const {
|
|
103
|
-
|
|
104
|
-
debounce,
|
|
105
|
-
onValueChange,
|
|
106
|
-
labels,
|
|
107
|
-
value,
|
|
108
|
-
label,
|
|
109
|
-
valueOverThumb,
|
|
110
|
-
formatTooltip,
|
|
111
|
-
styles = {},
|
|
112
|
-
style,
|
|
113
|
-
variants,
|
|
114
|
-
...props
|
|
115
|
-
} = sliderProps
|
|
116
|
-
|
|
117
|
-
const changeDebounce = typeof debounce === 'number' ? debounce : 100
|
|
118
|
-
|
|
119
|
-
const debounceTimeout = useRef(null)
|
|
120
|
-
const toggleTooltipTimeout = useRef(null)
|
|
121
|
-
const valueRef = useRef(value)
|
|
122
|
-
|
|
123
|
-
const variantStyles = useComponentStyle('Slider', {
|
|
124
|
-
variants
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
function setValue(){
|
|
128
|
-
onValueChange(valueRef.current)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function onChange(val){
|
|
132
|
-
|
|
133
|
-
let eventValue = val
|
|
134
|
-
|
|
135
|
-
if(Array.isArray(val)){
|
|
136
|
-
eventValue = val[0]
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if(eventValue === value) return
|
|
140
|
-
|
|
141
|
-
valueRef.current = eventValue as number
|
|
142
|
-
|
|
143
|
-
if(debounceTimeout.current) clearTimeout(debounceTimeout.current)
|
|
144
|
-
|
|
145
|
-
debounceTimeout.current = setTimeout(() => {
|
|
146
|
-
setValue()
|
|
147
|
-
}, changeDebounce)
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return <View style={[variantStyles.wrapper, style]}>
|
|
151
|
-
<InputLabel label={label} style={[variantStyles.label, styles.label]}/>
|
|
152
|
-
<RNSlider
|
|
153
|
-
value={value}
|
|
154
|
-
|
|
155
|
-
onSlidingStart={() => {
|
|
156
|
-
if(toggleTooltipTimeout.current) clearTimeout(toggleTooltipTimeout.current)
|
|
157
|
-
|
|
158
|
-
setTooltipVisible(true)
|
|
159
|
-
}}
|
|
160
|
-
|
|
161
|
-
onSlidingComplete={() => {
|
|
162
|
-
toggleTooltipTimeout.current = setTimeout(() => setTooltipVisible(false),830)
|
|
163
|
-
}}
|
|
164
|
-
|
|
165
|
-
onValueChange={onChange}
|
|
166
|
-
|
|
167
|
-
renderAboveThumbComponent={(idx) => {
|
|
168
|
-
if(!valueOverThumb || typeof value !== 'number') return null
|
|
169
|
-
|
|
170
|
-
return <ThumbTooltip visible={tooltipVisible} variantStyles={variantStyles} styles={styles}>
|
|
171
|
-
{formatTooltip ? formatTooltip(value) : value.toString()}
|
|
172
|
-
</ThumbTooltip>
|
|
173
|
-
}}
|
|
174
|
-
|
|
175
|
-
renderTrackMarkComponent={(idx) => <SliderMark
|
|
176
|
-
index={idx}
|
|
177
|
-
sliderProps={sliderProps}
|
|
178
|
-
styles={styles}
|
|
179
|
-
variantStyles={variantStyles}
|
|
180
|
-
/>}
|
|
181
|
-
|
|
182
|
-
maximumValue={labels ? labels.length - 1 : 10}
|
|
183
|
-
|
|
184
|
-
trackMarks={labels ? Object.keys(labels).map((z) => parseInt(z)) : []}
|
|
185
|
-
|
|
186
|
-
containerStyle={[variantStyles.inputContainer, styles.inputContainer] as any}
|
|
187
|
-
|
|
188
|
-
thumbStyle={StyleSheet.flatten([variantStyles.handle, styles.handle]) as any}
|
|
189
|
-
|
|
190
|
-
trackStyle={[variantStyles.track, styles.track] as any}
|
|
191
|
-
|
|
192
|
-
minimumTrackTintColor={
|
|
193
|
-
StyleSheet.flatten([variantStyles.selectedTrack, styles.selectedTrack])?.backgroundColor
|
|
194
|
-
}
|
|
195
|
-
{...props}
|
|
196
|
-
/>
|
|
197
|
-
</View>
|
|
198
|
-
}
|
package/src/components/index.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export * from './View'
|
|
2
|
-
export * from './Icon'
|
|
3
|
-
export * from './Touchable'
|
|
4
|
-
export * from './Text'
|
|
5
|
-
export * from './Image'
|
|
6
|
-
export * from './Checkbox'
|
|
7
|
-
export * from './TextInput'
|
|
8
|
-
export * from './RadioInput'
|
|
9
|
-
export * from './Switch'
|
|
10
|
-
export * from './ContentView'
|
|
11
|
-
|
|
12
|
-
export * from './Select'
|
|
13
|
-
export * from './FileInput'
|
|
14
|
-
export * from './Slider'
|
|
15
|
-
export * from './Navigation'
|
|
16
|
-
export * from './Scroll'
|
|
17
|
-
export * from './ActivityIndicator'
|
|
18
|
-
export * from './Button'
|
|
19
|
-
export * from './ContentView'
|
|
20
|
-
export * from './Overlay'
|
|
21
|
-
export * from './Modal'
|
|
22
|
-
|
|
23
|
-
export * from './Navigation'
|