@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.
- package/dist/components/Autocomplete/types.d.ts +1 -2
- package/dist/components/Backdrop/index.js +2 -2
- package/dist/components/Backdrop/index.js.map +1 -1
- package/dist/components/DatePickerModal/index.js +2 -3
- package/dist/components/DatePickerModal/index.js.map +1 -1
- package/dist/components/Modal/index.d.ts +0 -1
- package/dist/components/Modal/index.js +25 -41
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/styles.d.ts +1 -1
- package/dist/components/Modal/types.d.ts +1 -2
- package/dist/components/Pager/PagerItem.d.ts +7 -0
- package/dist/components/Pager/PagerItem.js +12 -0
- package/dist/components/Pager/PagerItem.js.map +1 -0
- package/dist/components/Pager/index.js +34 -25
- package/dist/components/Pager/index.js.map +1 -1
- package/dist/components/Pager/types.d.ts +2 -3
- package/dist/components/Select/index.js +4 -5
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/types.d.ts +1 -2
- package/dist/components/SortablePhotos/useSortablePhotos.js +2 -6
- package/dist/components/SortablePhotos/useSortablePhotos.js.map +1 -1
- package/dist/deprecated/index.d.ts +1 -0
- package/dist/deprecated/index.js +2 -0
- package/dist/deprecated/index.js.map +1 -1
- package/dist/{utils/ModalManager/context.js → deprecated/modals/Context.js} +3 -6
- package/dist/deprecated/modals/Context.js.map +1 -0
- package/dist/{utils/ModalManager → deprecated/modals}/components.js +1 -1
- package/dist/deprecated/modals/components.js.map +1 -0
- package/dist/{utils/ModalManager → deprecated/modals}/index.d.ts +1 -1
- package/dist/{utils/ModalManager → deprecated/modals}/index.js +1 -1
- package/dist/deprecated/modals/index.js.map +1 -0
- package/dist/deprecated/permissions/Context.js +1 -1
- package/dist/deprecated/permissions/Context.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/types/utility.d.ts +8 -0
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +0 -2
- package/dist/utils/index.js.map +1 -1
- package/package.json +27 -25
- package/package.json.bak +14 -12
- package/src/components/Autocomplete/types.ts +1 -2
- package/src/components/Backdrop/index.tsx +2 -2
- package/src/components/DatePickerModal/index.tsx +2 -3
- package/src/components/Modal/index.tsx +77 -96
- package/src/components/Modal/styles.ts +0 -1
- package/src/components/Modal/types.ts +1 -2
- package/src/components/Pager/PagerItem.tsx +20 -0
- package/src/components/Pager/index.tsx +57 -32
- package/src/components/Pager/types.ts +2 -3
- package/src/components/Select/index.tsx +4 -4
- package/src/components/Select/types.ts +1 -2
- package/src/components/SortablePhotos/useSortablePhotos.ts +2 -7
- package/src/deprecated/index.ts +2 -1
- package/src/{utils/ModalManager/context.tsx → deprecated/modals/Context.tsx} +9 -11
- package/src/{utils/ModalManager → deprecated/modals}/components.tsx +5 -5
- package/src/{utils/ModalManager → deprecated/modals}/index.ts +2 -2
- package/src/deprecated/permissions/Context.tsx +1 -1
- package/src/index.ts +1 -2
- package/src/types/utility.ts +8 -0
- package/src/utils/index.ts +0 -2
- package/dist/utils/KeyboardAware/context.d.ts +0 -14
- package/dist/utils/KeyboardAware/context.js +0 -15
- package/dist/utils/KeyboardAware/context.js.map +0 -1
- package/dist/utils/KeyboardAware/index.d.ts +0 -2
- package/dist/utils/KeyboardAware/index.js +0 -3
- package/dist/utils/KeyboardAware/index.js.map +0 -1
- package/dist/utils/KeyboardAware/keyboardHooks.d.ts +0 -21
- package/dist/utils/KeyboardAware/keyboardHooks.js +0 -77
- package/dist/utils/KeyboardAware/keyboardHooks.js.map +0 -1
- package/dist/utils/ModalManager/components.js.map +0 -1
- package/dist/utils/ModalManager/context.js.map +0 -1
- package/dist/utils/ModalManager/index.js.map +0 -1
- package/src/utils/KeyboardAware/context.tsx +0 -21
- package/src/utils/KeyboardAware/index.ts +0 -4
- package/src/utils/KeyboardAware/keyboardHooks.ts +0 -110
- /package/dist/{utils/ModalManager/context.d.ts → deprecated/modals/Context.d.ts} +0 -0
- /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,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
|
-
}
|
|
File without changes
|
|
File without changes
|