├── .flowconfig ├── .gitignore ├── DashedBorder.android.js ├── DashedBorder.ios.js ├── README.md ├── RNDashedBorder.xcodeproj └── project.pbxproj ├── RNDashedBorder ├── RNDashedBorder.h ├── RNDashedBorder.m ├── RNDashedBorderManager.h └── RNDashedBorderManager.m ├── RNDashedBorderTests └── Info.plist ├── index.js └── package.json /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | # We fork some components by platform. 4 | .*/*.web.js 5 | .*/*.android.js 6 | 7 | # Some modules have their own node_modules with overlap 8 | .*/node_modules/node-haste/.* 9 | 10 | # Ignore react-tools where there are overlaps, but don't ignore anything that 11 | # react-native relies on 12 | .*/node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js 13 | .*/node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js 14 | .*/node_modules/react-tools/src/browser/ui/React.js 15 | .*/node_modules/react-tools/src/core/ReactInstanceHandles.js 16 | .*/node_modules/react-tools/src/event/EventPropagators.js 17 | .*/node_modules/flux/lib/invariant.js 18 | 19 | # Ignore jest 20 | .*/node_modules/jest-cli/.* 21 | 22 | # Ignore examples 23 | .*/Examples/.* 24 | 25 | [include] 26 | 27 | [libs] 28 | node_modules/react-native/Libraries/react-native/react-native-interface.js 29 | interfaces.js 30 | 31 | [options] 32 | module.system=haste 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # node.js 26 | # 27 | node_modules/ 28 | npm-debug.log 29 | -------------------------------------------------------------------------------- /DashedBorder.android.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | var React = require('react-native') 4 | var { 5 | View, 6 | } = React 7 | 8 | var DashedBorder = React.createClass({ 9 | render: function() { 10 | var borderStyle = { 11 | borderRadius: 1, // hack for borderStyle. 12 | borderWidth: 1, 13 | borderStyle: 'dashed', 14 | borderColor: this.props.color, 15 | } 16 | return ( 17 | 18 | {this.props.children} 19 | 20 | ) 21 | }, 22 | }) 23 | 24 | module.exports = DashedBorder; 25 | -------------------------------------------------------------------------------- /DashedBorder.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule DashedBorder 3 | * @flow 4 | */ 5 | 6 | 'use strict'; 7 | 8 | var { requireNativeComponent, } = require('react-native'); 9 | var DashedBorder = requireNativeComponent('RNDashedBorder', null); 10 | 11 | module.exports = DashedBorder; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #DEPRECATED 2 | dashed border already works on react native 0.19+. Use `style : { borderStyle: 'dashed' }` in your stylesheet. 3 | 4 | # react-native-dashed-border 5 | 6 | Very simple native component that gives you dashed borders. Copied from brentvatne example [here](https://github.com/brentvatne/react-native-dashed-border-example) 7 | 8 | ### Add it to your ios project 9 | 10 | 1. Run `npm install react-native-dashed-border --save` 11 | 2. Open your project in XCode, right click on `Libraries` and click `Add 12 | Files to "Your Project Name"` [(Screenshot)](http://url.brentvatne.ca/jQp8) then [(Screenshot)](http://url.brentvatne.ca/1gqUD). 13 | 3. Add `libRNDashedBorder.a` to `Build Phases -> Link Binary With Libraries` 14 | [(Screenshot)](http://url.brentvatne.ca/17Xfe). 15 | 4. Whenever you want to use it within React code now you can: `var DashedBorder = require('react-native-dashed-border');` 16 | 17 | ### Add it to your android project 18 | 19 | Just ``npm install react-native-dashed-border`` and require should work. 20 | 21 | ### Note 22 | 1. lineDashPattern is not supported on android. 23 | 24 | ## Example 25 | 26 | ```javascript 27 | var React = require('react-native'); 28 | var DashedBorder = require('react-native-dashed-border'); 29 | 30 | var DashedBorderExampleApp = React.createClass({ 31 | render: function() { 32 | return ( 33 | 34 | 35 | 36 | ); 37 | } 38 | }); 39 | ``` 40 | 41 | ![Demo](https://raw.githubusercontent.com/brentvatne/react-native-dashed-border-example/master/example.png) 42 | 43 | 44 | -------------------------------------------------------------------------------- /RNDashedBorder.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 465C8B611AFBCD9E003B5C69 /* RNDashedBorder.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 465C8B601AFBCD9E003B5C69 /* RNDashedBorder.h */; }; 11 | 465C8B631AFBCD9E003B5C69 /* RNDashedBorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 465C8B621AFBCD9E003B5C69 /* RNDashedBorder.m */; }; 12 | 465C8B691AFBCD9E003B5C69 /* libRNDashedBorder.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 465C8B5D1AFBCD9E003B5C69 /* libRNDashedBorder.a */; }; 13 | 465C8B791AFBD0F8003B5C69 /* RNDashedBorderManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 465C8B781AFBD0F8003B5C69 /* RNDashedBorderManager.m */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXContainerItemProxy section */ 17 | 465C8B6A1AFBCD9E003B5C69 /* PBXContainerItemProxy */ = { 18 | isa = PBXContainerItemProxy; 19 | containerPortal = 465C8B551AFBCD9E003B5C69 /* Project object */; 20 | proxyType = 1; 21 | remoteGlobalIDString = 465C8B5C1AFBCD9E003B5C69; 22 | remoteInfo = RNDashedBorder; 23 | }; 24 | /* End PBXContainerItemProxy section */ 25 | 26 | /* Begin PBXCopyFilesBuildPhase section */ 27 | 465C8B5B1AFBCD9E003B5C69 /* CopyFiles */ = { 28 | isa = PBXCopyFilesBuildPhase; 29 | buildActionMask = 2147483647; 30 | dstPath = "include/$(PRODUCT_NAME)"; 31 | dstSubfolderSpec = 16; 32 | files = ( 33 | 465C8B611AFBCD9E003B5C69 /* RNDashedBorder.h in CopyFiles */, 34 | ); 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXCopyFilesBuildPhase section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 465C8B5D1AFBCD9E003B5C69 /* libRNDashedBorder.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNDashedBorder.a; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 465C8B601AFBCD9E003B5C69 /* RNDashedBorder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNDashedBorder.h; sourceTree = ""; }; 42 | 465C8B621AFBCD9E003B5C69 /* RNDashedBorder.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNDashedBorder.m; sourceTree = ""; }; 43 | 465C8B681AFBCD9E003B5C69 /* RNDashedBorderTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNDashedBorderTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 465C8B6E1AFBCD9E003B5C69 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | 465C8B771AFBD0C6003B5C69 /* RNDashedBorderManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNDashedBorderManager.h; sourceTree = ""; }; 46 | 465C8B781AFBD0F8003B5C69 /* RNDashedBorderManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNDashedBorderManager.m; sourceTree = ""; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | 465C8B5A1AFBCD9E003B5C69 /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | 465C8B651AFBCD9E003B5C69 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | 465C8B691AFBCD9E003B5C69 /* libRNDashedBorder.a in Frameworks */, 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | 465C8B541AFBCD9E003B5C69 = { 69 | isa = PBXGroup; 70 | children = ( 71 | 465C8B5F1AFBCD9E003B5C69 /* RNDashedBorder */, 72 | 465C8B6C1AFBCD9E003B5C69 /* RNDashedBorderTests */, 73 | 465C8B5E1AFBCD9E003B5C69 /* Products */, 74 | ); 75 | sourceTree = ""; 76 | }; 77 | 465C8B5E1AFBCD9E003B5C69 /* Products */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 465C8B5D1AFBCD9E003B5C69 /* libRNDashedBorder.a */, 81 | 465C8B681AFBCD9E003B5C69 /* RNDashedBorderTests.xctest */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 465C8B5F1AFBCD9E003B5C69 /* RNDashedBorder */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 465C8B601AFBCD9E003B5C69 /* RNDashedBorder.h */, 90 | 465C8B621AFBCD9E003B5C69 /* RNDashedBorder.m */, 91 | 465C8B771AFBD0C6003B5C69 /* RNDashedBorderManager.h */, 92 | 465C8B781AFBD0F8003B5C69 /* RNDashedBorderManager.m */, 93 | ); 94 | path = RNDashedBorder; 95 | sourceTree = ""; 96 | }; 97 | 465C8B6C1AFBCD9E003B5C69 /* RNDashedBorderTests */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 465C8B6D1AFBCD9E003B5C69 /* Supporting Files */, 101 | ); 102 | path = RNDashedBorderTests; 103 | sourceTree = ""; 104 | }; 105 | 465C8B6D1AFBCD9E003B5C69 /* Supporting Files */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 465C8B6E1AFBCD9E003B5C69 /* Info.plist */, 109 | ); 110 | name = "Supporting Files"; 111 | sourceTree = ""; 112 | }; 113 | /* End PBXGroup section */ 114 | 115 | /* Begin PBXNativeTarget section */ 116 | 465C8B5C1AFBCD9E003B5C69 /* RNDashedBorder */ = { 117 | isa = PBXNativeTarget; 118 | buildConfigurationList = 465C8B711AFBCD9E003B5C69 /* Build configuration list for PBXNativeTarget "RNDashedBorder" */; 119 | buildPhases = ( 120 | 465C8B591AFBCD9E003B5C69 /* Sources */, 121 | 465C8B5A1AFBCD9E003B5C69 /* Frameworks */, 122 | 465C8B5B1AFBCD9E003B5C69 /* CopyFiles */, 123 | ); 124 | buildRules = ( 125 | ); 126 | dependencies = ( 127 | ); 128 | name = RNDashedBorder; 129 | productName = RNDashedBorder; 130 | productReference = 465C8B5D1AFBCD9E003B5C69 /* libRNDashedBorder.a */; 131 | productType = "com.apple.product-type.library.static"; 132 | }; 133 | 465C8B671AFBCD9E003B5C69 /* RNDashedBorderTests */ = { 134 | isa = PBXNativeTarget; 135 | buildConfigurationList = 465C8B741AFBCD9E003B5C69 /* Build configuration list for PBXNativeTarget "RNDashedBorderTests" */; 136 | buildPhases = ( 137 | 465C8B641AFBCD9E003B5C69 /* Sources */, 138 | 465C8B651AFBCD9E003B5C69 /* Frameworks */, 139 | 465C8B661AFBCD9E003B5C69 /* Resources */, 140 | ); 141 | buildRules = ( 142 | ); 143 | dependencies = ( 144 | 465C8B6B1AFBCD9E003B5C69 /* PBXTargetDependency */, 145 | ); 146 | name = RNDashedBorderTests; 147 | productName = RNDashedBorderTests; 148 | productReference = 465C8B681AFBCD9E003B5C69 /* RNDashedBorderTests.xctest */; 149 | productType = "com.apple.product-type.bundle.unit-test"; 150 | }; 151 | /* End PBXNativeTarget section */ 152 | 153 | /* Begin PBXProject section */ 154 | 465C8B551AFBCD9E003B5C69 /* Project object */ = { 155 | isa = PBXProject; 156 | attributes = { 157 | LastUpgradeCheck = 0710; 158 | ORGANIZATIONNAME = "Chirag Jain"; 159 | TargetAttributes = { 160 | 465C8B5C1AFBCD9E003B5C69 = { 161 | CreatedOnToolsVersion = 6.3.1; 162 | }; 163 | 465C8B671AFBCD9E003B5C69 = { 164 | CreatedOnToolsVersion = 6.3.1; 165 | }; 166 | }; 167 | }; 168 | buildConfigurationList = 465C8B581AFBCD9E003B5C69 /* Build configuration list for PBXProject "RNDashedBorder" */; 169 | compatibilityVersion = "Xcode 3.2"; 170 | developmentRegion = English; 171 | hasScannedForEncodings = 0; 172 | knownRegions = ( 173 | en, 174 | ); 175 | mainGroup = 465C8B541AFBCD9E003B5C69; 176 | productRefGroup = 465C8B5E1AFBCD9E003B5C69 /* Products */; 177 | projectDirPath = ""; 178 | projectRoot = ""; 179 | targets = ( 180 | 465C8B5C1AFBCD9E003B5C69 /* RNDashedBorder */, 181 | 465C8B671AFBCD9E003B5C69 /* RNDashedBorderTests */, 182 | ); 183 | }; 184 | /* End PBXProject section */ 185 | 186 | /* Begin PBXResourcesBuildPhase section */ 187 | 465C8B661AFBCD9E003B5C69 /* Resources */ = { 188 | isa = PBXResourcesBuildPhase; 189 | buildActionMask = 2147483647; 190 | files = ( 191 | ); 192 | runOnlyForDeploymentPostprocessing = 0; 193 | }; 194 | /* End PBXResourcesBuildPhase section */ 195 | 196 | /* Begin PBXSourcesBuildPhase section */ 197 | 465C8B591AFBCD9E003B5C69 /* Sources */ = { 198 | isa = PBXSourcesBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | 465C8B791AFBD0F8003B5C69 /* RNDashedBorderManager.m in Sources */, 202 | 465C8B631AFBCD9E003B5C69 /* RNDashedBorder.m in Sources */, 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | }; 206 | 465C8B641AFBCD9E003B5C69 /* Sources */ = { 207 | isa = PBXSourcesBuildPhase; 208 | buildActionMask = 2147483647; 209 | files = ( 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | }; 213 | /* End PBXSourcesBuildPhase section */ 214 | 215 | /* Begin PBXTargetDependency section */ 216 | 465C8B6B1AFBCD9E003B5C69 /* PBXTargetDependency */ = { 217 | isa = PBXTargetDependency; 218 | target = 465C8B5C1AFBCD9E003B5C69 /* RNDashedBorder */; 219 | targetProxy = 465C8B6A1AFBCD9E003B5C69 /* PBXContainerItemProxy */; 220 | }; 221 | /* End PBXTargetDependency section */ 222 | 223 | /* Begin XCBuildConfiguration section */ 224 | 465C8B6F1AFBCD9E003B5C69 /* Debug */ = { 225 | isa = XCBuildConfiguration; 226 | buildSettings = { 227 | ALWAYS_SEARCH_USER_PATHS = NO; 228 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 229 | CLANG_CXX_LIBRARY = "libc++"; 230 | CLANG_ENABLE_MODULES = YES; 231 | CLANG_ENABLE_OBJC_ARC = YES; 232 | CLANG_WARN_BOOL_CONVERSION = YES; 233 | CLANG_WARN_CONSTANT_CONVERSION = YES; 234 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 235 | CLANG_WARN_EMPTY_BODY = YES; 236 | CLANG_WARN_ENUM_CONVERSION = YES; 237 | CLANG_WARN_INT_CONVERSION = YES; 238 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 239 | CLANG_WARN_UNREACHABLE_CODE = YES; 240 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 241 | COPY_PHASE_STRIP = NO; 242 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 243 | ENABLE_STRICT_OBJC_MSGSEND = YES; 244 | ENABLE_TESTABILITY = YES; 245 | GCC_C_LANGUAGE_STANDARD = gnu99; 246 | GCC_DYNAMIC_NO_PIC = NO; 247 | GCC_NO_COMMON_BLOCKS = YES; 248 | GCC_OPTIMIZATION_LEVEL = 0; 249 | GCC_PREPROCESSOR_DEFINITIONS = ( 250 | "DEBUG=1", 251 | "$(inherited)", 252 | ); 253 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 254 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 255 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 256 | GCC_WARN_UNDECLARED_SELECTOR = YES; 257 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 258 | GCC_WARN_UNUSED_FUNCTION = YES; 259 | GCC_WARN_UNUSED_VARIABLE = YES; 260 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 261 | MTL_ENABLE_DEBUG_INFO = YES; 262 | ONLY_ACTIVE_ARCH = YES; 263 | SDKROOT = iphoneos; 264 | }; 265 | name = Debug; 266 | }; 267 | 465C8B701AFBCD9E003B5C69 /* Release */ = { 268 | isa = XCBuildConfiguration; 269 | buildSettings = { 270 | ALWAYS_SEARCH_USER_PATHS = NO; 271 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 272 | CLANG_CXX_LIBRARY = "libc++"; 273 | CLANG_ENABLE_MODULES = YES; 274 | CLANG_ENABLE_OBJC_ARC = YES; 275 | CLANG_WARN_BOOL_CONVERSION = YES; 276 | CLANG_WARN_CONSTANT_CONVERSION = YES; 277 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 278 | CLANG_WARN_EMPTY_BODY = YES; 279 | CLANG_WARN_ENUM_CONVERSION = YES; 280 | CLANG_WARN_INT_CONVERSION = YES; 281 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 282 | CLANG_WARN_UNREACHABLE_CODE = YES; 283 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 284 | COPY_PHASE_STRIP = NO; 285 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 286 | ENABLE_NS_ASSERTIONS = NO; 287 | ENABLE_STRICT_OBJC_MSGSEND = YES; 288 | GCC_C_LANGUAGE_STANDARD = gnu99; 289 | GCC_NO_COMMON_BLOCKS = YES; 290 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 291 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 292 | GCC_WARN_UNDECLARED_SELECTOR = YES; 293 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 294 | GCC_WARN_UNUSED_FUNCTION = YES; 295 | GCC_WARN_UNUSED_VARIABLE = YES; 296 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 297 | MTL_ENABLE_DEBUG_INFO = NO; 298 | SDKROOT = iphoneos; 299 | VALIDATE_PRODUCT = YES; 300 | }; 301 | name = Release; 302 | }; 303 | 465C8B721AFBCD9E003B5C69 /* Debug */ = { 304 | isa = XCBuildConfiguration; 305 | buildSettings = { 306 | HEADER_SEARCH_PATHS = ( 307 | "$(inherited)", 308 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 309 | "$(SRCROOT)/node_modules/react-native/React/**", 310 | "$(SRCROOT)/../react-native/React/**", 311 | ); 312 | OTHER_LDFLAGS = "-ObjC"; 313 | PRODUCT_NAME = "$(TARGET_NAME)"; 314 | SKIP_INSTALL = YES; 315 | }; 316 | name = Debug; 317 | }; 318 | 465C8B731AFBCD9E003B5C69 /* Release */ = { 319 | isa = XCBuildConfiguration; 320 | buildSettings = { 321 | HEADER_SEARCH_PATHS = ( 322 | "$(inherited)", 323 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 324 | "$(SRCROOT)/node_modules/react-native/React/**", 325 | "$(SRCROOT)/../react-native/React/**", 326 | ); 327 | OTHER_LDFLAGS = "-ObjC"; 328 | PRODUCT_NAME = "$(TARGET_NAME)"; 329 | SKIP_INSTALL = YES; 330 | }; 331 | name = Release; 332 | }; 333 | 465C8B751AFBCD9E003B5C69 /* Debug */ = { 334 | isa = XCBuildConfiguration; 335 | buildSettings = { 336 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 337 | FRAMEWORK_SEARCH_PATHS = ( 338 | "$(SDKROOT)/Developer/Library/Frameworks", 339 | "$(inherited)", 340 | ); 341 | GCC_PREPROCESSOR_DEFINITIONS = ( 342 | "DEBUG=1", 343 | "$(inherited)", 344 | ); 345 | INFOPLIST_FILE = RNDashedBorderTests/Info.plist; 346 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 347 | PRODUCT_BUNDLE_IDENTIFIER = "cj.$(PRODUCT_NAME:rfc1034identifier)"; 348 | PRODUCT_NAME = "$(TARGET_NAME)"; 349 | }; 350 | name = Debug; 351 | }; 352 | 465C8B761AFBCD9E003B5C69 /* Release */ = { 353 | isa = XCBuildConfiguration; 354 | buildSettings = { 355 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 356 | FRAMEWORK_SEARCH_PATHS = ( 357 | "$(SDKROOT)/Developer/Library/Frameworks", 358 | "$(inherited)", 359 | ); 360 | INFOPLIST_FILE = RNDashedBorderTests/Info.plist; 361 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 362 | PRODUCT_BUNDLE_IDENTIFIER = "cj.$(PRODUCT_NAME:rfc1034identifier)"; 363 | PRODUCT_NAME = "$(TARGET_NAME)"; 364 | }; 365 | name = Release; 366 | }; 367 | /* End XCBuildConfiguration section */ 368 | 369 | /* Begin XCConfigurationList section */ 370 | 465C8B581AFBCD9E003B5C69 /* Build configuration list for PBXProject "RNDashedBorder" */ = { 371 | isa = XCConfigurationList; 372 | buildConfigurations = ( 373 | 465C8B6F1AFBCD9E003B5C69 /* Debug */, 374 | 465C8B701AFBCD9E003B5C69 /* Release */, 375 | ); 376 | defaultConfigurationIsVisible = 0; 377 | defaultConfigurationName = Release; 378 | }; 379 | 465C8B711AFBCD9E003B5C69 /* Build configuration list for PBXNativeTarget "RNDashedBorder" */ = { 380 | isa = XCConfigurationList; 381 | buildConfigurations = ( 382 | 465C8B721AFBCD9E003B5C69 /* Debug */, 383 | 465C8B731AFBCD9E003B5C69 /* Release */, 384 | ); 385 | defaultConfigurationIsVisible = 0; 386 | defaultConfigurationName = Release; 387 | }; 388 | 465C8B741AFBCD9E003B5C69 /* Build configuration list for PBXNativeTarget "RNDashedBorderTests" */ = { 389 | isa = XCConfigurationList; 390 | buildConfigurations = ( 391 | 465C8B751AFBCD9E003B5C69 /* Debug */, 392 | 465C8B761AFBCD9E003B5C69 /* Release */, 393 | ); 394 | defaultConfigurationIsVisible = 0; 395 | defaultConfigurationName = Release; 396 | }; 397 | /* End XCConfigurationList section */ 398 | }; 399 | rootObject = 465C8B551AFBCD9E003B5C69 /* Project object */; 400 | } 401 | -------------------------------------------------------------------------------- /RNDashedBorder/RNDashedBorder.h: -------------------------------------------------------------------------------- 1 | // 2 | // RNDashedBorder.h 3 | // RNDashedBorder 4 | // 5 | // Created by Chirag Jain on 5/7/15. 6 | // Copyright (c) 2015 Chirag Jain. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "RCTView.h" 11 | 12 | @interface RNDashedBorder : RCTView 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /RNDashedBorder/RNDashedBorder.m: -------------------------------------------------------------------------------- 1 | // 2 | // RNDashedBorder.m 3 | // RNDashedBorder 4 | // 5 | // Created by Chirag Jain on 5/7/15. 6 | // Copyright (c) 2015 Chirag Jain. All rights reserved. 7 | // 8 | 9 | #import "RNDashedBorder.h" 10 | #import "RCTConvert.h" 11 | #import 12 | #import 13 | 14 | @implementation RNDashedBorder { 15 | CAShapeLayer *_border; 16 | } 17 | 18 | - (instancetype)init 19 | { 20 | if ((self = [super init])) { 21 | _border = [CAShapeLayer layer]; 22 | _border.fillColor = nil; 23 | [self.layer addSublayer:_border]; 24 | } 25 | 26 | return self; 27 | } 28 | 29 | - (void)layoutSubviews 30 | { 31 | [super layoutSubviews]; 32 | _border.path = [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:self.borderRadius].CGPath; 33 | _border.frame = self.bounds; 34 | } 35 | 36 | - (void)setColor:(NSNumber *)colorString 37 | { 38 | _border.strokeColor = [RCTConvert UIColor:colorString].CGColor; 39 | } 40 | 41 | - (void)setLineDashPattern:(NSArray *)pattern 42 | { 43 | _border.lineDashPattern = pattern; 44 | } 45 | 46 | - (void)setLineWidth:(NSNumber *)lineWidth 47 | { 48 | _border.lineWidth = [RCTConvert CGFloat:lineWidth]; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /RNDashedBorder/RNDashedBorderManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // RNDashedBorderManager.h 3 | // RNDashedBorder 4 | // 5 | // Created by Chirag Jain on 5/7/15. 6 | // Copyright (c) 2015 Chirag Jain. All rights reserved. 7 | // 8 | 9 | #import "RCTViewManager.h" 10 | 11 | @interface RNDashedBorderManager : RCTViewManager 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /RNDashedBorder/RNDashedBorderManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // RNDashedBorderManager.m 3 | // RNDashedBorder 4 | // 5 | // Created by Chirag Jain on 5/7/15. 6 | // Copyright (c) 2015 Chirag Jain. All rights reserved. 7 | // 8 | 9 | #import "RNDashedBorderManager.h" 10 | #import "RNDashedBorder.h" 11 | #import "RCTBridge.h" 12 | 13 | @implementation RNDashedBorderManager 14 | 15 | RCT_EXPORT_MODULE(); 16 | 17 | @synthesize bridge = _bridge; 18 | 19 | - (UIView *)view 20 | { 21 | return [[RNDashedBorder alloc] init]; 22 | } 23 | 24 | - (dispatch_queue_t)methodQueue 25 | { 26 | return dispatch_get_main_queue(); 27 | } 28 | 29 | RCT_EXPORT_VIEW_PROPERTY(color, NSNumber); 30 | RCT_EXPORT_VIEW_PROPERTY(lineWidth, NSNumber); 31 | RCT_EXPORT_VIEW_PROPERTY(lineDashPattern, NSArray); 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /RNDashedBorderTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var React = require('react-native'); 2 | var { Platform } = React; 3 | 4 | if (Platform.OS === 'android') { 5 | module.exports = require('./DashedBorder.android'); 6 | } else if (Platform.OS === 'ios') { 7 | module.exports = require('./DashedBorder.ios'); 8 | } 9 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-dashed-border", 3 | "version": "2.1.1", 4 | "description": "A element for react-native", 5 | "author": { 6 | "name": "Chirag Jain", 7 | "email": "jain_chirag04@yahoo.com", 8 | "url": "http://chiragjain.tumblr.com" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git@github.com:chirag04/react-native-dashed-border.git" 13 | }, 14 | "keywords": [ 15 | "react", 16 | "react-native", 17 | "react-component", 18 | "ios", 19 | "android", 20 | "dashed border", 21 | "uiview", 22 | "view" 23 | ] 24 | } 25 | --------------------------------------------------------------------------------