@draftbit/core 46.8.2-81337b.2 → 46.8.2-9431ce.2

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.
Files changed (51) hide show
  1. package/lib/commonjs/components/DeprecatedCardWrapper.js +1 -15
  2. package/lib/commonjs/components/Markdown.js +30 -0
  3. package/lib/commonjs/index.js +7 -13
  4. package/lib/commonjs/mappings/Markdown.js +27 -0
  5. package/lib/commonjs/styles/overlay.js +3 -1
  6. package/lib/commonjs/utilities.js +2 -1
  7. package/lib/module/components/Markdown.js +20 -0
  8. package/lib/module/index.js +1 -1
  9. package/lib/module/mappings/Markdown.js +20 -0
  10. package/lib/typescript/src/components/Markdown.d.ts +8 -0
  11. package/lib/typescript/src/components/Markdown.d.ts.map +1 -0
  12. package/lib/typescript/src/index.d.ts +1 -1
  13. package/lib/typescript/src/index.d.ts.map +1 -1
  14. package/lib/typescript/src/mappings/{TabViewItem.d.ts → Markdown.d.ts} +5 -10
  15. package/lib/typescript/src/mappings/Markdown.d.ts.map +1 -0
  16. package/package.json +4 -5
  17. package/src/components/Markdown.js +10 -0
  18. package/src/components/Markdown.tsx +22 -0
  19. package/src/index.js +1 -1
  20. package/src/index.tsx +1 -1
  21. package/src/mappings/Markdown.js +25 -0
  22. package/src/mappings/Markdown.ts +32 -0
  23. package/lib/commonjs/components/TabView/TabView.js +0 -100
  24. package/lib/commonjs/components/TabView/TabViewItem.js +0 -25
  25. package/lib/commonjs/components/TabView/index.js +0 -20
  26. package/lib/commonjs/mappings/TabView.js +0 -74
  27. package/lib/commonjs/mappings/TabViewItem.js +0 -37
  28. package/lib/module/components/TabView/TabView.js +0 -90
  29. package/lib/module/components/TabView/TabViewItem.js +0 -20
  30. package/lib/module/components/TabView/index.js +0 -2
  31. package/lib/module/mappings/TabView.js +0 -67
  32. package/lib/module/mappings/TabViewItem.js +0 -30
  33. package/lib/typescript/src/components/TabView/TabView.d.ts +0 -26
  34. package/lib/typescript/src/components/TabView/TabView.d.ts.map +0 -1
  35. package/lib/typescript/src/components/TabView/TabViewItem.d.ts +0 -11
  36. package/lib/typescript/src/components/TabView/TabViewItem.d.ts.map +0 -1
  37. package/lib/typescript/src/components/TabView/index.d.ts +0 -3
  38. package/lib/typescript/src/components/TabView/index.d.ts.map +0 -1
  39. package/lib/typescript/src/mappings/TabView.d.ts +0 -123
  40. package/lib/typescript/src/mappings/TabView.d.ts.map +0 -1
  41. package/lib/typescript/src/mappings/TabViewItem.d.ts.map +0 -1
  42. package/src/components/TabView/TabView.js +0 -45
  43. package/src/components/TabView/TabView.tsx +0 -129
  44. package/src/components/TabView/TabViewItem.js +0 -11
  45. package/src/components/TabView/TabViewItem.tsx +0 -25
  46. package/src/components/TabView/index.js +0 -2
  47. package/src/components/TabView/index.tsx +0 -2
  48. package/src/mappings/TabView.js +0 -70
  49. package/src/mappings/TabView.ts +0 -81
  50. package/src/mappings/TabViewItem.js +0 -30
  51. package/src/mappings/TabViewItem.ts +0 -38
@@ -1,74 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.SEED_DATA = void 0;
7
- var _types = require("@draftbit/types");
8
- const SEED_DATA = {
9
- name: "Tab View",
10
- tag: "TabView",
11
- description: "Tab view container",
12
- category: _types.COMPONENT_TYPES.swiper,
13
- stylesPanelSections: [..._types.BLOCK_STYLES_SECTIONS, _types.StylesPanelSections.Background],
14
- triggers: [_types.Triggers.OnIndexChanged, _types.Triggers.OnEndReached],
15
- props: {
16
- onIndexChanged: (0, _types.createActionProp)({
17
- label: "On index changed",
18
- description: "Action to execute when swipe to new index"
19
- }),
20
- onEndReached: (0, _types.createActionProp)({
21
- label: "On end reached",
22
- description: "Action to execute when end of swiping reached"
23
- }),
24
- tabBarPosition: (0, _types.createTextEnumProp)({
25
- label: "Tab Bar Position",
26
- description: "Position of tab bar",
27
- options: ["top", "bottom"],
28
- defaultValue: "top"
29
- }),
30
- keyboardDismissMode: (0, _types.createTextEnumProp)({
31
- label: "Keyboard Dismiss Mode",
32
- description: "Keyboard Dismiss Mode",
33
- options: ["auto", "on-drag", "none"],
34
- defaultValue: "auto"
35
- }),
36
- swipeEnabled: (0, _types.createStaticBoolProp)({
37
- label: "Swipe Enabled",
38
- description: "Whether swiping is enabled or not",
39
- defaultValue: true
40
- }),
41
- scrollEnabled: (0, _types.createStaticBoolProp)({
42
- label: "Scroll Enabled",
43
- description: "Whether scrolling of tabs is enabled or not",
44
- defaultValue: false
45
- }),
46
- activeColor: (0, _types.createColorProp)({
47
- label: "Active Color",
48
- description: "Color of icon and text of active tab",
49
- defaultValue: "primary"
50
- }),
51
- inactiveColor: (0, _types.createColorProp)({
52
- label: "Inactive Color",
53
- description: "Color of icon and text of inactive tab(s)",
54
- defaultValue: null
55
- }),
56
- pressColor: (0, _types.createColorProp)({
57
- label: "Press Color",
58
- description: "Color of ripple when pressed",
59
- defaultValue: "primary",
60
- group: _types.GROUPS.android
61
- }),
62
- indicatorColor: (0, _types.createColorProp)({
63
- label: "Indicator Color",
64
- description: "Color of indicator",
65
- defaultValue: "primary"
66
- }),
67
- tabsBackgroundColor: (0, _types.createColorProp)({
68
- label: "Tabs Background Color",
69
- description: "Background color of tabs container",
70
- defaultValue: "background"
71
- })
72
- }
73
- };
74
- exports.SEED_DATA = SEED_DATA;
@@ -1,37 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.SEED_DATA = void 0;
7
- var _types = require("@draftbit/types");
8
- const SEED_DATA = {
9
- name: "Tab View Item",
10
- tag: "TabViewItem",
11
- description: "Single Tab View item to be used in TabView. Each item represents a single tab and its content",
12
- category: _types.COMPONENT_TYPES.swiper,
13
- stylesPanelSections: _types.CONTAINER_COMPONENT_STYLES_SECTIONS,
14
- layout: {
15
- flex: 1
16
- },
17
- props: {
18
- title: (0, _types.createTextProp)({
19
- label: "Title",
20
- description: "Title of tab item",
21
- defaultValue: "Title",
22
- required: true,
23
- group: _types.GROUPS.basic
24
- }),
25
- icon: (0, _types.createIconProp)({
26
- defaultValue: null,
27
- required: false
28
- }),
29
- accessibilityLabel: (0, _types.createTextProp)({
30
- label: "Accessibility Label",
31
- description: "Accessibility Label",
32
- defaultValue: null,
33
- group: _types.GROUPS.accessibility
34
- })
35
- }
36
- };
37
- exports.SEED_DATA = SEED_DATA;
@@ -1,90 +0,0 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- import * as React from "react";
3
- import { TabView, TabBar, SceneMap } from "react-native-tab-view";
4
- import TabViewItem from "./TabViewItem";
5
- import { withTheme } from "../../theming";
6
- const TabViewComponent = _ref => {
7
- let {
8
- Icon,
9
- onIndexChanged,
10
- onEndReached,
11
- tabBarPosition,
12
- keyboardDismissMode,
13
- swipeEnabled,
14
- scrollEnabled,
15
- activeColor,
16
- inactiveColor,
17
- pressColor,
18
- indicatorColor,
19
- tabsBackgroundColor,
20
- style,
21
- theme,
22
- children
23
- } = _ref;
24
- const [index, setIndex] = React.useState(0);
25
- const [routes, setRoutes] = React.useState([]);
26
- const [tabScenes, setTabScenes] = React.useState({});
27
-
28
- //Populate routes and scenes based on children
29
- React.useEffect(() => {
30
- const newRoutes = [];
31
- const scenes = {};
32
- React.Children.toArray(children).filter(child => /*#__PURE__*/React.isValidElement(child) && child.type === TabViewItem).forEach((item, idx) => {
33
- const child = item;
34
- newRoutes.push({
35
- key: idx.toString(),
36
- title: child.props.title,
37
- icon: child.props.icon,
38
- accessibilityLabel: child.props.accessibilityLabel
39
- });
40
- scenes[idx] = () => child;
41
- });
42
- setRoutes(newRoutes);
43
- setTabScenes(scenes);
44
- }, [children]);
45
- const indexChangeHandler = i => {
46
- setIndex(i);
47
- onIndexChanged === null || onIndexChanged === void 0 ? void 0 : onIndexChanged(i);
48
- if (i === routes.length) {
49
- onEndReached === null || onEndReached === void 0 ? void 0 : onEndReached();
50
- }
51
- };
52
- const renderTabBar = props => {
53
- return /*#__PURE__*/React.createElement(TabBar, _extends({}, props, {
54
- activeColor: activeColor || theme.colors.primary,
55
- inactiveColor: inactiveColor || theme.colors.divider,
56
- pressColor: pressColor || theme.colors.primary,
57
- scrollEnabled: scrollEnabled,
58
- indicatorStyle: {
59
- backgroundColor: indicatorColor || theme.colors.primary
60
- },
61
- renderIcon: _ref2 => {
62
- let {
63
- route,
64
- color
65
- } = _ref2;
66
- return route !== null && route !== void 0 && route.icon ? /*#__PURE__*/React.createElement(Icon, {
67
- name: route.icon,
68
- color: color,
69
- size: 36
70
- }) : null;
71
- },
72
- style: [{
73
- backgroundColor: tabsBackgroundColor || theme.colors.background
74
- }, style]
75
- }));
76
- };
77
- return /*#__PURE__*/React.createElement(TabView, {
78
- navigationState: {
79
- index,
80
- routes
81
- },
82
- renderScene: SceneMap(tabScenes),
83
- renderTabBar: renderTabBar,
84
- onIndexChange: indexChangeHandler,
85
- tabBarPosition: tabBarPosition,
86
- keyboardDismissMode: keyboardDismissMode,
87
- swipeEnabled: swipeEnabled
88
- });
89
- };
90
- export default withTheme(TabViewComponent);
@@ -1,20 +0,0 @@
1
- import React from "react";
2
- import { StyleSheet, View } from "react-native";
3
-
4
- //Props used by parent (TabView) to create tabs
5
-
6
- const TabViewItem = _ref => {
7
- let {
8
- style,
9
- children
10
- } = _ref;
11
- return /*#__PURE__*/React.createElement(View, {
12
- style: [styles.parentContainer, style]
13
- }, children);
14
- };
15
- const styles = StyleSheet.create({
16
- parentContainer: {
17
- flex: 1
18
- }
19
- });
20
- export default TabViewItem;
@@ -1,2 +0,0 @@
1
- export { default as TabView } from "./TabView";
2
- export { default as TabViewItem } from "./TabViewItem";
@@ -1,67 +0,0 @@
1
- import { COMPONENT_TYPES, createTextEnumProp, createColorProp, BLOCK_STYLES_SECTIONS, StylesPanelSections, Triggers, createActionProp, createStaticBoolProp, GROUPS } from "@draftbit/types";
2
- export const SEED_DATA = {
3
- name: "Tab View",
4
- tag: "TabView",
5
- description: "Tab view container",
6
- category: COMPONENT_TYPES.swiper,
7
- stylesPanelSections: [...BLOCK_STYLES_SECTIONS, StylesPanelSections.Background],
8
- triggers: [Triggers.OnIndexChanged, Triggers.OnEndReached],
9
- props: {
10
- onIndexChanged: createActionProp({
11
- label: "On index changed",
12
- description: "Action to execute when swipe to new index"
13
- }),
14
- onEndReached: createActionProp({
15
- label: "On end reached",
16
- description: "Action to execute when end of swiping reached"
17
- }),
18
- tabBarPosition: createTextEnumProp({
19
- label: "Tab Bar Position",
20
- description: "Position of tab bar",
21
- options: ["top", "bottom"],
22
- defaultValue: "top"
23
- }),
24
- keyboardDismissMode: createTextEnumProp({
25
- label: "Keyboard Dismiss Mode",
26
- description: "Keyboard Dismiss Mode",
27
- options: ["auto", "on-drag", "none"],
28
- defaultValue: "auto"
29
- }),
30
- swipeEnabled: createStaticBoolProp({
31
- label: "Swipe Enabled",
32
- description: "Whether swiping is enabled or not",
33
- defaultValue: true
34
- }),
35
- scrollEnabled: createStaticBoolProp({
36
- label: "Scroll Enabled",
37
- description: "Whether scrolling of tabs is enabled or not",
38
- defaultValue: false
39
- }),
40
- activeColor: createColorProp({
41
- label: "Active Color",
42
- description: "Color of icon and text of active tab",
43
- defaultValue: "primary"
44
- }),
45
- inactiveColor: createColorProp({
46
- label: "Inactive Color",
47
- description: "Color of icon and text of inactive tab(s)",
48
- defaultValue: null
49
- }),
50
- pressColor: createColorProp({
51
- label: "Press Color",
52
- description: "Color of ripple when pressed",
53
- defaultValue: "primary",
54
- group: GROUPS.android
55
- }),
56
- indicatorColor: createColorProp({
57
- label: "Indicator Color",
58
- description: "Color of indicator",
59
- defaultValue: "primary"
60
- }),
61
- tabsBackgroundColor: createColorProp({
62
- label: "Tabs Background Color",
63
- description: "Background color of tabs container",
64
- defaultValue: "background"
65
- })
66
- }
67
- };
@@ -1,30 +0,0 @@
1
- import { COMPONENT_TYPES, createTextProp, createIconProp, CONTAINER_COMPONENT_STYLES_SECTIONS, GROUPS } from "@draftbit/types";
2
- export const SEED_DATA = {
3
- name: "Tab View Item",
4
- tag: "TabViewItem",
5
- description: "Single Tab View item to be used in TabView. Each item represents a single tab and its content",
6
- category: COMPONENT_TYPES.swiper,
7
- stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
8
- layout: {
9
- flex: 1
10
- },
11
- props: {
12
- title: createTextProp({
13
- label: "Title",
14
- description: "Title of tab item",
15
- defaultValue: "Title",
16
- required: true,
17
- group: GROUPS.basic
18
- }),
19
- icon: createIconProp({
20
- defaultValue: null,
21
- required: false
22
- }),
23
- accessibilityLabel: createTextProp({
24
- label: "Accessibility Label",
25
- description: "Accessibility Label",
26
- defaultValue: null,
27
- group: GROUPS.accessibility
28
- })
29
- }
30
- };
@@ -1,26 +0,0 @@
1
- import * as React from "react";
2
- import { StyleProp, ViewStyle } from "react-native";
3
- import type { IconSlot } from "../../interfaces/Icon";
4
- import type { Theme } from "../../styles/DefaultTheme";
5
- declare type TabBarPosition = "top" | "bottom";
6
- declare type KeyboardDismissMode = "none" | "auto" | "on-drag";
7
- declare type TabViewProps = {
8
- onIndexChanged?: (index: number) => void;
9
- onEndReached?: () => void;
10
- tabBarPosition?: TabBarPosition;
11
- keyboardDismissMode?: KeyboardDismissMode;
12
- swipeEnabled?: boolean;
13
- scrollEnabled?: boolean;
14
- activeColor?: string;
15
- inactiveColor?: string;
16
- pressColor?: string;
17
- indicatorColor?: string;
18
- tabsBackgroundColor?: string;
19
- style?: StyleProp<ViewStyle>;
20
- theme: Theme;
21
- } & IconSlot;
22
- declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<React.PropsWithChildren<TabViewProps>, "theme"> & {
23
- theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
24
- }> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<React.PropsWithChildren<TabViewProps>> & React.FC<React.PropsWithChildren<TabViewProps>>, {}>;
25
- export default _default;
26
- //# sourceMappingURL=TabView.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TabView.d.ts","sourceRoot":"","sources":["../../../../../src/components/TabView/TabView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAWpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAKvD,aAAK,cAAc,GAAG,KAAK,GAAG,QAAQ,CAAC;AACvC,aAAK,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAEvD,aAAK,YAAY,GAAG;IAClB,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,EAAE,KAAK,CAAC;CACd,GAAG,QAAQ,CAAC;;;;AA4Fb,wBAA2C"}
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- import { StyleProp, ViewStyle } from "react-native";
3
- interface TabViewItemProps {
4
- title: string;
5
- icon?: string;
6
- accessibilityLabel?: string;
7
- style?: StyleProp<ViewStyle>;
8
- }
9
- declare const TabViewItem: React.FC<React.PropsWithChildren<TabViewItemProps>>;
10
- export default TabViewItem;
11
- //# sourceMappingURL=TabViewItem.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TabViewItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/TabView/TabViewItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAC;AAGtE,UAAU,gBAAgB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAKpE,CAAC;AAQF,eAAe,WAAW,CAAC"}
@@ -1,3 +0,0 @@
1
- export { default as TabView } from "./TabView";
2
- export { default as TabViewItem } from "./TabViewItem";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/TabView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC"}
@@ -1,123 +0,0 @@
1
- export declare const SEED_DATA: {
2
- name: string;
3
- tag: string;
4
- description: string;
5
- category: string;
6
- stylesPanelSections: string[];
7
- triggers: string[];
8
- props: {
9
- onIndexChanged: {
10
- label: string;
11
- description: string;
12
- editable: boolean;
13
- required: boolean;
14
- formType: string;
15
- propType: string;
16
- defaultValue: null;
17
- group: string;
18
- };
19
- onEndReached: {
20
- label: string;
21
- description: string;
22
- editable: boolean;
23
- required: boolean;
24
- formType: string;
25
- propType: string;
26
- defaultValue: null;
27
- group: string;
28
- };
29
- tabBarPosition: {
30
- group: string;
31
- label: string;
32
- description: string;
33
- editable: boolean;
34
- required: boolean;
35
- formType: string;
36
- propType: string;
37
- defaultValue: null;
38
- options: never[];
39
- };
40
- keyboardDismissMode: {
41
- group: string;
42
- label: string;
43
- description: string;
44
- editable: boolean;
45
- required: boolean;
46
- formType: string;
47
- propType: string;
48
- defaultValue: null;
49
- options: never[];
50
- };
51
- swipeEnabled: {
52
- label: string;
53
- description: string;
54
- formType: string;
55
- propType: string;
56
- defaultValue: boolean;
57
- editable: boolean;
58
- required: boolean;
59
- group: string;
60
- };
61
- scrollEnabled: {
62
- label: string;
63
- description: string;
64
- formType: string;
65
- propType: string;
66
- defaultValue: boolean;
67
- editable: boolean;
68
- required: boolean;
69
- group: string;
70
- };
71
- activeColor: {
72
- group: string;
73
- label: string;
74
- description: string;
75
- editable: boolean;
76
- required: boolean;
77
- defaultValue: null;
78
- formType: string;
79
- propType: string;
80
- };
81
- inactiveColor: {
82
- group: string;
83
- label: string;
84
- description: string;
85
- editable: boolean;
86
- required: boolean;
87
- defaultValue: null;
88
- formType: string;
89
- propType: string;
90
- };
91
- pressColor: {
92
- group: string;
93
- label: string;
94
- description: string;
95
- editable: boolean;
96
- required: boolean;
97
- defaultValue: null;
98
- formType: string;
99
- propType: string;
100
- };
101
- indicatorColor: {
102
- group: string;
103
- label: string;
104
- description: string;
105
- editable: boolean;
106
- required: boolean;
107
- defaultValue: null;
108
- formType: string;
109
- propType: string;
110
- };
111
- tabsBackgroundColor: {
112
- group: string;
113
- label: string;
114
- description: string;
115
- editable: boolean;
116
- required: boolean;
117
- defaultValue: null;
118
- formType: string;
119
- propType: string;
120
- };
121
- };
122
- };
123
- //# sourceMappingURL=TabView.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TabView.d.ts","sourceRoot":"","sources":["../../../../src/mappings/TabView.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoErB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"TabViewItem.d.ts","sourceRoot":"","sources":["../../../../src/mappings/TabViewItem.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;CA6BrB,CAAC"}
@@ -1,45 +0,0 @@
1
- import * as React from "react";
2
- import { TabView, TabBar, SceneMap, } from "react-native-tab-view";
3
- import TabViewItem from "./TabViewItem";
4
- import { withTheme } from "../../theming";
5
- const TabViewComponent = ({ Icon, onIndexChanged, onEndReached, tabBarPosition, keyboardDismissMode, swipeEnabled, scrollEnabled, activeColor, inactiveColor, pressColor, indicatorColor, tabsBackgroundColor, style, theme, children, }) => {
6
- const [index, setIndex] = React.useState(0);
7
- const [routes, setRoutes] = React.useState([]);
8
- const [tabScenes, setTabScenes] = React.useState({});
9
- //Populate routes and scenes based on children
10
- React.useEffect(() => {
11
- const newRoutes = [];
12
- const scenes = {};
13
- React.Children.toArray(children)
14
- .filter((child) => React.isValidElement(child) && child.type === TabViewItem)
15
- .forEach((item, idx) => {
16
- const child = item;
17
- newRoutes.push({
18
- key: idx.toString(),
19
- title: child.props.title,
20
- icon: child.props.icon,
21
- accessibilityLabel: child.props.accessibilityLabel,
22
- });
23
- scenes[idx] = () => child;
24
- });
25
- setRoutes(newRoutes);
26
- setTabScenes(scenes);
27
- }, [children]);
28
- const indexChangeHandler = (i) => {
29
- setIndex(i);
30
- onIndexChanged === null || onIndexChanged === void 0 ? void 0 : onIndexChanged(i);
31
- if (i === routes.length) {
32
- onEndReached === null || onEndReached === void 0 ? void 0 : onEndReached();
33
- }
34
- };
35
- const renderTabBar = (props) => {
36
- return (React.createElement(TabBar, { ...props, activeColor: activeColor || theme.colors.primary, inactiveColor: inactiveColor || theme.colors.divider, pressColor: pressColor || theme.colors.primary, scrollEnabled: scrollEnabled, indicatorStyle: {
37
- backgroundColor: indicatorColor || theme.colors.primary,
38
- }, renderIcon: ({ route, color }) => (route === null || route === void 0 ? void 0 : route.icon) ? (React.createElement(Icon, { name: route.icon, color: color, size: 36 })) : null, style: [
39
- { backgroundColor: tabsBackgroundColor || theme.colors.background },
40
- style,
41
- ] }));
42
- };
43
- return (React.createElement(TabView, { navigationState: { index, routes }, renderScene: SceneMap(tabScenes), renderTabBar: renderTabBar, onIndexChange: indexChangeHandler, tabBarPosition: tabBarPosition, keyboardDismissMode: keyboardDismissMode, swipeEnabled: swipeEnabled }));
44
- };
45
- export default withTheme(TabViewComponent);