@codeleap/mobile 5.0.9 → 5.0.11

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 (79) hide show
  1. package/dist/components/Autocomplete/types.d.ts +1 -2
  2. package/dist/components/Backdrop/index.js +2 -2
  3. package/dist/components/Backdrop/index.js.map +1 -1
  4. package/dist/components/DatePickerModal/index.js +2 -3
  5. package/dist/components/DatePickerModal/index.js.map +1 -1
  6. package/dist/components/Modal/index.d.ts +0 -1
  7. package/dist/components/Modal/index.js +25 -41
  8. package/dist/components/Modal/index.js.map +1 -1
  9. package/dist/components/Modal/styles.d.ts +1 -1
  10. package/dist/components/Modal/types.d.ts +1 -2
  11. package/dist/components/Pager/PagerItem.d.ts +7 -0
  12. package/dist/components/Pager/PagerItem.js +12 -0
  13. package/dist/components/Pager/PagerItem.js.map +1 -0
  14. package/dist/components/Pager/index.js +34 -25
  15. package/dist/components/Pager/index.js.map +1 -1
  16. package/dist/components/Pager/types.d.ts +2 -3
  17. package/dist/components/Select/index.js +4 -5
  18. package/dist/components/Select/index.js.map +1 -1
  19. package/dist/components/Select/types.d.ts +1 -2
  20. package/dist/components/SortablePhotos/useSortablePhotos.js +2 -6
  21. package/dist/components/SortablePhotos/useSortablePhotos.js.map +1 -1
  22. package/dist/deprecated/index.d.ts +1 -0
  23. package/dist/deprecated/index.js +2 -0
  24. package/dist/deprecated/index.js.map +1 -1
  25. package/dist/{utils/ModalManager/context.js → deprecated/modals/Context.js} +3 -6
  26. package/dist/deprecated/modals/Context.js.map +1 -0
  27. package/dist/{utils/ModalManager → deprecated/modals}/components.js +1 -1
  28. package/dist/deprecated/modals/components.js.map +1 -0
  29. package/dist/{utils/ModalManager → deprecated/modals}/index.d.ts +1 -1
  30. package/dist/{utils/ModalManager → deprecated/modals}/index.js +1 -1
  31. package/dist/deprecated/modals/index.js.map +1 -0
  32. package/dist/deprecated/permissions/Context.js +1 -1
  33. package/dist/deprecated/permissions/Context.js.map +1 -1
  34. package/dist/index.d.ts +1 -2
  35. package/dist/index.js +1 -2
  36. package/dist/index.js.map +1 -1
  37. package/dist/types/utility.d.ts +8 -0
  38. package/dist/utils/index.d.ts +0 -2
  39. package/dist/utils/index.js +0 -2
  40. package/dist/utils/index.js.map +1 -1
  41. package/package.json +27 -25
  42. package/package.json.bak +14 -12
  43. package/src/components/Autocomplete/types.ts +1 -2
  44. package/src/components/Backdrop/index.tsx +2 -2
  45. package/src/components/DatePickerModal/index.tsx +2 -3
  46. package/src/components/Modal/index.tsx +77 -96
  47. package/src/components/Modal/styles.ts +0 -1
  48. package/src/components/Modal/types.ts +1 -2
  49. package/src/components/Pager/PagerItem.tsx +20 -0
  50. package/src/components/Pager/index.tsx +57 -32
  51. package/src/components/Pager/types.ts +2 -3
  52. package/src/components/Select/index.tsx +4 -4
  53. package/src/components/Select/types.ts +1 -2
  54. package/src/components/SortablePhotos/useSortablePhotos.ts +2 -7
  55. package/src/deprecated/index.ts +2 -1
  56. package/src/{utils/ModalManager/context.tsx → deprecated/modals/Context.tsx} +9 -11
  57. package/src/{utils/ModalManager → deprecated/modals}/components.tsx +5 -5
  58. package/src/{utils/ModalManager → deprecated/modals}/index.ts +2 -2
  59. package/src/deprecated/permissions/Context.tsx +1 -1
  60. package/src/index.ts +1 -2
  61. package/src/types/utility.ts +8 -0
  62. package/src/utils/index.ts +0 -2
  63. package/dist/utils/KeyboardAware/context.d.ts +0 -14
  64. package/dist/utils/KeyboardAware/context.js +0 -15
  65. package/dist/utils/KeyboardAware/context.js.map +0 -1
  66. package/dist/utils/KeyboardAware/index.d.ts +0 -2
  67. package/dist/utils/KeyboardAware/index.js +0 -3
  68. package/dist/utils/KeyboardAware/index.js.map +0 -1
  69. package/dist/utils/KeyboardAware/keyboardHooks.d.ts +0 -21
  70. package/dist/utils/KeyboardAware/keyboardHooks.js +0 -77
  71. package/dist/utils/KeyboardAware/keyboardHooks.js.map +0 -1
  72. package/dist/utils/ModalManager/components.js.map +0 -1
  73. package/dist/utils/ModalManager/context.js.map +0 -1
  74. package/dist/utils/ModalManager/index.js.map +0 -1
  75. package/src/utils/KeyboardAware/context.tsx +0 -21
  76. package/src/utils/KeyboardAware/index.ts +0 -4
  77. package/src/utils/KeyboardAware/keyboardHooks.ts +0 -110
  78. /package/dist/{utils/ModalManager/context.d.ts → deprecated/modals/Context.d.ts} +0 -0
  79. /package/dist/{utils/ModalManager → deprecated/modals}/components.d.ts +0 -0
@@ -1,21 +0,0 @@
1
- import React from 'react'
2
- import { useKeyboardController } from '../../hooks'
3
-
4
- type TKeyboardCtx = {
5
- isVisible: boolean
6
- height: number
7
- }
8
-
9
- /**
10
- *
11
- * @deprecated useKeyboard does not need to be wrapped in a provider
12
- */
13
- export const KeyboardProvider = ({ children }) => {
14
- return <>
15
- {children}
16
- </>
17
- }
18
-
19
- export const useKeyboard = (): TKeyboardCtx => {
20
- return useKeyboardController()
21
- }
@@ -1,4 +0,0 @@
1
-
2
- export * from './keyboardHooks'
3
- export * from './context'
4
-
@@ -1,110 +0,0 @@
1
- import { PropsOf, TypeGuards } from '@codeleap/types'
2
- import { ScrollView, Platform, StyleSheet, Dimensions, EasingFunction, Easing } from 'react-native'
3
- import { TransitionConfig } from '../../types'
4
- import { useKeyboard } from './context'
5
- type ScrollViewProps = Partial<
6
- Pick<
7
- PropsOf<typeof ScrollView>,
8
- 'horizontal' | 'contentContainerStyle' | 'style'
9
- >
10
- > & {
11
- transition?: TransitionConfig
12
- }
13
-
14
- export type GetKeyboardAwarePropsOptions = {
15
- baseStyleProp?: 'style' | 'contentContainerStyle'
16
- adapt?: 'height' | 'maxHeight' | 'paddingBottom' | 'marginBottom' | 'bottom'
17
- enabled?: boolean
18
- animated?: boolean
19
- transition?: TransitionConfig
20
- enableOnAndroid?: boolean
21
- }
22
- type UseKeyboardAwareViewParams = {
23
- debugName?: string
24
- styles?: any
25
- } & GetKeyboardAwarePropsOptions
26
-
27
- export const useKeyboardAwareView = (params?: UseKeyboardAwareViewParams) => {
28
- const keyboard = useKeyboard()
29
- const options = params || {}
30
-
31
- const _options:GetKeyboardAwarePropsOptions = {
32
- adapt: 'maxHeight',
33
- baseStyleProp: 'style',
34
- enabled: true,
35
- enableOnAndroid: false,
36
- animated: false,
37
- ...options,
38
- transition: {
39
- easing: Easing.linear,
40
- duration: 200,
41
- type: 'timing',
42
- },
43
- }
44
-
45
- if (!_options.enabled || (Platform.OS === 'android' && !_options.enableOnAndroid)) {
46
- return {
47
- keyboard,
48
- style: params?.styles,
49
- }
50
- }
51
-
52
- const baseStyle = StyleSheet.flatten(params.styles || {})
53
-
54
- let baseValue = baseStyle[_options.adapt] as number
55
-
56
- if (TypeGuards.isNil(baseValue)) {
57
- baseValue = 0
58
- }
59
-
60
- let valid = true
61
- const warnOnNotNumber = () => {
62
- if (!TypeGuards.isNil(baseValue) && !TypeGuards.isNumber(baseValue)) {
63
- valid = false
64
- const debugStr = params?.debugName ? 'at ' + params?.debugName + ' ' : ''
65
- console.log(debugStr)
66
- }
67
- }
68
-
69
- let newStyleProp = {
70
- ...baseStyle,
71
- }
72
-
73
- switch (_options.adapt) {
74
- case 'height':
75
- warnOnNotNumber()
76
- const baseHeight = baseValue || 0
77
- newStyleProp.height = baseHeight - keyboard.height
78
- break
79
- case 'maxHeight':
80
- warnOnNotNumber()
81
- const baseMaxHeight = baseValue || Dimensions.get('window').height
82
- newStyleProp.maxHeight = baseMaxHeight - keyboard.height
83
- break
84
- case 'paddingBottom':
85
- warnOnNotNumber()
86
- const basePaddingBottom = baseValue || 0
87
- newStyleProp.paddingBottom = basePaddingBottom + keyboard.height
88
- break
89
- case 'marginBottom':
90
- warnOnNotNumber()
91
- const baseMarginBottom = baseValue || 0
92
- newStyleProp.marginBottom = baseMarginBottom + keyboard.height
93
- break
94
- case 'bottom':
95
- warnOnNotNumber()
96
- const baseBottom = baseValue || 0
97
- newStyleProp.bottom = baseBottom + keyboard.height
98
- break
99
- }
100
-
101
- if (!valid) {
102
- newStyleProp = params.styles
103
- }
104
-
105
- return {
106
- keyboard,
107
- style: newStyleProp,
108
-
109
- }
110
- }