@draftbit/core 46.8.2-3b498d.2 → 46.8.2-41c76e.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 (43) hide show
  1. package/lib/commonjs/index.js +0 -13
  2. package/lib/commonjs/mappings/FlashList.js +2 -8
  3. package/lib/module/index.js +0 -1
  4. package/lib/module/mappings/FlashList.js +3 -9
  5. package/lib/typescript/src/index.d.ts +0 -1
  6. package/lib/typescript/src/index.d.ts.map +1 -1
  7. package/lib/typescript/src/mappings/FlashList.d.ts +0 -6
  8. package/lib/typescript/src/mappings/FlashList.d.ts.map +1 -1
  9. package/package.json +3 -5
  10. package/src/index.js +0 -1
  11. package/src/index.tsx +0 -2
  12. package/src/mappings/FlashList.js +9 -9
  13. package/src/mappings/FlashList.ts +9 -9
  14. package/lib/commonjs/components/TabView/TabView.js +0 -113
  15. package/lib/commonjs/components/TabView/TabViewItem.js +0 -25
  16. package/lib/commonjs/components/TabView/index.js +0 -20
  17. package/lib/commonjs/mappings/TabView.js +0 -77
  18. package/lib/commonjs/mappings/TabViewItem.js +0 -37
  19. package/lib/module/components/TabView/TabView.js +0 -103
  20. package/lib/module/components/TabView/TabViewItem.js +0 -20
  21. package/lib/module/components/TabView/index.js +0 -2
  22. package/lib/module/mappings/TabView.js +0 -70
  23. package/lib/module/mappings/TabViewItem.js +0 -30
  24. package/lib/typescript/src/components/TabView/TabView.d.ts +0 -26
  25. package/lib/typescript/src/components/TabView/TabView.d.ts.map +0 -1
  26. package/lib/typescript/src/components/TabView/TabViewItem.d.ts +0 -11
  27. package/lib/typescript/src/components/TabView/TabViewItem.d.ts.map +0 -1
  28. package/lib/typescript/src/components/TabView/index.d.ts +0 -3
  29. package/lib/typescript/src/components/TabView/index.d.ts.map +0 -1
  30. package/lib/typescript/src/mappings/TabView.d.ts +0 -126
  31. package/lib/typescript/src/mappings/TabView.d.ts.map +0 -1
  32. package/lib/typescript/src/mappings/TabViewItem.d.ts +0 -25
  33. package/lib/typescript/src/mappings/TabViewItem.d.ts.map +0 -1
  34. package/src/components/TabView/TabView.js +0 -50
  35. package/src/components/TabView/TabView.tsx +0 -137
  36. package/src/components/TabView/TabViewItem.js +0 -11
  37. package/src/components/TabView/TabViewItem.tsx +0 -25
  38. package/src/components/TabView/index.js +0 -2
  39. package/src/components/TabView/index.tsx +0 -2
  40. package/src/mappings/TabView.js +0 -76
  41. package/src/mappings/TabView.ts +0 -86
  42. package/src/mappings/TabViewItem.js +0 -30
  43. package/src/mappings/TabViewItem.ts +0 -38
@@ -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,70 +0,0 @@
1
- import { COMPONENT_TYPES, createTextEnumProp, createColorProp, 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: [StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects, StylesPanelSections.LayoutSelectedItem, StylesPanelSections.Background, StylesPanelSections.Typography],
8
- layout: {
9
- flex: 1
10
- },
11
- triggers: [Triggers.OnIndexChanged, Triggers.OnEndReached],
12
- props: {
13
- onIndexChanged: createActionProp({
14
- label: "On index changed",
15
- description: "Action to execute when swipe to new index"
16
- }),
17
- onEndReached: createActionProp({
18
- label: "On end reached",
19
- description: "Action to execute when end of swiping reached"
20
- }),
21
- tabBarPosition: createTextEnumProp({
22
- label: "Tab Bar Position",
23
- description: "Position of tab bar",
24
- options: ["top", "bottom"],
25
- defaultValue: "top"
26
- }),
27
- keyboardDismissMode: createTextEnumProp({
28
- label: "Keyboard Dismiss Mode",
29
- description: "Keyboard Dismiss Mode",
30
- options: ["auto", "on-drag", "none"],
31
- defaultValue: "auto"
32
- }),
33
- swipeEnabled: createStaticBoolProp({
34
- label: "Swipe Enabled",
35
- description: "Whether swiping is enabled or not",
36
- defaultValue: true
37
- }),
38
- scrollEnabled: createStaticBoolProp({
39
- label: "Tab Scroll Enabled",
40
- description: "Whether scrolling of tabs is enabled or not",
41
- defaultValue: false
42
- }),
43
- activeColor: createColorProp({
44
- label: "Active Color",
45
- description: "Color of icon and text of active tab",
46
- defaultValue: "primary"
47
- }),
48
- inactiveColor: createColorProp({
49
- label: "Inactive Color",
50
- description: "Color of icon and text of inactive tab(s)",
51
- defaultValue: null
52
- }),
53
- pressColor: createColorProp({
54
- label: "Press Color",
55
- description: "Color of ripple when pressed",
56
- defaultValue: "primary",
57
- group: GROUPS.android
58
- }),
59
- indicatorColor: createColorProp({
60
- label: "Indicator Color",
61
- description: "Color of indicator",
62
- defaultValue: "primary"
63
- }),
64
- tabsBackgroundColor: createColorProp({
65
- label: "Tabs Background Color",
66
- description: "Background color of tabs container",
67
- defaultValue: "background"
68
- })
69
- }
70
- };
@@ -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,EAAc,MAAM,cAAc,CAAC;AAWhE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAMvD,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;;;;AAmGb,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,126 +0,0 @@
1
- export declare const SEED_DATA: {
2
- name: string;
3
- tag: string;
4
- description: string;
5
- category: string;
6
- stylesPanelSections: string[];
7
- layout: {
8
- flex: number;
9
- };
10
- triggers: string[];
11
- props: {
12
- onIndexChanged: {
13
- label: string;
14
- description: string;
15
- editable: boolean;
16
- required: boolean;
17
- formType: string;
18
- propType: string;
19
- defaultValue: null;
20
- group: string;
21
- };
22
- onEndReached: {
23
- label: string;
24
- description: string;
25
- editable: boolean;
26
- required: boolean;
27
- formType: string;
28
- propType: string;
29
- defaultValue: null;
30
- group: string;
31
- };
32
- tabBarPosition: {
33
- group: string;
34
- label: string;
35
- description: string;
36
- editable: boolean;
37
- required: boolean;
38
- formType: string;
39
- propType: string;
40
- defaultValue: null;
41
- options: never[];
42
- };
43
- keyboardDismissMode: {
44
- group: string;
45
- label: string;
46
- description: string;
47
- editable: boolean;
48
- required: boolean;
49
- formType: string;
50
- propType: string;
51
- defaultValue: null;
52
- options: never[];
53
- };
54
- swipeEnabled: {
55
- label: string;
56
- description: string;
57
- formType: string;
58
- propType: string;
59
- defaultValue: boolean;
60
- editable: boolean;
61
- required: boolean;
62
- group: string;
63
- };
64
- scrollEnabled: {
65
- label: string;
66
- description: string;
67
- formType: string;
68
- propType: string;
69
- defaultValue: boolean;
70
- editable: boolean;
71
- required: boolean;
72
- group: string;
73
- };
74
- activeColor: {
75
- group: string;
76
- label: string;
77
- description: string;
78
- editable: boolean;
79
- required: boolean;
80
- defaultValue: null;
81
- formType: string;
82
- propType: string;
83
- };
84
- inactiveColor: {
85
- group: string;
86
- label: string;
87
- description: string;
88
- editable: boolean;
89
- required: boolean;
90
- defaultValue: null;
91
- formType: string;
92
- propType: string;
93
- };
94
- pressColor: {
95
- group: string;
96
- label: string;
97
- description: string;
98
- editable: boolean;
99
- required: boolean;
100
- defaultValue: null;
101
- formType: string;
102
- propType: string;
103
- };
104
- indicatorColor: {
105
- group: string;
106
- label: string;
107
- description: string;
108
- editable: boolean;
109
- required: boolean;
110
- defaultValue: null;
111
- formType: string;
112
- propType: string;
113
- };
114
- tabsBackgroundColor: {
115
- group: string;
116
- label: string;
117
- description: string;
118
- editable: boolean;
119
- required: boolean;
120
- defaultValue: null;
121
- formType: string;
122
- propType: string;
123
- };
124
- };
125
- };
126
- //# sourceMappingURL=TabView.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TabView.d.ts","sourceRoot":"","sources":["../../../../src/mappings/TabView.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0ErB,CAAC"}
@@ -1,25 +0,0 @@
1
- export declare const SEED_DATA: {
2
- name: string;
3
- tag: string;
4
- description: string;
5
- category: string;
6
- stylesPanelSections: string[];
7
- layout: {
8
- flex: number;
9
- };
10
- props: {
11
- title: any;
12
- icon: {
13
- label: string;
14
- description: string;
15
- formType: string;
16
- propType: string;
17
- defaultValue: string;
18
- required: boolean;
19
- editable: boolean;
20
- group: string;
21
- };
22
- accessibilityLabel: any;
23
- };
24
- };
25
- //# sourceMappingURL=TabViewItem.d.ts.map
@@ -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,50 +0,0 @@
1
- import * as React from "react";
2
- import { StyleSheet } from "react-native";
3
- import { TabView, TabBar, SceneMap, } from "react-native-tab-view";
4
- import TabViewItem from "./TabViewItem";
5
- import { withTheme } from "../../theming";
6
- import { extractStyles } from "../../utilities";
7
- const TabViewComponent = ({ Icon, onIndexChanged, onEndReached, tabBarPosition, keyboardDismissMode, swipeEnabled, scrollEnabled, activeColor, inactiveColor, pressColor, indicatorColor, tabsBackgroundColor, style, theme, children, }) => {
8
- const [index, setIndex] = React.useState(0);
9
- const [routes, setRoutes] = React.useState([]);
10
- const [tabScenes, setTabScenes] = React.useState({});
11
- const { textStyles, viewStyles } = extractStyles(style);
12
- //Populate routes and scenes based on children
13
- React.useEffect(() => {
14
- const newRoutes = [];
15
- const scenes = {};
16
- React.Children.toArray(children)
17
- .filter((child) => React.isValidElement(child) && child.type === TabViewItem)
18
- .forEach((item, idx) => {
19
- const child = item;
20
- newRoutes.push({
21
- key: idx.toString(),
22
- title: child.props.title,
23
- icon: child.props.icon,
24
- accessibilityLabel: child.props.accessibilityLabel,
25
- });
26
- scenes[idx] = () => child;
27
- });
28
- setRoutes(newRoutes);
29
- setTabScenes(scenes);
30
- }, [children]);
31
- const indexChangeHandler = (i) => {
32
- setIndex(i);
33
- onIndexChanged === null || onIndexChanged === void 0 ? void 0 : onIndexChanged(i);
34
- if (i === routes.length) {
35
- onEndReached === null || onEndReached === void 0 ? void 0 : onEndReached();
36
- }
37
- };
38
- const renderTabBar = (props) => {
39
- return (React.createElement(TabBar, { ...props, activeColor: activeColor || theme.colors.primary, inactiveColor: inactiveColor || theme.colors.divider, pressColor: pressColor || theme.colors.primary, scrollEnabled: scrollEnabled, indicatorStyle: {
40
- backgroundColor: indicatorColor || theme.colors.primary,
41
- }, labelStyle: textStyles, renderIcon: ({ route, color }) => (route === null || route === void 0 ? void 0 : route.icon) ? (React.createElement(Icon, { name: route.icon, color: color, size: 36 })) : null, style: {
42
- backgroundColor: tabsBackgroundColor || theme.colors.background,
43
- } }));
44
- };
45
- return (React.createElement(TabView, { style: [styles.tabView, viewStyles], navigationState: { index, routes }, renderScene: SceneMap(tabScenes), renderTabBar: renderTabBar, onIndexChange: indexChangeHandler, tabBarPosition: tabBarPosition, keyboardDismissMode: keyboardDismissMode, swipeEnabled: swipeEnabled }));
46
- };
47
- const styles = StyleSheet.create({
48
- tabView: { flex: 1 },
49
- });
50
- export default withTheme(TabViewComponent);
@@ -1,137 +0,0 @@
1
- import * as React from "react";
2
- import { StyleProp, ViewStyle, StyleSheet } from "react-native";
3
- import {
4
- TabView,
5
- TabBar,
6
- SceneMap,
7
- SceneRendererProps,
8
- NavigationState,
9
- Route,
10
- } from "react-native-tab-view";
11
-
12
- import TabViewItem from "./TabViewItem";
13
- import type { IconSlot } from "../../interfaces/Icon";
14
- import { withTheme } from "../../theming";
15
- import type { Theme } from "../../styles/DefaultTheme";
16
- import { extractStyles } from "../../utilities";
17
-
18
- type TabBarProps = SceneRendererProps & {
19
- navigationState: NavigationState<any>;
20
- };
21
- type TabBarPosition = "top" | "bottom";
22
- type KeyboardDismissMode = "none" | "auto" | "on-drag";
23
-
24
- type TabViewProps = {
25
- onIndexChanged?: (index: number) => void;
26
- onEndReached?: () => void;
27
- tabBarPosition?: TabBarPosition;
28
- keyboardDismissMode?: KeyboardDismissMode;
29
- swipeEnabled?: boolean;
30
- scrollEnabled?: boolean;
31
- activeColor?: string;
32
- inactiveColor?: string;
33
- pressColor?: string;
34
- indicatorColor?: string;
35
- tabsBackgroundColor?: string;
36
- style?: StyleProp<ViewStyle>;
37
- theme: Theme;
38
- } & IconSlot;
39
-
40
- const TabViewComponent: React.FC<React.PropsWithChildren<TabViewProps>> = ({
41
- Icon,
42
- onIndexChanged,
43
- onEndReached,
44
- tabBarPosition,
45
- keyboardDismissMode,
46
- swipeEnabled,
47
- scrollEnabled,
48
- activeColor,
49
- inactiveColor,
50
- pressColor,
51
- indicatorColor,
52
- tabsBackgroundColor,
53
- style,
54
- theme,
55
- children,
56
- }) => {
57
- const [index, setIndex] = React.useState(0);
58
- const [routes, setRoutes] = React.useState<Route[]>([]);
59
- const [tabScenes, setTabScenes] = React.useState({});
60
-
61
- const { textStyles, viewStyles } = extractStyles(style);
62
-
63
- //Populate routes and scenes based on children
64
- React.useEffect(() => {
65
- const newRoutes: Route[] = [];
66
- const scenes: any = {};
67
-
68
- React.Children.toArray(children)
69
- .filter(
70
- (child) => React.isValidElement(child) && child.type === TabViewItem
71
- )
72
- .forEach((item: any, idx) => {
73
- const child = item as React.ReactElement;
74
- newRoutes.push({
75
- key: idx.toString(),
76
- title: child.props.title,
77
- icon: child.props.icon,
78
- accessibilityLabel: child.props.accessibilityLabel,
79
- });
80
- scenes[idx] = () => child;
81
- });
82
-
83
- setRoutes(newRoutes);
84
- setTabScenes(scenes);
85
- }, [children]);
86
-
87
- const indexChangeHandler = (i: number) => {
88
- setIndex(i);
89
- onIndexChanged?.(i);
90
- if (i === routes.length) {
91
- onEndReached?.();
92
- }
93
- };
94
-
95
- const renderTabBar: React.FC<TabBarProps> = (props) => {
96
- return (
97
- <TabBar
98
- {...props}
99
- activeColor={activeColor || theme.colors.primary}
100
- inactiveColor={inactiveColor || theme.colors.divider}
101
- pressColor={pressColor || theme.colors.primary}
102
- scrollEnabled={scrollEnabled}
103
- indicatorStyle={{
104
- backgroundColor: indicatorColor || theme.colors.primary,
105
- }}
106
- labelStyle={textStyles}
107
- renderIcon={({ route, color }) =>
108
- route?.icon ? (
109
- <Icon name={route.icon} color={color} size={36} />
110
- ) : null
111
- }
112
- style={{
113
- backgroundColor: tabsBackgroundColor || theme.colors.background,
114
- }}
115
- />
116
- );
117
- };
118
-
119
- return (
120
- <TabView
121
- style={[styles.tabView, viewStyles]}
122
- navigationState={{ index, routes }}
123
- renderScene={SceneMap(tabScenes)}
124
- renderTabBar={renderTabBar}
125
- onIndexChange={indexChangeHandler}
126
- tabBarPosition={tabBarPosition}
127
- keyboardDismissMode={keyboardDismissMode}
128
- swipeEnabled={swipeEnabled}
129
- />
130
- );
131
- };
132
-
133
- const styles = StyleSheet.create({
134
- tabView: { flex: 1 },
135
- });
136
-
137
- export default withTheme(TabViewComponent);
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- import { StyleSheet, View } from "react-native";
3
- const TabViewItem = ({ style, children, }) => {
4
- return React.createElement(View, { style: [styles.parentContainer, style] }, children);
5
- };
6
- const styles = StyleSheet.create({
7
- parentContainer: {
8
- flex: 1,
9
- },
10
- });
11
- export default TabViewItem;
@@ -1,25 +0,0 @@
1
- import React from "react";
2
- import { StyleProp, ViewStyle, StyleSheet, View } from "react-native";
3
-
4
- //Props used by parent (TabView) to create tabs
5
- interface TabViewItemProps {
6
- title: string;
7
- icon?: string;
8
- accessibilityLabel?: string;
9
- style?: StyleProp<ViewStyle>;
10
- }
11
-
12
- const TabViewItem: React.FC<React.PropsWithChildren<TabViewItemProps>> = ({
13
- style,
14
- children,
15
- }) => {
16
- return <View style={[styles.parentContainer, style]}>{children}</View>;
17
- };
18
-
19
- const styles = StyleSheet.create({
20
- parentContainer: {
21
- flex: 1,
22
- },
23
- });
24
-
25
- export default TabViewItem;
@@ -1,2 +0,0 @@
1
- export { default as TabView } from "./TabView";
2
- export { default as TabViewItem } from "./TabViewItem";
@@ -1,2 +0,0 @@
1
- export { default as TabView } from "./TabView";
2
- export { default as TabViewItem } from "./TabViewItem";
@@ -1,76 +0,0 @@
1
- import { COMPONENT_TYPES, createTextEnumProp, createColorProp, 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: [
8
- StylesPanelSections.Size,
9
- StylesPanelSections.MarginsAndPaddings,
10
- StylesPanelSections.Position,
11
- StylesPanelSections.Effects,
12
- StylesPanelSections.LayoutSelectedItem,
13
- StylesPanelSections.Background,
14
- StylesPanelSections.Typography,
15
- ],
16
- layout: { flex: 1 },
17
- triggers: [Triggers.OnIndexChanged, Triggers.OnEndReached],
18
- props: {
19
- onIndexChanged: createActionProp({
20
- label: "On index changed",
21
- description: "Action to execute when swipe to new index",
22
- }),
23
- onEndReached: createActionProp({
24
- label: "On end reached",
25
- description: "Action to execute when end of swiping reached",
26
- }),
27
- tabBarPosition: createTextEnumProp({
28
- label: "Tab Bar Position",
29
- description: "Position of tab bar",
30
- options: ["top", "bottom"],
31
- defaultValue: "top",
32
- }),
33
- keyboardDismissMode: createTextEnumProp({
34
- label: "Keyboard Dismiss Mode",
35
- description: "Keyboard Dismiss Mode",
36
- options: ["auto", "on-drag", "none"],
37
- defaultValue: "auto",
38
- }),
39
- swipeEnabled: createStaticBoolProp({
40
- label: "Swipe Enabled",
41
- description: "Whether swiping is enabled or not",
42
- defaultValue: true,
43
- }),
44
- scrollEnabled: createStaticBoolProp({
45
- label: "Tab Scroll Enabled",
46
- description: "Whether scrolling of tabs is enabled or not",
47
- defaultValue: false,
48
- }),
49
- activeColor: createColorProp({
50
- label: "Active Color",
51
- description: "Color of icon and text of active tab",
52
- defaultValue: "primary",
53
- }),
54
- inactiveColor: createColorProp({
55
- label: "Inactive Color",
56
- description: "Color of icon and text of inactive tab(s)",
57
- defaultValue: null,
58
- }),
59
- pressColor: createColorProp({
60
- label: "Press Color",
61
- description: "Color of ripple when pressed",
62
- defaultValue: "primary",
63
- group: GROUPS.android,
64
- }),
65
- indicatorColor: createColorProp({
66
- label: "Indicator Color",
67
- description: "Color of indicator",
68
- defaultValue: "primary",
69
- }),
70
- tabsBackgroundColor: createColorProp({
71
- label: "Tabs Background Color",
72
- description: "Background color of tabs container",
73
- defaultValue: "background",
74
- }),
75
- },
76
- };