question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`borderStyle` has no effect on Android, border is always solid

See original GitHub issue

Setting borderStyle has no effect on Android. Regardless of the setting, the border will always be solid.

Environment

Environment:
  OS: macOS Sierra 10.12.6
  Node: 7.10.1
  Yarn: 1.2.1
  npm: 4.2.0
  Watchman: 4.5.0
  Xcode: Xcode 9.2 Build version 9C40b
  Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
  react: 16.2.0 => 16.2.0
  react-native: 0.54.0 => 0.54.0

Expected Behavior

When setting the borderStyle to “dashed” or “dotted”, I expect the view to have a dashed or dotted border. This works correctly on iOS:

image

Actual Behavior

Regardless of setting, the border is solid on Android:

image

Steps to Reproduce

Create a View with styles specifying a borderWidth, borderColor, and borderStyle (borderRadius was also set, since there seem to be existing issues with the border when borderRadius is not specified).

This component will reproduce the issue:

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

export default class App extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <Text>Open up App.js to start working on your app!</Text>
        <Text>Changes you make will automatically reload.</Text>
        <Text>Shake your phone to open the developer menu.</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
    marginVertical: 200,
    marginHorizontal: 20,
    borderColor: '#000',
    borderRadius: 5,
    borderWidth: 5,
    borderStyle: 'dashed'
  },
});

An Expo Snack is also available that reproduces the issue: https://snack.expo.io/r1NCAukKf

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

11reactions
sahandevscommented, Apr 16, 2018

I’m facing this issue on RN 0.55.2 too

4reactions
hramoscommented, May 24, 2018

It’s a known issue - no need to add more “me too” comments for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does a CSS border look different on Android?
How some devices render '1px' with multiple pixels and it is not always pretty because they are using different pixel ratios (dpr) such...
Read more >
Borders (Cascading Style Sheets: The Definitive Guide)
Despite this, the reason you don't usually see borders is that the default style is none, which prevents them from existing. If a...
Read more >
border-style - CSS: Cascading Style Sheets - MDN Web Docs
Displays a border with an extruded appearance. It is the opposite of groove . inset. Displays a border that makes the element appear...
Read more >
Learn To Create Border Style in React Native - eduCBA
Here we discuss how we can create Border Style in React Native with Syntax and ... you can combine border styles to create...
Read more >
CSS Border - Javatpoint
Note: The border-color property is not used alone. It is always used with other border properties like "border-style" property to set the border...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found