Reputation: 2615
I want to use rounded TextInput in my react-native application but when I am setting its borderRadius property its not working. Suggest me way to do that.
<TextInput placeholder="Email" style={styles.textInput} />
textInput:{
borderColor:'black',
backgroundColor:'#D3D3D3',
width:300,
borderWidth: 1,
borderStyle: 'solid',
fontSize:15,
borderRadius: 25,
}
Upvotes: 5
Views: 23593
Reputation: 353
*f you are using React Native Paper, try this:
<TextInput
label="Enter the URL of the recipe you want to save"
value={url}
onChangeText={text => setUrl(text)}
autoCapitalize="none"
style={styles.input}
mode="outlined"
outlineStyle={{borderRadius: 50}}
/>
Upvotes: 1
Reputation: 41
Add theme={{roundness: 20}} theme is a react native paper property
Upvotes: 1
Reputation: 459
I was having the same issue. You need to use the outlineStyle prop.
Example: <Input outlineStyle={{borderRadius: 20}} />
This works like a charm.
Upvotes: 0
Reputation: 426
In the latest version of react native paper docs, they mention that you need to use outlineStyle to set border color and border-radius
outlineStyle
Type: StyleProp<ViewStyle>
Pass style to override the default style of outlined wrapper. Overrides style when mode is set to outlined Example: borderRadius, borderColor
Upvotes: 0
Reputation: 653
Apply below code :
<TextInput
style={{ height: 40, width: "95%", borderColor: 'gray', borderWidth: 2, borderRadius: 20, marginBottom: 20, fontSize: 18 }}
// Adding hint in TextInput using Placeholder option.
placeholder=" Enter Your First Name"
// Making the Under line Transparent.
underlineColorAndroid="transparent"
/>
Upvotes: 1
Reputation: 3219
Try overflow:"hidden"
on the TextInput that has borderRadius.
Upvotes: 9
Reputation: 4232
Apply border on View
, parent of TextInput
<View style={styles.borderStyle}>
<TextInput placeholder="Email" style={styles.textInput} />
</View>
Upvotes: 6