Awesome
#DEPRECATED
dashed border already works on react native 0.19+. Use style : { borderStyle: 'dashed' }
in your stylesheet.
react-native-dashed-border
Very simple native component that gives you dashed borders. Copied from brentvatne example here
Add it to your ios project
- Run
npm install react-native-dashed-border --save
- Open your project in XCode, right click on
Libraries
and clickAdd Files to "Your Project Name"
(Screenshot) then (Screenshot). - Add
libRNDashedBorder.a
toBuild Phases -> Link Binary With Libraries
(Screenshot). - Whenever you want to use it within React code now you can:
var DashedBorder = require('react-native-dashed-border');
Add it to your android project
Just npm install react-native-dashed-border
and require should work.
Note
- lineDashPattern is not supported on android.
Example
var React = require('react-native');
var DashedBorder = require('react-native-dashed-border');
var DashedBorderExampleApp = React.createClass({
render: function() {
return (
<DashedBorder color={React.processColor('#343434')} lineDashPattern={[4,2]} lineWidth={1.5} style={styles.container}>
<Image source={require('image!announcement')} style={styles.image} />
</DashedBorder>
);
}
});