@codeleap/mobile 3.2.16 → 3.2.18

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/mobile",
3
- "version": "3.2.16",
3
+ "version": "3.2.18",
4
4
  "main": "src/index.ts",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -30,7 +30,10 @@ const _Text = forwardRef<NativeText, TextProps>((textProps, ref) => {
30
30
  ...textProps,
31
31
  }
32
32
 
33
- const pressPolyfillEnabled = Platform.OS === 'android' && !!onPress && !pressDisabled
33
+ const pressPolyfillEnabled = Platform.select({
34
+ ios: props.suppressHighlighting,
35
+ android: true,
36
+ }) && !!onPress && !pressDisabled
34
37
 
35
38
  const [pressed, setPressed] = useState(false)
36
39
  const pressedRef = React.useRef(false)
@@ -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
- let spacingFunction = horizontal ? 'marginHorizontal' : 'marginVertical'
70
-
71
- switch (idx) {
72
- case 0:
73
- spacingFunction = horizontal ? 'marginRight' : 'marginBottom'
74
- break
75
- case childArr.length - 1:
76
- spacingFunction = horizontal ? 'marginLeft' : 'marginTop'
77
- break
78
- default:
79
- break
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 Theme.spacing[spacingFunction](value / 2)
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: string
12
+ icon?: string
13
+ image?: ImageProps['source']
14
+ imageProps?: Omit<ImageProps, 'source'>
12
15
  }
13
16
 
14
17
  export type PermissionConfig = BasePermissionConfig &