|
@@ -1,10 +1,11 @@
|
1
|
1
|
import React from 'react';
|
2
|
|
-import { Image } from 'react-native';
|
|
2
|
+import { Image, View, ViewStyle } from 'react-native';
|
3
|
3
|
import { SvgCssUri } from 'react-native-svg';
|
4
|
4
|
import { connect } from 'react-redux';
|
5
|
5
|
|
6
|
6
|
import { translate } from '../../../base/i18n/functions';
|
7
|
7
|
import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
|
|
8
|
+import BaseTheme from '../../../base/ui/components/BaseTheme.native';
|
8
|
9
|
|
9
|
10
|
import styles from './styles';
|
10
|
11
|
|
|
@@ -13,6 +14,7 @@ interface IProps extends AbstractButtonProps {
|
13
|
14
|
backgroundColor?: string;
|
14
|
15
|
icon: any;
|
15
|
16
|
id?: string;
|
|
17
|
+ isToolboxButton?: boolean;
|
16
|
18
|
text?: string;
|
17
|
19
|
}
|
18
|
20
|
|
|
@@ -40,20 +42,30 @@ class CustomOptionButton extends AbstractButton<IProps> {
|
40
|
42
|
}
|
41
|
43
|
|
42
|
44
|
if (this.iconSrc?.includes('svg')) {
|
43
|
|
- iconComponent
|
44
|
|
- = (
|
45
|
|
- <SvgCssUri
|
46
|
|
- style = { styles.iconImageStyles }
|
47
|
|
- uri = { this.iconSrc } />);
|
|
45
|
+ iconComponent = (
|
|
46
|
+ <SvgCssUri
|
|
47
|
+ height = { BaseTheme.spacing[4] }
|
|
48
|
+ uri = { this.iconSrc }
|
|
49
|
+ width = { BaseTheme.spacing[4] } />
|
|
50
|
+ );
|
48
|
51
|
} else {
|
49
|
|
- iconComponent
|
50
|
|
- = (
|
51
|
|
- <Image
|
52
|
|
- source = {{ uri: this.iconSrc }}
|
53
|
|
- style = { styles.iconImageStyles } />);
|
|
52
|
+ iconComponent = (
|
|
53
|
+ <Image
|
|
54
|
+ height = { BaseTheme.spacing[4] }
|
|
55
|
+ resizeMode = { 'contain' }
|
|
56
|
+ source = {{ uri: this.iconSrc }}
|
|
57
|
+ width = { BaseTheme.spacing[4] } />
|
|
58
|
+ );
|
54
|
59
|
}
|
55
|
60
|
|
56
|
|
- return iconComponent;
|
|
61
|
+ return (
|
|
62
|
+ <View
|
|
63
|
+ style = { this.props.isToolboxButton && [
|
|
64
|
+ styles.toolboxButtonIconContainer,
|
|
65
|
+ { backgroundColor: this.backgroundColor } ] as ViewStyle }>
|
|
66
|
+ { iconComponent }
|
|
67
|
+ </View>
|
|
68
|
+ );
|
57
|
69
|
};
|
58
|
70
|
|
59
|
71
|
label = this.text || '';
|