@codeleap/mobile 3.20.0 → 3.20.3

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.20.0",
3
+ "version": "3.20.3",
4
4
  "main": "src/index.ts",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -93,17 +93,16 @@ export const EmptyPlaceholder:React.FC<EmptyPlaceholderProps> = (props: EmptyPla
93
93
  if (icon) {
94
94
  _image = <Icon name={icon} style={componentStyles.icon}/>
95
95
  } else if (image) {
96
- _image = <Image source={image} style={[
97
- componentStyles.image,
98
-
99
- ]}/>
96
+ _image = <Image source={image} style={[componentStyles.image]}/>
100
97
  }
101
98
 
102
99
  return (
103
100
  <View style={componentStyles.wrapper}>
104
- <View style={componentStyles.imageWrapper}>
105
- {_image}
106
- </View>
101
+ {React.isValidElement(_image) ? (
102
+ <View style={componentStyles.imageWrapper}>
103
+ {_image}
104
+ </View>
105
+ ) : null}
107
106
 
108
107
  {React.isValidElement(emptyText) ? emptyText : <Text text={emptyText} style={componentStyles.title}/> }
109
108
  {React.isValidElement(description) ? description : <Text text={description} style={componentStyles.description}/> }
@@ -43,7 +43,7 @@ export type PagerProps = React.PropsWithChildren<{
43
43
  renderPageWrapper?: React.FC<PageProps>
44
44
  pageWrapperProps?: any
45
45
  width?: number
46
- onScroll?: (event: ScrollEvent, args: { isLeft: boolean; isRight: boolean; x: number }) => void
46
+ onScroll?: (event: ScrollEvent, args: { isLeft?: boolean; isRight?: boolean; x?: number }) => void
47
47
  /** If TRUE render page, nextPage and prevPage only */
48
48
  windowing?: boolean
49
49
  scrollRightEnabled?: boolean
@@ -157,10 +157,13 @@ export const Pager = (pagerProps: PagerProps) => {
157
157
  }, [childArr, page, setPage, waitEventDispatch.current])
158
158
 
159
159
  const handleScroll = (event: ScrollEvent) => {
160
- if (!scrollEnabled) return null
161
-
162
160
  const scrollX = event?.nativeEvent?.contentOffset?.x
163
161
 
162
+ if (!scrollEnabled) {
163
+ if (TypeGuards.isFunction(onScroll)) onScroll?.(event, { x: scrollX })
164
+ return null
165
+ }
166
+
164
167
  if (!_scrollEnabled) {
165
168
  setScrollPositionX(scrollX)
166
169
  return null
@@ -75,6 +75,7 @@ const _Touchable = forwardRef<
75
75
  analyticsName,
76
76
  analyticsData = {},
77
77
  dismissKeyboard,
78
+ disabled,
78
79
  ...props
79
80
  } = {
80
81
  ...defaultProps,
@@ -142,7 +143,7 @@ const _Touchable = forwardRef<
142
143
 
143
144
  }
144
145
 
145
- const _styles = StyleSheet.flatten([variantStyles.wrapper, style])
146
+ const _styles = StyleSheet.flatten([variantStyles.wrapper, disabled && variantStyles['wrapper:disabled'], style])
146
147
 
147
148
  const disableFeedback = !onPress || noFeedback
148
149
 
@@ -2,7 +2,7 @@ import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
2
  import { StylesOf } from '../../types'
3
3
  import { TouchableFeedbackConfig } from '../../utils'
4
4
 
5
- export type TouchableComposition = 'wrapper' | 'feedback' | 'pressable'
5
+ export type TouchableComposition = 'wrapper' | 'wrapper:disabled' | 'feedback' | 'pressable'
6
6
 
7
7
  export type TouchableStylesGen<TCSS = any> = StylesOf<Exclude<TouchableComposition, 'feedback'>> & {
8
8
  feedback?: TouchableFeedbackConfig