I was trying to implement the Input from React Native Elements, which is the blue one. I want to make the Input have full width within the red view. So I did
width: '100%', marginHorizontal: 0, padding: 0, and alignItems: 'stretch' independently.
But none of them didn't work. What is the problem? This is the screenshot of the screen
And this is the corresponding code
<View style = {styles.campusInputView}>
<Input
containerStyle = {styles.campusInputContainer}
inputStyle = {styles.campusInput}
placeholder = 'KAIST'
editable = {false}
/>
</View>
with the style
campusInputView: {
borderWidth: 1,
borderColor: 'red',
position: 'absolute',
top: height * 100 / 640,
left: width * 45 / 360,
width: width * 270 / 360,
},
campusInputContainer: {
borderWidth: 1,
borderColor: 'green',
alignItems: 'stretch',
},
campusInput: {
borderWidth: 1,
borderColor: 'blue',
flex: 1,
fontFamily: 'NanumSquareB',
fontSize: 20,
paddingVertical: 0,
},
Overwriting paddingHorizontal
of containerStyle
as 0
makes the input full width.
Overwriting only padding
as 0
is not enough.
import { Input } from 'react-native-elements'
<Input
containerStyle = {{ paddingHorizontal: 0 }}
// other settings
/>
You should add paddingHorizontal: 0
to campusInputContainer
campusInputContainer: {
borderWidth: 1,
borderColor: 'green',
alignItems: 'stretch',
paddingHorizontal: 0
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With