@r0b0t3d/react-native-collapsible 1.3.0 → 1.3.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.
@@ -5,12 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = CollapsibleHeaderContainer;
7
7
 
8
- var _react = require("react");
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _reactNative = require("react-native");
9
11
 
10
12
  var _useCollapsibleHeaderContext = _interopRequireDefault(require("../../hooks/useCollapsibleHeaderContext"));
11
13
 
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
15
 
16
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
+
18
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
+
14
20
  /* eslint-disable react-hooks/exhaustive-deps */
15
21
  let key = 0;
16
22
 
@@ -23,15 +29,27 @@ function CollapsibleHeaderContainer({
23
29
  unmount,
24
30
  update
25
31
  } = (0, _useCollapsibleHeaderContext.default)();
32
+ const internalStyle = (0, _react.useMemo)(() => {
33
+ return {
34
+ zIndex: 100000 - key
35
+ };
36
+ }, []);
37
+ const content = (0, _react.useMemo)(() => {
38
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
39
+ key: contentKey,
40
+ style: internalStyle,
41
+ pointerEvents: "box-none"
42
+ }, children);
43
+ }, [children]);
26
44
  (0, _react.useEffect)(() => {
27
- mount(contentKey, children);
45
+ mount(contentKey, content);
28
46
  return () => {
29
47
  unmount(contentKey);
30
48
  };
31
49
  }, [contentKey]);
32
50
  (0, _react.useEffect)(() => {
33
- update(contentKey, children);
34
- }, [children]);
51
+ update(contentKey, content);
52
+ }, [content]);
35
53
  return null;
36
54
  }
37
55
  //# sourceMappingURL=CollapsibleHeaderContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["CollapsibleHeaderContainer.tsx"],"names":["key","CollapsibleHeaderContainer","children","contentKey","mount","unmount","update"],"mappings":";;;;;;;AACA;;AAEA;;;;AAHA;AAUA,IAAIA,GAAG,GAAG,CAAV;;AAEe,SAASC,0BAAT,CAAoC;AAAEC,EAAAA;AAAF,CAApC,EAAyD;AACtE,QAAMC,UAAU,GAAG,oBAAQ,MAAO,sBAAqBH,GAAG,EAAG,EAA1C,EAA6C,EAA7C,CAAnB;AACA,QAAM;AAAEI,IAAAA,KAAF;AAASC,IAAAA,OAAT;AAAkBC,IAAAA;AAAlB,MAA6B,2CAAnC;AAEA,wBAAU,MAAM;AACdF,IAAAA,KAAK,CAACD,UAAD,EAAaD,QAAb,CAAL;AAEA,WAAO,MAAM;AACXG,MAAAA,OAAO,CAACF,UAAD,CAAP;AACD,KAFD;AAGD,GAND,EAMG,CAACA,UAAD,CANH;AAQA,wBAAU,MAAM;AACdG,IAAAA,MAAM,CAACH,UAAD,EAAaD,QAAb,CAAN;AACD,GAFD,EAEG,CAACA,QAAD,CAFH;AAIA,SAAO,IAAP;AACD","sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\nimport { ReactNode, useEffect, useMemo } from 'react';\nimport type { StyleProp, ViewStyle } from 'react-native';\nimport useCollapsibleHeaderContext from '../../hooks/useCollapsibleHeaderContext';\n\ntype Props = {\n children: ReactNode;\n containerStyle?: StyleProp<ViewStyle>;\n};\n\nlet key = 0;\n\nexport default function CollapsibleHeaderContainer({ children }: Props) {\n const contentKey = useMemo(() => `collapsible-header-${key++}`, []);\n const { mount, unmount, update } = useCollapsibleHeaderContext();\n\n useEffect(() => {\n mount(contentKey, children);\n\n return () => {\n unmount(contentKey);\n };\n }, [contentKey]);\n\n useEffect(() => {\n update(contentKey, children);\n }, [children]);\n\n return null;\n}\n"]}
1
+ {"version":3,"sources":["CollapsibleHeaderContainer.tsx"],"names":["key","CollapsibleHeaderContainer","children","contentKey","mount","unmount","update","internalStyle","zIndex","content"],"mappings":";;;;;;;AACA;;AACA;;AACA;;;;;;;;AAHA;AAUA,IAAIA,GAAG,GAAG,CAAV;;AAEe,SAASC,0BAAT,CAAoC;AAAEC,EAAAA;AAAF,CAApC,EAAyD;AACtE,QAAMC,UAAU,GAAG,oBAAQ,MAAO,sBAAqBH,GAAG,EAAG,EAA1C,EAA6C,EAA7C,CAAnB;AACA,QAAM;AAAEI,IAAAA,KAAF;AAASC,IAAAA,OAAT;AAAkBC,IAAAA;AAAlB,MAA6B,2CAAnC;AAEA,QAAMC,aAAa,GAAG,oBAAQ,MAAM;AAClC,WAAO;AACLC,MAAAA,MAAM,EAAE,SAASR;AADZ,KAAP;AAGD,GAJqB,EAInB,EAJmB,CAAtB;AAMA,QAAMS,OAAO,GAAG,oBAAQ,MAAM;AAC5B,wBACE,6BAAC,iBAAD;AAAM,MAAA,GAAG,EAAEN,UAAX;AAAuB,MAAA,KAAK,EAAEI,aAA9B;AAA6C,MAAA,aAAa,EAAC;AAA3D,OACGL,QADH,CADF;AAKD,GANe,EAMb,CAACA,QAAD,CANa,CAAhB;AAQA,wBAAU,MAAM;AACdE,IAAAA,KAAK,CAACD,UAAD,EAAaM,OAAb,CAAL;AAEA,WAAO,MAAM;AACXJ,MAAAA,OAAO,CAACF,UAAD,CAAP;AACD,KAFD;AAGD,GAND,EAMG,CAACA,UAAD,CANH;AAQA,wBAAU,MAAM;AACdG,IAAAA,MAAM,CAACH,UAAD,EAAaM,OAAb,CAAN;AACD,GAFD,EAEG,CAACA,OAAD,CAFH;AAIA,SAAO,IAAP;AACD","sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\nimport React, { ReactNode, useEffect, useMemo } from 'react';\nimport { View, StyleProp, ViewStyle } from 'react-native';\nimport useCollapsibleHeaderContext from '../../hooks/useCollapsibleHeaderContext';\n\ntype Props = {\n children: ReactNode;\n containerStyle?: StyleProp<ViewStyle>;\n};\n\nlet key = 0;\n\nexport default function CollapsibleHeaderContainer({ children }: Props) {\n const contentKey = useMemo(() => `collapsible-header-${key++}`, []);\n const { mount, unmount, update } = useCollapsibleHeaderContext();\n\n const internalStyle = useMemo(() => {\n return {\n zIndex: 100000 - key,\n };\n }, []);\n\n const content = useMemo(() => {\n return (\n <View key={contentKey} style={internalStyle} pointerEvents=\"box-none\">\n {children}\n </View>\n );\n }, [children]);\n\n useEffect(() => {\n mount(contentKey, content);\n\n return () => {\n unmount(contentKey);\n };\n }, [contentKey]);\n\n useEffect(() => {\n update(contentKey, content);\n }, [content]);\n\n return null;\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable react-hooks/exhaustive-deps */
2
- import { useEffect, useMemo } from 'react';
2
+ import React, { useEffect, useMemo } from 'react';
3
+ import { View } from 'react-native';
3
4
  import useCollapsibleHeaderContext from '../../hooks/useCollapsibleHeaderContext';
4
5
  let key = 0;
5
6
  export default function CollapsibleHeaderContainer({
@@ -11,15 +12,27 @@ export default function CollapsibleHeaderContainer({
11
12
  unmount,
12
13
  update
13
14
  } = useCollapsibleHeaderContext();
15
+ const internalStyle = useMemo(() => {
16
+ return {
17
+ zIndex: 100000 - key
18
+ };
19
+ }, []);
20
+ const content = useMemo(() => {
21
+ return /*#__PURE__*/React.createElement(View, {
22
+ key: contentKey,
23
+ style: internalStyle,
24
+ pointerEvents: "box-none"
25
+ }, children);
26
+ }, [children]);
14
27
  useEffect(() => {
15
- mount(contentKey, children);
28
+ mount(contentKey, content);
16
29
  return () => {
17
30
  unmount(contentKey);
18
31
  };
19
32
  }, [contentKey]);
20
33
  useEffect(() => {
21
- update(contentKey, children);
22
- }, [children]);
34
+ update(contentKey, content);
35
+ }, [content]);
23
36
  return null;
24
37
  }
25
38
  //# sourceMappingURL=CollapsibleHeaderContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["CollapsibleHeaderContainer.tsx"],"names":["useEffect","useMemo","useCollapsibleHeaderContext","key","CollapsibleHeaderContainer","children","contentKey","mount","unmount","update"],"mappings":"AAAA;AACA,SAAoBA,SAApB,EAA+BC,OAA/B,QAA8C,OAA9C;AAEA,OAAOC,2BAAP,MAAwC,yCAAxC;AAOA,IAAIC,GAAG,GAAG,CAAV;AAEA,eAAe,SAASC,0BAAT,CAAoC;AAAEC,EAAAA;AAAF,CAApC,EAAyD;AACtE,QAAMC,UAAU,GAAGL,OAAO,CAAC,MAAO,sBAAqBE,GAAG,EAAG,EAAnC,EAAsC,EAAtC,CAA1B;AACA,QAAM;AAAEI,IAAAA,KAAF;AAASC,IAAAA,OAAT;AAAkBC,IAAAA;AAAlB,MAA6BP,2BAA2B,EAA9D;AAEAF,EAAAA,SAAS,CAAC,MAAM;AACdO,IAAAA,KAAK,CAACD,UAAD,EAAaD,QAAb,CAAL;AAEA,WAAO,MAAM;AACXG,MAAAA,OAAO,CAACF,UAAD,CAAP;AACD,KAFD;AAGD,GANQ,EAMN,CAACA,UAAD,CANM,CAAT;AAQAN,EAAAA,SAAS,CAAC,MAAM;AACdS,IAAAA,MAAM,CAACH,UAAD,EAAaD,QAAb,CAAN;AACD,GAFQ,EAEN,CAACA,QAAD,CAFM,CAAT;AAIA,SAAO,IAAP;AACD","sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\nimport { ReactNode, useEffect, useMemo } from 'react';\nimport type { StyleProp, ViewStyle } from 'react-native';\nimport useCollapsibleHeaderContext from '../../hooks/useCollapsibleHeaderContext';\n\ntype Props = {\n children: ReactNode;\n containerStyle?: StyleProp<ViewStyle>;\n};\n\nlet key = 0;\n\nexport default function CollapsibleHeaderContainer({ children }: Props) {\n const contentKey = useMemo(() => `collapsible-header-${key++}`, []);\n const { mount, unmount, update } = useCollapsibleHeaderContext();\n\n useEffect(() => {\n mount(contentKey, children);\n\n return () => {\n unmount(contentKey);\n };\n }, [contentKey]);\n\n useEffect(() => {\n update(contentKey, children);\n }, [children]);\n\n return null;\n}\n"]}
1
+ {"version":3,"sources":["CollapsibleHeaderContainer.tsx"],"names":["React","useEffect","useMemo","View","useCollapsibleHeaderContext","key","CollapsibleHeaderContainer","children","contentKey","mount","unmount","update","internalStyle","zIndex","content"],"mappings":"AAAA;AACA,OAAOA,KAAP,IAA2BC,SAA3B,EAAsCC,OAAtC,QAAqD,OAArD;AACA,SAASC,IAAT,QAA2C,cAA3C;AACA,OAAOC,2BAAP,MAAwC,yCAAxC;AAOA,IAAIC,GAAG,GAAG,CAAV;AAEA,eAAe,SAASC,0BAAT,CAAoC;AAAEC,EAAAA;AAAF,CAApC,EAAyD;AACtE,QAAMC,UAAU,GAAGN,OAAO,CAAC,MAAO,sBAAqBG,GAAG,EAAG,EAAnC,EAAsC,EAAtC,CAA1B;AACA,QAAM;AAAEI,IAAAA,KAAF;AAASC,IAAAA,OAAT;AAAkBC,IAAAA;AAAlB,MAA6BP,2BAA2B,EAA9D;AAEA,QAAMQ,aAAa,GAAGV,OAAO,CAAC,MAAM;AAClC,WAAO;AACLW,MAAAA,MAAM,EAAE,SAASR;AADZ,KAAP;AAGD,GAJ4B,EAI1B,EAJ0B,CAA7B;AAMA,QAAMS,OAAO,GAAGZ,OAAO,CAAC,MAAM;AAC5B,wBACE,oBAAC,IAAD;AAAM,MAAA,GAAG,EAAEM,UAAX;AAAuB,MAAA,KAAK,EAAEI,aAA9B;AAA6C,MAAA,aAAa,EAAC;AAA3D,OACGL,QADH,CADF;AAKD,GANsB,EAMpB,CAACA,QAAD,CANoB,CAAvB;AAQAN,EAAAA,SAAS,CAAC,MAAM;AACdQ,IAAAA,KAAK,CAACD,UAAD,EAAaM,OAAb,CAAL;AAEA,WAAO,MAAM;AACXJ,MAAAA,OAAO,CAACF,UAAD,CAAP;AACD,KAFD;AAGD,GANQ,EAMN,CAACA,UAAD,CANM,CAAT;AAQAP,EAAAA,SAAS,CAAC,MAAM;AACdU,IAAAA,MAAM,CAACH,UAAD,EAAaM,OAAb,CAAN;AACD,GAFQ,EAEN,CAACA,OAAD,CAFM,CAAT;AAIA,SAAO,IAAP;AACD","sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\nimport React, { ReactNode, useEffect, useMemo } from 'react';\nimport { View, StyleProp, ViewStyle } from 'react-native';\nimport useCollapsibleHeaderContext from '../../hooks/useCollapsibleHeaderContext';\n\ntype Props = {\n children: ReactNode;\n containerStyle?: StyleProp<ViewStyle>;\n};\n\nlet key = 0;\n\nexport default function CollapsibleHeaderContainer({ children }: Props) {\n const contentKey = useMemo(() => `collapsible-header-${key++}`, []);\n const { mount, unmount, update } = useCollapsibleHeaderContext();\n\n const internalStyle = useMemo(() => {\n return {\n zIndex: 100000 - key,\n };\n }, []);\n\n const content = useMemo(() => {\n return (\n <View key={contentKey} style={internalStyle} pointerEvents=\"box-none\">\n {children}\n </View>\n );\n }, [children]);\n\n useEffect(() => {\n mount(contentKey, content);\n\n return () => {\n unmount(contentKey);\n };\n }, [contentKey]);\n\n useEffect(() => {\n update(contentKey, content);\n }, [content]);\n\n return null;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import type { StyleProp, ViewStyle } from 'react-native';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
3
  declare type Props = {
4
4
  children: ReactNode;
5
5
  containerStyle?: StyleProp<ViewStyle>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r0b0t3d/react-native-collapsible",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Fully customizable collapsible views",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable react-hooks/exhaustive-deps */
2
- import { ReactNode, useEffect, useMemo } from 'react';
3
- import type { StyleProp, ViewStyle } from 'react-native';
2
+ import React, { ReactNode, useEffect, useMemo } from 'react';
3
+ import { View, StyleProp, ViewStyle } from 'react-native';
4
4
  import useCollapsibleHeaderContext from '../../hooks/useCollapsibleHeaderContext';
5
5
 
6
6
  type Props = {
@@ -14,8 +14,22 @@ export default function CollapsibleHeaderContainer({ children }: Props) {
14
14
  const contentKey = useMemo(() => `collapsible-header-${key++}`, []);
15
15
  const { mount, unmount, update } = useCollapsibleHeaderContext();
16
16
 
17
+ const internalStyle = useMemo(() => {
18
+ return {
19
+ zIndex: 100000 - key,
20
+ };
21
+ }, []);
22
+
23
+ const content = useMemo(() => {
24
+ return (
25
+ <View key={contentKey} style={internalStyle} pointerEvents="box-none">
26
+ {children}
27
+ </View>
28
+ );
29
+ }, [children]);
30
+
17
31
  useEffect(() => {
18
- mount(contentKey, children);
32
+ mount(contentKey, content);
19
33
 
20
34
  return () => {
21
35
  unmount(contentKey);
@@ -23,8 +37,8 @@ export default function CollapsibleHeaderContainer({ children }: Props) {
23
37
  }, [contentKey]);
24
38
 
25
39
  useEffect(() => {
26
- update(contentKey, children);
27
- }, [children]);
40
+ update(contentKey, content);
41
+ }, [content]);
28
42
 
29
43
  return null;
30
44
  }