[RN] Make BaseIndicator render simpler

This commit is contained in:
Bettenbuk Zoltan 2019-04-01 17:42:16 +02:00 committed by Saúl Ibarra Corretgé
parent b1a70240fc
commit b791fc32fd
2 changed files with 15 additions and 26 deletions

View File

@ -33,19 +33,12 @@ export default class BaseIndicator extends Component<Props> {
render() {
const { highlight, icon } = this.props;
const iconElement = (<Icon
name = { icon }
style = { styles.indicator } />
return (
<View style = { highlight ? styles.highlightedIndicator : null }>
<Icon
name = { icon }
style = { styles.indicator } />
</View>
);
if (highlight) {
return (
<View style = { styles.indicatorBackground }>
{ iconElement }
</View>
);
}
return iconElement;
}
}

View File

@ -14,6 +14,15 @@ export const AVATAR_SIZE = 50;
* The styles of the feature filmstrip.
*/
export default {
/**
* Highlighted indicator additional style.
*/
highlightedIndicator: {
backgroundColor: ColorPalette.blue,
borderRadius: 16,
padding: 4
},
/**
* Dominant speaker indicator style.
*/
@ -28,19 +37,6 @@ export default {
}
},
/**
* Dominant speaker indicator background style.
*/
indicatorBackground: {
alignItems: 'center',
backgroundColor: ColorPalette.blue,
borderRadius: 16,
flexDirection: 'row',
justifyContent: 'center',
height: 20,
width: 20
},
/**
* The style of the narrow {@link Filmstrip} version which displays
* thumbnails in a row at the bottom of the screen.