@codeleap/mobile 2.2.10 → 2.3.0
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/utils/ModalManager/components.js +0 -7
- package/dist/utils/ModalManager/components.js.map +1 -1
- package/package.json +2 -1
- package/src/components/ActionIcon/index.tsx +0 -32
- package/src/components/ActionIcon/styles.ts +0 -97
- package/src/components/ActivityIndicator/index.tsx +0 -50
- package/src/components/ActivityIndicator/styles.ts +0 -68
- package/src/components/Animated.tsx +0 -34
- package/src/components/AutoComplete/index.tsx +0 -163
- package/src/components/AutoComplete/styles.ts +0 -44
- package/src/components/Backdrop/index.tsx +0 -48
- package/src/components/Backdrop/styles.ts +0 -33
- package/src/components/Button/index.tsx +0 -167
- package/src/components/Button/styles.ts +0 -129
- package/src/components/Calendar/index.tsx +0 -65
- package/src/components/Calendar/style.ts +0 -35
- package/src/components/Calendar/types.ts +0 -102
- package/src/components/Checkbox/index.tsx +0 -91
- package/src/components/Checkbox/styles.ts +0 -81
- package/src/components/ContentView/index.tsx +0 -63
- package/src/components/ContentView/styles.ts +0 -24
- package/src/components/Drawer/index.tsx +0 -33
- package/src/components/Drawer/styles.ts +0 -43
- package/src/components/EmptyPlaceholder/index.tsx +0 -88
- package/src/components/EmptyPlaceholder/styles.ts +0 -58
- package/src/components/FileInput/index.tsx +0 -181
- package/src/components/FileInput/styles.ts +0 -15
- package/src/components/Grid/index.tsx +0 -117
- package/src/components/Grid/styles.ts +0 -11
- package/src/components/Icon/index.tsx +0 -69
- package/src/components/Icon/styles.ts +0 -57
- package/src/components/Image/index.tsx +0 -91
- package/src/components/Image/styles.ts +0 -20
- package/src/components/ImageView/Spotlight.tsx +0 -157
- package/src/components/ImageView/component.tsx +0 -38
- package/src/components/ImageView/index.ts +0 -2
- package/src/components/InputLabel/index.tsx +0 -38
- package/src/components/InputLabel/styles.ts +0 -19
- package/src/components/List/PaginationIndicator.tsx +0 -71
- package/src/components/List/index.tsx +0 -114
- package/src/components/List/styles.ts +0 -19
- package/src/components/Modal/index.tsx +0 -218
- package/src/components/Modal/styles.ts +0 -153
- package/src/components/MultiSelect/index.tsx +0 -138
- package/src/components/MultiSelect/styles.ts +0 -18
- package/src/components/MultiSelect/types.ts +0 -42
- package/src/components/Navigation/Navigation.tsx +0 -54
- package/src/components/Navigation/constants.ts +0 -8
- package/src/components/Navigation/index.tsx +0 -3
- package/src/components/Navigation/types.ts +0 -35
- package/src/components/Navigation/utils.tsx +0 -57
- package/src/components/Pager/index.tsx +0 -121
- package/src/components/Pager/styles.ts +0 -81
- package/src/components/RadioInput/index.tsx +0 -106
- package/src/components/RadioInput/styles.ts +0 -67
- package/src/components/Scroll/index.tsx +0 -124
- package/src/components/Scroll/styles.ts +0 -18
- package/src/components/Sections/index.tsx +0 -91
- package/src/components/SegmentedControl/index.tsx +0 -204
- package/src/components/SegmentedControl/styles.ts +0 -89
- package/src/components/Select/index.tsx +0 -167
- package/src/components/Select/styles.ts +0 -62
- package/src/components/Select/types.ts +0 -43
- package/src/components/Slider/Mark.tsx +0 -46
- package/src/components/Slider/Thumb.tsx +0 -29
- package/src/components/Slider/index.tsx +0 -130
- package/src/components/Slider/styles.ts +0 -76
- package/src/components/Slider/types.ts +0 -30
- package/src/components/Switch/index.tsx +0 -91
- package/src/components/Switch/styles.ts +0 -38
- package/src/components/Text/index.tsx +0 -97
- package/src/components/Text/styles.ts +0 -50
- package/src/components/TextInput/index.tsx +0 -319
- package/src/components/TextInput/styles.ts +0 -127
- package/src/components/Touchable/index.tsx +0 -172
- package/src/components/Touchable/styles.ts +0 -28
- package/src/components/View/index.tsx +0 -103
- package/src/components/View/styles.ts +0 -24
- package/src/components/components.ts +0 -42
- package/src/components/defaultStyles.ts +0 -62
- package/src/components/legacy/Modal/index.tsx +0 -163
- package/src/components/legacy/Modal/styles.ts +0 -125
- package/src/components/legacy/Pager/index.tsx +0 -242
- package/src/components/legacy/Pager/styles.ts +0 -51
- package/src/components/legacy/index.ts +0 -2
- package/src/modules/documentPicker.ts +0 -7
- package/src/modules/fastImage.ts +0 -2
- package/src/modules/imageCropPicker.d.ts +0 -497
- package/src/modules/index.d.ts +0 -682
- package/src/modules/reactNavigation.ts +0 -15
- package/src/modules/textInputMask.ts +0 -11
- package/src/modules/types/documentPicker.d.ts +0 -215
- package/src/modules/types/fileTypes.ts +0 -138
- package/src/modules/types/textInputMask.ts +0 -9
- package/src/types/index.ts +0 -1
- package/src/types/utility.ts +0 -9
- package/src/utils/KeyboardAware/context.tsx +0 -75
- package/src/utils/KeyboardAware/index.ts +0 -17
- package/src/utils/KeyboardAware/keyboardHooks.ts +0 -124
- package/src/utils/KeyboardAware/lib/KeyboardAwareFlatList.ts +0 -4
- package/src/utils/KeyboardAware/lib/KeyboardAwareHOC.tsx +0 -618
- package/src/utils/KeyboardAware/lib/KeyboardAwareInterface.ts +0 -13
- package/src/utils/KeyboardAware/lib/KeyboardAwareScrollView.ts +0 -6
- package/src/utils/KeyboardAware/lib/KeyboardAwareSectionList.ts +0 -6
- package/src/utils/KeyboardAware/types.ts +0 -159
- package/src/utils/ModalManager/components.tsx +0 -119
- package/src/utils/ModalManager/context.tsx +0 -260
- package/src/utils/ModalManager/index.ts +0 -16
- package/src/utils/OSAlert.ts +0 -180
- package/src/utils/PermissionManager/context.tsx +0 -302
- package/src/utils/PermissionManager/index.ts +0 -20
- package/src/utils/PermissionManager/types.ts +0 -24
- package/src/utils/hooks.ts +0 -163
- package/src/utils/index.ts +0 -11
- package/src/utils/input.ts +0 -51
- package/src/utils/misc.ts +0 -83
- package/src/utils/notifications.ts +0 -206
- package/src/utils/theme.ts +0 -55
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import * as Animatable from 'react-native-animatable'
|
|
3
|
-
import { ComponentPropsWithoutRef, forwardRef } from 'react'
|
|
4
|
-
import {
|
|
5
|
-
ComponentVariants,
|
|
6
|
-
useDefaultComponentStyle,
|
|
7
|
-
ViewStyles,
|
|
8
|
-
BaseViewProps,
|
|
9
|
-
useCodeleapContext,
|
|
10
|
-
} from '@codeleap/common'
|
|
11
|
-
import { View as NativeView } from 'react-native'
|
|
12
|
-
import { MotiView, MotiProps } from 'moti'
|
|
13
|
-
import { GetKeyboardAwarePropsOptions, useKeyboardAwareView } from '../../utils'
|
|
14
|
-
|
|
15
|
-
export * from './styles'
|
|
16
|
-
|
|
17
|
-
export type ViewProps = ComponentPropsWithoutRef<typeof NativeView> &
|
|
18
|
-
ComponentVariants<typeof ViewStyles> & {
|
|
19
|
-
ref?: any
|
|
20
|
-
component?: any
|
|
21
|
-
animated?: boolean
|
|
22
|
-
keyboardAware?: GetKeyboardAwarePropsOptions
|
|
23
|
-
} & BaseViewProps
|
|
24
|
-
|
|
25
|
-
export const View: React.FC<ViewProps & Partial<MotiProps>> = forwardRef<NativeView, ViewProps & Partial<MotiProps>>((viewProps, ref) => {
|
|
26
|
-
const {
|
|
27
|
-
responsiveVariants = {},
|
|
28
|
-
variants = [],
|
|
29
|
-
children,
|
|
30
|
-
style,
|
|
31
|
-
keyboardAware,
|
|
32
|
-
component,
|
|
33
|
-
animated = false,
|
|
34
|
-
...props
|
|
35
|
-
} = viewProps
|
|
36
|
-
|
|
37
|
-
const variantStyles = useDefaultComponentStyle('View', {
|
|
38
|
-
responsiveVariants,
|
|
39
|
-
variants,
|
|
40
|
-
})
|
|
41
|
-
const Component = animated ? MotiView : (component || NativeView)
|
|
42
|
-
const keyboard = useKeyboardAwareView()
|
|
43
|
-
const _props = keyboard.getKeyboardAwareProps(
|
|
44
|
-
{
|
|
45
|
-
style: [variantStyles.wrapper, style], ref: ref, ...props,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
adapt: 'paddingBottom',
|
|
49
|
-
baseStyleProp: 'style',
|
|
50
|
-
|
|
51
|
-
enabled: false,
|
|
52
|
-
...keyboardAware,
|
|
53
|
-
},
|
|
54
|
-
)
|
|
55
|
-
return (
|
|
56
|
-
<Component {..._props}>
|
|
57
|
-
{children}
|
|
58
|
-
</Component>
|
|
59
|
-
)
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
export const AnimatedView = Animatable.createAnimatableComponent(
|
|
63
|
-
View,
|
|
64
|
-
) as unknown as React.ForwardRefExoticComponent<
|
|
65
|
-
{ transition?: any; animation?: any } & ViewProps
|
|
66
|
-
>
|
|
67
|
-
|
|
68
|
-
type GapProps = ViewProps & {
|
|
69
|
-
value: number
|
|
70
|
-
|
|
71
|
-
defaultProps?: any
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export const Gap:React.FC<GapProps> = ({ children, value, defaultProps = {}, ...props }) => {
|
|
75
|
-
const { Theme } = useCodeleapContext()
|
|
76
|
-
const horizontal = props.variants?.includes('row')
|
|
77
|
-
return (
|
|
78
|
-
<View {...props}>
|
|
79
|
-
{
|
|
80
|
-
React.Children.toArray(children).map((Element, idx, childArr) => {
|
|
81
|
-
if (React.isValidElement(Element)) {
|
|
82
|
-
const props = { ...Element.props, ...defaultProps }
|
|
83
|
-
|
|
84
|
-
let spacingFunction = horizontal ? 'marginHorizontal' : 'marginVertical'
|
|
85
|
-
switch (idx) {
|
|
86
|
-
case 0:
|
|
87
|
-
spacingFunction = horizontal ? 'marginRight' : 'marginBottom'
|
|
88
|
-
break
|
|
89
|
-
case childArr.length - 1:
|
|
90
|
-
spacingFunction = horizontal ? 'marginLeft' : 'marginTop'
|
|
91
|
-
break
|
|
92
|
-
default:
|
|
93
|
-
break
|
|
94
|
-
}
|
|
95
|
-
props.style = [props.style, Theme.spacing[spacingFunction](value / 2)]
|
|
96
|
-
return React.cloneElement(Element, props)
|
|
97
|
-
}
|
|
98
|
-
return Element
|
|
99
|
-
})
|
|
100
|
-
}
|
|
101
|
-
</View>
|
|
102
|
-
)
|
|
103
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
|
|
2
|
-
|
|
3
|
-
export type ViewComposition = 'wrapper'
|
|
4
|
-
|
|
5
|
-
const createViewStyle = createDefaultVariantFactory<ViewComposition>()
|
|
6
|
-
|
|
7
|
-
const presets = includePresets((styles) => createViewStyle(() => ({ wrapper: styles })),
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
export const ViewStyles = {
|
|
11
|
-
...presets,
|
|
12
|
-
default: createViewStyle((t) => ({
|
|
13
|
-
// wrapper: {
|
|
14
|
-
// display: 'flex',
|
|
15
|
-
// },
|
|
16
|
-
})),
|
|
17
|
-
separator: createViewStyle((t) => ({
|
|
18
|
-
wrapper: {
|
|
19
|
-
width: '100%',
|
|
20
|
-
height: t.values.pixel,
|
|
21
|
-
backgroundColor: t.colors.borders,
|
|
22
|
-
},
|
|
23
|
-
})),
|
|
24
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export * from './View'
|
|
2
|
-
export * from './Animated'
|
|
3
|
-
export * from './Icon'
|
|
4
|
-
export * from './Touchable'
|
|
5
|
-
export * from './Text'
|
|
6
|
-
export * from './Image'
|
|
7
|
-
export * from './Checkbox'
|
|
8
|
-
export * from './TextInput'
|
|
9
|
-
export * from './RadioInput'
|
|
10
|
-
export * from './Switch'
|
|
11
|
-
export * from './ContentView'
|
|
12
|
-
export * from './Sections'
|
|
13
|
-
export * from './Select'
|
|
14
|
-
export * from './FileInput'
|
|
15
|
-
export * from './Slider'
|
|
16
|
-
export * from './SegmentedControl'
|
|
17
|
-
export * from './Navigation'
|
|
18
|
-
export * from './Scroll'
|
|
19
|
-
export * from './List'
|
|
20
|
-
export * from './ActivityIndicator'
|
|
21
|
-
export * from './Button'
|
|
22
|
-
export * from './ContentView'
|
|
23
|
-
export * from './Modal'
|
|
24
|
-
export * from './Calendar'
|
|
25
|
-
export * from './ImageView'
|
|
26
|
-
export * from './Navigation'
|
|
27
|
-
export * from './Pager'
|
|
28
|
-
export * from './EmptyPlaceholder'
|
|
29
|
-
export * from './Backdrop'
|
|
30
|
-
export * from './Drawer'
|
|
31
|
-
export * from './MultiSelect'
|
|
32
|
-
export * from './AutoComplete'
|
|
33
|
-
export * from './Grid'
|
|
34
|
-
export * from './InputLabel'
|
|
35
|
-
export * from './ActionIcon'
|
|
36
|
-
|
|
37
|
-
import * as Legacy from './legacy'
|
|
38
|
-
export {
|
|
39
|
-
Legacy,
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export * from './defaultStyles'
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { ViewStyles } from './View'
|
|
2
|
-
import { IconStyles } from './Icon'
|
|
3
|
-
import { TouchableStyles } from './Touchable'
|
|
4
|
-
import { TextStyles } from './Text'
|
|
5
|
-
import { ImageStyles } from './Image'
|
|
6
|
-
import { CheckboxStyles } from './Checkbox'
|
|
7
|
-
import { TextInputStyles } from './TextInput'
|
|
8
|
-
import { RadioInputStyles } from './RadioInput'
|
|
9
|
-
import { SwitchStyles } from './Switch'
|
|
10
|
-
import { SelectStyles } from './Select'
|
|
11
|
-
import { FileInputStyles } from './FileInput'
|
|
12
|
-
import { SliderStyles } from './Slider'
|
|
13
|
-
import { SegmentedControlStyles } from './SegmentedControl'
|
|
14
|
-
import { ActivityIndicatorStyles } from './ActivityIndicator'
|
|
15
|
-
import { ButtonStyles } from './Button'
|
|
16
|
-
import { ContentViewStyles } from './ContentView'
|
|
17
|
-
import { ModalStyles } from './Modal'
|
|
18
|
-
import { EmptyPlaceholderStyles } from './EmptyPlaceholder'
|
|
19
|
-
import { BackdropStyles } from './Backdrop'
|
|
20
|
-
import { PagerStyles } from './Pager'
|
|
21
|
-
import { CalendarStyles } from './Calendar'
|
|
22
|
-
import { DrawerStyles } from './Drawer/styles'
|
|
23
|
-
import { ListStyles, PaginationIndicatorStyles } from './List'
|
|
24
|
-
import { AutoCompleteStyles } from './AutoComplete'
|
|
25
|
-
import { MultiSelectStyles } from './MultiSelect'
|
|
26
|
-
import { ScrollStyles } from './Scroll'
|
|
27
|
-
import { ActionIconStyles } from './ActionIcon'
|
|
28
|
-
import { GridStyles } from './Grid'
|
|
29
|
-
import { InputLabelStyles } from './InputLabel'
|
|
30
|
-
|
|
31
|
-
export const defaultStyles = {
|
|
32
|
-
View: ViewStyles,
|
|
33
|
-
Icon: IconStyles,
|
|
34
|
-
Touchable: TouchableStyles,
|
|
35
|
-
Text: TextStyles,
|
|
36
|
-
Image: ImageStyles,
|
|
37
|
-
Checkbox: CheckboxStyles,
|
|
38
|
-
TextInput: TextInputStyles,
|
|
39
|
-
RadioInput: RadioInputStyles,
|
|
40
|
-
Switch: SwitchStyles,
|
|
41
|
-
Select: SelectStyles,
|
|
42
|
-
FileInput: FileInputStyles,
|
|
43
|
-
List: ListStyles,
|
|
44
|
-
Slider: SliderStyles,
|
|
45
|
-
SegmentedControl: SegmentedControlStyles,
|
|
46
|
-
ActivityIndicator: ActivityIndicatorStyles,
|
|
47
|
-
Button: ButtonStyles,
|
|
48
|
-
ContentView: ContentViewStyles,
|
|
49
|
-
Modal: ModalStyles,
|
|
50
|
-
EmptyPlaceholder: EmptyPlaceholderStyles,
|
|
51
|
-
Backdrop: BackdropStyles,
|
|
52
|
-
Calendar: CalendarStyles,
|
|
53
|
-
Pager: PagerStyles,
|
|
54
|
-
Drawer: DrawerStyles,
|
|
55
|
-
AutoComplete: AutoCompleteStyles,
|
|
56
|
-
MultiSelect: MultiSelectStyles,
|
|
57
|
-
Scroll: ScrollStyles,
|
|
58
|
-
PaginationIndicator: PaginationIndicatorStyles,
|
|
59
|
-
ActionIcon: ActionIconStyles,
|
|
60
|
-
Grid: GridStyles,
|
|
61
|
-
InputLabel: InputLabelStyles,
|
|
62
|
-
}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import { View, ViewProps, AnimatedView } from '../../View'
|
|
3
|
-
import { Button, ButtonProps } from '../../Button'
|
|
4
|
-
import { Scroll } from '../../Scroll'
|
|
5
|
-
import {
|
|
6
|
-
capitalize,
|
|
7
|
-
ComponentVariants,
|
|
8
|
-
IconPlaceholder,
|
|
9
|
-
useDefaultComponentStyle,
|
|
10
|
-
} from '@codeleap/common'
|
|
11
|
-
import {
|
|
12
|
-
MobileModalComposition,
|
|
13
|
-
MobileModalStyles,
|
|
14
|
-
MobileModalParts,
|
|
15
|
-
} from './styles'
|
|
16
|
-
import { StyleSheet } from 'react-native'
|
|
17
|
-
import { StylesOf } from '../../../types/utility'
|
|
18
|
-
|
|
19
|
-
import { Touchable } from '../../Touchable'
|
|
20
|
-
import { Text } from '../../Text'
|
|
21
|
-
import { Animated } from '../../Animated'
|
|
22
|
-
import { GetKeyboardAwarePropsOptions } from '../../../utils'
|
|
23
|
-
|
|
24
|
-
export * from './styles'
|
|
25
|
-
|
|
26
|
-
export type ModalProps = Omit<ViewProps, 'variants' | 'styles'> & {
|
|
27
|
-
variants?: ComponentVariants<typeof MobileModalStyles>['variants']
|
|
28
|
-
styles?: StylesOf<MobileModalComposition>
|
|
29
|
-
dismissOnBackdrop?: boolean
|
|
30
|
-
buttonProps?: ButtonProps
|
|
31
|
-
accessible?: boolean
|
|
32
|
-
showClose?: boolean
|
|
33
|
-
closable?: boolean
|
|
34
|
-
footer?: React.ReactNode
|
|
35
|
-
title?: React.ReactNode
|
|
36
|
-
debugName?: string
|
|
37
|
-
closeIconName?: IconPlaceholder
|
|
38
|
-
visible: boolean
|
|
39
|
-
toggle?: () => void
|
|
40
|
-
zIndex?: number
|
|
41
|
-
scroll?: boolean
|
|
42
|
-
keyboardAware?: GetKeyboardAwarePropsOptions
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export const Modal: React.FC<ModalProps> = (modalProps) => {
|
|
46
|
-
const {
|
|
47
|
-
variants = [],
|
|
48
|
-
styles = {},
|
|
49
|
-
visible,
|
|
50
|
-
showClose,
|
|
51
|
-
closable = true,
|
|
52
|
-
title,
|
|
53
|
-
footer,
|
|
54
|
-
children,
|
|
55
|
-
toggle = () => null,
|
|
56
|
-
dismissOnBackdrop = true,
|
|
57
|
-
closeIconName = 'close',
|
|
58
|
-
debugName,
|
|
59
|
-
scroll = true,
|
|
60
|
-
keyboardAware,
|
|
61
|
-
zIndex = null,
|
|
62
|
-
...props
|
|
63
|
-
} = modalProps
|
|
64
|
-
|
|
65
|
-
const variantStyles = useDefaultComponentStyle('Modal', {
|
|
66
|
-
variants: variants as any,
|
|
67
|
-
transform: StyleSheet.flatten,
|
|
68
|
-
styles,
|
|
69
|
-
}) as ModalProps['styles']
|
|
70
|
-
|
|
71
|
-
function getStyles(key: MobileModalParts) {
|
|
72
|
-
const s = [
|
|
73
|
-
variantStyles[key],
|
|
74
|
-
styles[key],
|
|
75
|
-
visible ? variantStyles[key + ':visible'] : {},
|
|
76
|
-
visible ? styles[key + ':visible'] : {},
|
|
77
|
-
]
|
|
78
|
-
|
|
79
|
-
return s
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const buttonStyles = React.useMemo(() => {
|
|
83
|
-
const buttonEntries = {}
|
|
84
|
-
|
|
85
|
-
for (const [key, style] of Object.entries(variantStyles)) {
|
|
86
|
-
if (key.startsWith('closeButton')) {
|
|
87
|
-
buttonEntries[capitalize(key.replace('closeButton', ''), true)] = style
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return buttonEntries
|
|
91
|
-
}, [variantStyles])
|
|
92
|
-
|
|
93
|
-
const boxAnimation = {
|
|
94
|
-
hidden: {
|
|
95
|
-
...variantStyles['box:pose'],
|
|
96
|
-
...styles['box:pose'],
|
|
97
|
-
},
|
|
98
|
-
visible: {
|
|
99
|
-
...variantStyles['box:pose:visible'],
|
|
100
|
-
...styles['box:pose:visible'],
|
|
101
|
-
},
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const wrapperStyle = StyleSheet.flatten(getStyles('wrapper'))
|
|
105
|
-
return (
|
|
106
|
-
<View
|
|
107
|
-
style={[wrapperStyle, { zIndex: typeof zIndex === 'number' ? zIndex : wrapperStyle?.zIndex }]}
|
|
108
|
-
pointerEvents={visible ? 'auto' : 'none'}
|
|
109
|
-
>
|
|
110
|
-
<AnimatedView style={getStyles('overlay')} transition={'opacity'} />
|
|
111
|
-
<Scroll
|
|
112
|
-
style={getStyles('innerWrapper')}
|
|
113
|
-
contentContainerStyle={getStyles('innerWrapperScroll')}
|
|
114
|
-
scrollEnabled={scroll}
|
|
115
|
-
keyboardAware={keyboardAware}
|
|
116
|
-
>
|
|
117
|
-
{dismissOnBackdrop && (
|
|
118
|
-
<Touchable
|
|
119
|
-
debugName={`${debugName} modal backdrop`}
|
|
120
|
-
activeOpacity={1}
|
|
121
|
-
onPress={() => toggle()}
|
|
122
|
-
style={getStyles('touchableBackdrop')}
|
|
123
|
-
/>
|
|
124
|
-
)}
|
|
125
|
-
<Animated
|
|
126
|
-
component='View'
|
|
127
|
-
config={boxAnimation}
|
|
128
|
-
pose={visible ? 'visible' : 'hidden'}
|
|
129
|
-
style={getStyles('box')}
|
|
130
|
-
>
|
|
131
|
-
{(title || showClose) && (
|
|
132
|
-
<View style={getStyles('header')}>
|
|
133
|
-
{typeof title === 'string' ? (
|
|
134
|
-
<Text text={title} style={getStyles('title')} />
|
|
135
|
-
) : (
|
|
136
|
-
title
|
|
137
|
-
)}
|
|
138
|
-
|
|
139
|
-
{showClose && closable && (
|
|
140
|
-
<Button
|
|
141
|
-
debugName={`${debugName} modal close button`}
|
|
142
|
-
icon={closeIconName as IconPlaceholder}
|
|
143
|
-
variants={['icon']}
|
|
144
|
-
onPress={toggle}
|
|
145
|
-
styles={buttonStyles}
|
|
146
|
-
/>
|
|
147
|
-
)}
|
|
148
|
-
</View>
|
|
149
|
-
)}
|
|
150
|
-
|
|
151
|
-
<View style={getStyles('body')}>{children}</View>
|
|
152
|
-
{footer && (
|
|
153
|
-
<View style={getStyles('footer')}>
|
|
154
|
-
{typeof footer === 'string' ? <Text text={footer} /> : footer}
|
|
155
|
-
</View>
|
|
156
|
-
)}
|
|
157
|
-
</Animated>
|
|
158
|
-
</Scroll>
|
|
159
|
-
</View>
|
|
160
|
-
)
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export default Modal
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ButtonComposition,
|
|
3
|
-
createDefaultVariantFactory,
|
|
4
|
-
includePresets,
|
|
5
|
-
ModalStyles,
|
|
6
|
-
assignTextStyle,
|
|
7
|
-
} from '@codeleap/common'
|
|
8
|
-
|
|
9
|
-
export const modalTransition = {
|
|
10
|
-
duration: 150,
|
|
11
|
-
ease: 'easeOut',
|
|
12
|
-
useNativeDriver: false,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type MobileModalParts =
|
|
16
|
-
| 'wrapper'
|
|
17
|
-
| 'overlay'
|
|
18
|
-
| 'innerWrapper'
|
|
19
|
-
| 'innerWrapperScroll'
|
|
20
|
-
| 'box'
|
|
21
|
-
| 'footer'
|
|
22
|
-
| 'body'
|
|
23
|
-
| 'header'
|
|
24
|
-
| 'touchableBackdrop'
|
|
25
|
-
| 'box:pose'
|
|
26
|
-
| 'title'
|
|
27
|
-
| `closeButton${Capitalize<ButtonComposition>}`
|
|
28
|
-
|
|
29
|
-
export type MobileModalComposition =
|
|
30
|
-
| MobileModalParts
|
|
31
|
-
| `${MobileModalParts}:visible`
|
|
32
|
-
|
|
33
|
-
const createModalStyle = createDefaultVariantFactory<MobileModalComposition>()
|
|
34
|
-
|
|
35
|
-
const presets = includePresets((style) => createModalStyle(() => ({ body: style })))
|
|
36
|
-
|
|
37
|
-
const defaultModalStyles = ModalStyles
|
|
38
|
-
|
|
39
|
-
export const MobileModalStyles = {
|
|
40
|
-
...defaultModalStyles,
|
|
41
|
-
...presets,
|
|
42
|
-
default: createModalStyle((theme) => {
|
|
43
|
-
const fullSize = {
|
|
44
|
-
...theme.presets.whole,
|
|
45
|
-
position: 'absolute',
|
|
46
|
-
width: theme?.values?.width,
|
|
47
|
-
height: theme?.values?.height,
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
wrapper: {
|
|
52
|
-
zIndex: 1,
|
|
53
|
-
|
|
54
|
-
...fullSize,
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
overlay: {
|
|
58
|
-
opacity: 0,
|
|
59
|
-
|
|
60
|
-
backgroundColor: theme.colors.black,
|
|
61
|
-
...fullSize,
|
|
62
|
-
},
|
|
63
|
-
'overlay:visible': {
|
|
64
|
-
opacity: 0.5,
|
|
65
|
-
},
|
|
66
|
-
innerWrapper: {},
|
|
67
|
-
innerWrapperScroll: {
|
|
68
|
-
display: 'flex',
|
|
69
|
-
alignItems: 'center',
|
|
70
|
-
...theme.presets.justifyCenter,
|
|
71
|
-
minHeight: theme.values.window.height,
|
|
72
|
-
},
|
|
73
|
-
box: {
|
|
74
|
-
width: '80%',
|
|
75
|
-
backgroundColor: theme.colors.background,
|
|
76
|
-
borderRadius: theme.borderRadius.medium,
|
|
77
|
-
...theme.spacing.padding(2),
|
|
78
|
-
},
|
|
79
|
-
touchableBackdrop: {
|
|
80
|
-
...fullSize,
|
|
81
|
-
},
|
|
82
|
-
'box:pose': {
|
|
83
|
-
opacity: 0,
|
|
84
|
-
scale: 0.8,
|
|
85
|
-
transition: modalTransition,
|
|
86
|
-
},
|
|
87
|
-
'box:pose:visible': {
|
|
88
|
-
opacity: 1,
|
|
89
|
-
scale: 1,
|
|
90
|
-
transition: modalTransition,
|
|
91
|
-
},
|
|
92
|
-
header: {
|
|
93
|
-
flexDirection: 'row',
|
|
94
|
-
...theme.presets.justifySpaceBetween,
|
|
95
|
-
...theme.presets.alignCenter,
|
|
96
|
-
},
|
|
97
|
-
closeButtonWrapper: {
|
|
98
|
-
alignSelf: 'center',
|
|
99
|
-
...theme.spacing.marginLeft('auto'),
|
|
100
|
-
},
|
|
101
|
-
title: {
|
|
102
|
-
...theme.presets.textCenter,
|
|
103
|
-
...assignTextStyle('h3')(theme).text,
|
|
104
|
-
...theme.spacing.paddingBottom(1),
|
|
105
|
-
flex: 1,
|
|
106
|
-
},
|
|
107
|
-
}
|
|
108
|
-
}),
|
|
109
|
-
popup: createModalStyle(() => ({})),
|
|
110
|
-
fullscreen: createModalStyle((theme) => ({
|
|
111
|
-
overlay: {
|
|
112
|
-
backgroundColor: theme.colors.background,
|
|
113
|
-
},
|
|
114
|
-
'overlay:visible': {
|
|
115
|
-
opacity: 1,
|
|
116
|
-
},
|
|
117
|
-
box: {
|
|
118
|
-
flex: 1,
|
|
119
|
-
borderRadius: 0,
|
|
120
|
-
width: theme.values.width,
|
|
121
|
-
height: theme.values.window.height,
|
|
122
|
-
...theme.presets.center,
|
|
123
|
-
},
|
|
124
|
-
})),
|
|
125
|
-
}
|