Closed rad182 closed 7 years ago
Could you elaborate. The code as-is enumerates the key names and assigns the value. of
would bring back the value of the key, not the name unless there is an iterator symbol defined overriding that behavior.
when I try to override the style like this
<DialogBox
ref={dialogbox => {
this.dialogbox = dialogbox;
}}
isOverlayClickClose={false}
style={{
tipTitle: {
fontFamily: fonts.lato.semibold,
fontSize: 17
},
tipContent: {
fontFamily: fonts.lato.regular,
fontSize: 14,
color: '#676C71',
paddingLeft: 20,
paddingRight: 20,
textAlign: 'center'
}
}}
/>
The name
variable was getting 0
and 1
not sure why. or maybe this is not the way to override the style?
grr. you are correct! it is because Object.keys
is returning an array. The code as it is written should have been
for (const name in override) { ... }
The Object.keys
way normally would be:
Object.keys(override).forEach(name => {...})
and the token iterator (of
) works similar to the forEach
.
I will merge the change and publish a release.
Thanks for finding that!
it has been published to npm
This fixes style override because it's getting wrong keys