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

Dynamically resize Home's balance label. #890

Closed
wants to merge 7 commits into from

Conversation

valentinewallace
Copy link
Contributor

Closes #879.

Copy link
Contributor

@tanx tanx left a 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,
},
})
);
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get this UI bug when I don't set the width in the wrapper:

51401843_294491867927029_6915343391798591488_n

Copy link
Contributor Author

@valentinewallace valentinewallace Feb 7, 2019

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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?

width: 250,
},
})
);
Copy link
Contributor

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.

lineHeight: font.lineHeightXXXL,
lineHeight: null,
marginLeft: 10,
marginRight: 10,
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thx

},
unit: {
fontFamily: 'WorkSans Regular',
fontSize: font.sizeL,
lineHeight: 60,
marginLeft: 10,
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed :)

src/view/home.js Outdated
this.setState({ height: event.nativeEvent.layout.height });
}}
style={{ paddingTop: calculateTopPadding(this.state.height) }}
>
Copy link
Contributor

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?

Copy link
Contributor Author

@valentinewallace valentinewallace Feb 19, 2019

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!

Copy link
Contributor Author

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;
};
Copy link
Contributor

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.

Copy link
Contributor Author

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!

@tanx
Copy link
Contributor

tanx commented Aug 20, 2019

Closing in favor of #1295

@tanx tanx closed this Aug 20, 2019
@tanx tanx deleted the resize-balance branch August 22, 2019 10:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resize balance label to fit screen width on mobile (home screen)
2 participants