@tecsinapse/react-native-kit 1.12.6 → 1.12.10

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/CHANGELOG.md CHANGED
@@ -3,6 +3,38 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.12.10](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.12.9...@tecsinapse/react-native-kit@1.12.10) (2022-01-11)
7
+
8
+ **Note:** Version bump only for package @tecsinapse/react-native-kit
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.12.9](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.12.8...@tecsinapse/react-native-kit@1.12.9) (2022-01-06)
15
+
16
+ **Note:** Version bump only for package @tecsinapse/react-native-kit
17
+
18
+
19
+
20
+
21
+
22
+ ## [1.12.8](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.12.7...@tecsinapse/react-native-kit@1.12.8) (2022-01-05)
23
+
24
+ **Note:** Version bump only for package @tecsinapse/react-native-kit
25
+
26
+
27
+
28
+
29
+
30
+ ## [1.12.7](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.12.6...@tecsinapse/react-native-kit@1.12.7) (2022-01-04)
31
+
32
+ **Note:** Version bump only for package @tecsinapse/react-native-kit
33
+
34
+
35
+
36
+
37
+
6
38
  ## [1.12.6](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-native-kit@1.12.5...@tecsinapse/react-native-kit@1.12.6) (2021-12-29)
7
39
 
8
40
  **Note:** Version bump only for package @tecsinapse/react-native-kit
@@ -7,6 +7,8 @@ exports.CustomTabContent = exports.TabContent = exports.TabContainer = exports.S
7
7
 
8
8
  var _native = _interopRequireDefault(require("@emotion/native"));
9
9
 
10
+ var _reactCore = require("@tecsinapse/react-core");
11
+
10
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
13
 
12
14
  const StyledView = _native.default.View`
@@ -33,7 +35,7 @@ const TabContainer = _native.default.Pressable`
33
35
  }) => theme.spacing.deca};
34
36
  border-top-width: ${({
35
37
  selected
36
- }) => selected ? '2px' : 0};
38
+ }) => selected ? (0, _reactCore.RFValueStr)('2px') : 0};
37
39
  border-color: ${({
38
40
  theme
39
41
  }) => theme.color.primary.medium};
@@ -45,7 +47,7 @@ const TabContent = _native.default.View`
45
47
  aspect-ratio: 1;
46
48
  justify-content: center;
47
49
  align-items: center;
48
- min-height: 48px;
50
+ min-height: ${(0, _reactCore.RFValueStr)('48px')};
49
51
  background-color: ${({
50
52
  theme
51
53
  }) => theme.color.primary.xlight};
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/BottomNavigator/styled.ts"],"names":["StyledView","styled","View","theme","spacing","deca","kilo","miscellaneous","surfaceColor","TabContainer","Pressable","mili","selected","color","primary","medium","TabContent","xlight","borderRadius","CustomTabContent"],"mappings":";;;;;;;AAAA;;;;AAIO,MAAMA,UAAU,GAAGC,gBAAOC,IAAsC;AACvE;AACA;AACA,wBAAwB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAcC,IAAK;AAC1D,oBAAoB,CAAC;AAAEF,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAcE,IAAK;AACtD,sBAAsB,CAAC;AAAEH,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACI,aAAN,CAAoBC,YAAa;AACtE,CANO;;AAQA,MAAMC,YAAY,GAAGR,gBAAOS,SAEjC;AACF;AACA,uBAAuB,CAAC;AAAEP,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAcO,IAAK;AACzD,iBAAiB,CAAC;AAAER,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAcC,IAAK;AACnD,sBAAsB,CAAC;AAAEO,EAAAA;AAAF,CAAD,KAAmBA,QAAQ,GAAG,KAAH,GAAW,CAAG;AAC/D,kBAAkB,CAAC;AAAET,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACU,KAAN,CAAYC,OAAZ,CAAoBC,MAAO;AAC5D;AACA;AACA,CAVO;;AAYA,MAAMC,UAAU,GAAGf,gBAAOC,IAAsC;AACvE;AACA;AACA;AACA;AACA,sBAAsB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACU,KAAN,CAAYC,OAAZ,CAAoBG,MAAO;AAChE,mBAAmB,CAAC;AAAEd,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACe,YAAN,CAAmB,MAAnB,CAA2B;AAC7D,CAPO;;AASA,MAAMC,gBAAgB,GAAGlB,gBAAOC,IAAsC,EAAtE","sourcesContent":["import styled from '@emotion/native';\nimport { StyleProps } from '@tecsinapse/react-core';\nimport { PressableProps, ViewProps } from 'react-native';\n\nexport const StyledView = styled.View<ViewProps & Partial<StyleProps>>`\n flex-direction: row;\n justify-content: space-between;\n padding-horizontal: ${({ theme }) => theme.spacing.deca};\n padding-bottom: ${({ theme }) => theme.spacing.kilo};\n background-color: ${({ theme }) => theme.miscellaneous.surfaceColor};\n`;\n\nexport const TabContainer = styled.Pressable<\n { selected: boolean } & PressableProps & Partial<StyleProps>\n>`\n flex: 1;\n margin-horizontal: ${({ theme }) => theme.spacing.mili};\n padding-top: ${({ theme }) => theme.spacing.deca};\n border-top-width: ${({ selected }) => (selected ? '2px' : 0)};\n border-color: ${({ theme }) => theme.color.primary.medium};\n align-items: center;\n justify-content: flex-end;\n`;\n\nexport const TabContent = styled.View<ViewProps & Partial<StyleProps>>`\n aspect-ratio: 1;\n justify-content: center;\n align-items: center;\n min-height: 48px;\n background-color: ${({ theme }) => theme.color.primary.xlight};\n border-radius: ${({ theme }) => theme.borderRadius['mili']};\n`;\n\nexport const CustomTabContent = styled.View<ViewProps & Partial<StyleProps>>``;\n"],"file":"styled.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/BottomNavigator/styled.ts"],"names":["StyledView","styled","View","theme","spacing","deca","kilo","miscellaneous","surfaceColor","TabContainer","Pressable","mili","selected","color","primary","medium","TabContent","xlight","borderRadius","CustomTabContent"],"mappings":";;;;;;;AAAA;;AACA;;;;AAGO,MAAMA,UAAU,GAAGC,gBAAOC,IAAsC;AACvE;AACA;AACA,wBAAwB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAcC,IAAK;AAC1D,oBAAoB,CAAC;AAAEF,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAcE,IAAK;AACtD,sBAAsB,CAAC;AAAEH,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACI,aAAN,CAAoBC,YAAa;AACtE,CANO;;AAQA,MAAMC,YAAY,GAAGR,gBAAOS,SAEjC;AACF;AACA,uBAAuB,CAAC;AAAEP,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAcO,IAAK;AACzD,iBAAiB,CAAC;AAAER,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAcC,IAAK;AACnD,sBAAsB,CAAC;AAAEO,EAAAA;AAAF,CAAD,KAAmBA,QAAQ,GAAG,2BAAW,KAAX,CAAH,GAAuB,CAAG;AAC3E,kBAAkB,CAAC;AAAET,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACU,KAAN,CAAYC,OAAZ,CAAoBC,MAAO;AAC5D;AACA;AACA,CAVO;;AAYA,MAAMC,UAAU,GAAGf,gBAAOC,IAAsC;AACvE;AACA;AACA;AACA,gBAAgB,2BAAW,MAAX,CAAmB;AACnC,sBAAsB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACU,KAAN,CAAYC,OAAZ,CAAoBG,MAAO;AAChE,mBAAmB,CAAC;AAAEd,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACe,YAAN,CAAmB,MAAnB,CAA2B;AAC7D,CAPO;;AASA,MAAMC,gBAAgB,GAAGlB,gBAAOC,IAAsC,EAAtE","sourcesContent":["import styled from '@emotion/native';\nimport { RFValueStr, StyleProps } from '@tecsinapse/react-core';\nimport { PressableProps, ViewProps } from 'react-native';\n\nexport const StyledView = styled.View<ViewProps & Partial<StyleProps>>`\n flex-direction: row;\n justify-content: space-between;\n padding-horizontal: ${({ theme }) => theme.spacing.deca};\n padding-bottom: ${({ theme }) => theme.spacing.kilo};\n background-color: ${({ theme }) => theme.miscellaneous.surfaceColor};\n`;\n\nexport const TabContainer = styled.Pressable<\n { selected: boolean } & PressableProps & Partial<StyleProps>\n>`\n flex: 1;\n margin-horizontal: ${({ theme }) => theme.spacing.mili};\n padding-top: ${({ theme }) => theme.spacing.deca};\n border-top-width: ${({ selected }) => (selected ? RFValueStr('2px') : 0)};\n border-color: ${({ theme }) => theme.color.primary.medium};\n align-items: center;\n justify-content: flex-end;\n`;\n\nexport const TabContent = styled.View<ViewProps & Partial<StyleProps>>`\n aspect-ratio: 1;\n justify-content: center;\n align-items: center;\n min-height: ${RFValueStr('48px')};\n background-color: ${({ theme }) => theme.color.primary.xlight};\n border-radius: ${({ theme }) => theme.borderRadius['mili']};\n`;\n\nexport const CustomTabContent = styled.View<ViewProps & Partial<StyleProps>>``;\n"],"file":"styled.js"}
@@ -14,7 +14,7 @@ var _styled = require("../Text/styled");
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
16
  const StyledInputContainer = (0, _native.default)(_reactCore.InputContainer)`
17
- min-height: 50px;
17
+ min-height: ${(0, _reactCore.RFValueStr)('50px')};
18
18
  `;
19
19
  exports.StyledInputContainer = StyledInputContainer;
20
20
  const StyledNativeInputBase = (0, _native.default)(_reactCore.InputElement)`
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/Input/styled.ts"],"names":["StyledInputContainer","InputContainer","StyledNativeInputBase","InputElement","theme","typography","h5","lineHeight","StyledNativeInput","fontStyles"],"mappings":";;;;;;;AAAA;;AACA;;AAKA;;;;AAGO,MAAMA,oBAAoB,GAAG,qBAAOC,yBAAP,CAA4C;AAChF;AACA,CAFO;;AAIP,MAAMC,qBAAqB,GAAG,qBAAOC,uBAAP,CAE5B;AACF,YAAY,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,UAAN,CAAiBC,EAAjB,CAAoBC,UAAW;AAC1D;AACA;AACA,CANA;AAQO,MAAMC,iBAAiB,GAAG,qBAAON,qBAAP,EAE/BO,kBAF+B,CAA1B","sourcesContent":["import styled from '@emotion/native';\nimport {\n InputContainer,\n InputElement,\n StyleProps,\n} from '@tecsinapse/react-core';\nimport { Font, fontStyles } from '../Text/styled';\nimport { InputNativeProps } from './Input';\n\nexport const StyledInputContainer = styled(InputContainer)<Partial<StyleProps>>`\n min-height: 50px;\n`;\n\nconst StyledNativeInputBase = styled(InputElement)<\n Partial<InputNativeProps> & Partial<StyleProps>\n>`\n height: ${({ theme }) => theme.typography.h5.lineHeight};\n width: 100%;\n padding: 0;\n`;\n\nexport const StyledNativeInput = styled(StyledNativeInputBase)<\n Font & Partial<InputNativeProps> & Partial<StyleProps>\n>(fontStyles);\n"],"file":"styled.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/Input/styled.ts"],"names":["StyledInputContainer","InputContainer","StyledNativeInputBase","InputElement","theme","typography","h5","lineHeight","StyledNativeInput","fontStyles"],"mappings":";;;;;;;AAAA;;AACA;;AAMA;;;;AAGO,MAAMA,oBAAoB,GAAG,qBAAOC,yBAAP,CAA4C;AAChF,gBAAgB,2BAAW,MAAX,CAAmB;AACnC,CAFO;;AAIP,MAAMC,qBAAqB,GAAG,qBAAOC,uBAAP,CAE5B;AACF,YAAY,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,UAAN,CAAiBC,EAAjB,CAAoBC,UAAW;AAC1D;AACA;AACA,CANA;AAQO,MAAMC,iBAAiB,GAAG,qBAAON,qBAAP,EAE/BO,kBAF+B,CAA1B","sourcesContent":["import styled from '@emotion/native';\nimport {\n InputContainer,\n InputElement,\n RFValueStr,\n StyleProps\n} from '@tecsinapse/react-core';\nimport { Font, fontStyles } from '../Text/styled';\nimport { InputNativeProps } from './Input';\n\nexport const StyledInputContainer = styled(InputContainer)<Partial<StyleProps>>`\n min-height: ${RFValueStr('50px')};\n`;\n\nconst StyledNativeInputBase = styled(InputElement)<\n Partial<InputNativeProps> & Partial<StyleProps>\n>`\n height: ${({ theme }) => theme.typography.h5.lineHeight};\n width: 100%;\n padding: 0;\n`;\n\nexport const StyledNativeInput = styled(StyledNativeInputBase)<\n Font & Partial<InputNativeProps> & Partial<StyleProps>\n>(fontStyles);\n"],"file":"styled.js"}
@@ -22,14 +22,15 @@ class ModalLifecycleHandler {
22
22
  var _nodeA$lastVisualizat, _nodeB$lastVisualizat;
23
23
 
24
24
  return (((_nodeA$lastVisualizat = nodeA.lastVisualization) === null || _nodeA$lastVisualizat === void 0 ? void 0 : _nodeA$lastVisualizat.getTime()) || 0) - (((_nodeB$lastVisualizat = nodeB.lastVisualization) === null || _nodeB$lastVisualizat === void 0 ? void 0 : _nodeB$lastVisualizat.getTime()) || 0);
25
- }).map(node => {
25
+ }).map((node, index, filteredNodes) => {
26
26
  let modalElement = node.modal();
27
27
  let {
28
28
  props
29
29
  } = modalElement;
30
- return _react.default.cloneElement(modalElement, {
30
+ return _react.default.cloneElement(modalElement, { ...props,
31
31
  key: node.id,
32
32
  visible: node.visible,
33
+ isLastShown: filteredNodes.length - 1 === index,
33
34
  close: () => this.close(node.id),
34
35
  onClose: () => {
35
36
  var _props$onClose;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/Modal/ModalLifecycleHandler.ts"],"names":["ModalLifecycleHandler","constructor","state","nodes","Array","from","nodeGroup","values","filter","node","visible","lastVisualization","sort","nodeA","nodeB","getTime","map","modalElement","modal","props","React","cloneElement","key","id","close","onClose","remove","updateState","modals","has","savedNode","get","set","delete","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L;AAAgBpB,QAAAA,OAAO,EAAE,IAAzB;AAA+BC,QAAAA,iBAAiB,EAAE,IAAIyB,IAAJ;AAAlD,OAAvB,CAAb;AACA,WAAKF,MAAL;AACH,KAhGa;;AAAA,mCAuGEX,EAAD,IAAgB;AAC3B,YAAMO,SAAS,GAAG,KAAKxB,SAAL,CAAeyB,GAAf,CAAmBR,EAAnB,CAAlB;AACAO,MAAAA,SAAS,IAAI,KAAKxB,SAAL,CAAe0B,GAAf,CAAmBT,EAAnB,EAAuB,EAAE,GAAGO,SAAL;AAAgBpB,QAAAA,OAAO,EAAE;AAAzB,OAAvB,CAAb;AACA,WAAKwB,MAAL;AACH,KA3Ga;;AACV,SAAK5B,SAAL,GAAiB,IAAI+B,GAAJ,EAAjB;AACA,SAAKnC,KAAL,GAAaiC,SAAb;AACH;;AAR8B;;;;AAwH5B,MAAMG,2BAA2B,GAAG,MAAM;AAC7C,SAAO,IAAItC,qBAAJ,EAAP;AACH,CAFM","sourcesContent":["import React, { Dispatch, ReactElement } from \"react\"\nimport { IBaseModal } from \"./ui/types\"\n\n/**\n * It Represents a node (usually a modal component) in the modal's lifecycle handler.\n */\ninterface ModalNode {\n id: string\n visible?: boolean\n lastVisualization?: Date\n modal: () => ReactElement<IBaseModal>\n}\n\n/**\n * Manage all modal's lifecycle.\n */\nexport class ModalLifecycleHandler {\n \n nodeGroup: Map<string, ModalNode>\n state: [ReactElement<IBaseModal>[], Dispatch<ReactElement<IBaseModal>[]>] | undefined\n\n constructor() {\n this.nodeGroup = new Map()\n this.state = undefined\n }\n\n /**\n * Holds the ModalGroupManager state.\n * \n * @param state \n */\n public attach = (state: [ReactElement<IBaseModal>[], Dispatch<ReactElement<IBaseModal>[]>]) => {\n this.state = state\n }\n\n /**\n * Updates all the modal components.\n */\n public update = () => {\n const nodes = Array.from(this.nodeGroup.values())\n .filter(node => node.visible || !!node.lastVisualization)\n .sort((nodeA, nodeB) => (nodeA.lastVisualization?.getTime() || 0) - (nodeB.lastVisualization?.getTime() || 0))\n .map(node => {\n let modalElement = node.modal()\n let { props } = modalElement\n return React.cloneElement(modalElement, {\n key: node.id,\n visible: node.visible,\n close: () => this.close(node.id),\n onClose: () => {\n this.remove(node.id)\n props.onClose?.()\n }\n })\n })\n \n const [, updateState ] = this.state || []\n updateState?.(nodes)\n }\n\n /**\n * Renders all selected modals.\n * \n * @returns \n */\n public render = (): ReactElement<IBaseModal>[] => {\n const [ modals ] = this.state || []\n return modals || []\n }\n\n /**\n * Tells to the lifecycle handler that a modal component needs to be handled.\n * \n * @param id \n * @param modal \n * @returns \n */\n public sync = (id: string, modal: () => ReactElement<IBaseModal>) => {\n if (this.nodeGroup.has(id)) {\n const savedNode = this.nodeGroup.get(id)\n savedNode && this.nodeGroup.set(id, { ...savedNode, modal })\n return\n }\n this.nodeGroup.set(id, { id, modal })\n }\n\n /**\n * Destroy a modal from the lifecycle handler.\n * \n * @param id \n */\n public destroy = (id: string) => {\n this.nodeGroup.delete(id)\n this.update()\n }\n\n /**\n * Removes a modal from the rendering stack. It tells to the lifecycle handler that a modal \n * component is no longer used by the application.\n * \n * @param id \n */\n private remove = (id: string) => {\n const savedNode = this.nodeGroup.get(id)\n savedNode && this.nodeGroup.set(id, { ...savedNode, lastVisualization: undefined })\n this.update()\n }\n\n /**\n * Makes a modal appears.\n * \n * @param id \n */\n public show = (id: string) => {\n const savedNode = this.nodeGroup.get(id)\n savedNode && this.nodeGroup.set(id, { ...savedNode, visible: true, lastVisualization: new Date() })\n this.update()\n }\n\n /**\n * Makes a modal disappears.\n * \n * @param id \n */\n public close = (id: string) => {\n const savedNode = this.nodeGroup.get(id)\n savedNode && this.nodeGroup.set(id, { ...savedNode, visible: false })\n this.update()\n }\n}\n\n/**\n * Creates a new ModalLifecycleHandlere instance.\n * \n * @returns \n */\nexport const createModalLifecycleHandler = () => {\n return new ModalLifecycleHandler()\n}\n"],"file":"ModalLifecycleHandler.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/Modal/ModalLifecycleHandler.ts"],"names":["ModalLifecycleHandler","constructor","state","nodes","Array","from","nodeGroup","values","filter","node","visible","lastVisualization","sort","nodeA","nodeB","getTime","map","index","filteredNodes","modalElement","modal","props","React","cloneElement","key","id","isLastShown","length","close","onClose","remove","updateState","modals","has","savedNode","get","set","delete","update","undefined","Date","Map","createModalLifecycleHandler"],"mappings":";;;;;;;AAAA;;;;;;AAgBO,MAAMA,qBAAN,CAA4B;AAK/BC,EAAAA,WAAW,GAAG;AAAA,oCAUGC,KAAD,IAA+E;AAC3F,WAAKA,KAAL,GAAaA,KAAb;AACH,KAZa;;AAAA,oCAiBE,MAAM;AAClB,YAAMC,KAAK,GAAGC,KAAK,CAACC,IAAN,CAAW,KAAKC,SAAL,CAAeC,MAAf,EAAX,EACTC,MADS,CACFC,IAAI,IAAIA,IAAI,CAACC,OAAL,IAAgB,CAAC,CAACD,IAAI,CAACE,iBAD7B,EAETC,IAFS,CAEJ,CAACC,KAAD,EAAQC,KAAR;AAAA;;AAAA,eAAkB,CAAC,0BAAAD,KAAK,CAACF,iBAAN,gFAAyBI,OAAzB,OAAsC,CAAvC,KAA6C,0BAAAD,KAAK,CAACH,iBAAN,gFAAyBI,OAAzB,OAAsC,CAAnF,CAAlB;AAAA,OAFI,EAGTC,GAHS,CAGL,CAACP,IAAD,EAAOQ,KAAP,EAAcC,aAAd,KAAgC;AACjC,YAAIC,YAAY,GAAGV,IAAI,CAACW,KAAL,EAAnB;AACA,YAAI;AAAEC,UAAAA;AAAF,YAAYF,YAAhB;AACA,eAAOG,eAAMC,YAAN,CAAmBJ,YAAnB,EAAiC,EACpC,GAAGE,KADiC;AAEpCG,UAAAA,GAAG,EAAEf,IAAI,CAACgB,EAF0B;AAGpCf,UAAAA,OAAO,EAAED,IAAI,CAACC,OAHsB;AAIpCgB,UAAAA,WAAW,EAAER,aAAa,CAACS,MAAd,GAAuB,CAAvB,KAA6BV,KAJN;AAKpCW,UAAAA,KAAK,EAAE,MAAM,KAAKA,KAAL,CAAW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AnB,EAAuB,EAAE,GAAGS,SAAL;AAAgBvB,QAAAA,iBAAiB,EAAE4B;AAAnC,OAAvB,CAAb;AACA,WAAKD,MAAL;AACH,KAvFa;;AAAA,kCA8FCb,EAAD,IAAgB;AAC1B,YAAMS,SAAS,GAAG,KAAK5B,SAAL,CAAe6B,GAAf,CAAmBV,EAAnB,CAAlB;AACAS,MAAAA,SAAS,IAAI,KAAK5B,SAAL,CAAe8B,GAAf,CAAmBX,EAAnB,EAAuB,EAAE,GAAGS,SAAL;AAAgBxB,QAAAA,OAAO,EAAE,IAAzB;AAA+BC,QAAAA,iBAAiB,EAAE,IAAI6B,IAAJ;AAAlD,OAAvB,CAAb;AACA,WAAKF,MAAL;AACH,KAlGa;;AAAA,mCAyGEb,EAAD,IAAgB;AAC3B,YAAMS,SAAS,GAAG,KAAK5B,SAAL,CAAe6B,GAAf,CAAmBV,EAAnB,CAAlB;AACAS,MAAAA,SAAS,IAAI,KAAK5B,SAAL,CAAe8B,GAAf,CAAmBX,EAAnB,EAAuB,EAAE,GAAGS,SAAL;AAAgBxB,QAAAA,OAAO,EAAE;AAAzB,OAAvB,CAAb;AACA,WAAK4B,MAAL;AACH,KA7Ga;;AACV,SAAKhC,SAAL,GAAiB,IAAImC,GAAJ,EAAjB;AACA,SAAKvC,KAAL,GAAaqC,SAAb;AACH;;AAR8B;;;;AA0H5B,MAAMG,2BAA2B,GAAG,MAAM;AAC7C,SAAO,IAAI1C,qBAAJ,EAAP;AACH,CAFM","sourcesContent":["import React, { Dispatch, ReactElement } from \"react\"\nimport { IBaseModal } from \"./ui/types\"\n\n/**\n * It Represents a node (usually a modal component) in the modal's lifecycle handler.\n */\ninterface ModalNode {\n id: string\n visible?: boolean\n lastVisualization?: Date\n modal: () => ReactElement<IBaseModal>\n}\n\n/**\n * Manage all modal's lifecycle.\n */\nexport class ModalLifecycleHandler {\n \n nodeGroup: Map<string, ModalNode>\n state: [ReactElement<IBaseModal>[], Dispatch<ReactElement<IBaseModal>[]>] | undefined\n\n constructor() {\n this.nodeGroup = new Map()\n this.state = undefined\n }\n\n /**\n * Holds the ModalGroupManager state.\n * \n * @param state \n */\n public attach = (state: [ReactElement<IBaseModal>[], Dispatch<ReactElement<IBaseModal>[]>]) => {\n this.state = state\n }\n\n /**\n * Updates all the modal components.\n */\n public update = () => {\n const nodes = Array.from(this.nodeGroup.values())\n .filter(node => node.visible || !!node.lastVisualization)\n .sort((nodeA, nodeB) => (nodeA.lastVisualization?.getTime() || 0) - (nodeB.lastVisualization?.getTime() || 0))\n .map((node, index, filteredNodes) => {\n let modalElement = node.modal()\n let { props } = modalElement\n return React.cloneElement(modalElement, {\n ...props,\n key: node.id,\n visible: node.visible,\n isLastShown: filteredNodes.length - 1 === index,\n close: () => this.close(node.id),\n onClose: () => {\n this.remove(node.id)\n props.onClose?.()\n }\n })\n })\n \n const [, updateState ] = this.state || []\n updateState?.(nodes)\n }\n\n /**\n * Renders all selected modals.\n * \n * @returns \n */\n public render = (): ReactElement<IBaseModal>[] => {\n const [ modals ] = this.state || []\n return modals || []\n }\n\n /**\n * Tells to the lifecycle handler that a modal component needs to be handled.\n * \n * @param id \n * @param modal \n * @returns \n */\n public sync = (id: string, modal: () => ReactElement<IBaseModal>) => {\n if (this.nodeGroup.has(id)) {\n const savedNode = this.nodeGroup.get(id)\n savedNode && this.nodeGroup.set(id, { ...savedNode, modal })\n return\n }\n this.nodeGroup.set(id, { id, modal })\n }\n\n /**\n * Destroy a modal from the lifecycle handler.\n * \n * @param id \n */\n public destroy = (id: string) => {\n this.nodeGroup.delete(id)\n this.update()\n }\n\n /**\n * Removes a modal from the rendering stack. It tells to the lifecycle handler that a modal \n * component is no longer used by the application.\n * \n * @param id \n */\n private remove = (id: string) => {\n const savedNode = this.nodeGroup.get(id)\n savedNode && this.nodeGroup.set(id, { ...savedNode, lastVisualization: undefined })\n this.update()\n }\n\n /**\n * Makes a modal appears.\n * \n * @param id \n */\n public show = (id: string) => {\n const savedNode = this.nodeGroup.get(id)\n savedNode && this.nodeGroup.set(id, { ...savedNode, visible: true, lastVisualization: new Date() })\n this.update()\n }\n\n /**\n * Makes a modal disappears.\n * \n * @param id \n */\n public close = (id: string) => {\n const savedNode = this.nodeGroup.get(id)\n savedNode && this.nodeGroup.set(id, { ...savedNode, visible: false })\n this.update()\n }\n}\n\n/**\n * Creates a new ModalLifecycleHandlere instance.\n * \n * @returns \n */\nexport const createModalLifecycleHandler = () => {\n return new ModalLifecycleHandler()\n}\n"],"file":"ModalLifecycleHandler.js"}
@@ -28,16 +28,22 @@ const ModalView = ({
28
28
  children,
29
29
  visible,
30
30
  BoxComponent = _reactCore.BoxContent,
31
+ frozen,
32
+ isLastShown,
31
33
  close,
32
34
  onClose
33
35
  }) => {
34
36
  const {
35
37
  bottom
36
38
  } = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
39
+ const [ready, setReady] = (0, _react.useState)(false);
40
+ const [keyboardOpened, setKeyboardOpened] = (0, _react.useState)(false);
41
+ const [boxHeight, setBoxHeight] = (0, _react.useState)(0);
37
42
  const backgroundCarrier = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
38
43
  const translationCarrier = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
39
44
  const opacityCarrier = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
40
- const show = (0, _react.useCallback)(to => {
45
+ const offset = isLastShown && keyboardOpened ? 0 : bottom;
46
+ const show = (0, _react.useCallback)(() => {
41
47
  _reactNative.Animated.sequence([_reactNative.Animated.timing(backgroundCarrier, {
42
48
  toValue: INTERPOLATION_STEPS,
43
49
  duration: INTERPOLATION_DURATION,
@@ -48,27 +54,27 @@ const ModalView = ({
48
54
  duration: OPACITY_DURATION,
49
55
  useNativeDriver: true
50
56
  }), _reactNative.Animated.timing(translationCarrier, {
51
- toValue: to,
57
+ toValue: 0,
52
58
  duration: INTERPOLATION_DURATION,
53
59
  easing: _reactNative.Easing.out(_reactNative.Easing.circle),
54
60
  useNativeDriver: true
55
61
  })]).start();
56
62
  }, []);
57
- const hide = (0, _react.useCallback)(() => {
58
- _reactNative.Animated.sequence([_reactNative.Animated.timing(translationCarrier, {
59
- toValue: 0,
63
+ const hide = (0, _react.useCallback)(to => {
64
+ _reactNative.Animated.sequence([_reactNative.Animated.parallel([_reactNative.Animated.timing(translationCarrier, {
65
+ toValue: to,
60
66
  duration: INTERPOLATION_DURATION,
61
67
  easing: _reactNative.Easing.out(_reactNative.Easing.circle),
62
68
  useNativeDriver: true
63
- }), _reactNative.Animated.timing(backgroundCarrier, {
69
+ }), _reactNative.Animated.timing(opacityCarrier, {
70
+ toValue: 0,
71
+ duration: INTERPOLATION_DURATION,
72
+ useNativeDriver: true
73
+ })]), _reactNative.Animated.timing(backgroundCarrier, {
64
74
  toValue: 0,
65
75
  duration: INTERPOLATION_DURATION,
66
76
  easing: _reactNative.Easing.out(_reactNative.Easing.circle),
67
77
  useNativeDriver: false
68
- }), _reactNative.Animated.timing(opacityCarrier, {
69
- toValue: 0,
70
- duration: OPACITY_DURATION,
71
- useNativeDriver: true
72
78
  })]).start(onClose);
73
79
  }, [onClose]);
74
80
  const backgroundInterpolation = backgroundCarrier.interpolate({
@@ -76,21 +82,45 @@ const ModalView = ({
76
82
  outputRange: ['rgba(0, 0, 0, 0)', `rgba(0, 0, 0, ${BACKDROP_ALPHA})`]
77
83
  });
78
84
  const handleBoxLayoutChanges = (0, _react.useCallback)(lce => {
79
- let boxHeight = lce.nativeEvent.layout.height;
80
- boxHeight > 0 && requestAnimationFrame(() => show(-boxHeight));
81
- }, [show]);
85
+ let boxHeightEvent = lce.nativeEvent.layout.height;
86
+ setBoxHeight(boxHeightEvent);
87
+
88
+ if (visible && !ready) {
89
+ translationCarrier.setValue(boxHeightEvent);
90
+ setReady(true);
91
+ }
92
+ }, [show, ready, visible, setReady]);
82
93
  (0, _react.useEffect)(() => {
83
- if (!visible) {
84
- hide();
94
+ if (visible && ready) requestAnimationFrame(() => show());
95
+
96
+ if (!visible && !ready) {
97
+ _reactNative.Keyboard.dismiss();
98
+
99
+ requestAnimationFrame(() => hide(boxHeight));
85
100
  }
86
- }, [visible]);
101
+
102
+ if (!visible && ready) setReady(false);
103
+ }, [ready, visible]);
104
+ (0, _react.useEffect)(() => {
105
+ const showEvent = _reactNative.Keyboard.addListener('keyboardDidShow', () => setKeyboardOpened(true));
106
+
107
+ const hideEvent = _reactNative.Keyboard.addListener('keyboardDidHide', () => setKeyboardOpened(false));
108
+
109
+ return () => {
110
+ showEvent.remove();
111
+ hideEvent.remove();
112
+ };
113
+ }, []);
87
114
  return _react.default.createElement(_styled.StyledPressableBackDrop, {
88
- onPress: close
115
+ onPress: !frozen ? close : undefined
89
116
  }, _react.default.createElement(_styled.BackDropView, {
90
117
  style: {
91
118
  backgroundColor: backgroundInterpolation
92
119
  }
93
- }), _react.default.createElement(_reactNative.Animated.View, {
120
+ }, _react.default.createElement(_reactNative.KeyboardAvoidingView, {
121
+ enabled: isLastShown,
122
+ behavior: "padding"
123
+ }, _react.default.createElement(_reactNative.Animated.View, {
94
124
  style: {
95
125
  opacity: opacityCarrier,
96
126
  transform: [{
@@ -100,10 +130,10 @@ const ModalView = ({
100
130
  }, _react.default.createElement(_reactNative.Pressable, null, _react.default.createElement(BoxComponent, {
101
131
  onLayout: handleBoxLayoutChanges,
102
132
  style: {
103
- paddingBottom: bottom
133
+ paddingBottom: offset
104
134
  },
105
135
  variant: "bottom"
106
- }, _react.default.createElement(_styled.CloseBar, null), children))));
136
+ }, _react.default.createElement(_styled.CloseBar, null), children))))));
107
137
  };
108
138
 
109
139
  exports.ModalView = ModalView;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/atoms/Modal/ui/BaseModalView.tsx"],"names":["BACKDROP_ALPHA","INTERPOLATION_STEPS","INTERPOLATION_DURATION","OPACITY_DURATION","ModalView","children","visible","BoxComponent","BoxContent","close","onClose","bottom","backgroundCarrier","Animated","Value","current","translationCarrier","opacityCarrier","show","to","sequence","timing","toValue","duration","easing","Easing","out","circle","useNativeDriver","start","hide","backgroundInterpolation","interpolate","inputRange","outputRange","handleBoxLayoutChanges","lce","boxHeight","nativeEvent","layout","height","requestAnimationFrame","backgroundColor","opacity","transform","translateY","paddingBottom"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;AAGA,MAAMA,cAAc,GAAG,GAAvB;AACA,MAAMC,mBAAmB,GAAG,EAA5B;AACA,MAAMC,sBAAsB,GAAG,GAA/B;AACA,MAAMC,gBAAgB,GAAG,EAAzB;;AAEO,MAAMC,SAAyB,GAAG,CAAC;AACtCC,EAAAA,QADsC;AAEtCC,EAAAA,OAFsC;AAGtCC,EAAAA,YAAY,GAAGC,qBAHuB;AAItCC,EAAAA,KAJsC;AAKtCC,EAAAA;AALsC,CAAD,KAMnC;AAEF,QAAM;AAAEC,IAAAA;AAAF,MAAa,oDAAnB;AACA,QAAMC,iBAAiB,GAAG,mBAAO,IAAIC,sBAASC,KAAb,CAAmB,CAAnB,CAAP,EAA8BC,OAAxD;AACA,QAAMC,kBAAkB,GAAG,mBAAO,IAAIH,sBAASC,KAAb,CAAmB,CAAnB,CAAP,EAA8BC,OAAzD;AACA,QAAME,cAAc,GAAG,mBAAO,IAAIJ,sBAASC,KAAb,CAAmB,CAAnB,CAAP,EAA8BC,OAArD;AAEA,QAAMG,IAAI,GAAG,wBAAaC,EAAD,IAAgB;AACrCN,0BAASO,QAAT,CAAkB,CACdP,sBAASQ,MAAT,CAAgBT,iBAAhB,EAAmC;AAC/BU,MAAAA,OAAO,EAAErB,mBADsB;AAE/BsB,MAAAA,QAAQ,EAAErB,sBAFqB;AAG/BsB,MAAAA,MAAM,EAAEC,oBAAOC,GAAP,CAAWD,oBAAOE,MAAlB,CAHuB;AAI/BC,MAAAA,eAAe,EAAE;AAJc,KAAnC,CADc,EAOdf,sBAASQ,MAAT,CAAgBJ,cAAhB,EAAgC;AAC5BK,MAAAA,OAAO,EAAE,CADmB;AAE5BC,MAAAA,QAAQ,EAAEpB,gB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CAAC,CAAD,EAAIhC,mBAAJ,CAD8C;AAE1DiC,IAAAA,WAAW,EAAE,CAAC,kBAAD,EAAsB,iBAAgBlC,cAAe,GAArD;AAF6C,GAA9B,CAAhC;AAKA,QAAMmC,sBAAsB,GAAG,wBAAaC,GAAD,IAA4B;AACnE,QAAIC,SAAS,GAAGD,GAAG,CAACE,WAAJ,CAAgBC,MAAhB,CAAuBC,MAAvC;AACAH,IAAAA,SAAS,GAAG,CAAZ,IAAiBI,qBAAqB,CAAC,MAAMvB,IAAI,CAAC,CAACmB,SAAF,CAAX,CAAtC;AACH,GAH8B,EAG5B,CAACnB,IAAD,CAH4B,CAA/B;AAKA,wBAAU,MAAM;AACZ,QAAI,CAACZ,OAAL,EAAc;AACVwB,MAAAA,IAAI;AACP;AACJ,GAJD,EAIG,CAACxB,OAAD,CAJH;AAMA,SACI,6BAAC,+BAAD;AAAyB,IAAA,OAAO,EAAEG;AAAlC,KACI,6BAAC,oBAAD;AAAc,IAAA,KAAK,EAAE;AAAEiC,MAAAA,eAAe,EAAEX;AAAnB;AAArB,IADJ,EAEI,6BAAC,qBAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAE;AAAEY,MAAAA,OAAO,EAAE1B,cAAX;AAA2B2B,MAAAA,SAAS,EAAE,CAAC;AAAEC,QAAAA,UAAU,EAAE7B;AAAd,OAAD;AAAtC;AAAtB,KACI,6BAAC,sBAAD,QACI,6BAAC,YAAD;AAAc,IAAA,QAAQ,EAAEmB,sBAAxB;AAAgD,IAAA,KAAK,EAAE;AAAEW,MAAAA,aAAa,EAAEnC;AAAjB,KAAvD;AAAkF,IAAA,OAAO,EAAC;AAA1F,KACI,6BAAC,gBAAD,OADJ,EAEKN,QAFL,CADJ,CADJ,CAFJ,CADJ;AAaH,CAtFM","sourcesContent":["import { BoxContent } from \"@tecsinapse/react-core\";\nimport React, { FC, useCallback, useEffect, useRef } from \"react\";\nimport { Animated, Easing, LayoutChangeEvent, Pressable } from \"react-native\";\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { BackDropView, CloseBar, StyledPressableBackDrop } from \"./styled\";\nimport { IBaseModal } from \"./types\";\n\nconst BACKDROP_ALPHA = .65\nconst INTERPOLATION_STEPS = 10\nconst INTERPOLATION_DURATION = 195 //ms\nconst OPACITY_DURATION = 25 //ms\n\nexport const ModalView: FC<IBaseModal> = ({ \n children,\n visible,\n BoxComponent = BoxContent,\n close,\n onClose\n}) => {\n \n const { bottom } = useSafeAreaInsets()\n const backgroundCarrier = useRef(new Animated.Value(0)).current\n const translationCarrier = useRef(new Animated.Value(0)).current\n const opacityCarrier = useRef(new Animated.Value(0)).current\n\n const show = useCallback((to: number) => {\n Animated.sequence([\n Animated.timing(backgroundCarrier, {\n toValue: INTERPOLATION_STEPS,\n duration: INTERPOLATION_DURATION,\n easing: Easing.out(Easing.circle),\n useNativeDriver: false\n }),\n Animated.timing(opacityCarrier, {\n toValue: 1,\n duration: OPACITY_DURATION,\n useNativeDriver: true\n }),\n Animated.timing(translationCarrier, {\n toValue: to,\n duration: INTERPOLATION_DURATION,\n easing: Easing.out(Easing.circle),\n useNativeDriver: true\n })\n ]).start()\n }, [])\n\n const hide = useCallback(() => {\n Animated.sequence([\n Animated.timing(translationCarrier, {\n toValue: 0,\n duration: INTERPOLATION_DURATION,\n easing: Easing.out(Easing.circle),\n useNativeDriver: true\n }),\n Animated.timing(backgroundCarrier, {\n toValue: 0,\n duration: INTERPOLATION_DURATION,\n easing: Easing.out(Easing.circle),\n useNativeDriver: false\n }),\n Animated.timing(opacityCarrier, {\n toValue: 0,\n duration: OPACITY_DURATION,\n useNativeDriver: true\n }),\n ]).start(onClose)\n }, [onClose])\n\n const backgroundInterpolation = backgroundCarrier.interpolate({\n inputRange: [0, INTERPOLATION_STEPS],\n outputRange: ['rgba(0, 0, 0, 0)', `rgba(0, 0, 0, ${BACKDROP_ALPHA})`]\n })\n\n const handleBoxLayoutChanges = useCallback((lce: LayoutChangeEvent) => {\n let boxHeight = lce.nativeEvent.layout.height\n boxHeight > 0 && requestAnimationFrame(() => show(-boxHeight))\n }, [show])\n\n useEffect(() => {\n if (!visible) {\n hide()\n }\n }, [visible])\n\n return (\n <StyledPressableBackDrop onPress={close}>\n <BackDropView style={{ backgroundColor: backgroundInterpolation }}/>\n <Animated.View style={{ opacity: opacityCarrier, transform: [{ translateY: translationCarrier }]}}>\n <Pressable>\n <BoxComponent onLayout={handleBoxLayoutChanges} style={{ paddingBottom: bottom }} variant=\"bottom\">\n <CloseBar/>\n {children}\n </BoxComponent>\n </Pressable>\n </Animated.View>\n </StyledPressableBackDrop>\n )\n}"],"file":"BaseModalView.js"}
1
+ {"version":3,"sources":["../../../../../src/components/atoms/Modal/ui/BaseModalView.tsx"],"names":["BACKDROP_ALPHA","INTERPOLATION_STEPS","INTERPOLATION_DURATION","OPACITY_DURATION","ModalView","children","visible","BoxComponent","BoxContent","frozen","isLastShown","close","onClose","bottom","ready","setReady","keyboardOpened","setKeyboardOpened","boxHeight","setBoxHeight","backgroundCarrier","Animated","Value","current","translationCarrier","opacityCarrier","offset","show","sequence","timing","toValue","duration","easing","Easing","out","circle","useNativeDriver","start","hide","to","parallel","backgroundInterpolation","interpolate","inputRange","outputRange","handleBoxLayoutChanges","lce","boxHeightEvent","nativeEvent","layout","height","setValue","requestAnimationFrame","Keyboard","dismiss","showEvent","addListener","hideEvent","remove","undefined","backgroundColor","opacity","transform","translateY","paddingBottom"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;AAGA,MAAMA,cAAc,GAAG,GAAvB;AACA,MAAMC,mBAAmB,GAAG,EAA5B;AACA,MAAMC,sBAAsB,GAAG,GAA/B;AACA,MAAMC,gBAAgB,GAAG,EAAzB;;AAEO,MAAMC,SAAyB,GAAG,CAAC;AACtCC,EAAAA,QADsC;AAEtCC,EAAAA,OAFsC;AAGtCC,EAAAA,YAAY,GAAGC,qBAHuB;AAItCC,EAAAA,MAJsC;AAKtCC,EAAAA,WALsC;AAMtCC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,KACI,6BAAC,oBAAD;AAAc,IAAA,KAAK,EAAE;AAAEC,MAAAA,eAAe,EAAEnB;AAAnB;AAArB,KACI,6BAAC,iCAAD;AAAsB,IAAA,OAAO,EAAE/B,WAA/B;AAA4C,IAAA,QAAQ,EAAC;AAArD,KACI,6BAAC,qBAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAE;AAAEmD,MAAAA,OAAO,EAAEpC,cAAX;AAA2BqC,MAAAA,SAAS,EAAE,CAAC;AAAEC,QAAAA,UAAU,EAAEvC;AAAd,OAAD;AAAtC;AAAtB,KACI,6BAAC,sBAAD,QACI,6BAAC,YAAD;AAAc,IAAA,QAAQ,EAAEqB,sBAAxB;AAAgD,IAAA,KAAK,EAAE;AAAEmB,MAAAA,aAAa,EAAEtC;AAAjB,KAAvD;AAAkF,IAAA,OAAO,EAAC;AAA1F,KACI,6BAAC,gBAAD,OADJ,EAEKrB,QAFL,CADJ,CADJ,CADJ,CADJ,CADJ,CADJ;AAgBH,CAlHM","sourcesContent":["import { BoxContent } from \"@tecsinapse/react-core\";\nimport React, { FC, useCallback, useEffect, useRef, useState } from \"react\";\nimport { Animated, Easing, Keyboard, KeyboardAvoidingView, LayoutChangeEvent, Pressable } from \"react-native\";\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { BackDropView, CloseBar, StyledPressableBackDrop } from \"./styled\";\nimport { IBaseModal } from \"./types\";\n\nconst BACKDROP_ALPHA = .65\nconst INTERPOLATION_STEPS = 10\nconst INTERPOLATION_DURATION = 195 //ms\nconst OPACITY_DURATION = 25 //ms\n\nexport const ModalView: FC<IBaseModal> = ({\n children,\n visible,\n BoxComponent = BoxContent,\n frozen,\n isLastShown,\n close,\n onClose\n}) => {\n \n const { bottom } = useSafeAreaInsets()\n const [ ready, setReady ] = useState(false)\n const [ keyboardOpened, setKeyboardOpened ] = useState(false)\n const [ boxHeight, setBoxHeight ] = useState(0)\n const backgroundCarrier = useRef(new Animated.Value(0)).current\n const translationCarrier = useRef(new Animated.Value(0)).current\n const opacityCarrier = useRef(new Animated.Value(0)).current\n const offset = isLastShown && keyboardOpened ? 0 : bottom\n\n const show = useCallback(() => {\n Animated.sequence([\n Animated.timing(backgroundCarrier, {\n toValue: INTERPOLATION_STEPS,\n duration: INTERPOLATION_DURATION,\n easing: Easing.out(Easing.circle),\n useNativeDriver: false\n }),\n Animated.timing(opacityCarrier, {\n toValue: 1,\n duration: OPACITY_DURATION,\n useNativeDriver: true\n }),\n Animated.timing(translationCarrier, {\n toValue: 0,\n duration: INTERPOLATION_DURATION,\n easing: Easing.out(Easing.circle),\n useNativeDriver: true\n })\n ]).start()\n }, [])\n\n const hide = useCallback((to: number) => {\n Animated.sequence([\n Animated.parallel([\n Animated.timing(translationCarrier, {\n toValue: to,\n duration: INTERPOLATION_DURATION,\n easing: Easing.out(Easing.circle),\n useNativeDriver: true\n }),\n Animated.timing(opacityCarrier, {\n toValue: 0,\n duration: INTERPOLATION_DURATION,\n useNativeDriver: true\n }) \n ]),\n Animated.timing(backgroundCarrier, {\n toValue: 0,\n duration: INTERPOLATION_DURATION,\n easing: Easing.out(Easing.circle),\n useNativeDriver: false\n }),\n ]).start(onClose)\n }, [onClose])\n\n const backgroundInterpolation = backgroundCarrier.interpolate({\n inputRange: [0, INTERPOLATION_STEPS],\n outputRange: ['rgba(0, 0, 0, 0)', `rgba(0, 0, 0, ${BACKDROP_ALPHA})`]\n })\n\n const handleBoxLayoutChanges = useCallback((lce: LayoutChangeEvent) => {\n let boxHeightEvent = lce.nativeEvent.layout.height\n setBoxHeight(boxHeightEvent)\n \n if (visible && !ready) {\n translationCarrier.setValue(boxHeightEvent)\n setReady(true)\n }\n }, [show, ready, visible, setReady])\n\n useEffect(() => {\n if (visible && ready) requestAnimationFrame(() => show())\n if (!visible && !ready) {\n Keyboard.dismiss()\n requestAnimationFrame(() => hide(boxHeight))\n }\n if (!visible && ready) setReady(false)\n }, [ready, visible])\n\n useEffect(() => {\n const showEvent = Keyboard.addListener('keyboardDidShow', () => setKeyboardOpened(true))\n const hideEvent = Keyboard.addListener('keyboardDidHide', () => setKeyboardOpened(false))\n return () => {\n showEvent.remove()\n hideEvent.remove()\n }\n }, [])\n\n return (\n <StyledPressableBackDrop onPress={!frozen ? close : undefined}>\n <BackDropView style={{ backgroundColor: backgroundInterpolation }}>\n <KeyboardAvoidingView enabled={isLastShown} behavior=\"padding\">\n <Animated.View style={{ opacity: opacityCarrier, transform: [{ translateY: translationCarrier }]}}>\n <Pressable>\n <BoxComponent onLayout={handleBoxLayoutChanges} style={{ paddingBottom: offset }} variant=\"bottom\">\n <CloseBar/>\n {children}\n </BoxComponent>\n </Pressable>\n </Animated.View>\n </KeyboardAvoidingView>\n </BackDropView>\n </StyledPressableBackDrop>\n )\n}"],"file":"BaseModalView.js"}
@@ -7,6 +7,8 @@ exports.CloseBar = exports.BackDropView = exports.StyledPressableBackDrop = void
7
7
 
8
8
  var _native = _interopRequireDefault(require("@emotion/native"));
9
9
 
10
+ var _reactCore = require("@tecsinapse/react-core");
11
+
10
12
  var _reactNative = require("react-native");
11
13
 
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -19,17 +21,18 @@ const StyledPressableBackDrop = _native.default.Pressable`
19
21
  `;
20
22
  exports.StyledPressableBackDrop = StyledPressableBackDrop;
21
23
  const BackDropView = (0, _native.default)(_reactNative.Animated.View)`
22
- height: 100%;
24
+ justify-content: flex-end;
25
+ flex: 1;
23
26
  `;
24
27
  exports.BackDropView = BackDropView;
25
28
  const CloseBar = _native.default.View`
26
29
  background-color: ${({
27
30
  theme
28
31
  }) => theme.color.secondary.light};
29
- border-radius: 10px;
30
- margin: 5px auto;
31
- width: 42px;
32
- height: 5px;
32
+ border-radius: ${(0, _reactCore.RFValueStr)('10px')};
33
+ margin: ${`${(0, _reactCore.RFValueStr)('5px')} auto`};
34
+ width: ${(0, _reactCore.RFValueStr)('42px')};
35
+ height: ${(0, _reactCore.RFValueStr)('5px')};
33
36
  `;
34
37
  exports.CloseBar = CloseBar;
35
38
  //# sourceMappingURL=styled.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/atoms/Modal/ui/styled.ts"],"names":["StyledPressableBackDrop","styled","Pressable","BackDropView","Animated","View","CloseBar","theme","color","secondary","light"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAEO,MAAMA,uBAAuB,GAAGC,gBAAOC,SAA+B;AAC7E;AACA;AACA;AACA;AACA,CALO;;AAOA,MAAMC,YAAY,GAAG,qBAAOC,sBAASC,IAAhB,CAA2C;AACvE;AACA,CAFO;;AAIA,MAAMC,QAAQ,GAAGL,gBAAOI,IAA0B;AACzD,wBAAwB,CAAC;AAAEE,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,KAAN,CAAYC,SAAZ,CAAsBC,KAAM;AACnE;AACA;AACA;AACA;AACA,CANO","sourcesContent":["import styled from \"@emotion/native\";\nimport { StyleProps } from \"@tecsinapse/react-core\";\nimport { Animated } from \"react-native\";\n\nexport const StyledPressableBackDrop = styled.Pressable<Partial<StyleProps>>`\n flex: 1;\n position: absolute;\n width: 100%;\n height: 100%;\n`\n\nexport const BackDropView = styled(Animated.View)<Partial<StyleProps>>`\n height: 100%;\n`\n\nexport const CloseBar = styled.View<Partial<StyleProps>>`\n background-color: ${({ theme }) => theme.color.secondary.light};\n border-radius: 10px;\n margin: 5px auto;\n width: 42px;\n height: 5px;\n`"],"file":"styled.js"}
1
+ {"version":3,"sources":["../../../../../src/components/atoms/Modal/ui/styled.ts"],"names":["StyledPressableBackDrop","styled","Pressable","BackDropView","Animated","View","CloseBar","theme","color","secondary","light"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAEO,MAAMA,uBAAuB,GAAGC,gBAAOC,SAA+B;AAC7E;AACA;AACA;AACA;AACA,CALO;;AAOA,MAAMC,YAAY,GAAG,qBAAOC,sBAASC,IAAhB,CAA2C;AACvE;AACA;AACA,CAHO;;AAKA,MAAMC,QAAQ,GAAGL,gBAAOI,IAA0B;AACzD,wBAAwB,CAAC;AAAEE,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,KAAN,CAAYC,SAAZ,CAAsBC,KAAM;AACnE,qBAAqB,2BAAW,MAAX,CAAmB;AACxC,cAAe,GAAE,2BAAW,KAAX,CAAkB,OAAO;AAC1C,aAAa,2BAAW,MAAX,CAAmB;AAChC,cAAc,2BAAW,KAAX,CAAkB;AAChC,CANO","sourcesContent":["import styled from \"@emotion/native\";\nimport { RFValueStr, StyleProps } from \"@tecsinapse/react-core\";\nimport { Animated } from \"react-native\";\n\nexport const StyledPressableBackDrop = styled.Pressable<Partial<StyleProps>>`\n flex: 1;\n position: absolute;\n width: 100%;\n height: 100%;\n`\n\nexport const BackDropView = styled(Animated.View)<Partial<StyleProps>>`\n justify-content: flex-end;\n flex: 1;\n`\n\nexport const CloseBar = styled.View<Partial<StyleProps>>`\n background-color: ${({ theme }) => theme.color.secondary.light};\n border-radius: ${RFValueStr('10px')};\n margin: ${`${RFValueStr('5px')} auto`};\n width: ${RFValueStr('42px')};\n height: ${RFValueStr('5px')};\n`"],"file":"styled.js"}
@@ -2,6 +2,8 @@
2
2
  export interface IBaseModal {
3
3
  visible?: boolean;
4
4
  BoxComponent?: React.FC<any>;
5
+ frozen?: boolean;
6
+ isLastShown?: boolean;
5
7
  close?: () => void;
6
8
  onClose?: () => void;
7
9
  }
@@ -56,7 +56,7 @@ const Header = (0, _native.default)(_reactNative.View)`
56
56
  padding: ${({
57
57
  theme
58
58
  }) => theme.spacing.deca};
59
- height: 75px;
59
+ height: ${(0, _reactCore.RFValueStr)('75px')};
60
60
  `;
61
61
  exports.Header = Header;
62
62
  const CloseButton = (0, _native.default)(_reactCore.Button)`
@@ -78,7 +78,7 @@ const SearchBar = (0, _native.default)(_Input.Input)`
78
78
  `;
79
79
  exports.SearchBar = SearchBar;
80
80
  const ListItem = (0, _native.default)(_reactCore.PressableSurface)`
81
- border-bottom-width: 1px;
81
+ border-bottom-width: ${(0, _reactCore.RFValueStr)('1px')};
82
82
  border-color: ${({
83
83
  theme
84
84
  }) => theme.color.secondary.light};
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/Select/styled.ts"],"names":["StyledModal","View","theme","miscellaneous","bodyColor","StyledSelectionText","Text","props","typography","h5","lineHeight","Dummy","StyledPressableSurface","PressableSurface","Header","spacing","deca","CloseButton","Button","SearchBarContainer","SearchBar","Input","ListItem","color","secondary","light","mili","ModalFooter","SelectIcon","Icon","centi","medium","FetchIndicator","ActivityIndicator"],"mappings":";;;;;;;AAAA;;AACA;;AAUA;;AACA;;AACA;;;;;;AAEO,MAAMA,WAAW,GAAG,qBAAOC,iBAAP,CAA+C;AAC1E;AACA,sBAAsB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,aAAN,CAAoBC,SAAU;AACnE;AACA;AACA,CALO;;AAOA,MAAMC,mBAAmB,GAAG,qBAAOC,UAAP,EAChCC,KAAD;AAAA;;AAAA,SAA+D,gBAAI;AACrE,mBADoE,gBACjDA,KAAK,CAACL,KAD2C,iDACjD,aAAaM,UAAb,CAAwBC,EAAxB,CAA2BC,UAAW;AACzD,MAAM,oCAAoBH,KAApB,CAA2B;AACjC,GAHE;AAAA,CADiC,CAA5B;;AAOA,MAAMI,KAAK,GAAG,qBAAOV,iBAAP,CAAa;AAClC;AACA;AACA,CAHO;;AAKA,MAAMW,sBAAsB,GAAG,qBACpCC,2BADoC,CAEb;AACzB;AACA,CAJO;;AAMA,MAAMC,MAAM,GAAG,qBAAOb,iBAAP,CAA8C;AACpE;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACa,OAAN,CAAcC,IAAK;AAC/C;AACA,CATO;;AAWA,MAAMC,WAAW,GAAG,qBAAOC,iBAAP,CAAkD;AAC7E;AACA;AACA,CAHO;;AAKA,MAAMC,kBAAkB,GAAG,qBAAOlB,iBAAP,CAA8C;AAChF,aAAa,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACa,OAAN,CAAcC,IAAK;AAC/C;AACA,CAHO;;AAKA,MAAMI,SAAS,GAAG,qBAAOC,YAAP,CAAsD;AAC/E,mBAAmB,CAAC;AAAEnB,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACa,OAAN,CAAcC,IAAK;AACrD,CAFO;;AAIA,MAAMM,QAAQ,GAAG,qBAAOT,2BAAP,CAEtB;AACF;AACA,kBAAkB,CAAC;AAAEX,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACqB,KAAN,CAAYC,SAAZ,CAAsBC,KAAM;AAC7D,sBAAsB,CAAC;AAAEvB,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACa,OAAN,CAAcW,IAAK;AACxD,wBAAwB,CAAC;AAAExB,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACa,OAAN,CAAcC,IAAK;AAC1D,CAPO;;AASA,MAAMW,WAAW,GAAG,qBAAO1B,iBAAP,CAAkC;AAC7D;AACA;AACA;AACA,sBAAsB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,aAAN,CAAoBC,SAAU;AACnE,aAAa,CAAC;AAAEF,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACa,OAAN,CAAcC,IAAK;AAC/C,CANO;;AAQA,MAAMY,UAAU,GAAG,qBAAOC,eAAP,CAAkC;AAC5D,aAAa,CAAC;AAAE3B,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACa,OAAN,CAAce,KAAM;AAChD,WAAW,CAAC;AAAE5B,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACqB,KAAN,CAAYC,SAAZ,CAAsBO,MAAO;AACvD,CAHO;;AAKA,MAAMC,cAAc,GAAG,qBAAOC,8BAAP,CAA0B;AACxD;AACA,CAFO","sourcesContent":["import styled, { css } from '@emotion/native';\nimport {\n Button,\n ButtonProps,\n disabledInputStyles,\n Icon,\n InputContainerProps,\n PressableSurface,\n PressableSurfaceProps,\n StyleProps,\n} from '@tecsinapse/react-core';\nimport { ActivityIndicator, ModalProps, View, ViewProps } from 'react-native';\nimport { Input, InputNativeProps } from '../Input';\nimport { Text } from '../Text';\n\nexport const StyledModal = styled(View)<ModalProps & Partial<StyleProps>>`\n position: relative;\n background-color: ${({ theme }) => theme.miscellaneous.bodyColor};\n height: 100%;\n width: 100%;\n`;\n\nexport const StyledSelectionText = styled(Text)(\n (props: Partial<InputContainerProps> & Partial<StyleProps>) => css`\n line-height: ${props.theme?.typography.h5.lineHeight};\n ${disabledInputStyles(props)};\n `\n);\n\nexport const Dummy = styled(View)`\n aspect-ratio: 1;\n height: 100%;\n`;\n\nexport const StyledPressableSurface = styled(\n PressableSurface\n)<PressableSurfaceProps>`\n width: 100%;\n`;\n\nexport const Header = styled(View)<ViewProps & Partial<StyleProps>>`\n position: relative;\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n padding: ${({ theme }) => theme.spacing.deca};\n height: 75px;\n`;\n\nexport const CloseButton = styled(Button)<ButtonProps & Partial<StyleProps>>`\n aspect-ratio: 1;\n height: 100%;\n`;\n\nexport const SearchBarContainer = styled(View)<ViewProps & Partial<StyleProps>>`\n padding: ${({ theme }) => theme.spacing.deca};\n position: relative;\n`;\n\nexport const SearchBar = styled(Input)<InputNativeProps & Partial<StyleProps>>`\n margin-bottom: ${({ theme }) => theme.spacing.deca};\n`;\n\nexport const ListItem = styled(PressableSurface)<\n PressableSurfaceProps & Partial<StyleProps>\n>`\n border-bottom-width: 1px;\n border-color: ${({ theme }) => theme.color.secondary.light};\n padding-vertical: ${({ theme }) => theme.spacing.mili};\n padding-horizontal: ${({ theme }) => theme.spacing.deca};\n`;\n\nexport const ModalFooter = styled(View)<Partial<StyleProps>>`\n width: 100%;\n height: auto;\n bottom: 0;\n background-color: ${({ theme }) => theme.miscellaneous.bodyColor};\n padding: ${({ theme }) => theme.spacing.deca};\n`;\n\nexport const SelectIcon = styled(Icon)<Partial<StyleProps>>`\n padding: ${({ theme }) => theme.spacing.centi};\n color: ${({ theme }) => theme.color.secondary.medium};\n`;\n\nexport const FetchIndicator = styled(ActivityIndicator)`\n align-self: center;\n`;\n"],"file":"styled.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/Select/styled.ts"],"names":["StyledModal","View","theme","miscellaneous","bodyColor","StyledSelectionText","Text","props","typography","h5","lineHeight","Dummy","StyledPressableSurface","PressableSurface","Header","spacing","deca","CloseButton","Button","SearchBarContainer","SearchBar","Input","ListItem","color","secondary","light","mili","ModalFooter","SelectIcon","Icon","centi","medium","FetchIndicator","ActivityIndicator"],"mappings":";;;;;;;AAAA;;AACA;;AAWA;;AACA;;AACA;;;;;;AAEO,MAAMA,WAAW,GAAG,qBAAOC,iBAAP,CAA+C;AAC1E;AACA,sBAAsB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,aAAN,CAAoBC,SAAU;AACnE;AACA;AACA,CALO;;AAOA,MAAMC,mBAAmB,GAAG,qBAAOC,UAAP,EAChCC,KAAD;AAAA;;AAAA,SAA+D,gBAAI;AACrE,mBADoE,gBACjDA,KAAK,CAACL,KAD2C,iDACjD,aAAaM,UAAb,CAAwBC,EAAxB,CAA2BC,UAAW;AACzD,MAAM,oCAAoBH,KAApB,CAA2B;AACjC,GAHE;AAAA,CADiC,CAA5B;;AAOA,MAAMI,KAAK,GAAG,qBAAOV,iBAAP,CAAa;AAClC;AACA;AACA,CAHO;;AAKA,MAAMW,sBAAsB,GAAG,qBACpCC,2BADoC,CAEb;AACzB;AACA,CAJO;;AAMA,MAAMC,MAAM,GAAG,qBAAOb,iBAAP,CAA8C;AACpE;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACa,OAAN,CAAcC,IAAK;AAC/C,YAAY,2BAAW,MAAX,CAAmB;AAC/B,CATO;;AAWA,MAAMC,WAAW,GA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cAAc,GAAG,qBAAOC,8BAAP,CAA0B;AACxD;AACA,CAFO","sourcesContent":["import styled, { css } from '@emotion/native';\nimport {\n Button,\n ButtonProps,\n disabledInputStyles,\n Icon,\n InputContainerProps,\n PressableSurface,\n PressableSurfaceProps,\n RFValueStr,\n StyleProps\n} from '@tecsinapse/react-core';\nimport { ActivityIndicator, ModalProps, View, ViewProps } from 'react-native';\nimport { Input, InputNativeProps } from '../Input';\nimport { Text } from '../Text';\n\nexport const StyledModal = styled(View)<ModalProps & Partial<StyleProps>>`\n position: relative;\n background-color: ${({ theme }) => theme.miscellaneous.bodyColor};\n height: 100%;\n width: 100%;\n`;\n\nexport const StyledSelectionText = styled(Text)(\n (props: Partial<InputContainerProps> & Partial<StyleProps>) => css`\n line-height: ${props.theme?.typography.h5.lineHeight};\n ${disabledInputStyles(props)};\n `\n);\n\nexport const Dummy = styled(View)`\n aspect-ratio: 1;\n height: 100%;\n`;\n\nexport const StyledPressableSurface = styled(\n PressableSurface\n)<PressableSurfaceProps>`\n width: 100%;\n`;\n\nexport const Header = styled(View)<ViewProps & Partial<StyleProps>>`\n position: relative;\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n padding: ${({ theme }) => theme.spacing.deca};\n height: ${RFValueStr('75px')};\n`;\n\nexport const CloseButton = styled(Button)<ButtonProps & Partial<StyleProps>>`\n aspect-ratio: 1;\n height: 100%;\n`;\n\nexport const SearchBarContainer = styled(View)<ViewProps & Partial<StyleProps>>`\n padding: ${({ theme }) => theme.spacing.deca};\n position: relative;\n`;\n\nexport const SearchBar = styled(Input)<InputNativeProps & Partial<StyleProps>>`\n margin-bottom: ${({ theme }) => theme.spacing.deca};\n`;\n\nexport const ListItem = styled(PressableSurface)<\n PressableSurfaceProps & Partial<StyleProps>\n>`\n border-bottom-width: ${RFValueStr('1px')};\n border-color: ${({ theme }) => theme.color.secondary.light};\n padding-vertical: ${({ theme }) => theme.spacing.mili};\n padding-horizontal: ${({ theme }) => theme.spacing.deca};\n`;\n\nexport const ModalFooter = styled(View)<Partial<StyleProps>>`\n width: 100%;\n height: auto;\n bottom: 0;\n background-color: ${({ theme }) => theme.miscellaneous.bodyColor};\n padding: ${({ theme }) => theme.spacing.deca};\n`;\n\nexport const SelectIcon = styled(Icon)<Partial<StyleProps>>`\n padding: ${({ theme }) => theme.spacing.centi};\n color: ${({ theme }) => theme.color.secondary.medium};\n`;\n\nexport const FetchIndicator = styled(ActivityIndicator)`\n align-self: center;\n`;\n"],"file":"styled.js"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tecsinapse/react-native-kit",
3
3
  "description": "TecSinapse React Native components",
4
- "version": "1.12.6",
4
+ "version": "1.12.10",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "MIT",
@@ -13,7 +13,7 @@
13
13
  "dependencies": {
14
14
  "@emotion/native": "^11.0.0",
15
15
  "@emotion/react": "^11.4.1",
16
- "@tecsinapse/react-core": "^1.12.4"
16
+ "@tecsinapse/react-core": "^1.12.7"
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
@@ -34,5 +34,5 @@
34
34
  "devDependencies": {
35
35
  "@types/uuid": "^8.3.3"
36
36
  },
37
- "gitHead": "fb35cbf99e1f305a8588f9b9dbb5cfbec1f204e1"
37
+ "gitHead": "cdb61cb619e5098670792c47729e0aae373749fc"
38
38
  }
@@ -1,5 +1,5 @@
1
1
  import styled from '@emotion/native';
2
- import { StyleProps } from '@tecsinapse/react-core';
2
+ import { RFValueStr, StyleProps } from '@tecsinapse/react-core';
3
3
  import { PressableProps, ViewProps } from 'react-native';
4
4
 
5
5
  export const StyledView = styled.View<ViewProps & Partial<StyleProps>>`
@@ -16,7 +16,7 @@ export const TabContainer = styled.Pressable<
16
16
  flex: 1;
17
17
  margin-horizontal: ${({ theme }) => theme.spacing.mili};
18
18
  padding-top: ${({ theme }) => theme.spacing.deca};
19
- border-top-width: ${({ selected }) => (selected ? '2px' : 0)};
19
+ border-top-width: ${({ selected }) => (selected ? RFValueStr('2px') : 0)};
20
20
  border-color: ${({ theme }) => theme.color.primary.medium};
21
21
  align-items: center;
22
22
  justify-content: flex-end;
@@ -26,7 +26,7 @@ export const TabContent = styled.View<ViewProps & Partial<StyleProps>>`
26
26
  aspect-ratio: 1;
27
27
  justify-content: center;
28
28
  align-items: center;
29
- min-height: 48px;
29
+ min-height: ${RFValueStr('48px')};
30
30
  background-color: ${({ theme }) => theme.color.primary.xlight};
31
31
  border-radius: ${({ theme }) => theme.borderRadius['mili']};
32
32
  `;
@@ -2,13 +2,14 @@ import styled from '@emotion/native';
2
2
  import {
3
3
  InputContainer,
4
4
  InputElement,
5
- StyleProps,
5
+ RFValueStr,
6
+ StyleProps
6
7
  } from '@tecsinapse/react-core';
7
8
  import { Font, fontStyles } from '../Text/styled';
8
9
  import { InputNativeProps } from './Input';
9
10
 
10
11
  export const StyledInputContainer = styled(InputContainer)<Partial<StyleProps>>`
11
- min-height: 50px;
12
+ min-height: ${RFValueStr('50px')};
12
13
  `;
13
14
 
14
15
  const StyledNativeInputBase = styled(InputElement)<
@@ -40,12 +40,14 @@ export class ModalLifecycleHandler {
40
40
  const nodes = Array.from(this.nodeGroup.values())
41
41
  .filter(node => node.visible || !!node.lastVisualization)
42
42
  .sort((nodeA, nodeB) => (nodeA.lastVisualization?.getTime() || 0) - (nodeB.lastVisualization?.getTime() || 0))
43
- .map(node => {
43
+ .map((node, index, filteredNodes) => {
44
44
  let modalElement = node.modal()
45
45
  let { props } = modalElement
46
46
  return React.cloneElement(modalElement, {
47
+ ...props,
47
48
  key: node.id,
48
49
  visible: node.visible,
50
+ isLastShown: filteredNodes.length - 1 === index,
49
51
  close: () => this.close(node.id),
50
52
  onClose: () => {
51
53
  this.remove(node.id)
@@ -1,6 +1,6 @@
1
1
  import { BoxContent } from "@tecsinapse/react-core";
2
- import React, { FC, useCallback, useEffect, useRef } from "react";
3
- import { Animated, Easing, LayoutChangeEvent, Pressable } from "react-native";
2
+ import React, { FC, useCallback, useEffect, useRef, useState } from "react";
3
+ import { Animated, Easing, Keyboard, KeyboardAvoidingView, LayoutChangeEvent, Pressable } from "react-native";
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
5
  import { BackDropView, CloseBar, StyledPressableBackDrop } from "./styled";
6
6
  import { IBaseModal } from "./types";
@@ -10,20 +10,26 @@ const INTERPOLATION_STEPS = 10
10
10
  const INTERPOLATION_DURATION = 195 //ms
11
11
  const OPACITY_DURATION = 25 //ms
12
12
 
13
- export const ModalView: FC<IBaseModal> = ({
13
+ export const ModalView: FC<IBaseModal> = ({
14
14
  children,
15
15
  visible,
16
16
  BoxComponent = BoxContent,
17
+ frozen,
18
+ isLastShown,
17
19
  close,
18
20
  onClose
19
21
  }) => {
20
22
 
21
23
  const { bottom } = useSafeAreaInsets()
24
+ const [ ready, setReady ] = useState(false)
25
+ const [ keyboardOpened, setKeyboardOpened ] = useState(false)
26
+ const [ boxHeight, setBoxHeight ] = useState(0)
22
27
  const backgroundCarrier = useRef(new Animated.Value(0)).current
23
28
  const translationCarrier = useRef(new Animated.Value(0)).current
24
29
  const opacityCarrier = useRef(new Animated.Value(0)).current
30
+ const offset = isLastShown && keyboardOpened ? 0 : bottom
25
31
 
26
- const show = useCallback((to: number) => {
32
+ const show = useCallback(() => {
27
33
  Animated.sequence([
28
34
  Animated.timing(backgroundCarrier, {
29
35
  toValue: INTERPOLATION_STEPS,
@@ -37,7 +43,7 @@ export const ModalView: FC<IBaseModal> = ({
37
43
  useNativeDriver: true
38
44
  }),
39
45
  Animated.timing(translationCarrier, {
40
- toValue: to,
46
+ toValue: 0,
41
47
  duration: INTERPOLATION_DURATION,
42
48
  easing: Easing.out(Easing.circle),
43
49
  useNativeDriver: true
@@ -45,25 +51,27 @@ export const ModalView: FC<IBaseModal> = ({
45
51
  ]).start()
46
52
  }, [])
47
53
 
48
- const hide = useCallback(() => {
54
+ const hide = useCallback((to: number) => {
49
55
  Animated.sequence([
50
- Animated.timing(translationCarrier, {
51
- toValue: 0,
52
- duration: INTERPOLATION_DURATION,
53
- easing: Easing.out(Easing.circle),
54
- useNativeDriver: true
55
- }),
56
+ Animated.parallel([
57
+ Animated.timing(translationCarrier, {
58
+ toValue: to,
59
+ duration: INTERPOLATION_DURATION,
60
+ easing: Easing.out(Easing.circle),
61
+ useNativeDriver: true
62
+ }),
63
+ Animated.timing(opacityCarrier, {
64
+ toValue: 0,
65
+ duration: INTERPOLATION_DURATION,
66
+ useNativeDriver: true
67
+ })
68
+ ]),
56
69
  Animated.timing(backgroundCarrier, {
57
70
  toValue: 0,
58
71
  duration: INTERPOLATION_DURATION,
59
72
  easing: Easing.out(Easing.circle),
60
73
  useNativeDriver: false
61
74
  }),
62
- Animated.timing(opacityCarrier, {
63
- toValue: 0,
64
- duration: OPACITY_DURATION,
65
- useNativeDriver: true
66
- }),
67
75
  ]).start(onClose)
68
76
  }, [onClose])
69
77
 
@@ -73,27 +81,47 @@ export const ModalView: FC<IBaseModal> = ({
73
81
  })
74
82
 
75
83
  const handleBoxLayoutChanges = useCallback((lce: LayoutChangeEvent) => {
76
- let boxHeight = lce.nativeEvent.layout.height
77
- boxHeight > 0 && requestAnimationFrame(() => show(-boxHeight))
78
- }, [show])
84
+ let boxHeightEvent = lce.nativeEvent.layout.height
85
+ setBoxHeight(boxHeightEvent)
86
+
87
+ if (visible && !ready) {
88
+ translationCarrier.setValue(boxHeightEvent)
89
+ setReady(true)
90
+ }
91
+ }, [show, ready, visible, setReady])
79
92
 
80
93
  useEffect(() => {
81
- if (!visible) {
82
- hide()
94
+ if (visible && ready) requestAnimationFrame(() => show())
95
+ if (!visible && !ready) {
96
+ Keyboard.dismiss()
97
+ requestAnimationFrame(() => hide(boxHeight))
83
98
  }
84
- }, [visible])
99
+ if (!visible && ready) setReady(false)
100
+ }, [ready, visible])
101
+
102
+ useEffect(() => {
103
+ const showEvent = Keyboard.addListener('keyboardDidShow', () => setKeyboardOpened(true))
104
+ const hideEvent = Keyboard.addListener('keyboardDidHide', () => setKeyboardOpened(false))
105
+ return () => {
106
+ showEvent.remove()
107
+ hideEvent.remove()
108
+ }
109
+ }, [])
85
110
 
86
111
  return (
87
- <StyledPressableBackDrop onPress={close}>
88
- <BackDropView style={{ backgroundColor: backgroundInterpolation }}/>
89
- <Animated.View style={{ opacity: opacityCarrier, transform: [{ translateY: translationCarrier }]}}>
90
- <Pressable>
91
- <BoxComponent onLayout={handleBoxLayoutChanges} style={{ paddingBottom: bottom }} variant="bottom">
92
- <CloseBar/>
93
- {children}
94
- </BoxComponent>
95
- </Pressable>
96
- </Animated.View>
112
+ <StyledPressableBackDrop onPress={!frozen ? close : undefined}>
113
+ <BackDropView style={{ backgroundColor: backgroundInterpolation }}>
114
+ <KeyboardAvoidingView enabled={isLastShown} behavior="padding">
115
+ <Animated.View style={{ opacity: opacityCarrier, transform: [{ translateY: translationCarrier }]}}>
116
+ <Pressable>
117
+ <BoxComponent onLayout={handleBoxLayoutChanges} style={{ paddingBottom: offset }} variant="bottom">
118
+ <CloseBar/>
119
+ {children}
120
+ </BoxComponent>
121
+ </Pressable>
122
+ </Animated.View>
123
+ </KeyboardAvoidingView>
124
+ </BackDropView>
97
125
  </StyledPressableBackDrop>
98
126
  )
99
127
  }
@@ -1,5 +1,5 @@
1
1
  import styled from "@emotion/native";
2
- import { StyleProps } from "@tecsinapse/react-core";
2
+ import { RFValueStr, StyleProps } from "@tecsinapse/react-core";
3
3
  import { Animated } from "react-native";
4
4
 
5
5
  export const StyledPressableBackDrop = styled.Pressable<Partial<StyleProps>>`
@@ -10,13 +10,14 @@ export const StyledPressableBackDrop = styled.Pressable<Partial<StyleProps>>`
10
10
  `
11
11
 
12
12
  export const BackDropView = styled(Animated.View)<Partial<StyleProps>>`
13
- height: 100%;
13
+ justify-content: flex-end;
14
+ flex: 1;
14
15
  `
15
16
 
16
17
  export const CloseBar = styled.View<Partial<StyleProps>>`
17
18
  background-color: ${({ theme }) => theme.color.secondary.light};
18
- border-radius: 10px;
19
- margin: 5px auto;
20
- width: 42px;
21
- height: 5px;
19
+ border-radius: ${RFValueStr('10px')};
20
+ margin: ${`${RFValueStr('5px')} auto`};
21
+ width: ${RFValueStr('42px')};
22
+ height: ${RFValueStr('5px')};
22
23
  `
@@ -5,6 +5,8 @@
5
5
  export interface IBaseModal {
6
6
  visible?: boolean
7
7
  BoxComponent?: React.FC<any>
8
+ frozen?: boolean
9
+ isLastShown?: boolean
8
10
  close?: () => void
9
11
  onClose?: () => void
10
12
  }
@@ -7,7 +7,8 @@ import {
7
7
  InputContainerProps,
8
8
  PressableSurface,
9
9
  PressableSurfaceProps,
10
- StyleProps,
10
+ RFValueStr,
11
+ StyleProps
11
12
  } from '@tecsinapse/react-core';
12
13
  import { ActivityIndicator, ModalProps, View, ViewProps } from 'react-native';
13
14
  import { Input, InputNativeProps } from '../Input';
@@ -46,7 +47,7 @@ export const Header = styled(View)<ViewProps & Partial<StyleProps>>`
46
47
  align-items: center;
47
48
  justify-content: space-between;
48
49
  padding: ${({ theme }) => theme.spacing.deca};
49
- height: 75px;
50
+ height: ${RFValueStr('75px')};
50
51
  `;
51
52
 
52
53
  export const CloseButton = styled(Button)<ButtonProps & Partial<StyleProps>>`
@@ -66,7 +67,7 @@ export const SearchBar = styled(Input)<InputNativeProps & Partial<StyleProps>>`
66
67
  export const ListItem = styled(PressableSurface)<
67
68
  PressableSurfaceProps & Partial<StyleProps>
68
69
  >`
69
- border-bottom-width: 1px;
70
+ border-bottom-width: ${RFValueStr('1px')};
70
71
  border-color: ${({ theme }) => theme.color.secondary.light};
71
72
  padding-vertical: ${({ theme }) => theme.spacing.mili};
72
73
  padding-horizontal: ${({ theme }) => theme.spacing.deca};