borderStyle: 'dashed' doesn't work correctly
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 127k
- Forks
- 25.3k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 4
Description
Description
Dear Developers:
I am trying to control the style of View.
When 'Dashed' pressed, the style of View will be changed, especially the borderStyle will be set as 'dashed'.
The problem is, when I run this on iOS devices, the dashed border line and the solid border line are coexisted. It only appears when overflow is set as 'hidden'

Waiting for your answer : )
import React, { useState } from 'react';
import { Text, View, StyleSheet } from 'react-native';
const styles = StyleSheet.create({
item: {
width: 100,
height: 100,
borderWidth: 1,
borderColor: 'gray',
borderRadius: 4,
overflow: 'hidden'
},
addItem: {
width: 100,
height: 100,
borderWidth: 3,
borderColor: 'red',
borderRadius: 4,
borderStyle: 'dashed',
overflow: 'visible'
}
})
const HelloWorldApp: React.FC = () => {
const [st, setSt] = useState(styles.item)
return (
<View
style={{
flex: 1,
justifyContent: "center",
alignItems: "center"
}}>
<Text>Hello, world!</Text>
<View style={st}/>
<Text onPress={() => {
setSt(styles.addItem)
}}>Dashed</Text>
<Text onPress={() => {
setSt(styles.item)
}}>Reset</Text>
</View>
)
}
export default HelloWorldApp;
Version
0.66.00
Output of npx react-native info
I dont have any info because I reproduced this problem on reactnative.dev/docs/tutorial
Steps to reproduce
You can paste code here reactnative.dev, where I met this problem.
Run with iOS device and click the 'Dashed' Text, you will met same problem, I think.
import React, { useState } from 'react';
import { Text, View, StyleSheet } from 'react-native';
const styles = StyleSheet.create({
item: {
width: 100,
height: 100,
borderWidth: 1,
borderColor: 'gray',
borderRadius: 4,
overflow: 'hidden'
},
addItem: {
width: 100,
height: 100,
borderWidth: 3,
borderColor: 'red',
borderRadius: 4,
borderStyle: 'dashed',
overflow: 'visible'
}
})
const HelloWorldApp: React.FC = () => {
const [st, setSt] = useState(styles.item)
return (
<View
style={{
flex: 1,
justifyContent: "center",
alignItems: "center"
}}>
<Text>Hello, world!</Text>
<View style={st}/>
<Text onPress={() => {
setSt(styles.addItem)
}}>Dashed</Text>
<Text onPress={() => {
setSt(styles.item)
}}>Reset</Text>
</View>
)
}
export default HelloWorldApp;
Snack, code example, screenshot, or link to a repository
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied View reproduction and run it on an iOS device, focusing on the interaction between borderStyle, borderWidth, borderRadius, and overflow. The issue is done when changing from the solid to dashed style no longer leaves a solid border visible when overflow is hidden.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100