@shoutem/ui 7.1.0-beta.11 → 7.1.0-beta.14
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.
|
@@ -43,7 +43,11 @@ const ActionSheet = ({
|
|
|
43
43
|
{hasConfirmOptions && (
|
|
44
44
|
<View style={style.segmentContainer}>
|
|
45
45
|
{_.map(confirmOptions, option => (
|
|
46
|
-
<ActionSheetOption
|
|
46
|
+
<ActionSheetOption
|
|
47
|
+
key={option.title}
|
|
48
|
+
option={option}
|
|
49
|
+
style={style.option}
|
|
50
|
+
/>
|
|
47
51
|
))}
|
|
48
52
|
</View>
|
|
49
53
|
)}
|
|
@@ -55,6 +59,7 @@ const ActionSheet = ({
|
|
|
55
59
|
key={option.title}
|
|
56
60
|
cancelOption
|
|
57
61
|
option={option}
|
|
62
|
+
style={style.option}
|
|
58
63
|
/>
|
|
59
64
|
))}
|
|
60
65
|
</View>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { connectStyle } from '@shoutem/theme';
|
|
4
|
+
import { isIos } from '../../services';
|
|
4
5
|
import { Text } from '../Text';
|
|
5
6
|
import { TouchableOpacity } from '../TouchableOpacity';
|
|
6
7
|
|
|
@@ -9,16 +10,24 @@ export const optionPropType = PropTypes.shape({
|
|
|
9
10
|
onPress: PropTypes.func,
|
|
10
11
|
});
|
|
11
12
|
|
|
12
|
-
function ActionSheetOption({ style, option, cancelOption }) {
|
|
13
|
+
function ActionSheetOption({ style, option, cancelOption, nativeStyle }) {
|
|
13
14
|
const { title, onPress } = option;
|
|
14
15
|
|
|
16
|
+
const useIosTextColor = nativeStyle && isIos;
|
|
17
|
+
|
|
15
18
|
return (
|
|
16
19
|
<TouchableOpacity
|
|
17
20
|
onPress={onPress}
|
|
18
21
|
style={style.container}
|
|
19
22
|
styleName="horizontal"
|
|
20
23
|
>
|
|
21
|
-
<Text
|
|
24
|
+
<Text
|
|
25
|
+
style={[
|
|
26
|
+
style.text,
|
|
27
|
+
cancelOption && style.cancelText,
|
|
28
|
+
useIosTextColor && style.iosBlueTextColor,
|
|
29
|
+
]}
|
|
30
|
+
>
|
|
22
31
|
{title}
|
|
23
32
|
</Text>
|
|
24
33
|
</TouchableOpacity>
|
|
@@ -28,12 +37,14 @@ function ActionSheetOption({ style, option, cancelOption }) {
|
|
|
28
37
|
ActionSheetOption.propTypes = {
|
|
29
38
|
style: PropTypes.object.isRequired,
|
|
30
39
|
cancelOption: PropTypes.bool,
|
|
40
|
+
nativeStyle: PropTypes.bool,
|
|
31
41
|
option: optionPropType,
|
|
32
42
|
};
|
|
33
43
|
|
|
34
44
|
ActionSheetOption.defaultProps = {
|
|
35
45
|
option: undefined,
|
|
36
46
|
cancelOption: false,
|
|
47
|
+
nativeStyle: false,
|
|
37
48
|
};
|
|
38
49
|
|
|
39
50
|
export default connectStyle('shoutem.ui.ActionSheetOption')(ActionSheetOption);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { connectStyle } from '@shoutem/theme';
|
|
4
|
+
import { View } from '../View';
|
|
5
|
+
import { getIcon } from './services';
|
|
6
|
+
|
|
7
|
+
function Icon({ name, style, ...otherProps }) {
|
|
8
|
+
const { color, width, height, ...otherStyle } = style;
|
|
9
|
+
|
|
10
|
+
const NamedIcon = getIcon(name);
|
|
11
|
+
|
|
12
|
+
if (!NamedIcon) {
|
|
13
|
+
// eslint-disable-next-line no-console
|
|
14
|
+
console.warn(`Icon with name '${name}' not found within the provided set`);
|
|
15
|
+
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
// Sometimes, in web, svg icons are not resized as expected, unless svg is wrapped inside View.
|
|
21
|
+
<View>
|
|
22
|
+
<NamedIcon
|
|
23
|
+
fill={color}
|
|
24
|
+
width={width}
|
|
25
|
+
height={height}
|
|
26
|
+
style={{ ...otherStyle }}
|
|
27
|
+
{...otherProps}
|
|
28
|
+
/>
|
|
29
|
+
</View>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Icon.propTypes = {
|
|
34
|
+
name: PropTypes.string.isRequired,
|
|
35
|
+
style: PropTypes.object.isRequired,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default connectStyle('shoutem.ui.Icon')(Icon);
|
package/components/Switch.js
CHANGED
|
@@ -2,19 +2,29 @@ import React from 'react';
|
|
|
2
2
|
import { Switch as RNSwitch } from 'react-native';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { connectStyle } from '@shoutem/theme';
|
|
5
|
+
import { isWeb } from '../services/platform';
|
|
5
6
|
import { View } from './View';
|
|
6
7
|
|
|
7
|
-
const Switch = ({ value, onValueChange, style }) =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
const Switch = ({ value, onValueChange, style }) => {
|
|
9
|
+
const webColors = {
|
|
10
|
+
trackColor: style.track?.false,
|
|
11
|
+
activeThumbColor: style.thumb,
|
|
12
|
+
activeTrackColor: style.track.true,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<View style={style.container}>
|
|
17
|
+
<RNSwitch
|
|
18
|
+
trackColor={isWeb ? style.track?.false : style.track}
|
|
19
|
+
thumbColor={style.thumb}
|
|
20
|
+
ios_backgroundColor={style.track?.false}
|
|
21
|
+
onValueChange={onValueChange}
|
|
22
|
+
value={value}
|
|
23
|
+
{...(isWeb && webColors)}
|
|
24
|
+
/>
|
|
25
|
+
</View>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
18
28
|
|
|
19
29
|
Switch.propTypes = {
|
|
20
30
|
onValueChange: PropTypes.func.isRequired,
|
package/package.json
CHANGED
package/theme.js
CHANGED
|
@@ -2733,6 +2733,7 @@ export default () => {
|
|
|
2733
2733
|
paddingVertical: 16,
|
|
2734
2734
|
borderBottomWidth: 1,
|
|
2735
2735
|
borderColor: 'rgba(130, 130, 130, 0.1)',
|
|
2736
|
+
alignItems: 'center',
|
|
2736
2737
|
},
|
|
2737
2738
|
text: {
|
|
2738
2739
|
fontSize: 15,
|
|
@@ -2745,6 +2746,9 @@ export default () => {
|
|
|
2745
2746
|
textAlign: 'center',
|
|
2746
2747
|
fontWeight: resolveFontWeight('700'),
|
|
2747
2748
|
},
|
|
2749
|
+
iosBlueTextColor: {
|
|
2750
|
+
color: '#007AFF',
|
|
2751
|
+
},
|
|
2748
2752
|
},
|
|
2749
2753
|
|
|
2750
2754
|
//
|