react-native: Setting borderStyle on to dashed or dotted for a single side does not render correctly on both iOS and Android
🐛 Bug Report
Setting the CSS property borderStyle to dashed or dotted for a single side on a View component does not work on both iOS and Android.
The docs show available values: https://facebook.github.io/react-native/docs/view-style-props#borderstyle
Android renders solid line for both dashed/dotted

iOS does not render anything for dashed/dotted

To Reproduce
Set a borderStyle css property on a View for a single side like this:
borderLeftWidth: 3,
borderLeftColor: 'red',
borderStyle: 'dashed',
Expected Behavior
A dashed border is rendered correctly on iOS and Android
Code Example
Snack: https://snack.expo.io/@mido/react-native-borderstyle-dashed-and-dotted-broken
Environment
React Native Environment Info:
System:
OS: macOS 10.14.4
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 977.25 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
Yarn: 1.6.0 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 21, 22, 23, 24, 25, 26, 27
Build Tools: 26.0.3, 27.0.3, 28.0.2, 28.0.3
System Images: android-24 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.1 AI-173.4907809
Xcode: 10.2/10E125 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.2 => 0.59.2
npmGlobalPackages:
react-native-log-ios: 1.0.1
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 58
- Comments: 62 (13 by maintainers)
Commits related to this issue
- Merge 0.66 into master (#951) * Rename immediate to ReactNativeMicrotask in Bridge Summary: Changelog: [Internal] This diff replaced all the internal occurrences of "Immediate" with "ReactNat... — committed to microsoft/react-native-macos by HeyImChris 5 years ago
- Upgrade from 0.66.0 to 0.66.4 (#977) * Adding metadata to React Native QPL points Summary: Changelog: [General][Added] - Added data field to markerPoint to allow callers to add additional arbitr... — committed to microsoft/react-native-macos by HeyImChris 5 years ago
temporary fix by this hacker
<View> <Text style={{ marginRight: 10, color: '#006087' }}>Routing Numbers</Text> <View style={{ marginRight: 10, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-evenly', marginTop: -10 }}> <Text>-</Text> <Text>-</Text> <Text>-</Text> <Text>-</Text> <Text>-</Text> <Text>-</Text> <Text>-</Text> <Text>-</Text> <Text>-</Text> <Text>-</Text> <Text>-</Text> <Text>-</Text> <Text>-</Text> <Text>-</Text> <Text>-</Text> </View> </View>Same problem, for now, this hack work for me
style={{ borderWidth: 1, borderStyle: 'dotted', borderColor: '#fff', borderBottomColor: 'red' }}You can set like below for only bottom border: borderWidth: 1, borderLeftWidth: 0, borderRightWidth: 0, borderTopWidth: 0, borderStyle: ‘dashed’
Still an issue on rn 0.63
not four side, just add a single side(left/right/top/bottom), it will render to solid line, no matter change a side borderColor or borderWidth, the dashed or dotted will render to solid line
still have the same issue with
rn 0.60.5Here’s how I got it to work (RN version 59.10)
overflow is amazing
I wrote pull request https://github.com/facebook/react-native/pull/29099 that fixes this issue
After a quick reserach I noticed that we have 25 issues in react-native for this bug https://github.com/facebook/react-native/issues/24224 https://github.com/facebook/react-native/issues/28695 https://github.com/facebook/react-native/issues/23651 https://github.com/facebook/react-native/issues/23475 https://github.com/facebook/react-native/issues/22256 https://github.com/facebook/react-native/issues/22226 https://github.com/facebook/react-native/issues/19234 https://github.com/facebook/react-native/issues/18285 https://github.com/facebook/react-native/issues/17344 https://github.com/facebook/react-native/issues/17343 https://github.com/facebook/react-native/issues/17251 https://github.com/facebook/react-native/issues/12817 https://github.com/facebook/react-native/issues/12403 https://github.com/facebook/react-native/issues/11042 https://github.com/facebook/react-native/issues/9343 https://github.com/facebook/react-native/issues/8236 https://github.com/facebook/react-native/issues/8105 https://github.com/facebook/react-native/issues/7838 https://github.com/facebook/react-native/issues/6721 https://github.com/facebook/react-native/issues/5411 https://github.com/facebook/react-native/issues/3159 https://github.com/facebook/react-native/issues/2335 https://github.com/facebook/react-native/issues/840 https://github.com/facebook/react-native/issues/27133 https://github.com/facebook/react-native/issues/28695
I decided to post this message and trigger linking between all this issues.
Wow. this issue still exist. How about that. Any fix for this? Thanks!
Should be reopened
This works for me for vertical dashed line. Both Android and iOS. But gives double width. “react-native”: “0.59.10”,
Update: (31-Mar-2020)
I finally ended up using
react-native-dash- https://github.com/obipawan/react-native-dash for consistent results in both iOS and androidhack: (inspired from @chinieer’s hack)
Same issue. Are we resolving this anytime soon?
react-native: “0.61.3” still have this issue
still have the issue
I was able to reproduce the issue with the latest release (
0.59.5)Still having issue in RN 0.67.4
@kishanbharda The only solution to this problem so far is to define a borderRadius with a value of 1
This fixes the issue:
https://github.com/facebook/react-native/blob/7e300db7035c98537e0719c88a7c1a451e59e250/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java#L1102-L1105
I’ll write a pull request with a quick fix.
You are right
still have the issue
Heya, this is still an issue with latest
0.60.4.@retyui thanks for the link. This bug is specifically talking about
<View>borderStyle prop which should be supported according to the docs.Tested on
0.59.2as well and it’s still broken.I getting warning Unsupported dashed / dotted border style on the ios.
Still having issue in RN 0.64.3
@euthribeiro I tried but not working in iOS. Same code working for Snack.io but not working in iOS.