@codeleap/mobile 3.5.0 → 3.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/mobile",
3
- "version": "3.5.0",
3
+ "version": "3.6.0",
4
4
  "main": "src/index.ts",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -30,6 +30,7 @@ export type IconProps = {
30
30
  wrapperProps?: Partial<PropsOf<typeof View>>
31
31
  size?: number
32
32
  styles?: StylesOf<IconComposition>
33
+ source?: string
33
34
  } & BadgeComponentProps
34
35
 
35
36
  export const IconComponent = (props: IconProps) => {
@@ -41,6 +42,7 @@ export const IconComponent = (props: IconProps) => {
41
42
  badgeProps = {},
42
43
  wrapperProps = {},
43
44
  styles = {},
45
+ source,
44
46
  ...otherProps
45
47
  } = props
46
48
 
@@ -55,17 +57,32 @@ export const IconComponent = (props: IconProps) => {
55
57
  },
56
58
  rootElement: 'icon',
57
59
  })
58
- const Component = Theme?.icons?.[name]
60
+ const Component = Theme?.icons?.[name] || (source && Theme.icons.RenderSource)
61
+
59
62
  onUpdate(() => {
60
63
  if (!Component && !!name) {
61
64
  logger.warn(
62
65
  `Icon: No icon found in theme for name "${name}".`,
63
- { props: { style, name, variants, variantStyles }},
66
+ { props: { style, name, variants, variantStyles } },
64
67
  'Component',
65
68
  )
69
+ } else if (!Component && !!source) {
70
+ logger.warn('Icon: Cannot render source, no RenderSource component in Theme.icons', {
71
+ source,
72
+ props: { style, name, variants, variantStyles },
73
+ Component,
74
+ }, 'Component')
66
75
  }
67
76
  }, [name])
68
77
 
78
+ if (!name && !source) {
79
+ return null
80
+ }
81
+
82
+ if (!Component) {
83
+ return null
84
+ }
85
+
69
86
  if (badge || TypeGuards.isNumber(badge)) {
70
87
  const badgeStyles = getNestedStylesByKey('badge', variantStyles)
71
88
 
@@ -80,20 +97,12 @@ export const IconComponent = (props: IconProps) => {
80
97
  ]
81
98
 
82
99
  return <View {...wrapperProps} style={wrapperStyle}>
83
- <Component {...otherProps} style={variantStyles.icon} />
100
+ <Component {...otherProps} style={variantStyles.icon} source={source} />
84
101
  <Badge styles={badgeStyles} badge={badge} {...badgeProps} />
85
102
  </View>
86
103
  }
87
104
 
88
- if (!name) {
89
- return null
90
- }
91
-
92
- if (!Component) {
93
-
94
- return null
95
- }
96
- return <Component {...otherProps} style={variantStyles.icon} />
105
+ return <Component {...otherProps} style={variantStyles.icon} source={source} />
97
106
  }
98
107
 
99
108
  function areEqual(prevProps, nextProps) {
@@ -199,8 +199,7 @@ export const Modal = (modalProps:ModalProps) => {
199
199
  showsVerticalScrollIndicator={false}
200
200
  keyboardAware
201
201
  animated
202
- // @ts-ignore
203
- ref={scrollRef}
202
+
204
203
  { ...scrollProps}
205
204
  >
206
205
  {dismissOnBackdrop &&