@evlop/native-components 1.0.152 → 1.0.153

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/RenderTabs/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAA6B,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAKzE,UAAU,GAAI,SAAQ,KAAK;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,EAAE,CAAC;CACjB;AAED,UAAU,eAAe;IACrB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,qBAAqB,CAAC,EAAE,GAAG,CAAC;CAC/B;AAMD,iBAAS,UAAU,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,EAAE,eAAe,eAkDnE;AAiBD,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/RenderTabs/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAA6B,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAMzE,UAAU,GAAI,SAAQ,KAAK;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,EAAE,CAAC;CACjB;AAED,UAAU,eAAe;IACrB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,qBAAqB,CAAC,EAAE,GAAG,CAAC;CAC/B;AAMD,iBAAS,UAAU,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,EAAE,eAAe,eA8DnE;AAgBD,eAAe,UAAU,CAAC"}
@@ -31,31 +31,41 @@ const react_native_tab_view_1 = require("react-native-tab-view");
31
31
  const react_native_1 = require("react-native");
32
32
  const RenderBlocks_1 = __importDefault(require("../RenderBlocks"));
33
33
  const commons_1 = require("@evlop/commons");
34
+ const native_1 = require("@react-navigation/native");
34
35
  function RenderTabs({ tabs, animatedScrollPostion }) {
35
- var _a, _b, _c;
36
+ var _a, _b, _c, _d;
36
37
  const layout = (0, react_native_1.useWindowDimensions)();
37
38
  const [index, setIndex] = (0, react_1.useState)(0);
38
39
  const theme = (0, commons_1.useTheme)();
39
- const tabBackgroundColor = (_a = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _a === void 0 ? void 0 : _a['header-background'];
40
- const tabTintColor = (_b = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _b === void 0 ? void 0 : _b['header-tint'];
41
- const borderColor = (_c = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _c === void 0 ? void 0 : _c['gray-200'];
40
+ const route = (0, native_1.useRoute)();
41
+ const tabIdFromParams = (_a = route.params) === null || _a === void 0 ? void 0 : _a.tab;
42
+ const tabBackgroundColor = (_b = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _b === void 0 ? void 0 : _b['body-background'];
43
+ const tabTintColor = (_c = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _c === void 0 ? void 0 : _c['primary'];
44
+ const borderColor = (_d = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _d === void 0 ? void 0 : _d['gray-200'];
42
45
  const routes = (0, react_1.useMemo)(() => tabs.map((tab) => ({ key: tab.id, title: tab.label, blocks: tab.blocks })), [tabs]);
46
+ // Watch for tab parameter changes
47
+ (0, react_1.useEffect)(() => {
48
+ if (!tabIdFromParams)
49
+ return;
50
+ const tabIndex = routes.findIndex(route => route.key === tabIdFromParams);
51
+ if (tabIndex >= 0)
52
+ setIndex(tabIndex);
53
+ }, [tabIdFromParams]);
43
54
  const tabBarStyles = (0, react_1.useMemo)(() => ({
44
- tabBar: [styles.tabBar, { backgroundColor: tabBackgroundColor, borderColor: borderColor }],
55
+ tabBar: [styles.tabBar, { backgroundColor: tabBackgroundColor }],
45
56
  label: [styles.label, { color: tabTintColor }],
46
57
  indicator: [styles.indicator, { backgroundColor: tabTintColor }]
47
- }), [tabBackgroundColor, tabTintColor, borderColor]);
58
+ }), [tabBackgroundColor, tabTintColor]);
48
59
  const renderScene = ({ route }) => {
49
60
  return (react_1.default.createElement(RenderBlocks_1.default, { blocks: route.blocks, animatedScrollPostion: animatedScrollPostion }));
50
61
  };
51
- const renderTabBar = (props) => (react_1.default.createElement(react_native_tab_view_1.TabBar, Object.assign({}, props, { style: tabBarStyles.tabBar, labelStyle: tabBarStyles.label, indicatorStyle: tabBarStyles.indicator, activeColor: tabTintColor, inactiveColor: tabTintColor })));
52
- return (react_1.default.createElement(react_native_tab_view_1.TabView, { navigationState: { index, routes }, tabBarPosition: "top", renderScene: renderScene, onIndexChange: setIndex, initialLayout: { width: layout.width }, renderTabBar: renderTabBar }));
62
+ const renderTabBar = (props) => (react_1.default.createElement(react_native_tab_view_1.TabBar, Object.assign({}, props, { scrollEnabled: false, style: tabBarStyles.tabBar, labelStyle: tabBarStyles.label, indicatorStyle: tabBarStyles.indicator, activeColor: tabTintColor, inactiveColor: tabTintColor })));
63
+ return (react_1.default.createElement(react_native_tab_view_1.TabView, { navigationState: { index, routes }, tabBarPosition: "top", lazy: true, renderScene: renderScene, onIndexChange: setIndex, initialLayout: { width: layout.width }, renderTabBar: renderTabBar }));
53
64
  }
54
65
  const styles = react_native_1.StyleSheet.create({
55
66
  tabBar: {
56
67
  elevation: 0,
57
68
  shadowOpacity: 0,
58
- borderBottomWidth: 1,
59
69
  },
60
70
  indicator: {
61
71
  height: 2,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/RenderTabs/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiD;AACjD,iEAAyE;AACzE,+CAA+D;AAC/D,mEAA2C;AAC3C,4CAA0C;AAiB1C,SAAS,UAAU,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAmB;;IAChE,MAAM,MAAM,GAAG,IAAA,kCAAmB,GAAE,CAAC;IACrC,MAAM,CAAC,KAAK,EAAE,QAAQ,C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;IACD,KAAK,EAAE;QACH,UAAU,EAAE,KAAK;QACjB,aAAa,EAAE,MAAM;KACxB;CACJ,CAAC,CAAC;AAEH,kBAAe,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evlop/native-components",
3
- "version": "1.0.152",
3
+ "version": "1.0.153",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "scripts": {