Padding is not overriding paddingTop, paddingLeft, paddingHorizontal, etc...
See original GitHub issueIs this a bug report?
Yes, padding attribute is not overriding individual padding attributes like paddingTop, paddingLeft, paddingVertical, etc…
Have you read the Contributing Guidelines?
Yes
Environment
Environment: OS: macOS Sierra 10.12.6 Node: 7.9.0 Yarn: 0.23.2 npm: 4.5.0 Watchman: 4.7.0 Xcode: Xcode 8.2.1 Build version 8C1002 Android Studio: 2.3 AI-162.3871768
Packages: (wanted => installed) react: 16.0.0-beta.5 => 16.0.0-beta.5 react-native: 0.49.3 => 0.49.3
Steps to Reproduce
- Create default styles for a wrapper component and assign padding values
const ScreenStyles = {
paddingTop: 0,
paddingLeft: 10,
paddingRight: 10,
paddingBottom: 10,
};
You also can try with paddingHorizontal and paddingVertical
- Declare new styles for custom screen, extending from ScreenStyles:
const CustomScreenStyles = StyleSheet.create({
screen: {
...ScreenStyles,
padding: 50,
}
});
Expected Behavior
Extended padding attribute must override individual values like paddingTop, paddingLeft, paddingVertical, etc…
Actual Behavior
padding attribute is not overriding individual padding attributes like paddingTop, paddingLeft, paddingVertical, etc…
Reproducible Demo
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:7
Top Results From Across the Web
React Native - why padding does not work?
Use this for padding: function padding(a, b, c, d) { return { paddingTop: a, paddingRight: b ? b : a, paddingBottom: c ?...
Read more >CSS Padding
Padding is used to create space around an element's content, inside of any defined borders. This element has a padding of 70px.
Read more >How To Use Styling in React Native Apps
When working with React Native, by default it does not use HTML and CSS ... and “end” override marginLeft and marginRight , paddingLeft...
Read more >padding - CSS: Cascading Style Sheets - MDN Web Docs
The padding CSS shorthand property sets the padding area on all four sides of an element at once.
Read more >Margin and Padding in an Android View
In this tutorial we will learn about Margin and Padding attributes which can be used to style and ... android:paddingLeft="20dp" android:paddingTop="20dp" ...
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
This issue is still reproducible but in array (
<View style={[someStyle, someAnotherStyle]} />
) react-native version0.54.0
Actual result - component, that are receiving style, have paddingTop equals to 8 Expected result - component, that are receiving style, will have paddingTop equals to 24
This is still an issue. Makes it hard to control layout when multiple styles are being merged (incorrectly). @facuescobar can you re-open it?