@codeleap/mobile 3.2.15 → 3.2.17
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/package.json
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
import { Animated, Platform, StyleSheet, Text as NativeText, TextProps as RNTextProps } from 'react-native'
|
|
11
11
|
import { usePressableFeedback } from '../../utils'
|
|
12
12
|
import { TextPresets } from './styles'
|
|
13
|
+
import { ComponentWithDefaultProps } from '../../types'
|
|
13
14
|
|
|
14
15
|
export * from './styles'
|
|
15
16
|
|
|
@@ -24,9 +25,15 @@ export type TextProps = RNTextProps & {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
const _Text = forwardRef<NativeText, TextProps>((textProps, ref) => {
|
|
27
|
-
const { variants = [], text, children, onPress, style, debounce = 1000, pressDisabled, ...props } =
|
|
28
|
+
const { variants = [], text, children, onPress, style, debounce = 1000, pressDisabled, ...props } = {
|
|
29
|
+
...Text.defaultProps,
|
|
30
|
+
...textProps,
|
|
31
|
+
}
|
|
28
32
|
|
|
29
|
-
const pressPolyfillEnabled = Platform.
|
|
33
|
+
const pressPolyfillEnabled = Platform.select({
|
|
34
|
+
ios: props.suppressHighlighting,
|
|
35
|
+
android: true,
|
|
36
|
+
}) && !!onPress && !pressDisabled
|
|
30
37
|
|
|
31
38
|
const [pressed, setPressed] = useState(false)
|
|
32
39
|
const pressedRef = React.useRef(false)
|
|
@@ -96,7 +103,10 @@ const _Text = forwardRef<NativeText, TextProps>((textProps, ref) => {
|
|
|
96
103
|
|
|
97
104
|
})
|
|
98
105
|
|
|
99
|
-
export const Text = _Text as
|
|
106
|
+
export const Text = _Text as ComponentWithDefaultProps<TextProps & {ref?: React.MutableRefObject<NativeText> }>
|
|
107
|
+
|
|
108
|
+
Text.defaultProps = {
|
|
109
|
+
}
|
|
100
110
|
|
|
101
111
|
export const AnimatedText = Animated.createAnimatedComponent(Text)
|
|
102
112
|
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
useCodeleapContext,
|
|
8
8
|
useMemo,
|
|
9
9
|
AnyRef,
|
|
10
|
+
TypeGuards,
|
|
10
11
|
} from '@codeleap/common'
|
|
11
12
|
import { View as NativeView, ViewProps as RNViewProps } from 'react-native'
|
|
12
13
|
import { GetKeyboardAwarePropsOptions } from '../../utils'
|
|
@@ -55,31 +56,36 @@ export const View = forwardRef<NativeView, ViewProps>((viewProps, ref) => {
|
|
|
55
56
|
|
|
56
57
|
type GapProps = ViewProps & {
|
|
57
58
|
value: number
|
|
58
|
-
|
|
59
|
+
crossValue?: number
|
|
59
60
|
defaultProps?: any
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
export const Gap = ({ children, value, defaultProps = {}, ...props }: GapProps) => {
|
|
63
|
+
export const Gap = ({ children, value, defaultProps = {}, crossValue = null, ...props }: GapProps) => {
|
|
63
64
|
const { Theme } = useCodeleapContext()
|
|
64
65
|
const childArr = React.Children.toArray(children)
|
|
65
66
|
|
|
66
67
|
const horizontal = props.variants?.includes('row')
|
|
68
|
+
|
|
67
69
|
const spacings = useMemo(() => {
|
|
68
70
|
return childArr.map((_, idx) => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
|
|
72
|
+
const space = Theme.spacing.value(value)
|
|
73
|
+
const crossSpace = Theme.spacing.value(crossValue)
|
|
74
|
+
|
|
75
|
+
const isLast = idx === childArr.length - 1
|
|
76
|
+
|
|
77
|
+
const spacingProperty = horizontal ? 'marginRight' : 'marginBottom'
|
|
78
|
+
const crossSpacingProperty = horizontal ? 'marginBottom' : 'marginRight'
|
|
79
|
+
|
|
80
|
+
const style = isLast ? {} : {
|
|
81
|
+
[spacingProperty]: space,
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (!TypeGuards.isNil(crossValue) && !isLast) {
|
|
85
|
+
style[crossSpacingProperty] = crossSpace
|
|
80
86
|
}
|
|
81
87
|
|
|
82
|
-
return
|
|
88
|
+
return style
|
|
83
89
|
})
|
|
84
90
|
|
|
85
91
|
}, [childArr.length, horizontal])
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PermissionTypes } from '@codeleap/common'
|
|
2
|
+
import { ImageProps } from '../../components/Image'
|
|
2
3
|
type NonGrantedPermissionTypes = Exclude<PermissionTypes.PermissionStatus, 'granted'>
|
|
3
4
|
|
|
4
5
|
export type BasePermissionConfig = {
|
|
@@ -8,7 +9,9 @@ export type BasePermissionConfig = {
|
|
|
8
9
|
onAllow: 'openSettings' | 'ask'
|
|
9
10
|
|
|
10
11
|
description: string[]
|
|
11
|
-
icon
|
|
12
|
+
icon?: string
|
|
13
|
+
image?: ImageProps['source']
|
|
14
|
+
imageProps?: Omit<ImageProps, 'source'>
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
export type PermissionConfig = BasePermissionConfig &
|