-
Notifications
You must be signed in to change notification settings - Fork 169
Dynamically resize Home's balance label. #890
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@valentinewallace I rebased this on the current master and added feedback
width: 250, | ||
}, | ||
}) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the wrapper need a width?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested removing the diff on home.js. It didn't change anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's because adjustFontSizeToFit
needs a reference point to know when resizing is necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@valentinewallace I think the issue with the btc unit behind the balance is causing adjustFontSizeToFit
to fail. If you display then number as fiat it scales as intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay, so are you saying it's ok to leave the width
as is?
3b0b1ae
to
811bb09
Compare
width: 250, | ||
}, | ||
}) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested removing the diff on home.js. It didn't change anything.
src/component/label.js
Outdated
lineHeight: font.lineHeightXXXL, | ||
lineHeight: null, | ||
marginLeft: 10, | ||
marginRight: 10, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The home screen already has 20 padding on the left and right. Margin shouldn't be required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, thx
src/component/label.js
Outdated
}, | ||
unit: { | ||
fontFamily: 'WorkSans Regular', | ||
fontSize: font.sizeL, | ||
lineHeight: 60, | ||
marginLeft: 10, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This marginLeft: 10
is still required if marginRight
on the numeral is removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed :)
811bb09
to
7191f1c
Compare
src/view/home.js
Outdated
this.setState({ height: event.nativeEvent.layout.height }); | ||
}} | ||
style={{ paddingTop: calculateTopPadding(this.state.height) }} | ||
> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Views should not contain any logic. Is there a reason we need to setState
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need the height of the balance to dynamically calculate the paddingTop
of the btc
unit.
I'll try switching from setState
to a normal action
instead!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
src/helper.js
Outdated
return 10; | ||
} | ||
return 5; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is a component specific function in the generic helper module? We should probably move this to the corresponding component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me know if you like my solution!
This is to ensure it stays level with the balance itself.
…e unit in theHome screen balance.
7191f1c
to
647dccf
Compare
Closing in favor of #1295 |
Closes #879.