Unnecessary marginTop
See original GitHub issueHello,
Thank you for this project which is working perfectly.
I want to discuss about the hardcoded top margin line 138 in index.js:
...
render() {
return (
<View style={{
flex: 1,
marginTop: 64, // <-- this line
}}>
<View style={[styles.infoView, this.props.topViewStyle]}>
{this._renderTopContent()}
</View>
{this._renderCamera()}
<View style={[styles.infoView, this.props.bottomViewStyle]}>
{this._renderBottomContent()}
</View>
</View>
)
}
...
This prevents me from making the camera fill the screen vertically, see this Android screenshot:
<QRCodeScanner onRead={this.handleRead} />
I believe this property was added to compensate for the navigation bar. Since a navigation bar doesn’t always have a height of 64, I would suggest removing this line and allow the parent component to manage the margin himself. This way, we could adapt the necessary margin depending on how we manage the navigation bar.
If that makes sense, I would be happy to make a PR for this.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
I'm using next.js and getting unnecessary top margin in index.js
h1, h2, h3, h4, h5, h6, p all tags are having default margin top in next.js. index.js import React, { Component } from...
Read more >margin-top - CSS: Cascading Style Sheets - MDN Web Docs
The margin-top CSS property sets the margin area on the top of an element. A positive value places it farther from its neighbors, ......
Read more >The Rules of Margin Collapse - Josh W Comeau
Siblings can combine adjacent margins (if the first element has margin-bottom, and the second one has margin-top). A parent and child can ...
Read more >[modern][styles] Remove unnecessary `margin-top` · b0e54eec45 ...
[modern][styles] Remove unnecessary `margin-top`. Following-up Iecb0d6c4c80cee1d1684597a6dedf7323e2ec54d. It isn't set anywhere inherited, hence we don't ...
Read more >Everything You Need To Know About CSS Margins
The margin-top , margin-right , margin-bottom and margin-left ... If your CMS was adding redundant paragraph elements, you probably wouldn't ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
const screenHeight = Math.round(Dimensions.get('window').height); <QRCodeScanner topViewStyle={{height: 0, flex: 0}} cameraStyle={{ height: screenHeight, }}
still having the same in
v1.41
hardcodingcameraStyle={{marginTop: -190 }}
is a pretty ugly walk around… but working…NOTE: I started getting this issue only after updating from
v1.1.2
tov1.4.1