Skip to content
This repository was archived by the owner on Feb 4, 2021. It is now read-only.

Commit fe01450

Browse files
committed
Allow Toolbar icons to be disabled
1 parent db0386b commit fe01450

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lib/Icon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default class Icon extends Component {
66

77
static propTypes = {
88
name: PropTypes.string.isRequired,
9-
style: PropTypes.object,
9+
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
1010
size: PropTypes.number,
1111
color: PropTypes.string
1212
};

lib/Toolbar.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ export default class Toolbar extends Component {
4848
}
4949
};
5050

51+
const opacityMap = {
52+
light: .38,
53+
dark: .30
54+
};
55+
5156
const styleMap = {
5257
backgroundColor: overrides && overrides.backgroundColor ? getColor(overrides.backgroundColor) : themeMap[theme].backgroundColor,
5358
color: overrides && overrides.color ? getColor(overrides.color) : themeMap[theme].color,
@@ -88,11 +93,12 @@ export default class Toolbar extends Component {
8893
color={styleMap.iconColor}
8994
badge={action.badge}
9095
onPress={action.onPress}
96+
disabled={action.disabled}
9197
>
9298
<Icon name={action.icon}
9399
size={24}
94100
color={styleMap.iconColor}
95-
style={styles.icon}
101+
style={[styles.icon, action.disabled ? { opacity: opacityMap[theme] } : null]}
96102
/>
97103
</IconToggle>
98104
);
@@ -105,6 +111,10 @@ export default class Toolbar extends Component {
105111

106112
const styles = {
107113
toolbar: {
114+
position: 'absolute',
115+
top: 0,
116+
left: 0,
117+
right: 0,
108118
height: 56,
109119
flexDirection: 'row',
110120
alignItems: 'center'

0 commit comments

Comments
 (0)