react-native-ui-lib 7.39.0-snapshot.6564 → 7.39.0-snapshot.6571
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 +4 -2
- package/scripts/docs/buildDocsCommon.js +3 -87
- package/src/assets/internal/icons/index.js +12 -12
- package/src/assets/internal/icons/index.web.js +38 -0
- package/src/assets/internal/images/index.js +8 -8
- package/src/assets/internal/images/index.web.js +26 -0
- package/src/components/avatar/index.d.ts +4 -1
- package/src/components/avatar/index.js +4 -2
- package/src/components/hint/hint.api.json +39 -5
- package/src/components/icon/index.js +3 -13
- package/src/components/image/index.js +4 -11
- package/src/incubator/toast/toast.api.json +63 -7
- package/src/utils/imageUtils.d.ts +0 -1
- package/src/utils/imageUtils.js +0 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-ui-lib",
|
|
3
|
-
"version": "7.39.0-snapshot.
|
|
3
|
+
"version": "7.39.0-snapshot.6571",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"types": "src/index.d.ts",
|
|
6
6
|
"author": "Ethan Sharabi <ethan.shar@gmail.com>",
|
|
@@ -32,13 +32,15 @@
|
|
|
32
32
|
"pre-push": "npm run build:dev && npm run test",
|
|
33
33
|
"docs:deploy": "./scripts/docs/deployDocs.sh",
|
|
34
34
|
"docs:build": "node scripts/docs/buildDocs.js",
|
|
35
|
+
"docs:start": "(cd docuilib && yarn start)",
|
|
35
36
|
"calendar:createMocks": "node scripts/createCalendarMockData.js",
|
|
36
37
|
"snippets:build": "node scripts/generateSnippets.js",
|
|
37
38
|
"release": "node ./scripts/release/release.js",
|
|
38
39
|
"releaseDemo": "./scripts/release/releaseDemo.sh",
|
|
39
40
|
"releaseDocs": "./scripts/release/releaseDocs.sh",
|
|
40
41
|
"releaseEslint": "./scripts/release/releaseEslint.sh",
|
|
41
|
-
"releaseNative": "./scripts/release/releaseNative.sh"
|
|
42
|
+
"releaseNative": "./scripts/release/releaseNative.sh",
|
|
43
|
+
"update-web-assets": "node scripts/assets/extract-dimensions.js"
|
|
42
44
|
},
|
|
43
45
|
"dependencies": {
|
|
44
46
|
"babel-plugin-transform-inline-environment-variables": "^0.0.2",
|
|
@@ -88,13 +88,9 @@ function processComponents(components) {
|
|
|
88
88
|
content += `sidebar_label: ${componentName}\n`;
|
|
89
89
|
content += '---\n\n';
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
content += `<ComponentPage component={${componentObject}}/>\n`;
|
|
95
|
-
} else {
|
|
96
|
-
content += `${buildOldDocs(component)}\n`;
|
|
97
|
-
}
|
|
91
|
+
content += `import ComponentPage from '@site/src/components/ComponentPage';\n\n`;
|
|
92
|
+
const componentObject = JSON.stringify(component);
|
|
93
|
+
content += `<ComponentPage component={${componentObject}}/>\n`;
|
|
98
94
|
|
|
99
95
|
let dirPath;
|
|
100
96
|
switch (component.category) {
|
|
@@ -153,84 +149,4 @@ function logStatistics(components) {
|
|
|
153
149
|
}
|
|
154
150
|
}
|
|
155
151
|
|
|
156
|
-
function buildOldDocs(component) {
|
|
157
|
-
let content = '';
|
|
158
|
-
content += `import UILivePreview from '@site/src/components/UILivePreview';\n\n`;
|
|
159
|
-
|
|
160
|
-
/* General Info */
|
|
161
|
-
content += `${component.description} \n`;
|
|
162
|
-
if (typeof component.example === 'string') {
|
|
163
|
-
content += `[(code example)](${component.example})\n`;
|
|
164
|
-
} else if (Array.isArray(component.example)) {
|
|
165
|
-
content += '(code examples: ';
|
|
166
|
-
component.example.forEach((example, index) => {
|
|
167
|
-
const slashIndex = example.lastIndexOf('/');
|
|
168
|
-
const dotIndex = example.lastIndexOf('.');
|
|
169
|
-
content += `${index > 0 ? ', ' : ''}[${example.slice(slashIndex + 1, dotIndex)}](${example})`;
|
|
170
|
-
});
|
|
171
|
-
content += ')\n';
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if (component.extends) {
|
|
175
|
-
let extendsText = component.extends?.join(', ');
|
|
176
|
-
if (component.extendsLink) {
|
|
177
|
-
extendsText = `[${extendsText}](${component.extendsLink})`;
|
|
178
|
-
} else {
|
|
179
|
-
extendsText = _.map(component.extends, generateExtendsLink).join(', ');
|
|
180
|
-
}
|
|
181
|
-
content += ':::info\n';
|
|
182
|
-
content += `This component extends **${extendsText}** props.\n`;
|
|
183
|
-
content += ':::\n';
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if (component.modifiers) {
|
|
187
|
-
content += ':::tip\n';
|
|
188
|
-
content += `This component support **${component.modifiers?.join(', ')}** modifiers.\n`;
|
|
189
|
-
content += ':::\n';
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (component.caution) {
|
|
193
|
-
content += ':::caution\n';
|
|
194
|
-
content += `${component.caution}\n`;
|
|
195
|
-
content += ':::\n';
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
if (component.note) {
|
|
199
|
-
content += ':::note\n';
|
|
200
|
-
content += `${component.note}\n`;
|
|
201
|
-
content += ':::\n';
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/* Images */
|
|
205
|
-
content += `<div style={{display: 'flex', flexDirection: 'row', overflowX: 'auto', maxHeight: '500px', alignItems: 'center'}}>`;
|
|
206
|
-
component.images?.forEach(image => {
|
|
207
|
-
content += `<img style={{maxHeight: '420px'}} src={'${image}'}/>`;
|
|
208
|
-
content += '\n\n';
|
|
209
|
-
});
|
|
210
|
-
content += '</div>\n\n';
|
|
211
|
-
|
|
212
|
-
/* Snippet */
|
|
213
|
-
if (component.snippet) {
|
|
214
|
-
content += `### Usage\n`;
|
|
215
|
-
content += `<UILivePreview componentName={"${component.name}"} code={\`${component.snippet
|
|
216
|
-
?.map(item => _.replace(item, new RegExp(/\$[1-9]/, 'g'), ''))
|
|
217
|
-
.join('\n')
|
|
218
|
-
.toString()}\`}/>\n\n`;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/* Props */
|
|
222
|
-
content += '## API\n';
|
|
223
|
-
_.sortBy(component.props, p => p.name)?.forEach(prop => {
|
|
224
|
-
content += `### ${prop.name}\n`;
|
|
225
|
-
if (prop.note) {
|
|
226
|
-
content += `#### ${prop.note}\n`;
|
|
227
|
-
}
|
|
228
|
-
content += `${prop.description}\n`;
|
|
229
|
-
// content += `<span style={{color: 'grey'}}>${_.escape(prop.type)}</span>\n\n`;
|
|
230
|
-
content += `\`${prop.type} \` \n\n`;
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
return content;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
152
|
module.exports = {buildDocs};
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
export const icons = {
|
|
2
2
|
get check() {
|
|
3
|
-
return
|
|
3
|
+
return require('./check.png');
|
|
4
4
|
},
|
|
5
5
|
get checkMarkSmall() {
|
|
6
|
-
return
|
|
6
|
+
return require('./checkMarkSmall.png');
|
|
7
7
|
},
|
|
8
8
|
get checkSmall() {
|
|
9
|
-
return
|
|
9
|
+
return require('./checkSmall.png');
|
|
10
10
|
},
|
|
11
11
|
get chevronDown() {
|
|
12
|
-
return
|
|
12
|
+
return require('./chevronDown.png');
|
|
13
13
|
},
|
|
14
14
|
get exclamationSmall() {
|
|
15
|
-
return
|
|
15
|
+
return require('./exclamationSmall.png');
|
|
16
16
|
},
|
|
17
17
|
get minusSmall() {
|
|
18
|
-
return
|
|
18
|
+
return require('./minusSmall.png');
|
|
19
19
|
},
|
|
20
20
|
get plusSmall() {
|
|
21
|
-
return
|
|
21
|
+
return require('./plusSmall.png');
|
|
22
22
|
},
|
|
23
23
|
get search() {
|
|
24
|
-
return
|
|
24
|
+
return require('./search.png');
|
|
25
25
|
},
|
|
26
26
|
get x() {
|
|
27
|
-
return
|
|
27
|
+
return require('./x.png');
|
|
28
28
|
},
|
|
29
29
|
get xFlat() {
|
|
30
|
-
return
|
|
30
|
+
return require('./xFlat.png');
|
|
31
31
|
},
|
|
32
32
|
get xMedium() {
|
|
33
|
-
return
|
|
33
|
+
return require('./xMedium.png');
|
|
34
34
|
},
|
|
35
35
|
get xSmall() {
|
|
36
|
-
return
|
|
36
|
+
return require('./xSmall.png');
|
|
37
37
|
}
|
|
38
38
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const icons = {
|
|
2
|
+
get check() {
|
|
3
|
+
return {uri: require('./check.png'), width: 21, height: 15};
|
|
4
|
+
},
|
|
5
|
+
get checkMarkSmall() {
|
|
6
|
+
return {uri: require('./checkMarkSmall.png'), width: 16, height: 16};
|
|
7
|
+
},
|
|
8
|
+
get checkSmall() {
|
|
9
|
+
return {uri: require('./checkSmall.png'), width: 24, height: 24};
|
|
10
|
+
},
|
|
11
|
+
get chevronDown() {
|
|
12
|
+
return {uri: require('./chevronDown.png'), width: 16, height: 16};
|
|
13
|
+
},
|
|
14
|
+
get exclamationSmall() {
|
|
15
|
+
return {uri: require('./exclamationSmall.png'), width: 16, height: 16};
|
|
16
|
+
},
|
|
17
|
+
get minusSmall() {
|
|
18
|
+
return {uri: require('./minusSmall.png'), width: 16, height: 16};
|
|
19
|
+
},
|
|
20
|
+
get plusSmall() {
|
|
21
|
+
return {uri: require('./plusSmall.png'), width: 16, height: 16};
|
|
22
|
+
},
|
|
23
|
+
get search() {
|
|
24
|
+
return {uri: require('./search.png'), width: 24, height: 24};
|
|
25
|
+
},
|
|
26
|
+
get x() {
|
|
27
|
+
return {uri: require('./x.png'), width: 17, height: 16};
|
|
28
|
+
},
|
|
29
|
+
get xFlat() {
|
|
30
|
+
return {uri: require('./xFlat.png'), width: 16, height: 16};
|
|
31
|
+
},
|
|
32
|
+
get xMedium() {
|
|
33
|
+
return {uri: require('./xMedium.png'), width: 24, height: 24};
|
|
34
|
+
},
|
|
35
|
+
get xSmall() {
|
|
36
|
+
return {uri: require('./xSmall.png'), width: 16, height: 16};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
export const images = {
|
|
2
2
|
get gradient() {
|
|
3
|
-
return
|
|
3
|
+
return require('./gradient.png');
|
|
4
4
|
},
|
|
5
5
|
get gradientOverlay() {
|
|
6
|
-
return
|
|
6
|
+
return require('./gradientOverlay.png');
|
|
7
7
|
},
|
|
8
8
|
get gradientOverlayHigh() {
|
|
9
|
-
return
|
|
9
|
+
return require('./gradientOverlayHigh.png');
|
|
10
10
|
},
|
|
11
11
|
get gradientOverlayLow() {
|
|
12
|
-
return
|
|
12
|
+
return require('./gradientOverlayLow.png');
|
|
13
13
|
},
|
|
14
14
|
get gradientOverlayMedium() {
|
|
15
|
-
return
|
|
15
|
+
return require('./gradientOverlayMedium.png');
|
|
16
16
|
},
|
|
17
17
|
get hintTipMiddle() {
|
|
18
|
-
return
|
|
18
|
+
return require('./hintTipMiddle.png');
|
|
19
19
|
},
|
|
20
20
|
get hintTipSide() {
|
|
21
|
-
return
|
|
21
|
+
return require('./hintTipSide.png');
|
|
22
22
|
},
|
|
23
23
|
get transparentSwatch() {
|
|
24
|
-
return
|
|
24
|
+
return require('./transparentSwatch.png');
|
|
25
25
|
}
|
|
26
26
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const images = {
|
|
2
|
+
get gradient() {
|
|
3
|
+
return {uri: require('./gradient.png'), width: 56, height: 2};
|
|
4
|
+
},
|
|
5
|
+
get gradientOverlay() {
|
|
6
|
+
return {uri: require('./gradientOverlay.png'), width: 76, height: 48};
|
|
7
|
+
},
|
|
8
|
+
get gradientOverlayHigh() {
|
|
9
|
+
return {uri: require('./gradientOverlayHigh.png'), width: 1, height: 297};
|
|
10
|
+
},
|
|
11
|
+
get gradientOverlayLow() {
|
|
12
|
+
return {uri: require('./gradientOverlayLow.png'), width: 1, height: 297};
|
|
13
|
+
},
|
|
14
|
+
get gradientOverlayMedium() {
|
|
15
|
+
return {uri: require('./gradientOverlayMedium.png'), width: 1, height: 297};
|
|
16
|
+
},
|
|
17
|
+
get hintTipMiddle() {
|
|
18
|
+
return {uri: require('./hintTipMiddle.png'), width: 20, height: 7};
|
|
19
|
+
},
|
|
20
|
+
get hintTipSide() {
|
|
21
|
+
return {uri: require('./hintTipSide.png'), width: 20, height: 24};
|
|
22
|
+
},
|
|
23
|
+
get transparentSwatch() {
|
|
24
|
+
return {uri: require('./transparentSwatch.png'), width: 100, height: 100};
|
|
25
|
+
}
|
|
26
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
|
-
import { StyleProp, ViewStyle, ImagePropsBase, ImageStyle, TextStyle, AccessibilityProps } from 'react-native';
|
|
2
|
+
import { StyleProp, ViewStyle, ImagePropsBase, ImageStyle, TextStyle, TextProps, AccessibilityProps } from 'react-native';
|
|
3
3
|
import { BadgeProps } from '../badge';
|
|
4
4
|
import { ImageProps } from '../image';
|
|
5
5
|
import { AnimatedImageProps } from '../animatedImage';
|
|
@@ -95,6 +95,7 @@ export type AvatarProps = Pick<AccessibilityProps, 'accessibilityLabel'> & Props
|
|
|
95
95
|
* The label color
|
|
96
96
|
*/
|
|
97
97
|
labelColor?: string;
|
|
98
|
+
labelEllipsizeMode?: TextProps['ellipsizeMode'];
|
|
98
99
|
/**
|
|
99
100
|
* ribbon label to display on the avatar
|
|
100
101
|
*/
|
|
@@ -223,6 +224,7 @@ declare const Avatar: React.ForwardRefExoticComponent<Pick<AccessibilityProps, "
|
|
|
223
224
|
* The label color
|
|
224
225
|
*/
|
|
225
226
|
labelColor?: string | undefined;
|
|
227
|
+
labelEllipsizeMode?: TextProps['ellipsizeMode'];
|
|
226
228
|
/**
|
|
227
229
|
* ribbon label to display on the avatar
|
|
228
230
|
*/
|
|
@@ -345,6 +347,7 @@ declare const _default: React.ForwardRefExoticComponent<Pick<AccessibilityProps,
|
|
|
345
347
|
* The label color
|
|
346
348
|
*/
|
|
347
349
|
labelColor?: string | undefined;
|
|
350
|
+
labelEllipsizeMode?: "middle" | "head" | "tail" | "clip" | undefined;
|
|
348
351
|
/**
|
|
349
352
|
* ribbon label to display on the avatar
|
|
350
353
|
*/
|
|
@@ -56,6 +56,7 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
56
56
|
useAutoColors,
|
|
57
57
|
autoColorsConfig,
|
|
58
58
|
containerStyle,
|
|
59
|
+
labelEllipsizeMode = 'clip',
|
|
59
60
|
onPress,
|
|
60
61
|
children
|
|
61
62
|
} = themeProps;
|
|
@@ -178,7 +179,7 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
178
179
|
const Container = onPress ? TouchableOpacity : View;
|
|
179
180
|
return <Container style={_containerStyle} ref={ref} testID={testID} onPress={onPress} accessible={!_isUndefined(onPress)} accessibilityLabel={'Avatar'} accessibilityRole={onPress ? 'button' : 'image'} hitSlop={onPress ? hitTargetPadding : undefined} {...accessibilityProps}>
|
|
180
181
|
<View testID={`${testID}.container`} style={textContainerStyle}>
|
|
181
|
-
{!_isUndefined(text) && <Text numberOfLines={1} style={textStyle} testID={`${testID}.label`}>
|
|
182
|
+
{!_isUndefined(text) && <Text numberOfLines={1} ellipsizeMode={labelEllipsizeMode} style={textStyle} testID={`${testID}.label`}>
|
|
182
183
|
{text}
|
|
183
184
|
</Text>}
|
|
184
185
|
</View>
|
|
@@ -194,7 +195,8 @@ const styles = StyleSheet.create({
|
|
|
194
195
|
...StyleSheet.absoluteFillObject,
|
|
195
196
|
alignItems: 'center',
|
|
196
197
|
justifyContent: 'center',
|
|
197
|
-
borderRadius: BorderRadiuses.br100
|
|
198
|
+
borderRadius: BorderRadiuses.br100,
|
|
199
|
+
overflow: 'hidden'
|
|
198
200
|
},
|
|
199
201
|
initialsContainerWithInset: {
|
|
200
202
|
top: 1,
|
|
@@ -159,13 +159,37 @@
|
|
|
159
159
|
],
|
|
160
160
|
"items": [
|
|
161
161
|
{
|
|
162
|
-
"title": "Left"
|
|
162
|
+
"title": "Left",
|
|
163
|
+
"content": [
|
|
164
|
+
{
|
|
165
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Hint/hint_alignment_left_top.png"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Hint/hint_alignment_left_bottom.png"
|
|
169
|
+
}
|
|
170
|
+
]
|
|
163
171
|
},
|
|
164
172
|
{
|
|
165
|
-
"title": "Center"
|
|
173
|
+
"title": "Center",
|
|
174
|
+
"content": [
|
|
175
|
+
{
|
|
176
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Hint/hint_alignment_center_top.png"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Hint/hint_alignment_center_bottom.png"
|
|
180
|
+
}
|
|
181
|
+
]
|
|
166
182
|
},
|
|
167
183
|
{
|
|
168
|
-
"title": "Right"
|
|
184
|
+
"title": "Right",
|
|
185
|
+
"content": [
|
|
186
|
+
{
|
|
187
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Hint/hint_alignment_right_top.png"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Hint/hint_alignment_right_bottom.png"
|
|
191
|
+
}
|
|
192
|
+
]
|
|
169
193
|
}
|
|
170
194
|
],
|
|
171
195
|
"title": "Alignment",
|
|
@@ -179,10 +203,20 @@
|
|
|
179
203
|
],
|
|
180
204
|
"items": [
|
|
181
205
|
{
|
|
182
|
-
"title": "None"
|
|
206
|
+
"title": "None",
|
|
207
|
+
"content": [
|
|
208
|
+
{
|
|
209
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Hint/hint_accessories_none.png"
|
|
210
|
+
}
|
|
211
|
+
]
|
|
183
212
|
},
|
|
184
213
|
{
|
|
185
|
-
"title": "Icon"
|
|
214
|
+
"title": "Icon",
|
|
215
|
+
"content": [
|
|
216
|
+
{
|
|
217
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Hint/hint_accessories_icon.png"
|
|
218
|
+
}
|
|
219
|
+
]
|
|
186
220
|
}
|
|
187
221
|
],
|
|
188
222
|
"title": "Accessories"
|
|
@@ -2,7 +2,7 @@ import isUndefined from 'lodash/isUndefined';
|
|
|
2
2
|
import React, { useMemo, forwardRef } from 'react';
|
|
3
3
|
import { Image, StyleSheet } from 'react-native';
|
|
4
4
|
import { asBaseComponent, Constants } from "../../commons/new";
|
|
5
|
-
import { getAsset, isSvg, isBase64ImageContent
|
|
5
|
+
import { getAsset, isSvg, isBase64ImageContent } from "../../utils/imageUtils";
|
|
6
6
|
import Badge from "../badge";
|
|
7
7
|
import SvgImage from "../svgImage";
|
|
8
8
|
|
|
@@ -50,20 +50,10 @@ const Icon = forwardRef((props, ref) => {
|
|
|
50
50
|
if (!isUndefined(assetName)) {
|
|
51
51
|
return getAsset(assetName, assetGroup);
|
|
52
52
|
}
|
|
53
|
-
return
|
|
53
|
+
return source;
|
|
54
54
|
}, [source, assetGroup, assetName]);
|
|
55
|
-
const sourceSizeStyle = useMemo(() => {
|
|
56
|
-
const styles = {};
|
|
57
|
-
if (iconSource?.width) {
|
|
58
|
-
styles.width = iconSource.width;
|
|
59
|
-
}
|
|
60
|
-
if (iconSource?.height) {
|
|
61
|
-
styles.height = iconSource.height;
|
|
62
|
-
}
|
|
63
|
-
return styles;
|
|
64
|
-
}, [iconSource]);
|
|
65
55
|
const renderImage = () => {
|
|
66
|
-
return <Image accessible={false} accessibilityRole={'image'} fsTagName={recorderTag} {...others} ref={ref} source={iconSource} style={[
|
|
56
|
+
return <Image accessible={false} accessibilityRole={'image'} fsTagName={recorderTag} {...others} ref={ref} source={iconSource} style={[margins, iconSize, shouldFlipRTL && styles.rtlFlipped, !!tintColor && {
|
|
67
57
|
tintColor
|
|
68
58
|
}, style]} />;
|
|
69
59
|
};
|
|
@@ -4,7 +4,7 @@ import React, { PureComponent } from 'react';
|
|
|
4
4
|
import hoistNonReactStatic from 'hoist-non-react-statics';
|
|
5
5
|
import { StyleSheet, Image as RNImage, ImageBackground } from 'react-native';
|
|
6
6
|
import { Constants, asBaseComponent } from "../../commons/new";
|
|
7
|
-
import { getAsset, isSvg
|
|
7
|
+
import { getAsset, isSvg } from "../../utils/imageUtils";
|
|
8
8
|
import Overlay from "../overlay";
|
|
9
9
|
import SvgImage from "../svgImage";
|
|
10
10
|
import View from "../view";
|
|
@@ -59,15 +59,14 @@ class Image extends PureComponent {
|
|
|
59
59
|
return !!overlayType || this.isGif() || !_isUndefined(customOverlayContent);
|
|
60
60
|
}
|
|
61
61
|
getVerifiedSource(source) {
|
|
62
|
-
|
|
63
|
-
if (sourceUri === null || sourceUri === '') {
|
|
62
|
+
if (_get(source, 'uri') === null || _get(source, 'uri') === '') {
|
|
64
63
|
// @ts-ignore
|
|
65
64
|
return {
|
|
66
65
|
...source,
|
|
67
66
|
uri: undefined
|
|
68
67
|
};
|
|
69
68
|
}
|
|
70
|
-
return
|
|
69
|
+
return source;
|
|
71
70
|
}
|
|
72
71
|
getImageSource() {
|
|
73
72
|
const {
|
|
@@ -148,7 +147,6 @@ class Image extends PureComponent {
|
|
|
148
147
|
modifiers,
|
|
149
148
|
recorderTag,
|
|
150
149
|
borderRadius,
|
|
151
|
-
source: _source,
|
|
152
150
|
...others
|
|
153
151
|
} = this.props;
|
|
154
152
|
const shouldFlipRTL = supportRTL && Constants.isRTL;
|
|
@@ -158,12 +156,7 @@ class Image extends PureComponent {
|
|
|
158
156
|
} = modifiers;
|
|
159
157
|
return (
|
|
160
158
|
// @ts-ignore
|
|
161
|
-
<ImageView style={[
|
|
162
|
-
// @ts-ignore
|
|
163
|
-
{
|
|
164
|
-
width: _source?.width,
|
|
165
|
-
height: _source?.height
|
|
166
|
-
}, tintColor && {
|
|
159
|
+
<ImageView style={[tintColor && {
|
|
167
160
|
tintColor
|
|
168
161
|
}, shouldFlipRTL && styles.rtlFlipped, width && {
|
|
169
162
|
width
|
|
@@ -102,21 +102,53 @@
|
|
|
102
102
|
"title": "Generic",
|
|
103
103
|
"content": [
|
|
104
104
|
{
|
|
105
|
+
"component": "Incubator.Toast",
|
|
105
106
|
"props": {
|
|
106
107
|
"visible": true,
|
|
107
|
-
"message": "Mika Or was saved to contacts."
|
|
108
|
+
"message": "Mika Or was saved to contacts.",
|
|
109
|
+
"preset": "general"
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
]
|
|
111
113
|
},
|
|
112
114
|
{
|
|
113
|
-
"title": "Success"
|
|
115
|
+
"title": "Success",
|
|
116
|
+
"content": [
|
|
117
|
+
{
|
|
118
|
+
"component": "Incubator.Toast",
|
|
119
|
+
"props": {
|
|
120
|
+
"visible": true,
|
|
121
|
+
"message": "Post published.",
|
|
122
|
+
"preset": "success"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
]
|
|
114
126
|
},
|
|
115
127
|
{
|
|
116
|
-
"title": "Validation"
|
|
128
|
+
"title": "Validation",
|
|
129
|
+
"content": [
|
|
130
|
+
{
|
|
131
|
+
"component": "Incubator.Toast",
|
|
132
|
+
"props": {
|
|
133
|
+
"visible": true,
|
|
134
|
+
"message": "Enter a card number.",
|
|
135
|
+
"preset": "failure"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
]
|
|
117
139
|
},
|
|
118
140
|
{
|
|
119
|
-
"title": "Offline Error"
|
|
141
|
+
"title": "Offline Error",
|
|
142
|
+
"content": [
|
|
143
|
+
{
|
|
144
|
+
"component": "Incubator.Toast",
|
|
145
|
+
"props": {
|
|
146
|
+
"visible": true,
|
|
147
|
+
"message": "This action is not available offline.",
|
|
148
|
+
"preset": "offline"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
]
|
|
120
152
|
}
|
|
121
153
|
],
|
|
122
154
|
"title": "Types"
|
|
@@ -126,13 +158,37 @@
|
|
|
126
158
|
"columns": ["Prop", "Preview"],
|
|
127
159
|
"items": [
|
|
128
160
|
{
|
|
129
|
-
"title": "None"
|
|
161
|
+
"title": "None",
|
|
162
|
+
"content": [
|
|
163
|
+
{
|
|
164
|
+
"component": "Incubator.Toast",
|
|
165
|
+
"props": {
|
|
166
|
+
"visible": true,
|
|
167
|
+
"message": "Action completed."
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
]
|
|
130
171
|
},
|
|
131
172
|
{
|
|
132
|
-
"title": "With action"
|
|
173
|
+
"title": "With action",
|
|
174
|
+
"content": [
|
|
175
|
+
{
|
|
176
|
+
"snippet": "<Incubator.Toast visible message=\"Action completed.\" action={{label: 'Undo', onPress: () => {}}}/>"
|
|
177
|
+
}
|
|
178
|
+
]
|
|
133
179
|
},
|
|
134
180
|
{
|
|
135
|
-
"title": "With loader"
|
|
181
|
+
"title": "With loader",
|
|
182
|
+
"content": [
|
|
183
|
+
{
|
|
184
|
+
"component": "Incubator.Toast",
|
|
185
|
+
"props": {
|
|
186
|
+
"visible": true,
|
|
187
|
+
"message": "Action completed.",
|
|
188
|
+
"showLoader": true
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
]
|
|
136
192
|
}
|
|
137
193
|
],
|
|
138
194
|
"title": "Accessories"
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ImageSourceType } from '../components/image';
|
|
2
|
-
export declare function extractImageSource(source?: ImageSourceType): ImageSourceType;
|
|
3
2
|
export declare function isSvgUri(source?: ImageSourceType): any;
|
|
4
3
|
export declare function isSvg(source?: ImageSourceType): any;
|
|
5
4
|
export declare function isBase64ImageContent(data: string): boolean;
|
package/src/utils/imageUtils.js
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import get from 'lodash/get';
|
|
2
2
|
import Assets from "../assets";
|
|
3
|
-
export function extractImageSource(source) {
|
|
4
|
-
const sourceUri = get(source, 'uri');
|
|
5
|
-
if (sourceUri) {
|
|
6
|
-
// Case when uri is a number (Local Assets)
|
|
7
|
-
if (typeof sourceUri === 'number') {
|
|
8
|
-
return sourceUri;
|
|
9
|
-
}
|
|
10
|
-
// Case when uri is a Base64 encoded string
|
|
11
|
-
if (typeof sourceUri === 'string' && isBase64ImageContent(sourceUri)) {
|
|
12
|
-
return source;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return source;
|
|
16
|
-
}
|
|
17
3
|
export function isSvgUri(source) {
|
|
18
4
|
// @ts-expect-error
|
|
19
5
|
return typeof source === 'object' && source?.uri?.endsWith?.('.svg');
|