@codeleap/mobile 5.0.9 → 5.0.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/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/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 +17 -15
- package/package.json.bak +4 -2
- 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/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
package/dist/utils/index.d.ts
CHANGED
|
@@ -2,8 +2,6 @@ export * from './OSAlert';
|
|
|
2
2
|
export * from './hooks';
|
|
3
3
|
export * from './misc';
|
|
4
4
|
export * from './NotificationManager';
|
|
5
|
-
export * from './ModalManager';
|
|
6
|
-
export * from './KeyboardAware';
|
|
7
5
|
export * from './input';
|
|
8
6
|
export * from './theme';
|
|
9
7
|
export * from './locale';
|
package/dist/utils/index.js
CHANGED
|
@@ -2,8 +2,6 @@ export * from './OSAlert';
|
|
|
2
2
|
export * from './hooks';
|
|
3
3
|
export * from './misc';
|
|
4
4
|
export * from './NotificationManager';
|
|
5
|
-
export * from './ModalManager';
|
|
6
|
-
export * from './KeyboardAware';
|
|
7
5
|
export * from './input';
|
|
8
6
|
export * from './theme';
|
|
9
7
|
export * from './locale';
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,uBAAuB,CAAA;AACrC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,uBAAuB,CAAA;AACrC,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/mobile",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.10",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -9,26 +9,28 @@
|
|
|
9
9
|
"directory": "packages/mobile"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@codeleap/types": "5.0.
|
|
13
|
-
"@codeleap/utils": "5.0.
|
|
14
|
-
"@codeleap/hooks": "5.0.
|
|
15
|
-
"@codeleap/form": "5.0.
|
|
16
|
-
"@codeleap/query": "5.0.
|
|
17
|
-
"@codeleap/logger": "5.0.
|
|
18
|
-
"@codeleap/config": "5.0.
|
|
12
|
+
"@codeleap/types": "5.0.10",
|
|
13
|
+
"@codeleap/utils": "5.0.10",
|
|
14
|
+
"@codeleap/hooks": "5.0.10",
|
|
15
|
+
"@codeleap/form": "5.0.10",
|
|
16
|
+
"@codeleap/query": "5.0.10",
|
|
17
|
+
"@codeleap/logger": "5.0.10",
|
|
18
|
+
"@codeleap/config": "5.0.10",
|
|
19
|
+
"@codeleap/modals": "5.0.10"
|
|
19
20
|
},
|
|
20
21
|
"scripts": {
|
|
21
22
|
"build": "tsc --build",
|
|
22
23
|
"lint": "eslint -c .eslintrc.js --fix \"./src/**/*.{ts,tsx,js,jsx}\""
|
|
23
24
|
},
|
|
24
25
|
"peerDependencies": {
|
|
25
|
-
"@codeleap/types": "5.0.
|
|
26
|
-
"@codeleap/utils": "5.0.
|
|
27
|
-
"@codeleap/hooks": "5.0.
|
|
28
|
-
"@codeleap/form": "5.0.
|
|
29
|
-
"@codeleap/query": "5.0.
|
|
30
|
-
"@codeleap/logger": "5.0.
|
|
31
|
-
"@codeleap/styles": "5.0.
|
|
26
|
+
"@codeleap/types": "5.0.10",
|
|
27
|
+
"@codeleap/utils": "5.0.10",
|
|
28
|
+
"@codeleap/hooks": "5.0.10",
|
|
29
|
+
"@codeleap/form": "5.0.10",
|
|
30
|
+
"@codeleap/query": "5.0.10",
|
|
31
|
+
"@codeleap/logger": "5.0.10",
|
|
32
|
+
"@codeleap/styles": "5.0.10",
|
|
33
|
+
"@codeleap/modals": "5.0.10",
|
|
32
34
|
"@d11/react-native-fast-image": "8.8.0",
|
|
33
35
|
"@react-native-firebase/messaging": "21.7.2",
|
|
34
36
|
"@react-navigation/bottom-tabs": "7.2.0",
|
package/package.json.bak
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/mobile",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.10",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"@codeleap/form": "workspace:*",
|
|
16
16
|
"@codeleap/query": "workspace:*",
|
|
17
17
|
"@codeleap/logger": "workspace:*",
|
|
18
|
-
"@codeleap/config": "workspace:*"
|
|
18
|
+
"@codeleap/config": "workspace:*",
|
|
19
|
+
"@codeleap/modals": "workspace:*"
|
|
19
20
|
},
|
|
20
21
|
"scripts": {
|
|
21
22
|
"build": "tsc --build",
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
"@codeleap/query": "workspace:*",
|
|
30
31
|
"@codeleap/logger": "workspace:*",
|
|
31
32
|
"@codeleap/styles": "workspace:*",
|
|
33
|
+
"@codeleap/modals": "workspace:*",
|
|
32
34
|
"@d11/react-native-fast-image": "8.8.0",
|
|
33
35
|
"@react-native-firebase/messaging": "21.7.2",
|
|
34
36
|
"@react-navigation/bottom-tabs": "7.2.0",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Option, Options, PropsOf } from '@codeleap/types'
|
|
2
|
-
import { StylesOf } from '../../types/utility'
|
|
3
|
-
import { GetKeyboardAwarePropsOptions } from '../../utils'
|
|
2
|
+
import { GetKeyboardAwarePropsOptions, StylesOf } from '../../types/utility'
|
|
4
3
|
import { Icon } from '../Icon'
|
|
5
4
|
import { FlatListProps } from '../List'
|
|
6
5
|
import { Text } from '../Text'
|
|
@@ -58,8 +58,8 @@ Backdrop.withVariantTypes = <S extends AnyRecord>(styles: S) => {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
Backdrop.defaultProps = {
|
|
61
|
-
entering: FadeIn.build(),
|
|
62
|
-
exiting: FadeOut.build(),
|
|
61
|
+
entering: FadeIn.duration(100).build(),
|
|
62
|
+
exiting: FadeOut.duration(100).delay(100).build(),
|
|
63
63
|
} as Partial<BackdropProps>
|
|
64
64
|
|
|
65
65
|
MobileStyleRegistry.registerComponent(Backdrop)
|
|
@@ -2,9 +2,8 @@ import React, { useMemo, useRef } from 'react'
|
|
|
2
2
|
import { TypeGuards } from '@codeleap/types'
|
|
3
3
|
import { useConditionalState } from '@codeleap/hooks'
|
|
4
4
|
import DatePicker from 'react-native-date-picker'
|
|
5
|
-
import Modal from '../Modal'
|
|
5
|
+
import { Modal } from '../Modal'
|
|
6
6
|
import { TextInput } from '../TextInput'
|
|
7
|
-
import { ModalManager } from '../../utils'
|
|
8
7
|
import { Button } from '../Button'
|
|
9
8
|
import { DatePickerModalProps } from './types'
|
|
10
9
|
import { AnyRecord, IJSX, StyledComponentProps, useCompositionStyles } from '@codeleap/styles'
|
|
@@ -128,7 +127,7 @@ export const DatePickerModal = (props: DatePickerModalProps) => {
|
|
|
128
127
|
onInputValueChange,
|
|
129
128
|
} = useInputBase(field, fields.date, { value, onValueChange })
|
|
130
129
|
|
|
131
|
-
const Wrapper = isCustomModal ?
|
|
130
|
+
const Wrapper = isCustomModal ? Modal : React.Fragment
|
|
132
131
|
|
|
133
132
|
const compositionStyles = useCompositionStyles(['input', 'doneButton', 'cancelButton', 'confirmButton'], styles)
|
|
134
133
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { Fragment } from 'react'
|
|
2
2
|
import { View } from '../View'
|
|
3
3
|
import { Scroll } from '../Scroll'
|
|
4
4
|
import { TypeGuards } from '@codeleap/types'
|
|
@@ -7,12 +7,12 @@ import { useBackButton } from '../../utils/hooks'
|
|
|
7
7
|
import { Text } from '../Text'
|
|
8
8
|
import { Touchable } from '../Touchable'
|
|
9
9
|
import { ActionIcon } from '../ActionIcon'
|
|
10
|
-
import { useState } from 'react'
|
|
11
10
|
import { ModalHeaderProps, ModalProps } from './types'
|
|
12
|
-
import { AnyRecord, AppIcon, useNestedStylesByKey, IJSX, StyledComponentProps
|
|
11
|
+
import { AnyRecord, AppIcon, useNestedStylesByKey, IJSX, StyledComponentProps } from '@codeleap/styles'
|
|
13
12
|
import { MobileStyleRegistry } from '../../Registry'
|
|
14
13
|
import { useStylesFor } from '../../hooks'
|
|
15
14
|
import { FadeIn, FadeOut } from 'react-native-reanimated'
|
|
15
|
+
import { Portal } from '@gorhom/portal'
|
|
16
16
|
|
|
17
17
|
export * from './styles'
|
|
18
18
|
export * from './types'
|
|
@@ -67,26 +67,22 @@ export const Modal = (modalProps: ModalProps) => {
|
|
|
67
67
|
children,
|
|
68
68
|
toggle = () => null,
|
|
69
69
|
dismissOnBackdrop,
|
|
70
|
-
header
|
|
70
|
+
header,
|
|
71
71
|
debugName,
|
|
72
72
|
scroll,
|
|
73
|
-
renderHeader,
|
|
74
|
-
zIndex = null,
|
|
73
|
+
renderHeader: Header,
|
|
75
74
|
scrollProps = {},
|
|
76
75
|
closeOnHardwareBackPress,
|
|
77
76
|
style,
|
|
78
77
|
boxExiting,
|
|
79
78
|
boxEntering,
|
|
79
|
+
withPortal,
|
|
80
80
|
...props
|
|
81
81
|
} = {
|
|
82
82
|
...Modal.defaultProps,
|
|
83
83
|
...modalProps,
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
const themeValues = useTheme(store => (store.current as AppTheme<Theme>)?.values)
|
|
87
|
-
|
|
88
|
-
const [modalHeight, setModalHeight] = useState(0)
|
|
89
|
-
|
|
90
86
|
const styles = useStylesFor(Modal.styleRegistryName, style)
|
|
91
87
|
|
|
92
88
|
const buttonStyles = useNestedStylesByKey('closeButton', styles)
|
|
@@ -94,17 +90,7 @@ export const Modal = (modalProps: ModalProps) => {
|
|
|
94
90
|
const ScrollComponent = scroll ? Scroll : View
|
|
95
91
|
const scrollStyle = scroll ? styles?.scroll : styles?.innerWrapper
|
|
96
92
|
|
|
97
|
-
const
|
|
98
|
-
const topSpacing = modalHeight > heightThreshold ? styles?.topSpacing : 0
|
|
99
|
-
|
|
100
|
-
const headerProps: ModalHeaderProps = {
|
|
101
|
-
...modalProps,
|
|
102
|
-
closable,
|
|
103
|
-
styles,
|
|
104
|
-
buttonStyles,
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const Header = renderHeader || DefaultHeader
|
|
93
|
+
const Wrapper = withPortal ? Portal : Fragment
|
|
108
94
|
|
|
109
95
|
useBackButton(() => {
|
|
110
96
|
if (visible && closeOnHardwareBackPress) {
|
|
@@ -113,82 +99,77 @@ export const Modal = (modalProps: ModalProps) => {
|
|
|
113
99
|
}
|
|
114
100
|
}, [visible, toggle, closeOnHardwareBackPress])
|
|
115
101
|
|
|
116
|
-
const onModalLayout = (event) => {
|
|
117
|
-
const { height } = event.nativeEvent.layout
|
|
118
|
-
setModalHeight(height)
|
|
119
|
-
props?.onLayout?.(event)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
102
|
return (
|
|
123
|
-
<
|
|
124
|
-
style={
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
103
|
+
<Wrapper>
|
|
104
|
+
<View style={styles?.wrapper} pointerEvents={visible ? 'auto' : 'none'}>
|
|
105
|
+
<Backdrop
|
|
106
|
+
visible={visible}
|
|
107
|
+
debugName={`Modal ${debugName} backdrop`}
|
|
108
|
+
style={{
|
|
109
|
+
'wrapper:hidden': styles['backdrop:hidden'],
|
|
110
|
+
'wrapper:visible': styles['backdrop:visible'],
|
|
111
|
+
'wrapper': styles?.backdrop,
|
|
112
|
+
}}
|
|
113
|
+
wrapperProps={{
|
|
114
|
+
// @ts-expect-error
|
|
115
|
+
transition: styles['backdrop:transition'],
|
|
116
|
+
}}
|
|
117
|
+
/>
|
|
118
|
+
|
|
119
|
+
<ScrollComponent
|
|
120
|
+
contentContainerStyle={styles?.scrollContent}
|
|
121
|
+
showsVerticalScrollIndicator={false}
|
|
122
|
+
keyboardAware
|
|
123
|
+
animated
|
|
124
|
+
{...scrollProps}
|
|
125
|
+
style={scrollStyle}
|
|
126
|
+
>
|
|
127
|
+
{dismissOnBackdrop ? (
|
|
128
|
+
<Touchable
|
|
129
|
+
onPress={closable && visible ? toggle : (() => { })}
|
|
130
|
+
debounce={400}
|
|
131
|
+
debugName={'Modal backdrop touchable'}
|
|
132
|
+
style={styles?.backdropTouchable}
|
|
133
|
+
android_ripple={null}
|
|
134
|
+
noFeedback
|
|
135
|
+
/>) : null}
|
|
136
|
+
{
|
|
137
|
+
visible ? (
|
|
138
|
+
<View
|
|
139
|
+
animated
|
|
140
|
+
// @ts-ignore
|
|
141
|
+
entering={boxEntering}
|
|
142
|
+
exiting={boxExiting}
|
|
143
|
+
{...props}
|
|
144
|
+
style={styles?.box}
|
|
145
|
+
>
|
|
146
|
+
{header ? header : (
|
|
147
|
+
<Header
|
|
148
|
+
{...modalProps}
|
|
149
|
+
closable={closable}
|
|
150
|
+
styles={styles}
|
|
151
|
+
buttonStyles={buttonStyles}
|
|
152
|
+
/>
|
|
153
|
+
)}
|
|
154
|
+
|
|
155
|
+
<View style={styles?.body}>{children}</View>
|
|
156
|
+
|
|
157
|
+
{footer ? (
|
|
158
|
+
<View style={styles?.footer}>
|
|
159
|
+
{typeof footer === 'string' ? <Text text={footer} /> : footer}
|
|
160
|
+
</View>
|
|
161
|
+
) : null}
|
|
162
|
+
</View>
|
|
163
|
+
) : null
|
|
164
|
+
}
|
|
165
|
+
</ScrollComponent>
|
|
166
|
+
</View>
|
|
167
|
+
</Wrapper>
|
|
187
168
|
)
|
|
188
169
|
}
|
|
189
170
|
|
|
190
171
|
Modal.styleRegistryName = 'Modal'
|
|
191
|
-
Modal.elements = ['wrapper', 'box', 'backdrop', 'innerWrapper', 'scroll', 'body', 'footer', 'header', 'title', 'description', 'closeButton'
|
|
172
|
+
Modal.elements = ['wrapper', 'box', 'backdrop', 'innerWrapper', 'scroll', 'body', 'footer', 'header', 'title', 'description', 'closeButton']
|
|
192
173
|
Modal.rootElement = 'wrapper'
|
|
193
174
|
|
|
194
175
|
Modal.withVariantTypes = <S extends AnyRecord>(styles: S) => {
|
|
@@ -201,10 +182,10 @@ Modal.defaultProps = {
|
|
|
201
182
|
dismissOnBackdrop: true,
|
|
202
183
|
scroll: true,
|
|
203
184
|
closeOnHardwareBackPress: true,
|
|
204
|
-
boxEntering: FadeIn.duration(100).build(),
|
|
185
|
+
boxEntering: FadeIn.duration(100).delay(50).build(),
|
|
205
186
|
boxExiting: FadeOut.duration(100).build(),
|
|
187
|
+
withPortal: true,
|
|
188
|
+
renderHeader: DefaultHeader,
|
|
206
189
|
} as Partial<ModalProps>
|
|
207
190
|
|
|
208
|
-
MobileStyleRegistry.registerComponent(Modal)
|
|
209
|
-
|
|
210
|
-
export default Modal
|
|
191
|
+
MobileStyleRegistry.registerComponent(Modal)
|
|
@@ -20,7 +20,6 @@ export type ModalProps =
|
|
|
20
20
|
closeIconName?: AppIcon
|
|
21
21
|
visible?: boolean
|
|
22
22
|
toggle?: () => void
|
|
23
|
-
zIndex?: number
|
|
24
23
|
description?: React.ReactElement
|
|
25
24
|
scroll?: boolean
|
|
26
25
|
header?: React.ReactElement
|
|
@@ -30,7 +29,7 @@ export type ModalProps =
|
|
|
30
29
|
scrollProps?: PropsOf<typeof Scroll, 'ref'>
|
|
31
30
|
style?: StyledProp<ModalComposition>
|
|
32
31
|
id?: string
|
|
33
|
-
|
|
32
|
+
withPortal?: boolean
|
|
34
33
|
boxEntering?: ReanimatedEnteringAnimation
|
|
35
34
|
boxExiting?: ReanimatedExitingAnimation
|
|
36
35
|
}
|
|
@@ -11,10 +11,9 @@ import React, { useCallback, useMemo } from 'react'
|
|
|
11
11
|
import { List } from '../List'
|
|
12
12
|
import { TextInput } from '../TextInput'
|
|
13
13
|
import { SelectProps, ValueBoundSelectProps } from './types'
|
|
14
|
-
import { ModalManager } from '../../utils'
|
|
15
14
|
import { Button } from '../Button'
|
|
16
15
|
import { AnyRecord, AppIcon, IJSX, StyledComponentProps, useCompositionStyles } from '@codeleap/styles'
|
|
17
|
-
import Modal from '../Modal'
|
|
16
|
+
import { Modal } from '../Modal'
|
|
18
17
|
import { MobileStyleRegistry } from '../../Registry'
|
|
19
18
|
import { SearchInput } from '../SearchInput'
|
|
20
19
|
import { useStylesFor } from '../../hooks'
|
|
@@ -62,6 +61,7 @@ const OuterInput: ValueBoundSelectProps<any, boolean>['outerInputComponent'] = (
|
|
|
62
61
|
|
|
63
62
|
return <TextInput
|
|
64
63
|
value={TypeGuards.isString(currentValueLabel) ? currentValueLabel : null}
|
|
64
|
+
onValueChange={() => currentValueLabel}
|
|
65
65
|
rightIcon={clearIcon}
|
|
66
66
|
onPress={disabled ? null : () => toggle()}
|
|
67
67
|
disabled={disabled}
|
|
@@ -317,7 +317,7 @@ export const Select = <T extends string | number = string, Multi extends boolean
|
|
|
317
317
|
) : null
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
-
<
|
|
320
|
+
<Modal
|
|
321
321
|
title={label}
|
|
322
322
|
description={description}
|
|
323
323
|
{...modalProps}
|
|
@@ -343,7 +343,7 @@ export const Select = <T extends string | number = string, Multi extends boolean
|
|
|
343
343
|
loading,
|
|
344
344
|
}}
|
|
345
345
|
/>
|
|
346
|
-
</
|
|
346
|
+
</Modal>
|
|
347
347
|
</>
|
|
348
348
|
}
|
|
349
349
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Option, Options, PropsOf } from '@codeleap/types'
|
|
2
2
|
import { AppIcon, StyledProp } from '@codeleap/styles'
|
|
3
|
-
import { StylesOf } from '../../types/utility'
|
|
4
|
-
import { GetKeyboardAwarePropsOptions } from '../../utils'
|
|
3
|
+
import { GetKeyboardAwarePropsOptions, StylesOf } from '../../types/utility'
|
|
5
4
|
import { ActionIconProps } from '../ActionIcon'
|
|
6
5
|
import { Icon } from '../Icon'
|
|
7
6
|
import { FlatListProps } from '../List'
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { alert } from '@codeleap/modals'
|
|
2
2
|
import { useEffect, useMemo, useState } from '@codeleap/hooks'
|
|
3
3
|
import { FileInputImageSource, useFileInput } from '../FileInput'
|
|
4
4
|
import { SortablePhoto, SortablePhotosProps, WithId } from './types'
|
|
5
5
|
|
|
6
|
-
const SortableAlert = CreateOSAlert()
|
|
7
|
-
|
|
8
6
|
export const useSortablePhotos = <T extends SortablePhoto>(props: SortablePhotosProps<T>) => {
|
|
9
7
|
const {
|
|
10
8
|
onChangePhotos,
|
|
@@ -145,7 +143,7 @@ export const useSortablePhotos = <T extends SortablePhoto>(props: SortablePhotos
|
|
|
145
143
|
}
|
|
146
144
|
|
|
147
145
|
const handlePressPhoto = (photo: T, order: number) => {
|
|
148
|
-
|
|
146
|
+
alert.ask({
|
|
149
147
|
title: modalTitle,
|
|
150
148
|
body: modalBody,
|
|
151
149
|
options: [
|
|
@@ -153,9 +151,6 @@ export const useSortablePhotos = <T extends SortablePhoto>(props: SortablePhotos
|
|
|
153
151
|
{ text: modalCameraText, onPress: () => handleOpenPicker('camera', photo, order) },
|
|
154
152
|
!!photo?.filename && { text: modalDeleteText, onPress: () => handleDeletePhoto(photo, order) },
|
|
155
153
|
],
|
|
156
|
-
// @ts-expect-error
|
|
157
|
-
closable: true,
|
|
158
|
-
isRow: false,
|
|
159
154
|
})
|
|
160
155
|
|
|
161
156
|
onPressPhoto?.(data, photo, order)
|
package/src/deprecated/index.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * as Permissions from './permissions'
|
|
1
|
+
export * as Permissions from './permissions'
|
|
2
|
+
export * as Modals from './permissions'
|
|
@@ -2,7 +2,6 @@ import React from 'react'
|
|
|
2
2
|
import { AnyFunction, TypeGuards } from '@codeleap/types'
|
|
3
3
|
import { onUpdate, useState } from '@codeleap/hooks'
|
|
4
4
|
import { PortalProvider } from '@gorhom/portal'
|
|
5
|
-
import { KeyboardProvider } from '../KeyboardAware'
|
|
6
5
|
|
|
7
6
|
export type AppModalProps = {
|
|
8
7
|
visible: boolean
|
|
@@ -38,7 +37,7 @@ export function Provider({ children }) {
|
|
|
38
37
|
return !!modals[name]?.visible
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
const toggleModal:TModalContext['toggleModal'] = (name, set?: boolean, props?: any) => {
|
|
40
|
+
const toggleModal: TModalContext['toggleModal'] = (name, set?: boolean, props?: any) => {
|
|
42
41
|
const visible = isVisible(name)
|
|
43
42
|
|
|
44
43
|
const newVisible = typeof set === 'boolean' ? set : !visible
|
|
@@ -58,7 +57,7 @@ export function Provider({ children }) {
|
|
|
58
57
|
})
|
|
59
58
|
}
|
|
60
59
|
|
|
61
|
-
const setModal:TModalContext['setModal'] = (name, to) => {
|
|
60
|
+
const setModal: TModalContext['setModal'] = (name, to) => {
|
|
62
61
|
|
|
63
62
|
setModals((current) => ({
|
|
64
63
|
...current,
|
|
@@ -72,7 +71,7 @@ export function Provider({ children }) {
|
|
|
72
71
|
|
|
73
72
|
// const codeleapCtx = useCodeleapContext()
|
|
74
73
|
const defaultDuration = 300
|
|
75
|
-
const transition:TModalContext['transition'] = (from, to, options) => {
|
|
74
|
+
const transition: TModalContext['transition'] = (from, to, options) => {
|
|
76
75
|
return new Promise((resolve) => {
|
|
77
76
|
setTimeout(() => {
|
|
78
77
|
|
|
@@ -80,7 +79,7 @@ export function Provider({ children }) {
|
|
|
80
79
|
toggleModal(to, true, options?.props)
|
|
81
80
|
return
|
|
82
81
|
}
|
|
83
|
-
const _options:ModalTransitionOptions = {
|
|
82
|
+
const _options: ModalTransitionOptions = {
|
|
84
83
|
duration: defaultDuration,
|
|
85
84
|
...options,
|
|
86
85
|
}
|
|
@@ -137,7 +136,7 @@ export function Provider({ children }) {
|
|
|
137
136
|
setModals(newModals)
|
|
138
137
|
}
|
|
139
138
|
|
|
140
|
-
return
|
|
139
|
+
return (
|
|
141
140
|
<ModalContext.Provider value={{
|
|
142
141
|
state: modals,
|
|
143
142
|
toggleModal,
|
|
@@ -155,8 +154,7 @@ export function Provider({ children }) {
|
|
|
155
154
|
{children}
|
|
156
155
|
</PortalProvider>
|
|
157
156
|
</ModalContext.Provider>
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
)
|
|
160
158
|
}
|
|
161
159
|
|
|
162
160
|
export function useModalContext() {
|
|
@@ -175,9 +173,9 @@ export type UseModalSequenceOptions = {
|
|
|
175
173
|
|
|
176
174
|
export function useModalSequence(ids: string[], options?: UseModalSequenceOptions) {
|
|
177
175
|
|
|
178
|
-
const _options:UseModalSequenceOptions = {
|
|
176
|
+
const _options: UseModalSequenceOptions = {
|
|
179
177
|
closeLastOnFinish: true,
|
|
180
|
-
onFinish: () => {},
|
|
178
|
+
onFinish: () => { },
|
|
181
179
|
resetOnFinish: false,
|
|
182
180
|
waitForLastToCloseBeforeCallingFinish: true,
|
|
183
181
|
...options,
|
|
@@ -231,7 +229,7 @@ export function useModalSequence(ids: string[], options?: UseModalSequenceOption
|
|
|
231
229
|
}
|
|
232
230
|
|
|
233
231
|
function goto(idxOrId: string | number, props?: any) {
|
|
234
|
-
let newId:string = null
|
|
232
|
+
let newId: string = null
|
|
235
233
|
if (TypeGuards.isString(idxOrId)) {
|
|
236
234
|
newId = idxOrId
|
|
237
235
|
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { usePrevious, onMount, onUpdate } from '@codeleap/hooks'
|
|
3
3
|
import { PropsOf } from '@codeleap/types'
|
|
4
|
-
import { useModalContext } from './
|
|
4
|
+
import { useModalContext } from './Context'
|
|
5
5
|
import { Portal } from '@gorhom/portal'
|
|
6
6
|
import { Modal as _Modal } from '../../components/Modal'
|
|
7
7
|
|
|
8
8
|
type UseManagedModalArgs = {
|
|
9
9
|
id?: string
|
|
10
|
-
initialVisible
|
|
10
|
+
initialVisible?: boolean
|
|
11
11
|
parent?: string
|
|
12
12
|
visible?: boolean
|
|
13
13
|
toggle?: PropsOf<typeof _Modal>['toggle']
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
function useManagedModal(props:UseManagedModalArgs) {
|
|
16
|
+
function useManagedModal(props: UseManagedModalArgs) {
|
|
17
17
|
const {
|
|
18
18
|
initialVisible = false,
|
|
19
19
|
parent,
|
|
@@ -61,7 +61,7 @@ export type ManagedModalProps<T = PropsOf<typeof _Modal>> = Omit<T, 'visible' |
|
|
|
61
61
|
absolute?: boolean
|
|
62
62
|
|
|
63
63
|
}
|
|
64
|
-
export const Modal:React.FC<ManagedModalProps> = ({
|
|
64
|
+
export const Modal: React.FC<ManagedModalProps> = ({
|
|
65
65
|
children,
|
|
66
66
|
absolute = true,
|
|
67
67
|
...props
|
|
@@ -81,4 +81,4 @@ export const Modal:React.FC<ManagedModalProps> = ({
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
return content
|
|
84
|
-
}
|
|
84
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useModalContext, useModalSequence, Provider } from './
|
|
1
|
+
import { useModalContext, useModalSequence, Provider } from './Context'
|
|
2
2
|
import { Modal, ManagedModalProps } from './components'
|
|
3
3
|
|
|
4
4
|
export const ModalManager = {
|
|
@@ -10,4 +10,4 @@ export const ModalManager = {
|
|
|
10
10
|
|
|
11
11
|
export type {
|
|
12
12
|
ManagedModalProps,
|
|
13
|
-
}
|
|
13
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useContext, useState } from 'react'
|
|
2
|
-
import { useModalContext } from '../../utils/ModalManager/context'
|
|
3
2
|
import { onMount, onUpdate, useDebounce, usePrevious } from '@codeleap/hooks'
|
|
4
3
|
import { deepEqual } from '@codeleap/utils'
|
|
5
4
|
import { AppState, Linking } from 'react-native'
|
|
6
5
|
import { PermissionConfig, PermissionModalsConfig } from './types'
|
|
7
6
|
import { PermissionManager, PermissionTypes } from './package'
|
|
7
|
+
import { useModalContext } from '../modals/Context'
|
|
8
8
|
|
|
9
9
|
type TPermissionContext = {
|
|
10
10
|
state: Record<string, PermissionTypes.PermissionStatus>
|
package/src/index.ts
CHANGED
|
@@ -6,8 +6,7 @@ export * from './deprecated'
|
|
|
6
6
|
|
|
7
7
|
export { Linking } from 'react-native'
|
|
8
8
|
import uuid from 'react-native-uuid'
|
|
9
|
-
|
|
10
|
-
export { uuid, RNKeyboardAwareScrollView }
|
|
9
|
+
export { uuid }
|
|
11
10
|
export { MobileStyleRegistry } from './Registry'
|
|
12
11
|
|
|
13
12
|
import './modules/formConfig'
|
package/src/types/utility.ts
CHANGED
|
@@ -17,3 +17,11 @@ export type ChildrenProp = ReactNode | ReactNode[] | undefined
|
|
|
17
17
|
export type ReanimatedExitingAnimation = (values: ExitAnimationsValues) => LayoutAnimation
|
|
18
18
|
export type ReanimatedEnteringAnimation = (values: EntryAnimationsValues) => LayoutAnimation
|
|
19
19
|
|
|
20
|
+
export type GetKeyboardAwarePropsOptions = {
|
|
21
|
+
baseStyleProp?: 'style' | 'contentContainerStyle'
|
|
22
|
+
adapt?: 'height' | 'maxHeight' | 'paddingBottom' | 'marginBottom' | 'bottom'
|
|
23
|
+
enabled?: boolean
|
|
24
|
+
animated?: boolean
|
|
25
|
+
transition?: TransitionConfig
|
|
26
|
+
enableOnAndroid?: boolean
|
|
27
|
+
}
|