Unable to override input style
See original GitHub issueDescribe the bug
Unable to override the style of the element inside the container view.
To Reproduce
Steps to reproduce the behavior:
- Load the picker component in a blank app.
- Fill all required attributes for the component with the once similar to the main example.
- Add a
style
attribute and add the following value to it:
const style = {
inputAndroid: {
padding: 0,
paddingTop: 0,
paddingBottom: 0,
paddingLeft: 0,
paddingRight: 0,
paddingVertical: 0,
paddingHorizontal: 0,
},
inputIOS: {
padding: 0,
paddingTop: 0,
paddingBottom: 0,
paddingLeft: 0,
paddingRight: 0,
paddingVertical: 0,
paddingHorizontal: 0,
},
};
- The padding is still visible.
Expected behavior
The padding is removed, styles are applied.
Screenshots
Result, nothing changed:
Additional details
- Device: Pixel 2
- OS: 10.0 (Q) - API 29
- react-native-picker-select version: 7.0.0
- react-native version: 37.0.1
- react version: 16.9
Code sample
import React from 'react';
import RNPickerSelect from 'react-native-picker-select';
export default class App extends React.Component {
render() {
return (
<RNPickerSelect
style={style}
onValueChange={(value) => console.log(value)}
items={[
{ label: 'Football', value: 'football' },
{ label: 'Baseball', value: 'baseball' },
{ label: 'Hockey', value: 'hockey' },
]} />
);
}
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Can't override defined styles on input elements in CSS
I want to make a input element of a specific width in px. Unfortunately, there's a file that I can't edit which sets...
Read more >You can't override !important user agent CSS declarations
You can override user agent stylesheet declarations with your author styles. And indeed, you do that every day when you write your CSS....
Read more >autofill
The :auto-fill pseudo-class in CSS allows us to style <input> elements ... overriding those styles is something we are unable to do in...
Read more >Specificity - CSS: Cascading Style Sheets - MDN Web Docs
Create a separate, short style sheet containing only important declarations specifically overriding any important declarations you were unable ...
Read more >How to Override CSS Styles
It means that if you have an element with a class and ID selector with different styles, it is the ID style that...
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
For android it seems to be possible to get it some kind of working with the attribute
useNativeAndroidPickerStyle
set tofalse
. Then you can set the the style under theinputAndroid
attribute.However this removes the arrow icon on the right.
looks like this was solved. unless you set
useNativeAndroidPickerStyle={false}
or use the android headless mode, you’re dealing with the native android picker and styling is limited