react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Android borderLeftWidth and borderLeftColor broken

Open Jpoliachik opened this issue 10 years ago • 10 comments

I am attempting to use a css trick to produce triangles using the code:

'use strict';

var React = require('react-native');
var {
  AppRegistry,
  StyleSheet,
  Text,
  View,
} = React;

var SampleApp = React.createClass({
  render: function() {
    return (
      <View style={styles.container}>
        <View style={styles.triangle}/>
      </View>
    );
  }
});

var styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  triangle: {
     width: 0,
     height: 0,
     backgroundColor: 'transparent',
     borderStyle: 'solid',
     overflow: 'hidden',
     borderTopWidth: 50,
     borderRightWidth: 0,
     borderBottomWidth: 50,
     borderLeftWidth: 100,
     borderTopColor: 'transparent',
     borderRightColor: 'transparent',
     borderBottomColor: 'transparent',
     borderLeftColor: 'red',
   },
});

AppRegistry.registerComponent('SampleApp', () => SampleApp);

In iOS this produces: screen shot 2016-01-19 at 10 41 26 am

But in Android, it only shows a black square: screen shot 2016-01-19 at 10 40 21 am

Does Android support using these styles? It doesn't seem to like borderLeftWidth, borderLeftColor, etc.

I don't see anything related in the documented Known Issues.

Edit: The screenshots are from RNPlay running react-native 0.13.0-rc.

Jpoliachik avatar Jan 19 '16 15:01 Jpoliachik

Hey Jpoliachik, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If you don't know how to do something or something is not working as you expect but not sure it's a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!

facebook-github-bot avatar Jan 19 '16 15:01 facebook-github-bot

Just had a look at the code and these are not currently supported on Android. Have filed a task internally (t9789502) to look further at supporting it at some point.

dmmiller avatar Jan 22 '16 16:01 dmmiller

Anyone up for doing a PR for this?

dmmiller avatar Jan 22 '16 16:01 dmmiller

anyone doing this already?

hyugit avatar Feb 05 '16 19:02 hyugit

hey!!! anyone doing this already?

openGeeksLab avatar Feb 11 '16 14:02 openGeeksLab

Not that I know of. Feel free to jump on it :)

dmmiller avatar Feb 11 '16 14:02 dmmiller

@mobileDevNativeCross , @dmmiller , I did some digging last weekend, it seems we can do it here at Line 348.

The reasoning is that if we are drawing rectangles, we never gonna have any triangle any where.

However, if we are to use canvas.drawPath, instead of canvas.drawRect, we will be changing the default behavior of all the borders with different colors. I wonder if that is what we want.

Would love to have your options.

btw, I haven't started yet. So feel free to jump on it.

hyugit avatar Feb 11 '16 17:02 hyugit

Please take a look at PR #5911 @mobileDevNativeCross @dmmiller

Thanks,

Huang

hyugit avatar Feb 13 '16 22:02 hyugit

I think this issue can be closed by #5911 , right?

hyugit avatar Feb 21 '16 17:02 hyugit

Appears to fixed via https://github.com/facebook/react-native/commit/a6a4389bf4a581de5adfe0e5dda4aa4f70438dfc

Feel free to re-open if problem persists.

christopherdro avatar Apr 10 '16 18:04 christopherdro