├── .flowconfig ├── .gitignore ├── .watchmanconfig ├── Examples └── FullExample │ ├── index.ios.js │ ├── ios │ ├── ReactNativeFancyLabel.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── ReactNativeFancyLabel.xcscheme │ ├── ReactNativeFancyLabel │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ └── ReactNativeFancyLabelTests │ │ ├── Info.plist │ │ └── ReactNativeFancyLabelTests.m │ └── package.json ├── FancyLabel - iOS ├── LICENSE.md ├── MFLReactFancyLabel.h ├── MFLReactFancyLabel.m ├── MFLReactFancyLabelManager.h ├── MFLReactFancyLabelManager.m ├── THLabel.h └── THLabel.m ├── LICENSE ├── MFLReactFancyLabel.xcodeproj └── project.pbxproj ├── README.md ├── android ├── app │ ├── build.gradle │ ├── proguard-rules.pro │ ├── react.gradle │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── reactnativefancylabel │ │ │ └── MainActivity.java │ │ └── res │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ └── values │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── index.android.js └── settings.gradle ├── index.ios.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 | # Ugh 11 | .*/node_modules/babel.* 12 | .*/node_modules/babylon.* 13 | .*/node_modules/invariant.* 14 | 15 | # Ignore react and fbjs where there are overlaps, but don't ignore 16 | # anything that react-native relies on 17 | .*/node_modules/fbjs-haste/.*/__tests__/.* 18 | .*/node_modules/fbjs-haste/__forks__/Map.js 19 | .*/node_modules/fbjs-haste/__forks__/Promise.js 20 | .*/node_modules/fbjs-haste/__forks__/fetch.js 21 | .*/node_modules/fbjs-haste/core/ExecutionEnvironment.js 22 | .*/node_modules/fbjs-haste/core/isEmpty.js 23 | .*/node_modules/fbjs-haste/crypto/crc32.js 24 | .*/node_modules/fbjs-haste/stubs/ErrorUtils.js 25 | .*/node_modules/react-haste/React.js 26 | .*/node_modules/react-haste/renderers/dom/ReactDOM.js 27 | .*/node_modules/react-haste/renderers/shared/event/eventPlugins/ResponderEventPlugin.js 28 | 29 | # Ignore commoner tests 30 | .*/node_modules/commoner/test/.* 31 | 32 | # See https://github.com/facebook/flow/issues/442 33 | .*/react-tools/node_modules/commoner/lib/reader.js 34 | 35 | # Ignore jest 36 | .*/node_modules/jest-cli/.* 37 | 38 | # Ignore Website 39 | .*/website/.* 40 | 41 | [include] 42 | 43 | [libs] 44 | node_modules/react-native/Libraries/react-native/react-native-interface.js 45 | 46 | [options] 47 | module.system=haste 48 | 49 | munge_underscores=true 50 | 51 | module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' 52 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.png$' -> 'RelativeImageStub' 53 | 54 | suppress_type=$FlowIssue 55 | suppress_type=$FlowFixMe 56 | suppress_type=$FixMe 57 | 58 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 59 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)? #[0-9]+ 60 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 61 | 62 | [version] 63 | 0.19.0 64 | -------------------------------------------------------------------------------- /.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 | # Android/IJ 26 | # 27 | .idea 28 | .gradle 29 | local.properties 30 | 31 | # node.js 32 | # 33 | node_modules/ 34 | npm-debug.log 35 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Examples/FullExample/index.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | */ 5 | 'use strict'; 6 | 7 | var React = require('react-native'); 8 | var FancyLabel = require('react-native-fancy-label'); 9 | 10 | var { 11 | AppRegistry, 12 | StyleSheet, 13 | Text, 14 | View, 15 | } = React; 16 | 17 | var ReactNativeFancyLabelExample = React.createClass({ 18 | render: function() { 19 | 20 | var useAllProps = { 21 | fadeTruncatingMode: "None", 22 | textInsets: {top:0, left:0, bottom:0, right:0}, 23 | automaticallyAdjustTextInsets: false, 24 | letterSpacing: 2, 25 | adjustsFontSizeToFitWidth: true, 26 | baselineAdjustment: "AlignCenters", 27 | minimumScaleFactor: .5, 28 | textAlign:"center", 29 | 30 | strokeSize: 2, 31 | strokeColor: '#003355', 32 | strokePosition: "Outside", 33 | 34 | innerTextShadowOffset: {x:-1, y:-1}, 35 | innerTextShadowBlur: 1, 36 | innerTextShadowColor: 'rgba(0, 0, 0, .4)', 37 | 38 | textShadowOffset: {x:0, y:2}, 39 | textShadowBlur: 0, 40 | textShadowColor: '#000088', 41 | gradientStartPoint: {x:0.0, y:0.0}, 42 | gradientEndPoint: {x:.0, y:0.5}, 43 | gradientColors: ["#6ac141", "#35a1a2", "#a12cd2"], 44 | 45 | fontFamily: "HelveticaNeue-CondensedBlack", 46 | fontSize: 48, 47 | }; 48 | 49 | return ( 50 | 51 | 52 | {"Skillz Skillz Skillz"} 53 | 54 | {"Skillz"} 55 | {"Skillz!"} 56 | 57 | {/* 58 | 59 | 60 | {"Skillz Skillz Skillz"} 61 | 62 | {"Skillz"} 63 | {"Skillz"} 64 | */} 65 | 66 | ); 67 | } 68 | }); 69 | 70 | var styles = StyleSheet.create({ 71 | container: { 72 | flex: 1, 73 | flexDirection: 'column', 74 | justifyContent: 'center', 75 | alignItems: 'center', 76 | backgroundColor: '#F5FCFF', 77 | }, 78 | welcome: { 79 | fontSize: 20, 80 | textAlign: 'center', 81 | margin: 10, 82 | }, 83 | instructions: { 84 | textAlign: 'center', 85 | color: '#333333', 86 | marginBottom: 5, 87 | }, 88 | allStyles : { 89 | fadeTruncatingMode: "None", 90 | textInsets: {top:0, left:0, bottom:0, right:0}, 91 | automaticallyAdjustTextInsets: false, 92 | letterSpacing: 2, 93 | adjustsFontSizeToFitWidth: true, 94 | baselineAdjustment: "AlignCenters", 95 | minimumScaleFactor: .5, 96 | textAlign:"center", 97 | 98 | strokeSize: 2, 99 | strokeColor: '#003355', 100 | strokePosition: "Outside", 101 | 102 | innerTextShadowOffset: {x:-1, y:-1}, 103 | innerTextShadowBlur: 1, 104 | innerTextShadowColor: 'rgba(0, 0, 0, .4)', 105 | 106 | textShadowOffset: {x:0, y:2}, 107 | textShadowBlur: 0, 108 | textShadowColor: '#000088', 109 | gradientStartPoint: {x:0.0, y:0.0}, 110 | gradientEndPoint: {x:.0, y:0.5}, 111 | gradientColors: ["#6ac141", "#35a1a2", "#a12cd2"], 112 | 113 | fontFamily: "HelveticaNeue-CondensedBlack", 114 | fontSize: 48, 115 | }, 116 | gradientStyle : { 117 | gradientColors: ["red", "orange", "yellow"], 118 | adjustsFontSizeToFitWidth : false, 119 | fontFamily: "HelveticaNeue-CondensedBlack", 120 | strokeSize: 1, 121 | strokeColor: "gray", 122 | fontSize: 132, 123 | flex: 1, 124 | }, 125 | textAllStyles : { 126 | fontFamily: "HelveticaNeue-CondensedBlack", 127 | fontSize: 48, 128 | 129 | }, 130 | gradientSmallStyle : { 131 | flex: 1, 132 | gradientColors: ["red", "orange", "yellow"], 133 | adjustsFontSizeToFitWidth : true, 134 | fontFamily: "HelveticaNeue-CondensedBlack", 135 | strokeSize: 1, 136 | width: 150, 137 | strokeColor: "gray", 138 | fontSize: 132, 139 | 140 | }, 141 | textStyle : { 142 | adjustsFontSizeToFitWidth : false, 143 | fontFamily: "HelveticaNeue-CondensedBlack", 144 | fontSize: 132, 145 | flex: 1, 146 | }, 147 | textSmallStyle : { 148 | adjustsFontSizeToFitWidth : false, 149 | fontFamily: "HelveticaNeue-CondensedBlack", 150 | strokeSize: 1, 151 | strokeColor: "gray", 152 | fontSize: 132, 153 | flex: 1, 154 | }, 155 | 156 | }); 157 | 158 | AppRegistry.registerComponent('ReactNativeFancyLabelExample', () => ReactNativeFancyLabelExample); 159 | -------------------------------------------------------------------------------- /Examples/FullExample/ios/ReactNativeFancyLabel.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; 11 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; 12 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; }; 13 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; }; 14 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; }; 15 | 00E356F31AD99517003FC87E /* ReactNativeFancyLabelTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* ReactNativeFancyLabelTests.m */; }; 16 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; }; 17 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; }; 18 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; }; 19 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 20 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; 21 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 22 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 23 | 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 24 | 4F77B8681C6C57FE0080288E /* libMFLReactFancyLabel.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F77B84F1C6C532F0080288E /* libMFLReactFancyLabel.a */; }; 25 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; 32 | proxyType = 2; 33 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 34 | remoteInfo = RCTActionSheet; 35 | }; 36 | 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = { 37 | isa = PBXContainerItemProxy; 38 | containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; 39 | proxyType = 2; 40 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 41 | remoteInfo = RCTGeolocation; 42 | }; 43 | 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = { 44 | isa = PBXContainerItemProxy; 45 | containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 46 | proxyType = 2; 47 | remoteGlobalIDString = 58B5115D1A9E6B3D00147676; 48 | remoteInfo = RCTImage; 49 | }; 50 | 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = { 51 | isa = PBXContainerItemProxy; 52 | containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 53 | proxyType = 2; 54 | remoteGlobalIDString = 58B511DB1A9E6C8500147676; 55 | remoteInfo = RCTNetwork; 56 | }; 57 | 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = { 58 | isa = PBXContainerItemProxy; 59 | containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; 60 | proxyType = 2; 61 | remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; 62 | remoteInfo = RCTVibration; 63 | }; 64 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { 65 | isa = PBXContainerItemProxy; 66 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 67 | proxyType = 1; 68 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A; 69 | remoteInfo = ReactNativeFancyLabel; 70 | }; 71 | 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = { 72 | isa = PBXContainerItemProxy; 73 | containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 74 | proxyType = 2; 75 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 76 | remoteInfo = RCTSettings; 77 | }; 78 | 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = { 79 | isa = PBXContainerItemProxy; 80 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 81 | proxyType = 2; 82 | remoteGlobalIDString = 3C86DF461ADF2C930047B81A; 83 | remoteInfo = RCTWebSocket; 84 | }; 85 | 146834031AC3E56700842450 /* PBXContainerItemProxy */ = { 86 | isa = PBXContainerItemProxy; 87 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 88 | proxyType = 2; 89 | remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; 90 | remoteInfo = React; 91 | }; 92 | 4F77B84E1C6C532F0080288E /* PBXContainerItemProxy */ = { 93 | isa = PBXContainerItemProxy; 94 | containerPortal = 4F77B84A1C6C532F0080288E /* MFLReactFancyLabel.xcodeproj */; 95 | proxyType = 2; 96 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 97 | remoteInfo = MFLReactFancyLabel; 98 | }; 99 | 4F77B85B1C6C55EC0080288E /* PBXContainerItemProxy */ = { 100 | isa = PBXContainerItemProxy; 101 | containerPortal = 4F77B84A1C6C532F0080288E /* MFLReactFancyLabel.xcodeproj */; 102 | proxyType = 1; 103 | remoteGlobalIDString = 58B511DA1A9E6C8500147676; 104 | remoteInfo = MFLReactFancyLabel; 105 | }; 106 | 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { 107 | isa = PBXContainerItemProxy; 108 | containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 109 | proxyType = 2; 110 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 111 | remoteInfo = RCTLinking; 112 | }; 113 | 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = { 114 | isa = PBXContainerItemProxy; 115 | containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 116 | proxyType = 2; 117 | remoteGlobalIDString = 58B5119B1A9E6C1200147676; 118 | remoteInfo = RCTText; 119 | }; 120 | /* End PBXContainerItemProxy section */ 121 | 122 | /* Begin PBXFileReference section */ 123 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; 124 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; }; 125 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; }; 126 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; }; 127 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; }; 128 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; }; 129 | 00E356EE1AD99517003FC87E /* ReactNativeFancyLabelTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ReactNativeFancyLabelTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 130 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 131 | 00E356F21AD99517003FC87E /* ReactNativeFancyLabelTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReactNativeFancyLabelTests.m; sourceTree = ""; }; 132 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; }; 133 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; }; 134 | 13B07F961A680F5B00A75B9A /* ReactNativeFancyLabel.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ReactNativeFancyLabel.app; sourceTree = BUILT_PRODUCTS_DIR; }; 135 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = ReactNativeFancyLabel/AppDelegate.h; sourceTree = ""; }; 136 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = ReactNativeFancyLabel/AppDelegate.m; sourceTree = ""; }; 137 | 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 138 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = ReactNativeFancyLabel/Images.xcassets; sourceTree = ""; }; 139 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ReactNativeFancyLabel/Info.plist; sourceTree = ""; }; 140 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = ReactNativeFancyLabel/main.m; sourceTree = ""; }; 141 | 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; 142 | 4F77B84A1C6C532F0080288E /* MFLReactFancyLabel.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = MFLReactFancyLabel.xcodeproj; path = ../../../MFLReactFancyLabel.xcodeproj; sourceTree = ""; }; 143 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; 144 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; 145 | /* End PBXFileReference section */ 146 | 147 | /* Begin PBXFrameworksBuildPhase section */ 148 | 00E356EB1AD99517003FC87E /* Frameworks */ = { 149 | isa = PBXFrameworksBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | ); 153 | runOnlyForDeploymentPostprocessing = 0; 154 | }; 155 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 156 | isa = PBXFrameworksBuildPhase; 157 | buildActionMask = 2147483647; 158 | files = ( 159 | 4F77B8681C6C57FE0080288E /* libMFLReactFancyLabel.a in Frameworks */, 160 | 146834051AC3E58100842450 /* libReact.a in Frameworks */, 161 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, 162 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, 163 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, 164 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, 165 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */, 166 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, 167 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, 168 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 169 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, 170 | ); 171 | runOnlyForDeploymentPostprocessing = 0; 172 | }; 173 | /* End PBXFrameworksBuildPhase section */ 174 | 175 | /* Begin PBXGroup section */ 176 | 00C302A81ABCB8CE00DB3ED1 /* Products */ = { 177 | isa = PBXGroup; 178 | children = ( 179 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */, 180 | ); 181 | name = Products; 182 | sourceTree = ""; 183 | }; 184 | 00C302B61ABCB90400DB3ED1 /* Products */ = { 185 | isa = PBXGroup; 186 | children = ( 187 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */, 188 | ); 189 | name = Products; 190 | sourceTree = ""; 191 | }; 192 | 00C302BC1ABCB91800DB3ED1 /* Products */ = { 193 | isa = PBXGroup; 194 | children = ( 195 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, 196 | ); 197 | name = Products; 198 | sourceTree = ""; 199 | }; 200 | 00C302D41ABCB9D200DB3ED1 /* Products */ = { 201 | isa = PBXGroup; 202 | children = ( 203 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, 204 | ); 205 | name = Products; 206 | sourceTree = ""; 207 | }; 208 | 00C302E01ABCB9EE00DB3ED1 /* Products */ = { 209 | isa = PBXGroup; 210 | children = ( 211 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */, 212 | ); 213 | name = Products; 214 | sourceTree = ""; 215 | }; 216 | 00E356EF1AD99517003FC87E /* ReactNativeFancyLabelTests */ = { 217 | isa = PBXGroup; 218 | children = ( 219 | 00E356F21AD99517003FC87E /* ReactNativeFancyLabelTests.m */, 220 | 00E356F01AD99517003FC87E /* Supporting Files */, 221 | ); 222 | path = ReactNativeFancyLabelTests; 223 | sourceTree = ""; 224 | }; 225 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 226 | isa = PBXGroup; 227 | children = ( 228 | 00E356F11AD99517003FC87E /* Info.plist */, 229 | ); 230 | name = "Supporting Files"; 231 | sourceTree = ""; 232 | }; 233 | 139105B71AF99BAD00B5F7CC /* Products */ = { 234 | isa = PBXGroup; 235 | children = ( 236 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, 237 | ); 238 | name = Products; 239 | sourceTree = ""; 240 | }; 241 | 139FDEE71B06529A00C62182 /* Products */ = { 242 | isa = PBXGroup; 243 | children = ( 244 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, 245 | ); 246 | name = Products; 247 | sourceTree = ""; 248 | }; 249 | 13B07FAE1A68108700A75B9A /* ReactNativeFancyLabel */ = { 250 | isa = PBXGroup; 251 | children = ( 252 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 253 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 254 | 13B07FB01A68108700A75B9A /* AppDelegate.m */, 255 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 256 | 13B07FB61A68108700A75B9A /* Info.plist */, 257 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, 258 | 13B07FB71A68108700A75B9A /* main.m */, 259 | ); 260 | name = ReactNativeFancyLabel; 261 | sourceTree = ""; 262 | }; 263 | 146834001AC3E56700842450 /* Products */ = { 264 | isa = PBXGroup; 265 | children = ( 266 | 146834041AC3E56700842450 /* libReact.a */, 267 | ); 268 | name = Products; 269 | sourceTree = ""; 270 | }; 271 | 4F77B84B1C6C532F0080288E /* Products */ = { 272 | isa = PBXGroup; 273 | children = ( 274 | 4F77B84F1C6C532F0080288E /* libMFLReactFancyLabel.a */, 275 | ); 276 | name = Products; 277 | sourceTree = ""; 278 | }; 279 | 78C398B11ACF4ADC00677621 /* Products */ = { 280 | isa = PBXGroup; 281 | children = ( 282 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, 283 | ); 284 | name = Products; 285 | sourceTree = ""; 286 | }; 287 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 288 | isa = PBXGroup; 289 | children = ( 290 | 4F77B84A1C6C532F0080288E /* MFLReactFancyLabel.xcodeproj */, 291 | 146833FF1AC3E56700842450 /* React.xcodeproj */, 292 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, 293 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, 294 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, 295 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */, 296 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */, 297 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */, 298 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, 299 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 300 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, 301 | ); 302 | name = Libraries; 303 | sourceTree = ""; 304 | }; 305 | 832341B11AAA6A8300B99B32 /* Products */ = { 306 | isa = PBXGroup; 307 | children = ( 308 | 832341B51AAA6A8300B99B32 /* libRCTText.a */, 309 | ); 310 | name = Products; 311 | sourceTree = ""; 312 | }; 313 | 83CBB9F61A601CBA00E9B192 = { 314 | isa = PBXGroup; 315 | children = ( 316 | 13B07FAE1A68108700A75B9A /* ReactNativeFancyLabel */, 317 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 318 | 00E356EF1AD99517003FC87E /* ReactNativeFancyLabelTests */, 319 | 83CBBA001A601CBA00E9B192 /* Products */, 320 | ); 321 | indentWidth = 2; 322 | sourceTree = ""; 323 | tabWidth = 2; 324 | }; 325 | 83CBBA001A601CBA00E9B192 /* Products */ = { 326 | isa = PBXGroup; 327 | children = ( 328 | 13B07F961A680F5B00A75B9A /* ReactNativeFancyLabel.app */, 329 | 00E356EE1AD99517003FC87E /* ReactNativeFancyLabelTests.xctest */, 330 | ); 331 | name = Products; 332 | sourceTree = ""; 333 | }; 334 | /* End PBXGroup section */ 335 | 336 | /* Begin PBXNativeTarget section */ 337 | 00E356ED1AD99517003FC87E /* ReactNativeFancyLabelTests */ = { 338 | isa = PBXNativeTarget; 339 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "ReactNativeFancyLabelTests" */; 340 | buildPhases = ( 341 | 00E356EA1AD99517003FC87E /* Sources */, 342 | 00E356EB1AD99517003FC87E /* Frameworks */, 343 | 00E356EC1AD99517003FC87E /* Resources */, 344 | ); 345 | buildRules = ( 346 | ); 347 | dependencies = ( 348 | 00E356F51AD99517003FC87E /* PBXTargetDependency */, 349 | ); 350 | name = ReactNativeFancyLabelTests; 351 | productName = ReactNativeFancyLabelTests; 352 | productReference = 00E356EE1AD99517003FC87E /* ReactNativeFancyLabelTests.xctest */; 353 | productType = "com.apple.product-type.bundle.unit-test"; 354 | }; 355 | 13B07F861A680F5B00A75B9A /* ReactNativeFancyLabel */ = { 356 | isa = PBXNativeTarget; 357 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ReactNativeFancyLabel" */; 358 | buildPhases = ( 359 | 13B07F871A680F5B00A75B9A /* Sources */, 360 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 361 | 13B07F8E1A680F5B00A75B9A /* Resources */, 362 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 363 | ); 364 | buildRules = ( 365 | ); 366 | dependencies = ( 367 | 4F77B85C1C6C55EC0080288E /* PBXTargetDependency */, 368 | ); 369 | name = ReactNativeFancyLabel; 370 | productName = "Hello World"; 371 | productReference = 13B07F961A680F5B00A75B9A /* ReactNativeFancyLabel.app */; 372 | productType = "com.apple.product-type.application"; 373 | }; 374 | /* End PBXNativeTarget section */ 375 | 376 | /* Begin PBXProject section */ 377 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 378 | isa = PBXProject; 379 | attributes = { 380 | LastUpgradeCheck = 0610; 381 | ORGANIZATIONNAME = Facebook; 382 | TargetAttributes = { 383 | 00E356ED1AD99517003FC87E = { 384 | CreatedOnToolsVersion = 6.2; 385 | TestTargetID = 13B07F861A680F5B00A75B9A; 386 | }; 387 | }; 388 | }; 389 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ReactNativeFancyLabel" */; 390 | compatibilityVersion = "Xcode 3.2"; 391 | developmentRegion = English; 392 | hasScannedForEncodings = 0; 393 | knownRegions = ( 394 | en, 395 | Base, 396 | ); 397 | mainGroup = 83CBB9F61A601CBA00E9B192; 398 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 399 | projectDirPath = ""; 400 | projectReferences = ( 401 | { 402 | ProductGroup = 4F77B84B1C6C532F0080288E /* Products */; 403 | ProjectRef = 4F77B84A1C6C532F0080288E /* MFLReactFancyLabel.xcodeproj */; 404 | }, 405 | { 406 | ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; 407 | ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; 408 | }, 409 | { 410 | ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; 411 | ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; 412 | }, 413 | { 414 | ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */; 415 | ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 416 | }, 417 | { 418 | ProductGroup = 78C398B11ACF4ADC00677621 /* Products */; 419 | ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 420 | }, 421 | { 422 | ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */; 423 | ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 424 | }, 425 | { 426 | ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */; 427 | ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 428 | }, 429 | { 430 | ProductGroup = 832341B11AAA6A8300B99B32 /* Products */; 431 | ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 432 | }, 433 | { 434 | ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */; 435 | ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; 436 | }, 437 | { 438 | ProductGroup = 139FDEE71B06529A00C62182 /* Products */; 439 | ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 440 | }, 441 | { 442 | ProductGroup = 146834001AC3E56700842450 /* Products */; 443 | ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; 444 | }, 445 | ); 446 | projectRoot = ""; 447 | targets = ( 448 | 13B07F861A680F5B00A75B9A /* ReactNativeFancyLabel */, 449 | 00E356ED1AD99517003FC87E /* ReactNativeFancyLabelTests */, 450 | ); 451 | }; 452 | /* End PBXProject section */ 453 | 454 | /* Begin PBXReferenceProxy section */ 455 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = { 456 | isa = PBXReferenceProxy; 457 | fileType = archive.ar; 458 | path = libRCTActionSheet.a; 459 | remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */; 460 | sourceTree = BUILT_PRODUCTS_DIR; 461 | }; 462 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = { 463 | isa = PBXReferenceProxy; 464 | fileType = archive.ar; 465 | path = libRCTGeolocation.a; 466 | remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */; 467 | sourceTree = BUILT_PRODUCTS_DIR; 468 | }; 469 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = { 470 | isa = PBXReferenceProxy; 471 | fileType = archive.ar; 472 | path = libRCTImage.a; 473 | remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */; 474 | sourceTree = BUILT_PRODUCTS_DIR; 475 | }; 476 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = { 477 | isa = PBXReferenceProxy; 478 | fileType = archive.ar; 479 | path = libRCTNetwork.a; 480 | remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */; 481 | sourceTree = BUILT_PRODUCTS_DIR; 482 | }; 483 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = { 484 | isa = PBXReferenceProxy; 485 | fileType = archive.ar; 486 | path = libRCTVibration.a; 487 | remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; 488 | sourceTree = BUILT_PRODUCTS_DIR; 489 | }; 490 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = { 491 | isa = PBXReferenceProxy; 492 | fileType = archive.ar; 493 | path = libRCTSettings.a; 494 | remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */; 495 | sourceTree = BUILT_PRODUCTS_DIR; 496 | }; 497 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = { 498 | isa = PBXReferenceProxy; 499 | fileType = archive.ar; 500 | path = libRCTWebSocket.a; 501 | remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */; 502 | sourceTree = BUILT_PRODUCTS_DIR; 503 | }; 504 | 146834041AC3E56700842450 /* libReact.a */ = { 505 | isa = PBXReferenceProxy; 506 | fileType = archive.ar; 507 | path = libReact.a; 508 | remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; 509 | sourceTree = BUILT_PRODUCTS_DIR; 510 | }; 511 | 4F77B84F1C6C532F0080288E /* libMFLReactFancyLabel.a */ = { 512 | isa = PBXReferenceProxy; 513 | fileType = archive.ar; 514 | path = libMFLReactFancyLabel.a; 515 | remoteRef = 4F77B84E1C6C532F0080288E /* PBXContainerItemProxy */; 516 | sourceTree = BUILT_PRODUCTS_DIR; 517 | }; 518 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { 519 | isa = PBXReferenceProxy; 520 | fileType = archive.ar; 521 | path = libRCTLinking.a; 522 | remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */; 523 | sourceTree = BUILT_PRODUCTS_DIR; 524 | }; 525 | 832341B51AAA6A8300B99B32 /* libRCTText.a */ = { 526 | isa = PBXReferenceProxy; 527 | fileType = archive.ar; 528 | path = libRCTText.a; 529 | remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; 530 | sourceTree = BUILT_PRODUCTS_DIR; 531 | }; 532 | /* End PBXReferenceProxy section */ 533 | 534 | /* Begin PBXResourcesBuildPhase section */ 535 | 00E356EC1AD99517003FC87E /* Resources */ = { 536 | isa = PBXResourcesBuildPhase; 537 | buildActionMask = 2147483647; 538 | files = ( 539 | ); 540 | runOnlyForDeploymentPostprocessing = 0; 541 | }; 542 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 543 | isa = PBXResourcesBuildPhase; 544 | buildActionMask = 2147483647; 545 | files = ( 546 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 547 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, 548 | ); 549 | runOnlyForDeploymentPostprocessing = 0; 550 | }; 551 | /* End PBXResourcesBuildPhase section */ 552 | 553 | /* Begin PBXShellScriptBuildPhase section */ 554 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 555 | isa = PBXShellScriptBuildPhase; 556 | buildActionMask = 2147483647; 557 | files = ( 558 | ); 559 | inputPaths = ( 560 | ); 561 | name = "Bundle React Native code and images"; 562 | outputPaths = ( 563 | ); 564 | runOnlyForDeploymentPostprocessing = 0; 565 | shellPath = /bin/sh; 566 | shellScript = "../node_modules/react-native/packager/react-native-xcode.sh"; 567 | showEnvVarsInLog = 0; 568 | }; 569 | /* End PBXShellScriptBuildPhase section */ 570 | 571 | /* Begin PBXSourcesBuildPhase section */ 572 | 00E356EA1AD99517003FC87E /* Sources */ = { 573 | isa = PBXSourcesBuildPhase; 574 | buildActionMask = 2147483647; 575 | files = ( 576 | 00E356F31AD99517003FC87E /* ReactNativeFancyLabelTests.m in Sources */, 577 | ); 578 | runOnlyForDeploymentPostprocessing = 0; 579 | }; 580 | 13B07F871A680F5B00A75B9A /* Sources */ = { 581 | isa = PBXSourcesBuildPhase; 582 | buildActionMask = 2147483647; 583 | files = ( 584 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 585 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 586 | ); 587 | runOnlyForDeploymentPostprocessing = 0; 588 | }; 589 | /* End PBXSourcesBuildPhase section */ 590 | 591 | /* Begin PBXTargetDependency section */ 592 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { 593 | isa = PBXTargetDependency; 594 | target = 13B07F861A680F5B00A75B9A /* ReactNativeFancyLabel */; 595 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; 596 | }; 597 | 4F77B85C1C6C55EC0080288E /* PBXTargetDependency */ = { 598 | isa = PBXTargetDependency; 599 | name = MFLReactFancyLabel; 600 | targetProxy = 4F77B85B1C6C55EC0080288E /* PBXContainerItemProxy */; 601 | }; 602 | /* End PBXTargetDependency section */ 603 | 604 | /* Begin PBXVariantGroup section */ 605 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { 606 | isa = PBXVariantGroup; 607 | children = ( 608 | 13B07FB21A68108700A75B9A /* Base */, 609 | ); 610 | name = LaunchScreen.xib; 611 | path = ReactNativeFancyLabel; 612 | sourceTree = ""; 613 | }; 614 | /* End PBXVariantGroup section */ 615 | 616 | /* Begin XCBuildConfiguration section */ 617 | 00E356F61AD99517003FC87E /* Debug */ = { 618 | isa = XCBuildConfiguration; 619 | buildSettings = { 620 | BUNDLE_LOADER = "$(TEST_HOST)"; 621 | FRAMEWORK_SEARCH_PATHS = ( 622 | "$(SDKROOT)/Developer/Library/Frameworks", 623 | "$(inherited)", 624 | ); 625 | GCC_PREPROCESSOR_DEFINITIONS = ( 626 | "DEBUG=1", 627 | "$(inherited)", 628 | ); 629 | INFOPLIST_FILE = ReactNativeFancyLabelTests/Info.plist; 630 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 631 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 632 | PRODUCT_NAME = "$(TARGET_NAME)"; 633 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactNativeFancyLabel.app/ReactNativeFancyLabel"; 634 | }; 635 | name = Debug; 636 | }; 637 | 00E356F71AD99517003FC87E /* Release */ = { 638 | isa = XCBuildConfiguration; 639 | buildSettings = { 640 | BUNDLE_LOADER = "$(TEST_HOST)"; 641 | COPY_PHASE_STRIP = NO; 642 | FRAMEWORK_SEARCH_PATHS = ( 643 | "$(SDKROOT)/Developer/Library/Frameworks", 644 | "$(inherited)", 645 | ); 646 | INFOPLIST_FILE = ReactNativeFancyLabelTests/Info.plist; 647 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 648 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 649 | PRODUCT_NAME = "$(TARGET_NAME)"; 650 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactNativeFancyLabel.app/ReactNativeFancyLabel"; 651 | }; 652 | name = Release; 653 | }; 654 | 13B07F941A680F5B00A75B9A /* Debug */ = { 655 | isa = XCBuildConfiguration; 656 | buildSettings = { 657 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 658 | DEAD_CODE_STRIPPING = NO; 659 | HEADER_SEARCH_PATHS = ( 660 | "$(inherited)", 661 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 662 | "$(SRCROOT)/../node_modules/react-native/React/**", 663 | ); 664 | INFOPLIST_FILE = ReactNativeFancyLabel/Info.plist; 665 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 666 | OTHER_LDFLAGS = "-ObjC"; 667 | PRODUCT_NAME = ReactNativeFancyLabel; 668 | }; 669 | name = Debug; 670 | }; 671 | 13B07F951A680F5B00A75B9A /* Release */ = { 672 | isa = XCBuildConfiguration; 673 | buildSettings = { 674 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 675 | HEADER_SEARCH_PATHS = ( 676 | "$(inherited)", 677 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 678 | "$(SRCROOT)/../node_modules/react-native/React/**", 679 | ); 680 | INFOPLIST_FILE = ReactNativeFancyLabel/Info.plist; 681 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 682 | OTHER_LDFLAGS = "-ObjC"; 683 | PRODUCT_NAME = ReactNativeFancyLabel; 684 | }; 685 | name = Release; 686 | }; 687 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 688 | isa = XCBuildConfiguration; 689 | buildSettings = { 690 | ALWAYS_SEARCH_USER_PATHS = NO; 691 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 692 | CLANG_CXX_LIBRARY = "libc++"; 693 | CLANG_ENABLE_MODULES = YES; 694 | CLANG_ENABLE_OBJC_ARC = YES; 695 | CLANG_WARN_BOOL_CONVERSION = YES; 696 | CLANG_WARN_CONSTANT_CONVERSION = YES; 697 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 698 | CLANG_WARN_EMPTY_BODY = YES; 699 | CLANG_WARN_ENUM_CONVERSION = YES; 700 | CLANG_WARN_INT_CONVERSION = YES; 701 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 702 | CLANG_WARN_UNREACHABLE_CODE = YES; 703 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 704 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 705 | COPY_PHASE_STRIP = NO; 706 | ENABLE_STRICT_OBJC_MSGSEND = YES; 707 | GCC_C_LANGUAGE_STANDARD = gnu99; 708 | GCC_DYNAMIC_NO_PIC = NO; 709 | GCC_OPTIMIZATION_LEVEL = 0; 710 | GCC_PREPROCESSOR_DEFINITIONS = ( 711 | "DEBUG=1", 712 | "$(inherited)", 713 | ); 714 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 715 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 716 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 717 | GCC_WARN_UNDECLARED_SELECTOR = YES; 718 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 719 | GCC_WARN_UNUSED_FUNCTION = YES; 720 | GCC_WARN_UNUSED_VARIABLE = YES; 721 | HEADER_SEARCH_PATHS = ( 722 | "$(inherited)", 723 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 724 | "$(SRCROOT)/../node_modules/react-native/React/**", 725 | ); 726 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 727 | MTL_ENABLE_DEBUG_INFO = YES; 728 | ONLY_ACTIVE_ARCH = YES; 729 | SDKROOT = iphoneos; 730 | }; 731 | name = Debug; 732 | }; 733 | 83CBBA211A601CBA00E9B192 /* Release */ = { 734 | isa = XCBuildConfiguration; 735 | buildSettings = { 736 | ALWAYS_SEARCH_USER_PATHS = NO; 737 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 738 | CLANG_CXX_LIBRARY = "libc++"; 739 | CLANG_ENABLE_MODULES = YES; 740 | CLANG_ENABLE_OBJC_ARC = YES; 741 | CLANG_WARN_BOOL_CONVERSION = YES; 742 | CLANG_WARN_CONSTANT_CONVERSION = YES; 743 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 744 | CLANG_WARN_EMPTY_BODY = YES; 745 | CLANG_WARN_ENUM_CONVERSION = YES; 746 | CLANG_WARN_INT_CONVERSION = YES; 747 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 748 | CLANG_WARN_UNREACHABLE_CODE = YES; 749 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 750 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 751 | COPY_PHASE_STRIP = YES; 752 | ENABLE_NS_ASSERTIONS = NO; 753 | ENABLE_STRICT_OBJC_MSGSEND = YES; 754 | GCC_C_LANGUAGE_STANDARD = gnu99; 755 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 756 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 757 | GCC_WARN_UNDECLARED_SELECTOR = YES; 758 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 759 | GCC_WARN_UNUSED_FUNCTION = YES; 760 | GCC_WARN_UNUSED_VARIABLE = YES; 761 | HEADER_SEARCH_PATHS = ( 762 | "$(inherited)", 763 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 764 | "$(SRCROOT)/../node_modules/react-native/React/**", 765 | ); 766 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 767 | MTL_ENABLE_DEBUG_INFO = NO; 768 | SDKROOT = iphoneos; 769 | VALIDATE_PRODUCT = YES; 770 | }; 771 | name = Release; 772 | }; 773 | /* End XCBuildConfiguration section */ 774 | 775 | /* Begin XCConfigurationList section */ 776 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "ReactNativeFancyLabelTests" */ = { 777 | isa = XCConfigurationList; 778 | buildConfigurations = ( 779 | 00E356F61AD99517003FC87E /* Debug */, 780 | 00E356F71AD99517003FC87E /* Release */, 781 | ); 782 | defaultConfigurationIsVisible = 0; 783 | defaultConfigurationName = Release; 784 | }; 785 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ReactNativeFancyLabel" */ = { 786 | isa = XCConfigurationList; 787 | buildConfigurations = ( 788 | 13B07F941A680F5B00A75B9A /* Debug */, 789 | 13B07F951A680F5B00A75B9A /* Release */, 790 | ); 791 | defaultConfigurationIsVisible = 0; 792 | defaultConfigurationName = Release; 793 | }; 794 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ReactNativeFancyLabel" */ = { 795 | isa = XCConfigurationList; 796 | buildConfigurations = ( 797 | 83CBBA201A601CBA00E9B192 /* Debug */, 798 | 83CBBA211A601CBA00E9B192 /* Release */, 799 | ); 800 | defaultConfigurationIsVisible = 0; 801 | defaultConfigurationName = Release; 802 | }; 803 | /* End XCConfigurationList section */ 804 | }; 805 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 806 | } 807 | -------------------------------------------------------------------------------- /Examples/FullExample/ios/ReactNativeFancyLabel.xcodeproj/xcshareddata/xcschemes/ReactNativeFancyLabel.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /Examples/FullExample/ios/ReactNativeFancyLabel/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Examples/FullExample/ios/ReactNativeFancyLabel/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import "RCTRootView.h" 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | NSURL *jsCodeLocation; 19 | 20 | /** 21 | * Loading JavaScript code - uncomment the one you want. 22 | * 23 | * OPTION 1 24 | * Load from development server. Start the server from the repository root: 25 | * 26 | * $ npm start 27 | * 28 | * To run on device, change `localhost` to the IP address of your computer 29 | * (you can get this by typing `ifconfig` into the terminal and selecting the 30 | * `inet` value under `en0:`) and make sure your computer and iOS device are 31 | * on the same Wi-Fi network. 32 | */ 33 | 34 | jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"]; 35 | 36 | /** 37 | * OPTION 2 38 | * Load from pre-bundled file on disk. The static bundle is automatically 39 | * generated by "Bundle React Native code and images" build step. 40 | */ 41 | 42 | // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 43 | 44 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 45 | moduleName:@"ReactNativeFancyLabelExample" 46 | initialProperties:nil 47 | launchOptions:launchOptions]; 48 | 49 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 50 | UIViewController *rootViewController = [UIViewController new]; 51 | rootViewController.view = rootView; 52 | self.window.rootViewController = rootViewController; 53 | [self.window makeKeyAndVisible]; 54 | return YES; 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /Examples/FullExample/ios/ReactNativeFancyLabel/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Examples/FullExample/ios/ReactNativeFancyLabel/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Examples/FullExample/ios/ReactNativeFancyLabel/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSAllowsArbitraryLoads 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Examples/FullExample/ios/ReactNativeFancyLabel/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Examples/FullExample/ios/ReactNativeFancyLabelTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 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 | -------------------------------------------------------------------------------- /Examples/FullExample/ios/ReactNativeFancyLabelTests/ReactNativeFancyLabelTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #import "RCTLog.h" 14 | #import "RCTRootView.h" 15 | 16 | #define TIMEOUT_SECONDS 240 17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 18 | 19 | @interface ReactNativeFancyLabelTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation ReactNativeFancyLabelTests 24 | 25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 26 | { 27 | if (test(view)) { 28 | return YES; 29 | } 30 | for (UIView *subview in [view subviews]) { 31 | if ([self findSubviewInView:subview matching:test]) { 32 | return YES; 33 | } 34 | } 35 | return NO; 36 | } 37 | 38 | - (void)testRendersWelcomeScreen 39 | { 40 | UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; 41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 42 | BOOL foundElement = NO; 43 | 44 | __block NSString *redboxError = nil; 45 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 46 | if (level >= RCTLogLevelError) { 47 | redboxError = message; 48 | } 49 | }); 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | RCTSetLogFunction(RCTDefaultLogFunction); 64 | 65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /Examples/FullExample/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "GradientLabel", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node_modules/react-native/packager/packager.sh" 7 | }, 8 | "dependencies": { 9 | "react-native": "0.17.0", 10 | "react-native-fancy-label": "../../" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /FancyLabel - iOS/LICENSE.md: -------------------------------------------------------------------------------- 1 | THLabel 2 | 3 | Version 1.4.7, November 26th, 2015 4 | 5 | Copyright (c) 2015 Tobias Hagemann, tobiha.de 6 | 7 | This software is provided 'as-is', without any express or implied 8 | warranty. In no event will the authors be held liable for any damages 9 | arising from the use of this software. 10 | 11 | Permission is granted to anyone to use this software for any purpose, 12 | including commercial applications, and to alter it and redistribute it 13 | freely, subject to the following restrictions: 14 | 15 | 1. The origin of this software must not be misrepresented; you must not 16 | claim that you wrote the original software. If you use this software 17 | in a product, an acknowledgment in the product documentation would be 18 | appreciated but is not required. 19 | 2. Altered source versions must be plainly marked as such, and must not be 20 | misrepresented as being the original software. 21 | 3. This notice may not be removed or altered from any source distribution. -------------------------------------------------------------------------------- /FancyLabel - iOS/MFLReactFancyLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // MFLReactFancyLabel.h 3 | // ReactNativeFancyLabel 4 | // 5 | // Created by TJ Fallon on 1/11/16. 6 | // Copyright © 2016 Skillz. All rights reserved. 7 | // 8 | 9 | #import "RCTView.h" 10 | #import "RCTEventDispatcher.h" 11 | 12 | @interface MFLReactFancyLabel : RCTView 13 | 14 | - (id)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /FancyLabel - iOS/MFLReactFancyLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // MFLReactFancyLabel.m 3 | // ReactNativeFancyLabel 4 | // 5 | // Created by TJ Fallon on 1/11/16. 6 | // Copyright © 2016 Skillz. All rights reserved. 7 | // 8 | 9 | #import "MFLReactFancyLabel.h" 10 | #import "THLabel.h" 11 | #import "RCTConvert.h" 12 | 13 | @interface MFLReactFancyLabel () 14 | 15 | @property (nonatomic) RCTEventDispatcher *eventDispatcher; 16 | @property (nonatomic) UILabel *label; 17 | @property (nonatomic) THLabel *thLabel; 18 | 19 | @property (nonatomic) UIView *observedView; 20 | 21 | @end 22 | 23 | @implementation MFLReactFancyLabel 24 | 25 | RCT_EXPORT_MODULE(); 26 | 27 | - (id)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher 28 | { 29 | self = [super initWithFrame:CGRectZero]; 30 | if (self) { 31 | _eventDispatcher = eventDispatcher; 32 | } 33 | return self; 34 | } 35 | 36 | - (void)dealloc 37 | { 38 | self.observedView = nil; 39 | } 40 | 41 | - (void)insertSubview:(UIView *)view atIndex:(NSInteger)index 42 | { 43 | if ([view respondsToSelector:@selector(textStorage)]) { 44 | self.observedView = view; 45 | view.hidden = YES; 46 | } 47 | [super insertSubview:view atIndex:index]; 48 | } 49 | 50 | - (void)setObservedView:(UIView *)view 51 | { 52 | if (_observedView != view) { 53 | [_observedView removeObserver:self forKeyPath:@"textStorage"]; 54 | 55 | if (view) { 56 | [view addObserver:self 57 | forKeyPath:@"textStorage" 58 | options:NSKeyValueObservingOptionNew 59 | context:nil]; 60 | } 61 | _observedView = view; 62 | } 63 | } 64 | 65 | - (void)observeValueForKeyPath:(NSString *)keyPath 66 | ofObject:(id)object 67 | change:(NSDictionary *)change 68 | context:(void *)context 69 | { 70 | NSString *string = [change[@"new"] performSelector:@selector(string)]; 71 | 72 | if (string) { 73 | [self.label setText:string]; 74 | } 75 | } 76 | 77 | - (void)layoutSubviews 78 | { 79 | [self.label setFrame:self.bounds]; 80 | if (_thLabel) { 81 | _thLabel.frame = CGRectInset(_thLabel.frame, -2, -2); 82 | } 83 | [self.observedView removeFromSuperview]; 84 | [self.label setNeedsDisplay]; 85 | [self.label setNeedsLayout]; 86 | } 87 | 88 | - (UILabel*)label 89 | { 90 | if (!_label) { 91 | _label = [[UILabel alloc] initWithFrame:self.bounds]; 92 | [self addSubview:self.label]; 93 | } 94 | return _label; 95 | } 96 | 97 | - (THLabel*)thLabel 98 | { 99 | if (!_thLabel) { 100 | _thLabel = [[THLabel alloc] initWithFrame:self.bounds]; 101 | if (_label) { 102 | _thLabel.text = _label.text; 103 | _thLabel.textColor = _label.textColor; 104 | _thLabel.font = _label.font; 105 | _thLabel.textAlignment = _label.textAlignment; 106 | _thLabel.shadowOffset = _label.shadowOffset; 107 | _thLabel.shadowColor = _label.shadowColor; 108 | _thLabel.baselineAdjustment = _label.baselineAdjustment; 109 | _thLabel.adjustsFontSizeToFitWidth = _label.adjustsFontSizeToFitWidth; 110 | _thLabel.minimumScaleFactor = _label.minimumScaleFactor; 111 | 112 | [_label removeFromSuperview]; 113 | } 114 | _label = _thLabel; 115 | 116 | [self addSubview:_thLabel]; 117 | } 118 | return _thLabel; 119 | } 120 | 121 | #pragma mark Manager Setters 122 | 123 | - (void)setText:(NSString *)text 124 | { 125 | self.label.text = text; 126 | [self.label setNeedsDisplay]; 127 | } 128 | 129 | - (void)setColor:(UIColor *)textColor 130 | { 131 | self.label.textColor = textColor; 132 | [self.label setNeedsDisplay]; 133 | } 134 | 135 | - (void)setFontFamily:(NSString *)fontFace 136 | { 137 | self.label.font = [UIFont fontWithName:fontFace size:self.label.font.pointSize]; 138 | [self.label setNeedsDisplay]; 139 | } 140 | 141 | - (void)setFontSize:(CGFloat)fontSize 142 | { 143 | self.label.font = [UIFont fontWithName:self.label.font.fontName size:fontSize]; 144 | [self.label setNeedsDisplay]; 145 | } 146 | 147 | - (void)setTextAlign:(NSTextAlignment)alignment 148 | { 149 | self.label.textAlignment = alignment; 150 | [self.label setNeedsDisplay]; 151 | } 152 | 153 | - (void)setTextShadowOffset:(CGSize)shadowOffset 154 | { 155 | self.label.shadowOffset = shadowOffset; 156 | [self.label setNeedsDisplay]; 157 | } 158 | 159 | - (void)setTextShadowColor:(UIColor *)shadowColor 160 | { 161 | self.label.shadowColor = shadowColor; 162 | [self.label setNeedsDisplay]; 163 | } 164 | 165 | - (void)setBaselineAdjustment:(UIBaselineAdjustment)baselineAdjustment 166 | { 167 | self.label.baselineAdjustment = baselineAdjustment; 168 | [self.label setNeedsDisplay]; 169 | } 170 | 171 | - (void)setAdjustsFontSizeToFitWidth:(BOOL)adjustsFontSizeToFitWidth 172 | { 173 | self.label.adjustsFontSizeToFitWidth = adjustsFontSizeToFitWidth; 174 | [self.label setNeedsDisplay]; 175 | } 176 | 177 | - (void)setMinimumScaleFactor:(CGFloat)minimumScaleFactor 178 | { 179 | self.label.minimumScaleFactor = minimumScaleFactor; 180 | [self.label setNeedsDisplay]; 181 | } 182 | 183 | #pragma mark - THLabel Properties 184 | 185 | - (void)setGradientColors:(NSArray *)gradientColors 186 | { 187 | self.thLabel.gradientColors = gradientColors; 188 | [self.thLabel setNeedsDisplay]; 189 | } 190 | 191 | - (void)setGradientEndColor:(UIColor *)gradientEndColor 192 | { 193 | self.thLabel.gradientEndColor = gradientEndColor; 194 | [self.thLabel setNeedsDisplay]; 195 | } 196 | 197 | - (void)setGradientStartColor:(UIColor *)gradientStartColor 198 | { 199 | self.thLabel.gradientStartColor = gradientStartColor; 200 | [self.thLabel setNeedsDisplay]; 201 | } 202 | 203 | - (void)setGradientEndPoint:(CGPoint)gradientEndPoint 204 | { 205 | self.thLabel.gradientEndPoint = gradientEndPoint; 206 | [self.thLabel setNeedsDisplay]; 207 | } 208 | 209 | - (void)setGradientStartPoint:(CGPoint)gradientStartPoint 210 | { 211 | self.thLabel.gradientStartPoint = gradientStartPoint; 212 | [self.thLabel setNeedsDisplay]; 213 | } 214 | 215 | - (void)setTextShadowBlur:(CGFloat)shadowBlur 216 | { 217 | self.thLabel.shadowBlur = shadowBlur; 218 | [self.thLabel setNeedsDisplay]; 219 | } 220 | 221 | - (void)setInnerTextShadowOffset:(CGSize)innerShadowOffset 222 | { 223 | self.thLabel.innerShadowOffset = innerShadowOffset; 224 | [self.thLabel setNeedsDisplay]; 225 | } 226 | 227 | - (void)setInnerTextShadowColor:(UIColor *)innerShadowColor 228 | { 229 | self.thLabel.innerShadowColor = innerShadowColor; 230 | [self.thLabel setNeedsDisplay]; 231 | } 232 | 233 | - (void)setInnerTextShadowBlur:(CGFloat)innerShadowBlur 234 | { 235 | self.thLabel.innerShadowBlur = innerShadowBlur; 236 | [self.thLabel setNeedsDisplay]; 237 | } 238 | 239 | - (void)setStrokePosition:(THLabelStrokePosition)strokePosition 240 | { 241 | self.thLabel.strokePosition = strokePosition; 242 | [self.thLabel setNeedsDisplay]; 243 | } 244 | 245 | - (void)setStrokeColor:(UIColor *)strokeColor 246 | { 247 | self.thLabel.strokeColor = strokeColor; 248 | [self.thLabel setNeedsDisplay]; 249 | } 250 | 251 | - (void)setStrokeSize:(CGFloat)strokeSize 252 | { 253 | self.thLabel.strokeSize = strokeSize; 254 | [self.thLabel setNeedsDisplay]; 255 | } 256 | 257 | - (void)setLetterSpacing:(CGFloat)letterSpacing 258 | { 259 | self.thLabel.letterSpacing = letterSpacing; 260 | [self.thLabel setNeedsDisplay]; 261 | } 262 | 263 | - (void)setAutomaticallyAdjustTextInsets:(BOOL)automaticallyAdjustTextInsets 264 | { 265 | self.thLabel.letterSpacing = automaticallyAdjustTextInsets; 266 | [self.thLabel setNeedsDisplay]; 267 | } 268 | 269 | - (void)setTextInsets:(UIEdgeInsets)textInsets 270 | { 271 | self.thLabel.textInsets = textInsets; 272 | [self.thLabel setNeedsDisplay]; 273 | } 274 | 275 | - (void)setFadeTruncatingMode:(THLabelFadeTruncatingMode)fadeTruncatingMode 276 | { 277 | self.thLabel.fadeTruncatingMode = fadeTruncatingMode; 278 | [self.thLabel setNeedsDisplay]; 279 | } 280 | 281 | #pragma mark Enum Export 282 | @end 283 | -------------------------------------------------------------------------------- /FancyLabel - iOS/MFLReactFancyLabelManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // MFLReactFancyLabelManager.h 3 | // ReactNativeFancyLabel 4 | // 5 | // Created by TJ Fallon on 1/11/16. 6 | // Copyright © 2016 Skillz. All rights reserved. 7 | // 8 | 9 | #import "RCTViewManager.h" 10 | 11 | @interface MFLReactFancyLabelManager : RCTViewManager 12 | 13 | @end 14 | 15 | -------------------------------------------------------------------------------- /FancyLabel - iOS/MFLReactFancyLabelManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // MFLReactFancyLabelManager.m 3 | // ReactNativeFancyLabel 4 | // 5 | // Created by TJ Fallon on 1/11/16. 6 | // Copyright © 2016 Skillz. All rights reserved. 7 | // 8 | 9 | #import "MFLReactFancyLabelManager.h" 10 | #import "MFLReactFancyLabel.h" 11 | #import "RCTBridge.h" 12 | #import "THLabel.h" 13 | 14 | @implementation RCTConvert(MFLReactFancyLabelManager) 15 | 16 | RCT_ENUM_CONVERTER(UIBaselineAdjustment, (@{ 17 | @"AlignBaselines" : @(UIBaselineAdjustmentAlignBaselines), 18 | @"AlignCenters" : @(UIBaselineAdjustmentAlignCenters), 19 | @"None" : @(UIBaselineAdjustmentNone) 20 | }), UIBaselineAdjustmentAlignCenters, integerValue) 21 | 22 | RCT_ENUM_CONVERTER(THLabelFadeTruncatingMode, (@{ 23 | @"None": @(0), 24 | @"Tail": @(1), 25 | @"Head": @(2), 26 | @"HeadAndTail": @(3), 27 | }), 0, unsignedIntegerValue) 28 | 29 | RCT_ENUM_CONVERTER(THLabelStrokePosition, ( @{ 30 | @"Outside" : @(THLabelStrokePositionOutside), 31 | @"Center" : @(THLabelStrokePositionCenter), 32 | @"Inside" : @(THLabelStrokePositionInside) 33 | } 34 | ), THLabelStrokePositionCenter, integerValue) 35 | 36 | @end 37 | 38 | @interface MFLReactFancyLabelManager () 39 | 40 | @end 41 | 42 | @implementation MFLReactFancyLabelManager 43 | 44 | RCT_EXPORT_MODULE(); 45 | 46 | @synthesize bridge = _bridge; 47 | 48 | - (UIView *)view 49 | { 50 | return [[MFLReactFancyLabel alloc] initWithEventDispatcher:self.bridge.eventDispatcher]; 51 | } 52 | 53 | - (dispatch_queue_t)methodQueue 54 | { 55 | return dispatch_get_main_queue(); 56 | } 57 | 58 | RCT_EXPORT_VIEW_PROPERTY(fadeTruncatingMode, THLabelFadeTruncatingMode); 59 | RCT_EXPORT_VIEW_PROPERTY(textInsets, UIEdgeInsets); 60 | RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustTextInsets, BOOL); 61 | 62 | RCT_EXPORT_VIEW_PROPERTY(letterSpacing, CGFloat); 63 | 64 | RCT_EXPORT_VIEW_PROPERTY(strokeSize, CGFloat); 65 | RCT_EXPORT_VIEW_PROPERTY(strokeColor, UIColor); 66 | RCT_EXPORT_VIEW_PROPERTY(strokePosition, THLabelStrokePosition); 67 | 68 | RCT_EXPORT_VIEW_PROPERTY(innerTextShadowOffset, CGSize); 69 | RCT_EXPORT_VIEW_PROPERTY(innerTextShadowBlur, CGFloat); 70 | RCT_EXPORT_VIEW_PROPERTY(innerTextShadowColor, UIColor); 71 | 72 | RCT_EXPORT_VIEW_PROPERTY(textShadowBlur, CGFloat); 73 | RCT_EXPORT_VIEW_PROPERTY(textShadowColor, UIColor); 74 | RCT_EXPORT_VIEW_PROPERTY(textShadowOffset, CGSize); 75 | 76 | RCT_EXPORT_VIEW_PROPERTY(adjustsFontSizeToFitWidth, BOOL); 77 | RCT_EXPORT_VIEW_PROPERTY(baselineAdjustment, UIBaselineAdjustment); 78 | RCT_EXPORT_VIEW_PROPERTY(minimumScaleFactor, CGFloat); 79 | RCT_EXPORT_VIEW_PROPERTY(textAlign, NSTextAlignment); 80 | 81 | RCT_EXPORT_VIEW_PROPERTY(gradientColors, NSArray); 82 | RCT_EXPORT_VIEW_PROPERTY(gradientStartPoint, CGPoint); 83 | RCT_EXPORT_VIEW_PROPERTY(gradientEndPoint, CGPoint); 84 | 85 | RCT_EXPORT_VIEW_PROPERTY(fontFamily, NSString); 86 | RCT_EXPORT_VIEW_PROPERTY(fontSize, CGFloat); 87 | RCT_EXPORT_VIEW_PROPERTY(color, UIColor); 88 | 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /FancyLabel - iOS/THLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // THLabel.h 3 | // 4 | // Version 1.4.7 5 | // 6 | // Created by Tobias Hagemann on 11/25/12. 7 | // Copyright (c) 2015 tobiha.de. All rights reserved. 8 | // 9 | // Original source and inspiration from: 10 | // FXLabel by Nick Lockwood, 11 | // https://github.com/nicklockwood/FXLabel 12 | // KSLabel by Kai Schweiger, 13 | // https://github.com/vigorouscoding/KSLabel 14 | // GTMFadeTruncatingLabel by Google, 15 | // https://code.google.com/p/google-toolbox-for-mac/source/browse/trunk/iPhone/ 16 | // 17 | // Big thanks to Jason Miller for showing me sample code of his implementation 18 | // using Core Text! It inspired me to dig deeper and move away from drawing 19 | // with NSAttributedString on iOS 7, which caused a lot of problems. 20 | // 21 | // Distributed under the permissive zlib license 22 | // Get the latest version from here: 23 | // 24 | // https://github.com/MuscleRumble/THLabel 25 | // 26 | // This software is provided 'as-is', without any express or implied 27 | // warranty. In no event will the authors be held liable for any damages 28 | // arising from the use of this software. 29 | // 30 | // Permission is granted to anyone to use this software for any purpose, 31 | // including commercial applications, and to alter it and redistribute it 32 | // freely, subject to the following restrictions: 33 | // 34 | // 1. The origin of this software must not be misrepresented; you must not 35 | // claim that you wrote the original software. If you use this software 36 | // in a product, an acknowledgment in the product documentation would be 37 | // appreciated but is not required. 38 | // 39 | // 2. Altered source versions must be plainly marked as such, and must not be 40 | // misrepresented as being the original software. 41 | // 42 | // 3. This notice may not be removed or altered from any source distribution. 43 | // 44 | 45 | #import 46 | 47 | typedef NS_ENUM(NSInteger, THLabelStrokePosition) { 48 | THLabelStrokePositionOutside, 49 | THLabelStrokePositionCenter, 50 | THLabelStrokePositionInside 51 | }; 52 | 53 | typedef NS_OPTIONS(NSUInteger, THLabelFadeTruncatingMode) { 54 | THLabelFadeTruncatingModeNone = 0, 55 | THLabelFadeTruncatingModeTail = 1 << 0, 56 | THLabelFadeTruncatingModeHead = 1 << 1, 57 | THLabelFadeTruncatingModeHeadAndTail = THLabelFadeTruncatingModeHead | THLabelFadeTruncatingModeTail 58 | }; 59 | 60 | @interface THLabel : UILabel 61 | 62 | @property (nonatomic, assign) CGFloat letterSpacing; 63 | @property (nonatomic, assign) CGFloat lineSpacing; 64 | 65 | @property (nonatomic, assign) CGFloat shadowBlur; 66 | 67 | @property (nonatomic, assign) CGFloat innerShadowBlur; 68 | @property (nonatomic, assign) CGSize innerShadowOffset; 69 | @property (nonatomic, strong) UIColor *innerShadowColor; 70 | 71 | @property (nonatomic, assign) CGFloat strokeSize; 72 | @property (nonatomic, strong) UIColor *strokeColor; 73 | @property (nonatomic, assign) THLabelStrokePosition strokePosition; 74 | 75 | @property (nonatomic, strong) UIColor *gradientStartColor; 76 | @property (nonatomic, strong) UIColor *gradientEndColor; 77 | @property (nonatomic, copy) NSArray *gradientColors; 78 | @property (nonatomic, assign) CGPoint gradientStartPoint; 79 | @property (nonatomic, assign) CGPoint gradientEndPoint; 80 | 81 | @property (nonatomic, assign) THLabelFadeTruncatingMode fadeTruncatingMode; 82 | 83 | @property (nonatomic, assign) UIEdgeInsets textInsets; 84 | @property (nonatomic, assign) BOOL automaticallyAdjustTextInsets; 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /FancyLabel - iOS/THLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // THLabel.m 3 | // 4 | // Version 1.4.7 5 | // 6 | // Created by Tobias Hagemann on 11/25/12. 7 | // Copyright (c) 2015 tobiha.de. All rights reserved. 8 | // 9 | // Original source and inspiration from: 10 | // FXLabel by Nick Lockwood, 11 | // https://github.com/nicklockwood/FXLabel 12 | // KSLabel by Kai Schweiger, 13 | // https://github.com/vigorouscoding/KSLabel 14 | // GTMFadeTruncatingLabel by Google, 15 | // https://code.google.com/p/google-toolbox-for-mac/source/browse/trunk/iPhone/ 16 | // 17 | // Big thanks to Jason Miller for showing me sample code of his implementation 18 | // using Core Text! It inspired me to dig deeper and move away from drawing 19 | // with NSAttributedString on iOS 7, which caused a lot of problems. 20 | // 21 | // Distributed under the permissive zlib license 22 | // Get the latest version from here: 23 | // 24 | // https://github.com/MuscleRumble/THLabel 25 | // 26 | // This software is provided 'as-is', without any express or implied 27 | // warranty. In no event will the authors be held liable for any damages 28 | // arising from the use of this software. 29 | // 30 | // Permission is granted to anyone to use this software for any purpose, 31 | // including commercial applications, and to alter it and redistribute it 32 | // freely, subject to the following restrictions: 33 | // 34 | // 1. The origin of this software must not be misrepresented; you must not 35 | // claim that you wrote the original software. If you use this software 36 | // in a product, an acknowledgment in the product documentation would be 37 | // appreciated but is not required. 38 | // 39 | // 2. Altered source versions must be plainly marked as such, and must not be 40 | // misrepresented as being the original software. 41 | // 42 | // 3. This notice may not be removed or altered from any source distribution. 43 | // 44 | 45 | 46 | #import 47 | #if !__has_feature(objc_arc) 48 | #error This class requires automatic reference counting. 49 | #endif 50 | 51 | 52 | #import 53 | 54 | #import "THLabel.h" 55 | 56 | @implementation THLabel 57 | 58 | - (instancetype)initWithFrame:(CGRect)frame { 59 | if (self = [super initWithFrame:frame]) { 60 | self.backgroundColor = [UIColor clearColor]; 61 | [self setDefaults]; 62 | } 63 | return self; 64 | } 65 | 66 | - (instancetype)initWithCoder:(NSCoder *)aDecoder { 67 | if (self = [super initWithCoder:aDecoder]) { 68 | [self setDefaults]; 69 | } 70 | return self; 71 | } 72 | 73 | - (void)setDefaults { 74 | self.clipsToBounds = YES; 75 | self.letterSpacing = 0.0; 76 | self.gradientStartPoint = CGPointMake(0.5, 0.2); 77 | self.gradientEndPoint = CGPointMake(0.5, 0.8); 78 | self.automaticallyAdjustTextInsets = NO; 79 | } 80 | 81 | - (BOOL)hasShadow { 82 | return self.shadowColor && ![self.shadowColor isEqual:[UIColor clearColor]] && (self.shadowBlur > 0.0 || !CGSizeEqualToSize(self.shadowOffset, CGSizeZero)); 83 | } 84 | 85 | - (BOOL)hasInnerShadow { 86 | return self.innerShadowColor && ![self.innerShadowColor isEqual:[UIColor clearColor]] && (self.innerShadowBlur > 0.0 || !CGSizeEqualToSize(self.innerShadowOffset, CGSizeZero)); 87 | } 88 | 89 | - (BOOL)hasStroke { 90 | return self.strokeSize > 0.0 && ![self.strokeColor isEqual:[UIColor clearColor]]; 91 | } 92 | 93 | - (BOOL)hasGradient { 94 | return self.gradientColors.count > 1; 95 | } 96 | 97 | - (BOOL)hasFadeTruncating { 98 | return self.fadeTruncatingMode != THLabelFadeTruncatingModeNone; 99 | } 100 | 101 | - (CGSize)sizeThatFits:(CGSize)size { 102 | return [self intrinsicContentSize]; 103 | } 104 | 105 | - (CGSize)intrinsicContentSize { 106 | if (!self.text || [self.text isEqualToString:@""]) { 107 | return CGSizeZero; 108 | } else if (self.numberOfLines != 1) { 109 | CGRect textRect; 110 | CTFrameRef frameRef = [self frameRefFromSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) textRectOutput:&textRect]; 111 | CFRelease(frameRef); 112 | 113 | return textRect.size; 114 | } else { 115 | return [super intrinsicContentSize]; 116 | } 117 | } 118 | 119 | #pragma mark - Accessors and Mutators 120 | 121 | - (void)setShadowBlur:(CGFloat)shadowBlur { 122 | _shadowBlur = fmaxf(shadowBlur, 0.0); 123 | } 124 | 125 | - (UIColor *)gradientStartColor { 126 | return self.gradientColors.count ? self.gradientColors.firstObject : nil; 127 | } 128 | 129 | - (void)setGradientStartColor:(UIColor *)gradientStartColor { 130 | if (gradientStartColor == nil) { 131 | self.gradientColors = nil; 132 | } else if (self.gradientColors.count < 2) { 133 | self.gradientColors = @[gradientStartColor, gradientStartColor]; 134 | } else if (![self.gradientColors.firstObject isEqual:gradientStartColor]) { 135 | NSMutableArray *colors = [self.gradientColors mutableCopy]; 136 | colors[0] = gradientStartColor; 137 | self.gradientColors = colors; 138 | } 139 | } 140 | 141 | - (UIColor *)gradientEndColor { 142 | return self.gradientColors.lastObject; 143 | } 144 | 145 | - (void)setGradientEndColor:(UIColor *)gradientEndColor { 146 | if (gradientEndColor == nil) { 147 | self.gradientColors = nil; 148 | } else if (self.gradientColors.count < 2) { 149 | self.gradientColors = @[gradientEndColor, gradientEndColor]; 150 | } else if (![self.gradientColors.lastObject isEqual:gradientEndColor]) { 151 | NSMutableArray *colors = [self.gradientColors mutableCopy]; 152 | colors[colors.count - 1] = gradientEndColor; 153 | self.gradientColors = colors; 154 | } 155 | } 156 | 157 | - (void)setGradientColors:(NSArray *)gradientColors { 158 | if (self.gradientColors != gradientColors) { 159 | _gradientColors = [gradientColors copy]; 160 | [self setNeedsDisplay]; 161 | } 162 | } 163 | 164 | - (void)setTextInsets:(UIEdgeInsets)textInsets { 165 | if (!UIEdgeInsetsEqualToEdgeInsets(self.textInsets, textInsets)) { 166 | _textInsets = textInsets; 167 | [self setNeedsDisplay]; 168 | } 169 | } 170 | 171 | - (CGFloat)strokeSizeDependentOnStrokePosition { 172 | switch (self.strokePosition) { 173 | case THLabelStrokePositionCenter: 174 | return self.strokeSize; 175 | 176 | default: 177 | // Stroke width times 2, because CG draws a centered stroke. We cut the rest into halves. 178 | return self.strokeSize * 2.0; 179 | } 180 | } 181 | 182 | #pragma mark - Drawing 183 | 184 | - (void)drawRect:(CGRect)rect { 185 | // Don't draw anything, if there is no text. 186 | if (!self.text || [self.text isEqualToString:@""]) { 187 | return; 188 | } 189 | 190 | // ------- 191 | // Determine what has to be drawn. 192 | // ------- 193 | 194 | BOOL hasShadow = [self hasShadow]; 195 | BOOL hasInnerShadow = [self hasInnerShadow]; 196 | BOOL hasStroke = [self hasStroke]; 197 | BOOL hasGradient = [self hasGradient]; 198 | BOOL hasFadeTruncating = [self hasFadeTruncating]; 199 | BOOL needsMask = hasGradient || (hasStroke && self.strokePosition == THLabelStrokePositionInside) || hasInnerShadow; 200 | 201 | // ------- 202 | // Step 1: Begin new drawing context, where we will apply all our styles. 203 | // ------- 204 | 205 | UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0.0); 206 | CGContextRef context = UIGraphicsGetCurrentContext(); 207 | CGImageRef alphaMask = NULL; 208 | CGRect textRect; 209 | CTFrameRef frameRef = [self frameRefFromSize:self.bounds.size textRectOutput:&textRect]; 210 | 211 | // Invert everything, because CG works with an inverted coordinate system. 212 | CGContextTranslateCTM(context, 0.0, CGRectGetHeight(rect)); 213 | CGContextScaleCTM(context, 1.0, -1.0); 214 | 215 | // ------- 216 | // Step 2: Prepare mask. 217 | // ------- 218 | 219 | if (needsMask) { 220 | CGContextSaveGState(context); 221 | 222 | // Draw alpha mask. 223 | if (hasStroke) { 224 | // Text needs invisible stroke for consistent character glyph widths. 225 | CGContextSetTextDrawingMode(context, kCGTextFillStroke); 226 | CGContextSetLineWidth(context, [self strokeSizeDependentOnStrokePosition]); 227 | CGContextSetLineJoin(context, kCGLineJoinRound); 228 | [[UIColor clearColor] setStroke]; 229 | } else { 230 | CGContextSetTextDrawingMode(context, kCGTextFill); 231 | } 232 | 233 | [[UIColor whiteColor] setFill]; 234 | CTFrameDraw(frameRef, context); 235 | 236 | // Save alpha mask. 237 | alphaMask = CGBitmapContextCreateImage(context); 238 | 239 | // Clear the content. 240 | CGContextClearRect(context, rect); 241 | 242 | CGContextRestoreGState(context); 243 | } 244 | 245 | // ------- 246 | // Step 3: Draw text normally, or with gradient. 247 | // ------- 248 | 249 | CGContextSaveGState(context); 250 | 251 | if (!hasGradient) { 252 | // Draw text. 253 | if (hasStroke) { 254 | // Text needs invisible stroke for consistent character glyph widths. 255 | CGContextSetTextDrawingMode(context, kCGTextFillStroke); 256 | CGContextSetLineWidth(context, [self strokeSizeDependentOnStrokePosition]); 257 | CGContextSetLineJoin(context, kCGLineJoinRound); 258 | [[UIColor clearColor] setStroke]; 259 | } else { 260 | CGContextSetTextDrawingMode(context, kCGTextFill); 261 | } 262 | 263 | CTFrameDraw(frameRef, context); 264 | } else { 265 | // Clip the current context to alpha mask. 266 | CGContextClipToMask(context, rect, alphaMask); 267 | 268 | // Invert back to draw the gradient correctly. 269 | CGContextTranslateCTM(context, 0.0, CGRectGetHeight(rect)); 270 | CGContextScaleCTM(context, 1.0, -1.0); 271 | 272 | // Get gradient colors as CGColor. 273 | NSMutableArray *gradientColors = [NSMutableArray arrayWithCapacity:self.gradientColors.count]; 274 | for (UIColor *color in self.gradientColors) { 275 | [gradientColors addObject:(__bridge id)color.CGColor]; 276 | } 277 | 278 | // Create gradient. 279 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 280 | CGGradientRef gradient = CGGradientCreateWithColors(colorSpace, (__bridge CFArrayRef)gradientColors, NULL); 281 | CGPoint startPoint = CGPointMake(textRect.origin.x + self.gradientStartPoint.x * CGRectGetWidth(textRect), 282 | textRect.origin.y + self.gradientStartPoint.y * CGRectGetHeight(textRect)); 283 | CGPoint endPoint = CGPointMake(textRect.origin.x + self.gradientEndPoint.x * CGRectGetWidth(textRect), 284 | textRect.origin.y + self.gradientEndPoint.y * CGRectGetHeight(textRect)); 285 | 286 | // Draw gradient. 287 | CGContextDrawLinearGradient(context, gradient, startPoint, endPoint, kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation); 288 | 289 | // Clean up. 290 | CGColorSpaceRelease(colorSpace); 291 | CGGradientRelease(gradient); 292 | } 293 | 294 | CGContextRestoreGState(context); 295 | 296 | // ------- 297 | // Step 4: Draw inner shadow. 298 | // ------- 299 | 300 | if (hasInnerShadow) { 301 | CGContextSaveGState(context); 302 | 303 | // Clip the current context to alpha mask. 304 | CGContextClipToMask(context, rect, alphaMask); 305 | 306 | // Invert to draw the inner shadow correctly. 307 | CGContextTranslateCTM(context, 0.0, CGRectGetHeight(rect)); 308 | CGContextScaleCTM(context, 1.0, -1.0); 309 | 310 | // Draw inner shadow. 311 | CGImageRef shadowImage = [self inverseMaskFromAlphaMask:alphaMask withRect:rect]; 312 | CGContextSetShadowWithColor(context, self.innerShadowOffset, self.innerShadowBlur, self.innerShadowColor.CGColor); 313 | CGContextSetBlendMode(context, kCGBlendModeDarken); 314 | CGContextDrawImage(context, rect, shadowImage); 315 | 316 | // Clean up. 317 | CGImageRelease(shadowImage); 318 | 319 | CGContextRestoreGState(context); 320 | } 321 | 322 | // ------- 323 | // Step 5: Draw stroke. 324 | // ------- 325 | 326 | if (hasStroke) { 327 | CGContextSaveGState(context); 328 | 329 | CGContextSetTextDrawingMode(context, kCGTextStroke); 330 | 331 | CGImageRef image = NULL; 332 | 333 | if (self.strokePosition == THLabelStrokePositionOutside) { 334 | // Create an image from the text. 335 | image = CGBitmapContextCreateImage(context); 336 | } else if (self.strokePosition == THLabelStrokePositionInside) { 337 | // Clip the current context to alpha mask. 338 | CGContextClipToMask(context, rect, alphaMask); 339 | } 340 | 341 | // Draw stroke. 342 | CGImageRef strokeImage = [self strokeImageWithRect:rect frameRef:frameRef strokeSize:[self strokeSizeDependentOnStrokePosition] strokeColor:self.strokeColor]; 343 | CGContextDrawImage(context, rect, strokeImage); 344 | 345 | if (self.strokePosition == THLabelStrokePositionOutside) { 346 | // Draw the saved image over half of the stroke. 347 | CGContextDrawImage(context, rect, image); 348 | } 349 | 350 | // Clean up. 351 | CGImageRelease(strokeImage); 352 | CGImageRelease(image); 353 | 354 | CGContextRestoreGState(context); 355 | } 356 | 357 | // ------- 358 | // Step 6: Draw shadow. 359 | // ------- 360 | 361 | if (hasShadow) { 362 | CGContextSaveGState(context); 363 | 364 | // Create an image from the text. 365 | CGImageRef image = CGBitmapContextCreateImage(context); 366 | 367 | // Clear the content. 368 | CGContextClearRect(context, rect); 369 | 370 | // Set shadow attributes. 371 | CGContextSetShadowWithColor(context, self.shadowOffset, self.shadowBlur, self.shadowColor.CGColor); 372 | 373 | // Draw the saved image, which throws off a shadow. 374 | CGContextDrawImage(context, rect, image); 375 | 376 | // Clean up. 377 | CGImageRelease(image); 378 | 379 | CGContextRestoreGState(context); 380 | } 381 | 382 | // ------- 383 | // Step 7: Draw fade truncating. 384 | // ------- 385 | 386 | if (hasFadeTruncating) { 387 | CGContextSaveGState(context); 388 | 389 | // Create an image from the text. 390 | CGImageRef image = CGBitmapContextCreateImage(context); 391 | 392 | // Clear the content. 393 | CGContextClearRect(context, rect); 394 | 395 | // Clip the current context to linear gradient mask. 396 | CGImageRef linearGradientImage = [self linearGradientImageWithRect:rect fadeHead:self.fadeTruncatingMode & THLabelFadeTruncatingModeHead fadeTail:self.fadeTruncatingMode & THLabelFadeTruncatingModeTail]; 397 | CGContextClipToMask(context, self.bounds, linearGradientImage); 398 | 399 | // Draw the saved image, which is clipped by the linear gradient mask. 400 | CGContextDrawImage(context, rect, image); 401 | 402 | // Clean up. 403 | CGImageRelease(linearGradientImage); 404 | CGImageRelease(image); 405 | 406 | CGContextRestoreGState(context); 407 | } 408 | 409 | // ------- 410 | // Step 8: End drawing context and finally draw the text with all styles. 411 | // ------- 412 | 413 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 414 | UIGraphicsEndImageContext(); 415 | [image drawInRect:rect]; 416 | 417 | // ------- 418 | // Clean up. 419 | // ------- 420 | 421 | if (needsMask) { 422 | CGImageRelease(alphaMask); 423 | } 424 | 425 | CFRelease(frameRef); 426 | } 427 | 428 | - (CTFrameRef)frameRefFromSize:(CGSize)size textRectOutput:(CGRect *)textRectOutput CF_RETURNS_RETAINED { 429 | // Set up font. 430 | 431 | if (self.automaticallyAdjustTextInsets) { 432 | self.textInsets = [self fittingTextInsets]; 433 | } 434 | 435 | CGRect contentRect = [self contentRectFromSize:self.bounds.size withInsets:self.textInsets]; 436 | 437 | UIFont *fontToDraw = self.font; 438 | if (self.adjustsFontSizeToFitWidth) { 439 | BOOL textFits = NO; 440 | do { 441 | NSStringDrawingOptions options = (self.numberOfLines == 1) ? NSStringDrawingUsesFontLeading : 442 | (NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin); 443 | CGSize sizeNeeded = [self.text boundingRectWithSize:CGSizeMake(INT_MAX, INT_MAX) 444 | options:options 445 | attributes:@{NSFontAttributeName : [UIFont fontWithName:fontToDraw.fontName size:fontToDraw.pointSize]} 446 | context:nil].size; 447 | textFits = (sizeNeeded.height < contentRect.size.height ) && (sizeNeeded.width < contentRect.size.width); 448 | 449 | if (!textFits) { 450 | fontToDraw = [UIFont fontWithName:fontToDraw.fontName size:fontToDraw.pointSize - 1]; 451 | } 452 | } while (!textFits && fontToDraw.pointSize > 0); 453 | } 454 | 455 | 456 | CTFontRef fontRef = CTFontCreateWithName((__bridge CFStringRef)fontToDraw.fontName, fontToDraw.pointSize, NULL); 457 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0 458 | CTTextAlignment alignment = NSTextAlignmentToCTTextAlignment(self.textAlignment); 459 | #else 460 | CTTextAlignment alignment = NSTextAlignmentToCTTextAlignment ? NSTextAlignmentToCTTextAlignment(self.textAlignment) : [self CTTextAlignmentFromNSTextAlignment:self.textAlignment]; 461 | #endif 462 | CTLineBreakMode lineBreakMode = (CTLineBreakMode)self.lineBreakMode; 463 | CGFloat lineSpacing = self.lineSpacing; 464 | CTParagraphStyleSetting paragraphStyleSettings[] = { 465 | {kCTParagraphStyleSpecifierAlignment, sizeof(CTTextAlignment), &alignment}, 466 | {kCTParagraphStyleSpecifierLineBreakMode, sizeof(CTLineBreakMode), &lineBreakMode}, 467 | {kCTParagraphStyleSpecifierLineSpacingAdjustment, sizeof(CGFloat), &lineSpacing} 468 | }; 469 | CTParagraphStyleRef paragraphStyleRef = CTParagraphStyleCreate(paragraphStyleSettings, 3); 470 | CFNumberRef kernRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberCGFloatType, &_letterSpacing); 471 | 472 | // Set up attributed string. 473 | CFStringRef keys[] = {kCTFontAttributeName, kCTParagraphStyleAttributeName, kCTForegroundColorAttributeName, kCTKernAttributeName}; 474 | CFTypeRef values[] = {fontRef, paragraphStyleRef, self.textColor.CGColor, kernRef}; 475 | CFDictionaryRef attributes = CFDictionaryCreate(kCFAllocatorDefault, (const void **)&keys, (const void **)&values, sizeof(keys) / sizeof(keys[0]), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); 476 | CFRelease(fontRef); 477 | CFRelease(paragraphStyleRef); 478 | CFRelease(kernRef); 479 | 480 | CFStringRef stringRef = (__bridge CFStringRef)self.text; 481 | CFAttributedStringRef attributedStringRef = CFAttributedStringCreate(kCFAllocatorDefault, stringRef, attributes); 482 | CFRelease(attributes); 483 | 484 | // Set up frame. 485 | CTFramesetterRef framesetterRef = CTFramesetterCreateWithAttributedString(attributedStringRef); 486 | CFRelease(attributedStringRef); 487 | 488 | 489 | CGRect textRect = [self textRectFromContentRect:contentRect framesetterRef:framesetterRef]; 490 | if (textRectOutput) { 491 | *textRectOutput = textRect; 492 | } 493 | CGMutablePathRef pathRef = CGPathCreateMutable(); 494 | CGPathAddRect(pathRef, NULL, textRect); 495 | 496 | CTFrameRef frameRef = CTFramesetterCreateFrame(framesetterRef, CFRangeMake(0, self.text.length), pathRef, NULL); 497 | CFRelease(framesetterRef); 498 | CGPathRelease(pathRef); 499 | return frameRef; 500 | } 501 | 502 | // Workaround for < iOS 6. 503 | - (CTTextAlignment)CTTextAlignmentFromNSTextAlignment:(NSTextAlignment)nsTextAlignment { 504 | switch (nsTextAlignment) { 505 | case NSTextAlignmentLeft: 506 | return kCTTextAlignmentLeft; 507 | case NSTextAlignmentCenter: 508 | return kCTTextAlignmentCenter; 509 | case NSTextAlignmentRight: 510 | return kCTTextAlignmentRight; 511 | case NSTextAlignmentJustified: 512 | return kCTTextAlignmentJustified; 513 | case NSTextAlignmentNatural: 514 | return kCTTextAlignmentNatural; 515 | default: 516 | return 0; 517 | } 518 | } 519 | 520 | - (CGRect)contentRectFromSize:(CGSize)size withInsets:(UIEdgeInsets)insets { 521 | CGRect contentRect = CGRectMake(0.0, 0.0, size.width, size.height); 522 | 523 | // Apply insets. 524 | contentRect.origin.x += insets.left; 525 | contentRect.origin.y += insets.top; 526 | contentRect.size.width -= insets.left + insets.right; 527 | contentRect.size.height -= insets.top + insets.bottom; 528 | 529 | return contentRect; 530 | } 531 | 532 | - (CGRect)textRectFromContentRect:(CGRect)contentRect framesetterRef:(CTFramesetterRef)framesetterRef { 533 | CGSize suggestedTextRectSize = CTFramesetterSuggestFrameSizeWithConstraints(framesetterRef, CFRangeMake(0, self.text.length), NULL, contentRect.size, NULL); 534 | if (CGSizeEqualToSize(suggestedTextRectSize, CGSizeZero)) { 535 | suggestedTextRectSize = CTFramesetterSuggestFrameSizeWithConstraints(framesetterRef, CFRangeMake(0, self.text.length), NULL, CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX), NULL); 536 | } 537 | CGRect textRect = CGRectMake(0.0, 0.0, ceilf(suggestedTextRectSize.width), ceilf(suggestedTextRectSize.height)); 538 | 539 | // Horizontal alignment. 540 | switch (self.textAlignment) { 541 | case NSTextAlignmentCenter: 542 | textRect.origin.x = floorf(CGRectGetMinX(contentRect) + (CGRectGetWidth(contentRect) - CGRectGetWidth(textRect)) / 2.0); 543 | break; 544 | 545 | case NSTextAlignmentRight: 546 | textRect.origin.x = floorf(CGRectGetMinX(contentRect) + CGRectGetWidth(contentRect) - CGRectGetWidth(textRect)); 547 | break; 548 | 549 | default: 550 | textRect.origin.x = floorf(CGRectGetMinX(contentRect)); 551 | break; 552 | } 553 | 554 | // Vertical alignment. Top and bottom are upside down, because of inverted drawing. 555 | switch (self.contentMode) { 556 | case UIViewContentModeTop: 557 | case UIViewContentModeTopLeft: 558 | case UIViewContentModeTopRight: 559 | textRect.origin.y = floorf(CGRectGetMinY(contentRect) + CGRectGetHeight(contentRect) - CGRectGetHeight(textRect)); 560 | break; 561 | 562 | case UIViewContentModeBottom: 563 | case UIViewContentModeBottomLeft: 564 | case UIViewContentModeBottomRight: 565 | textRect.origin.y = floorf(CGRectGetMinY(contentRect)); 566 | break; 567 | 568 | default: 569 | textRect.origin.y = floorf(CGRectGetMinY(contentRect) + floorf((CGRectGetHeight(contentRect) - CGRectGetHeight(textRect)) / 2.0)); 570 | break; 571 | } 572 | 573 | return textRect; 574 | } 575 | 576 | - (UIEdgeInsets)fittingTextInsets { 577 | BOOL hasShadow = [self hasShadow]; 578 | BOOL hasStroke = [self hasStroke]; 579 | UIEdgeInsets edgeInsets = UIEdgeInsetsZero; 580 | 581 | if (hasStroke) { 582 | switch (self.strokePosition) { 583 | case THLabelStrokePositionOutside: 584 | edgeInsets = UIEdgeInsetsMake(self.strokeSize, self.strokeSize, self.strokeSize, self.strokeSize); 585 | break; 586 | 587 | case THLabelStrokePositionCenter: 588 | edgeInsets = UIEdgeInsetsMake(self.strokeSize / 2.0, self.strokeSize / 2.0, self.strokeSize / 2.0, self.strokeSize / 2.0); 589 | break; 590 | 591 | default: 592 | break; 593 | } 594 | } 595 | 596 | if (hasShadow) { 597 | edgeInsets.top = fmaxf(edgeInsets.top + self.shadowBlur + self.shadowOffset.height, edgeInsets.top); 598 | edgeInsets.left = fmaxf(edgeInsets.left + self.shadowBlur + self.shadowOffset.width, edgeInsets.left); 599 | edgeInsets.bottom = fmaxf(edgeInsets.bottom + self.shadowBlur - self.shadowOffset.height, edgeInsets.bottom); 600 | edgeInsets.right = fmaxf(edgeInsets.right + self.shadowBlur - self.shadowOffset.width, edgeInsets.right); 601 | } 602 | 603 | return edgeInsets; 604 | } 605 | 606 | #pragma mark - Image Functions 607 | 608 | - (CGImageRef)inverseMaskFromAlphaMask:(CGImageRef)alphaMask withRect:(CGRect)rect CF_RETURNS_RETAINED { 609 | // Create context. 610 | UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0.0); 611 | CGContextRef context = UIGraphicsGetCurrentContext(); 612 | 613 | // Fill rect, clip to alpha mask and clear. 614 | [[UIColor whiteColor] setFill]; 615 | UIRectFill(rect); 616 | CGContextClipToMask(context, rect, alphaMask); 617 | CGContextClearRect(context, rect); 618 | 619 | // Return image. 620 | CGImageRef image = CGBitmapContextCreateImage(context); 621 | UIGraphicsEndImageContext(); 622 | return image; 623 | } 624 | 625 | - (CGImageRef)strokeImageWithRect:(CGRect)rect frameRef:(CTFrameRef)frameRef strokeSize:(CGFloat)strokeSize strokeColor:(UIColor *)strokeColor CF_RETURNS_RETAINED { 626 | // Create context. 627 | UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0.0); 628 | CGContextRef context = UIGraphicsGetCurrentContext(); 629 | 630 | CGContextSetTextDrawingMode(context, kCGTextStroke); 631 | 632 | // Draw clipping mask. 633 | CGContextSetLineWidth(context, strokeSize); 634 | CGContextSetLineJoin(context, kCGLineJoinRound); 635 | [[UIColor whiteColor] setStroke]; 636 | CTFrameDraw(frameRef, context); 637 | 638 | // Save clipping mask. 639 | CGImageRef clippingMask = CGBitmapContextCreateImage(context); 640 | 641 | // Clear the content. 642 | CGContextClearRect(context, rect); 643 | 644 | // Draw stroke. 645 | CGContextClipToMask(context, rect, clippingMask); 646 | CGContextTranslateCTM(context, 0.0, CGRectGetHeight(rect)); 647 | CGContextScaleCTM(context, 1.0, -1.0); 648 | [strokeColor setFill]; 649 | UIRectFill(rect); 650 | 651 | // Clean up and return image. 652 | CGImageRelease(clippingMask); 653 | CGImageRef image = CGBitmapContextCreateImage(context); 654 | UIGraphicsEndImageContext(); 655 | return image; 656 | } 657 | 658 | - (CGImageRef)linearGradientImageWithRect:(CGRect)rect fadeHead:(BOOL)fadeHead fadeTail:(BOOL)fadeTail CF_RETURNS_RETAINED { 659 | // Create an opaque context. 660 | UIGraphicsBeginImageContextWithOptions(rect.size, YES, 0.0); 661 | CGContextRef context = UIGraphicsGetCurrentContext(); 662 | 663 | // White background will mask opaque, black gradient will mask transparent. 664 | [[UIColor whiteColor] setFill]; 665 | UIRectFill(rect); 666 | 667 | // Create gradient from white to black. 668 | CGFloat locs[2] = {0.0, 1.0}; 669 | CGFloat components[4] = {1.0, 1.0, 0.0, 1.0}; 670 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); 671 | CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, components, locs, 2); 672 | 673 | // Draw head and/or tail gradient. 674 | CGFloat fadeWidth = fminf(CGRectGetHeight(rect) * 2.0, floorf(CGRectGetWidth(rect) / 4.0)); 675 | CGFloat minX = CGRectGetMinX(rect); 676 | CGFloat maxX = CGRectGetMaxX(rect); 677 | if (fadeTail) { 678 | CGFloat startX = maxX - fadeWidth; 679 | CGPoint startPoint = CGPointMake(startX, CGRectGetMidY(rect)); 680 | CGPoint endPoint = CGPointMake(maxX, CGRectGetMidY(rect)); 681 | CGContextDrawLinearGradient(context, gradient, startPoint, endPoint, 0); 682 | } 683 | if (fadeHead) { 684 | CGFloat startX = minX + fadeWidth; 685 | CGPoint startPoint = CGPointMake(startX, CGRectGetMidY(rect)); 686 | CGPoint endPoint = CGPointMake(minX, CGRectGetMidY(rect)); 687 | CGContextDrawLinearGradient(context, gradient, startPoint, endPoint, 0); 688 | } 689 | 690 | // Clean up and return image. 691 | CGColorSpaceRelease(colorSpace); 692 | CGGradientRelease(gradient); 693 | CGImageRef image = CGBitmapContextCreateImage(context); 694 | UIGraphicsEndImageContext(); 695 | return image; 696 | } 697 | 698 | 699 | @end 700 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Tj 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MFLReactFancyLabel.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D9B8D2EE1C447601002ACB4B /* MFLReactFancyLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = D9B8D2E81C447601002ACB4B /* MFLReactFancyLabel.m */; }; 11 | D9B8D2EF1C447601002ACB4B /* MFLReactFancyLabelManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D9B8D2EA1C447601002ACB4B /* MFLReactFancyLabelManager.m */; }; 12 | D9B8D2F01C447601002ACB4B /* THLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = D9B8D2EC1C447601002ACB4B /* THLabel.m */; }; 13 | /* End PBXBuildFile section */ 14 | 15 | /* Begin PBXCopyFilesBuildPhase section */ 16 | 58B511D91A9E6C8500147676 /* Copy Files */ = { 17 | isa = PBXCopyFilesBuildPhase; 18 | buildActionMask = 2147483647; 19 | dstPath = "include/$(PRODUCT_NAME)"; 20 | dstSubfolderSpec = 16; 21 | files = ( 22 | ); 23 | name = "Copy Files"; 24 | runOnlyForDeploymentPostprocessing = 0; 25 | }; 26 | /* End PBXCopyFilesBuildPhase section */ 27 | 28 | /* Begin PBXFileReference section */ 29 | 134814201AA4EA6300B7C361 /* libMFLReactFancyLabel.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libMFLReactFancyLabel.a; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | D9B8D2E71C447601002ACB4B /* MFLReactFancyLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFLReactFancyLabel.h; sourceTree = ""; }; 31 | D9B8D2E81C447601002ACB4B /* MFLReactFancyLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFLReactFancyLabel.m; sourceTree = ""; }; 32 | D9B8D2E91C447601002ACB4B /* MFLReactFancyLabelManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFLReactFancyLabelManager.h; sourceTree = ""; }; 33 | D9B8D2EA1C447601002ACB4B /* MFLReactFancyLabelManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFLReactFancyLabelManager.m; sourceTree = ""; }; 34 | D9B8D2EB1C447601002ACB4B /* THLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = THLabel.h; sourceTree = ""; }; 35 | D9B8D2EC1C447601002ACB4B /* THLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = THLabel.m; sourceTree = ""; }; 36 | /* End PBXFileReference section */ 37 | 38 | /* Begin PBXFrameworksBuildPhase section */ 39 | 58B511D81A9E6C8500147676 /* Frameworks */ = { 40 | isa = PBXFrameworksBuildPhase; 41 | buildActionMask = 2147483647; 42 | files = ( 43 | ); 44 | runOnlyForDeploymentPostprocessing = 0; 45 | }; 46 | /* End PBXFrameworksBuildPhase section */ 47 | 48 | /* Begin PBXGroup section */ 49 | 134814211AA4EA7D00B7C361 /* Products */ = { 50 | isa = PBXGroup; 51 | children = ( 52 | 134814201AA4EA6300B7C361 /* libMFLReactFancyLabel.a */, 53 | ); 54 | name = Products; 55 | sourceTree = ""; 56 | }; 57 | 58B511D21A9E6C8500147676 = { 58 | isa = PBXGroup; 59 | children = ( 60 | D9B8D2E51C447601002ACB4B /* FancyLabel - iOS */, 61 | 134814211AA4EA7D00B7C361 /* Products */, 62 | ); 63 | sourceTree = ""; 64 | }; 65 | D9B8D2E51C447601002ACB4B /* FancyLabel - iOS */ = { 66 | isa = PBXGroup; 67 | children = ( 68 | D9B8D2E71C447601002ACB4B /* MFLReactFancyLabel.h */, 69 | D9B8D2E81C447601002ACB4B /* MFLReactFancyLabel.m */, 70 | D9B8D2E91C447601002ACB4B /* MFLReactFancyLabelManager.h */, 71 | D9B8D2EA1C447601002ACB4B /* MFLReactFancyLabelManager.m */, 72 | D9B8D2EB1C447601002ACB4B /* THLabel.h */, 73 | D9B8D2EC1C447601002ACB4B /* THLabel.m */, 74 | ); 75 | path = "FancyLabel - iOS"; 76 | sourceTree = ""; 77 | }; 78 | /* End PBXGroup section */ 79 | 80 | /* Begin PBXNativeTarget section */ 81 | 58B511DA1A9E6C8500147676 /* MFLReactFancyLabel */ = { 82 | isa = PBXNativeTarget; 83 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "MFLReactFancyLabel" */; 84 | buildPhases = ( 85 | 58B511D71A9E6C8500147676 /* Sources */, 86 | 58B511D81A9E6C8500147676 /* Frameworks */, 87 | 58B511D91A9E6C8500147676 /* Copy Files */, 88 | ); 89 | buildRules = ( 90 | ); 91 | dependencies = ( 92 | ); 93 | name = MFLReactFancyLabel; 94 | productName = RCTDataManager; 95 | productReference = 134814201AA4EA6300B7C361 /* libMFLReactFancyLabel.a */; 96 | productType = "com.apple.product-type.library.static"; 97 | }; 98 | /* End PBXNativeTarget section */ 99 | 100 | /* Begin PBXProject section */ 101 | 58B511D31A9E6C8500147676 /* Project object */ = { 102 | isa = PBXProject; 103 | attributes = { 104 | LastUpgradeCheck = 0610; 105 | ORGANIZATIONNAME = Facebook; 106 | TargetAttributes = { 107 | 58B511DA1A9E6C8500147676 = { 108 | CreatedOnToolsVersion = 6.1.1; 109 | }; 110 | }; 111 | }; 112 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "MFLReactFancyLabel" */; 113 | compatibilityVersion = "Xcode 3.2"; 114 | developmentRegion = English; 115 | hasScannedForEncodings = 0; 116 | knownRegions = ( 117 | en, 118 | ); 119 | mainGroup = 58B511D21A9E6C8500147676; 120 | productRefGroup = 58B511D21A9E6C8500147676; 121 | projectDirPath = ""; 122 | projectRoot = ""; 123 | targets = ( 124 | 58B511DA1A9E6C8500147676 /* MFLReactFancyLabel */, 125 | ); 126 | }; 127 | /* End PBXProject section */ 128 | 129 | /* Begin PBXSourcesBuildPhase section */ 130 | 58B511D71A9E6C8500147676 /* Sources */ = { 131 | isa = PBXSourcesBuildPhase; 132 | buildActionMask = 2147483647; 133 | files = ( 134 | D9B8D2EE1C447601002ACB4B /* MFLReactFancyLabel.m in Sources */, 135 | D9B8D2EF1C447601002ACB4B /* MFLReactFancyLabelManager.m in Sources */, 136 | D9B8D2F01C447601002ACB4B /* THLabel.m in Sources */, 137 | ); 138 | runOnlyForDeploymentPostprocessing = 0; 139 | }; 140 | /* End PBXSourcesBuildPhase section */ 141 | 142 | /* Begin XCBuildConfiguration section */ 143 | 58B511ED1A9E6C8500147676 /* Debug */ = { 144 | isa = XCBuildConfiguration; 145 | buildSettings = { 146 | ALWAYS_SEARCH_USER_PATHS = NO; 147 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 148 | CLANG_CXX_LIBRARY = "libc++"; 149 | CLANG_ENABLE_MODULES = YES; 150 | CLANG_ENABLE_OBJC_ARC = YES; 151 | CLANG_WARN_BOOL_CONVERSION = YES; 152 | CLANG_WARN_CONSTANT_CONVERSION = YES; 153 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 154 | CLANG_WARN_EMPTY_BODY = YES; 155 | CLANG_WARN_ENUM_CONVERSION = YES; 156 | CLANG_WARN_INT_CONVERSION = YES; 157 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 158 | CLANG_WARN_UNREACHABLE_CODE = YES; 159 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 160 | COPY_PHASE_STRIP = NO; 161 | ENABLE_STRICT_OBJC_MSGSEND = YES; 162 | GCC_C_LANGUAGE_STANDARD = gnu99; 163 | GCC_DYNAMIC_NO_PIC = NO; 164 | GCC_OPTIMIZATION_LEVEL = 0; 165 | GCC_PREPROCESSOR_DEFINITIONS = ( 166 | "DEBUG=1", 167 | "$(inherited)", 168 | ); 169 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 170 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 171 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 172 | GCC_WARN_UNDECLARED_SELECTOR = YES; 173 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 174 | GCC_WARN_UNUSED_FUNCTION = YES; 175 | GCC_WARN_UNUSED_VARIABLE = YES; 176 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 177 | MTL_ENABLE_DEBUG_INFO = YES; 178 | ONLY_ACTIVE_ARCH = YES; 179 | SDKROOT = iphoneos; 180 | }; 181 | name = Debug; 182 | }; 183 | 58B511EE1A9E6C8500147676 /* Release */ = { 184 | isa = XCBuildConfiguration; 185 | buildSettings = { 186 | ALWAYS_SEARCH_USER_PATHS = NO; 187 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 188 | CLANG_CXX_LIBRARY = "libc++"; 189 | CLANG_ENABLE_MODULES = YES; 190 | CLANG_ENABLE_OBJC_ARC = YES; 191 | CLANG_WARN_BOOL_CONVERSION = YES; 192 | CLANG_WARN_CONSTANT_CONVERSION = YES; 193 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 194 | CLANG_WARN_EMPTY_BODY = YES; 195 | CLANG_WARN_ENUM_CONVERSION = YES; 196 | CLANG_WARN_INT_CONVERSION = YES; 197 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 198 | CLANG_WARN_UNREACHABLE_CODE = YES; 199 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 200 | COPY_PHASE_STRIP = YES; 201 | ENABLE_NS_ASSERTIONS = NO; 202 | ENABLE_STRICT_OBJC_MSGSEND = YES; 203 | GCC_C_LANGUAGE_STANDARD = gnu99; 204 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 205 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 206 | GCC_WARN_UNDECLARED_SELECTOR = YES; 207 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 208 | GCC_WARN_UNUSED_FUNCTION = YES; 209 | GCC_WARN_UNUSED_VARIABLE = YES; 210 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 211 | MTL_ENABLE_DEBUG_INFO = NO; 212 | SDKROOT = iphoneos; 213 | VALIDATE_PRODUCT = YES; 214 | }; 215 | name = Release; 216 | }; 217 | 58B511F01A9E6C8500147676 /* Debug */ = { 218 | isa = XCBuildConfiguration; 219 | buildSettings = { 220 | HEADER_SEARCH_PATHS = ( 221 | "$(inherited)", 222 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 223 | "$(SRCROOT)/../../React/**", 224 | "$(SRCROOT)/../react-native/React/**", 225 | ); 226 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 227 | OTHER_LDFLAGS = "-ObjC"; 228 | PRODUCT_NAME = MFLReactFancyLabel; 229 | SKIP_INSTALL = YES; 230 | }; 231 | name = Debug; 232 | }; 233 | 58B511F11A9E6C8500147676 /* Release */ = { 234 | isa = XCBuildConfiguration; 235 | buildSettings = { 236 | HEADER_SEARCH_PATHS = ( 237 | "$(inherited)", 238 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 239 | "$(SRCROOT)/../../React/**", 240 | "$(SRCROOT)/../react-native/React/**", 241 | ); 242 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 243 | OTHER_LDFLAGS = "-ObjC"; 244 | PRODUCT_NAME = MFLReactFancyLabel; 245 | SKIP_INSTALL = YES; 246 | }; 247 | name = Release; 248 | }; 249 | /* End XCBuildConfiguration section */ 250 | 251 | /* Begin XCConfigurationList section */ 252 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "MFLReactFancyLabel" */ = { 253 | isa = XCConfigurationList; 254 | buildConfigurations = ( 255 | 58B511ED1A9E6C8500147676 /* Debug */, 256 | 58B511EE1A9E6C8500147676 /* Release */, 257 | ); 258 | defaultConfigurationIsVisible = 0; 259 | defaultConfigurationName = Release; 260 | }; 261 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "MFLReactFancyLabel" */ = { 262 | isa = XCConfigurationList; 263 | buildConfigurations = ( 264 | 58B511F01A9E6C8500147676 /* Debug */, 265 | 58B511F11A9E6C8500147676 /* Release */, 266 | ); 267 | defaultConfigurationIsVisible = 0; 268 | defaultConfigurationName = Release; 269 | }; 270 | /* End XCConfigurationList section */ 271 | }; 272 | rootObject = 58B511D31A9E6C8500147676 /* Project object */; 273 | } 274 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-native-fancy-label 2 | Cross platform (eventually) class for styling text with gradients, strokes, inner/outer shadows with blurring, as well as fading. 3 | 4 | Currently this is just a wrapper on [THLabel](https://github.com/MuscleRumble/THLabel) for iOS, with some slight modifications for auto-shrinking font size. Check there for more information. 5 | 6 | ![THLabel screenshot](https://raw.githubusercontent.com/MuscleRumble/THLabel/master/screenshot.png "THLabel screenshot") 7 | 8 | The included example shows usage of every single value possible currently. 9 | Note: Currently this is only single line, width must be specified manually, and text value must be passed as a prop. 10 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | /** 4 | * The react.gradle file registers two tasks: bundleDebugJsAndAssets and bundleReleaseJsAndAssets. 5 | * These basically call `react-native bundle` with the correct arguments during the Android build 6 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 7 | * bundle directly from the development server. Below you can see all the possible configurations 8 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 9 | * `apply from: "react.gradle"` line. 10 | * 11 | * project.ext.react = [ 12 | * // the name of the generated asset file containing your JS bundle 13 | * bundleAssetName: "index.android.bundle", 14 | * 15 | * // the entry file for bundle generation 16 | * entryFile: "index.android.js", 17 | * 18 | * // whether to bundle JS and assets in debug mode 19 | * bundleInDebug: false, 20 | * 21 | * // whether to bundle JS and assets in release mode 22 | * bundleInRelease: true, 23 | * 24 | * // the root of your project, i.e. where "package.json" lives 25 | * root: "../../", 26 | * 27 | * // where to put the JS bundle asset in debug mode 28 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 29 | * 30 | * // where to put the JS bundle asset in release mode 31 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 32 | * 33 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 34 | * // require('./image.png')), in debug mode 35 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 36 | * 37 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 38 | * // require('./image.png')), in release mode 39 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 40 | * 41 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 42 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 43 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 44 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 45 | * // for example, you might want to remove it from here. 46 | * inputExcludes: ["android/**", "ios/**"] 47 | * ] 48 | */ 49 | 50 | apply from: "react.gradle" 51 | 52 | android { 53 | compileSdkVersion 23 54 | buildToolsVersion "23.0.1" 55 | 56 | defaultConfig { 57 | applicationId "com.reactnativefancylabel" 58 | minSdkVersion 16 59 | targetSdkVersion 22 60 | versionCode 1 61 | versionName "1.0" 62 | ndk { 63 | abiFilters "armeabi-v7a", "x86" 64 | } 65 | } 66 | buildTypes { 67 | release { 68 | minifyEnabled false // Set this to true to enable Proguard 69 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 70 | } 71 | } 72 | } 73 | 74 | dependencies { 75 | compile fileTree(dir: "libs", include: ["*.jar"]) 76 | compile "com.android.support:appcompat-v7:23.0.1" 77 | compile "com.facebook.react:react-native:0.17.+" 78 | } 79 | -------------------------------------------------------------------------------- /android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Disabling obfuscation is useful if you collect stack traces from production crashes 20 | # (unless you are using a system that supports de-obfuscate the stack traces). 21 | -dontobfuscate 22 | 23 | # React Native 24 | 25 | # Keep our interfaces so they can be used by other ProGuard rules. 26 | # See http://sourceforge.net/p/proguard/bugs/466/ 27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip 28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters 29 | 30 | # Do not strip any method/class that is annotated with @DoNotStrip 31 | -keep @com.facebook.proguard.annotations.DoNotStrip class * 32 | -keepclassmembers class * { 33 | @com.facebook.proguard.annotations.DoNotStrip *; 34 | } 35 | 36 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { 37 | void set*(***); 38 | *** get*(); 39 | } 40 | 41 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } 42 | -keep class * extends com.facebook.react.bridge.NativeModule { *; } 43 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } 44 | -keepclassmembers class * { @com.facebook.react.uimanager.ReactProp ; } 45 | -keepclassmembers class * { @com.facebook.react.uimanager.ReactPropGroup ; } 46 | 47 | # okhttp 48 | 49 | -keepattributes Signature 50 | -keepattributes *Annotation* 51 | -keep class com.squareup.okhttp.** { *; } 52 | -keep interface com.squareup.okhttp.** { *; } 53 | -dontwarn com.squareup.okhttp.** 54 | 55 | # okio 56 | 57 | -keep class sun.misc.Unsafe { *; } 58 | -dontwarn java.nio.file.* 59 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 60 | -dontwarn okio.** 61 | -------------------------------------------------------------------------------- /android/app/react.gradle: -------------------------------------------------------------------------------- 1 | import org.apache.tools.ant.taskdefs.condition.Os 2 | 3 | def config = project.hasProperty("react") ? project.react : []; 4 | 5 | def bundleAssetName = config.bundleAssetName ?: "index.android.bundle" 6 | def entryFile = config.entryFile ?: "index.android.js" 7 | 8 | // because elvis operator 9 | def elvisFile(thing) { 10 | return thing ? file(thing) : null; 11 | } 12 | 13 | def reactRoot = elvisFile(config.root) ?: file("../../") 14 | def jsBundleDirDebug = elvisFile(config.jsBundleDirDebug) ?: 15 | file("$buildDir/intermediates/assets/debug") 16 | def jsBundleDirRelease = elvisFile(config.jsBundleDirRelease) ?: 17 | file("$buildDir/intermediates/assets/release") 18 | def resourcesDirDebug = elvisFile(config.resourcesDirDebug) ?: 19 | file("$buildDir/intermediates/res/merged/debug") 20 | def resourcesDirRelease = elvisFile(config.resourcesDirRelease) ?: 21 | file("$buildDir/intermediates/res/merged/release") 22 | def inputExcludes = config.inputExcludes ?: ["android/**", "ios/**"] 23 | 24 | def jsBundleFileDebug = file("$jsBundleDirDebug/$bundleAssetName") 25 | def jsBundleFileRelease = file("$jsBundleDirRelease/$bundleAssetName") 26 | 27 | task bundleDebugJsAndAssets(type: Exec) { 28 | // create dirs if they are not there (e.g. the "clean" task just ran) 29 | doFirst { 30 | jsBundleDirDebug.mkdirs() 31 | resourcesDirDebug.mkdirs() 32 | } 33 | 34 | // set up inputs and outputs so gradle can cache the result 35 | inputs.files fileTree(dir: reactRoot, excludes: inputExcludes) 36 | outputs.dir jsBundleDirDebug 37 | outputs.dir resourcesDirDebug 38 | 39 | // set up the call to the react-native cli 40 | workingDir reactRoot 41 | if (Os.isFamily(Os.FAMILY_WINDOWS)) { 42 | commandLine "cmd", "/c", "react-native", "bundle", "--platform", "android", "--dev", "true", "--entry-file", 43 | entryFile, "--bundle-output", jsBundleFileDebug, "--assets-dest", resourcesDirDebug 44 | } else { 45 | commandLine "react-native", "bundle", "--platform", "android", "--dev", "true", "--entry-file", 46 | entryFile, "--bundle-output", jsBundleFileDebug, "--assets-dest", resourcesDirDebug 47 | } 48 | 49 | enabled config.bundleInDebug ?: false 50 | } 51 | 52 | task bundleReleaseJsAndAssets(type: Exec) { 53 | // create dirs if they are not there (e.g. the "clean" task just ran) 54 | doFirst { 55 | jsBundleDirRelease.mkdirs() 56 | resourcesDirRelease.mkdirs() 57 | } 58 | 59 | // set up inputs and outputs so gradle can cache the result 60 | inputs.files fileTree(dir: reactRoot, excludes: inputExcludes) 61 | outputs.dir jsBundleDirRelease 62 | outputs.dir resourcesDirRelease 63 | 64 | // set up the call to the react-native cli 65 | workingDir reactRoot 66 | if (Os.isFamily(Os.FAMILY_WINDOWS)) { 67 | commandLine "cmd","/c", "react-native", "bundle", "--platform", "android", "--dev", "false", "--entry-file", 68 | entryFile, "--bundle-output", jsBundleFileRelease, "--assets-dest", resourcesDirRelease 69 | } else { 70 | commandLine "react-native", "bundle", "--platform", "android", "--dev", "false", "--entry-file", 71 | entryFile, "--bundle-output", jsBundleFileRelease, "--assets-dest", resourcesDirRelease 72 | } 73 | 74 | enabled config.bundleInRelease ?: true 75 | } 76 | 77 | gradle.projectsEvaluated { 78 | // hook bundleDebugJsAndAssets into the android build process 79 | bundleDebugJsAndAssets.dependsOn mergeDebugResources 80 | bundleDebugJsAndAssets.dependsOn mergeDebugAssets 81 | processDebugResources.dependsOn bundleDebugJsAndAssets 82 | 83 | // hook bundleReleaseJsAndAssets into the android build process 84 | bundleReleaseJsAndAssets.dependsOn mergeReleaseResources 85 | bundleReleaseJsAndAssets.dependsOn mergeReleaseAssets 86 | processReleaseResources.dependsOn bundleReleaseJsAndAssets 87 | } 88 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 11 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/reactnativefancylabel/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.reactnativefancylabel; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.view.KeyEvent; 6 | 7 | import com.facebook.react.LifecycleState; 8 | import com.facebook.react.ReactInstanceManager; 9 | import com.facebook.react.ReactRootView; 10 | import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; 11 | import com.facebook.react.shell.MainReactPackage; 12 | import com.facebook.soloader.SoLoader; 13 | 14 | public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler { 15 | 16 | private ReactInstanceManager mReactInstanceManager; 17 | private ReactRootView mReactRootView; 18 | 19 | @Override 20 | protected void onCreate(Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | mReactRootView = new ReactRootView(this); 23 | 24 | mReactInstanceManager = ReactInstanceManager.builder() 25 | .setApplication(getApplication()) 26 | .setBundleAssetName("index.android.bundle") 27 | .setJSMainModuleName("index.android") 28 | .addPackage(new MainReactPackage()) 29 | .setUseDeveloperSupport(BuildConfig.DEBUG) 30 | .setInitialLifecycleState(LifecycleState.RESUMED) 31 | .build(); 32 | 33 | mReactRootView.startReactApplication(mReactInstanceManager, "ReactNativeFancyLabel", null); 34 | 35 | setContentView(mReactRootView); 36 | } 37 | 38 | @Override 39 | public boolean onKeyUp(int keyCode, KeyEvent event) { 40 | if (keyCode == KeyEvent.KEYCODE_MENU && mReactInstanceManager != null) { 41 | mReactInstanceManager.showDevOptionsDialog(); 42 | return true; 43 | } 44 | return super.onKeyUp(keyCode, event); 45 | } 46 | 47 | @Override 48 | public void onBackPressed() { 49 | if (mReactInstanceManager != null) { 50 | mReactInstanceManager.onBackPressed(); 51 | } else { 52 | super.onBackPressed(); 53 | } 54 | } 55 | 56 | @Override 57 | public void invokeDefaultOnBackPressed() { 58 | super.onBackPressed(); 59 | } 60 | 61 | @Override 62 | protected void onPause() { 63 | super.onPause(); 64 | 65 | if (mReactInstanceManager != null) { 66 | mReactInstanceManager.onPause(); 67 | } 68 | } 69 | 70 | @Override 71 | protected void onResume() { 72 | super.onResume(); 73 | 74 | if (mReactInstanceManager != null) { 75 | mReactInstanceManager.onResume(this, this); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MattFoley/react-native-fancy-label/aae1055ab6a2c7a81baeb52a357591346b399e4b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MattFoley/react-native-fancy-label/aae1055ab6a2c7a81baeb52a357591346b399e4b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MattFoley/react-native-fancy-label/aae1055ab6a2c7a81baeb52a357591346b399e4b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MattFoley/react-native-fancy-label/aae1055ab6a2c7a81baeb52a357591346b399e4b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ReactNativeFancyLabel 3 | 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.3.1' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | mavenLocal() 18 | jcenter() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useDeprecatedNdk=true 21 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MattFoley/react-native-fancy-label/aae1055ab6a2c7a81baeb52a357591346b399e4b/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 6 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /android/index.android.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | */ 5 | 'use strict'; 6 | 7 | var React = require('react-native'); 8 | var { 9 | AppRegistry, 10 | StyleSheet, 11 | Text, 12 | View, 13 | } = React; 14 | 15 | var ReactNativeFancyLabel = React.createClass({ 16 | render: function() { 17 | return ( 18 | 19 | 20 | Welcome to React Native! 21 | 22 | 23 | To get started, edit index.android.js 24 | 25 | 26 | Shake or press menu button for dev menu 27 | 28 | 29 | ); 30 | } 31 | }); 32 | 33 | var styles = StyleSheet.create({ 34 | container: { 35 | flex: 1, 36 | justifyContent: 'center', 37 | alignItems: 'center', 38 | backgroundColor: '#F5FCFF', 39 | }, 40 | welcome: { 41 | fontSize: 20, 42 | textAlign: 'center', 43 | margin: 10, 44 | }, 45 | instructions: { 46 | textAlign: 'center', 47 | color: '#333333', 48 | marginBottom: 5, 49 | }, 50 | }); 51 | 52 | AppRegistry.registerComponent('ReactNativeFancyLabel', () => ReactNativeFancyLabel); 53 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'ReactNativeFancyLabel' 2 | 3 | include ':app' 4 | -------------------------------------------------------------------------------- /index.ios.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @providesModule FancyLabel 3 | * @flow 4 | */ 5 | 6 | var React = require('react'); 7 | var ReactNative = require('react-native'); 8 | var ReactPropTypes = require('react/lib/ReactPropTypes'); 9 | var StyleSheetPropType = require('react-native/Libraries/StyleSheet/StyleSheetPropType'); 10 | var ColorPropType = require('react-native/Libraries/StyleSheet/ColorPropType'); 11 | var ViewStylePropTypes = require('react-native/Libraries/Components/View/ViewStylePropTypes'); 12 | var StyleSheetValidation = require('react-native/Libraries/StyleSheet/StyleSheetValidation') 13 | var PointPropType = require('react-native/Libraries/StyleSheet/PointPropType'); 14 | 15 | var _ = require('lodash'); 16 | 17 | import { 18 | requireNativeComponent, 19 | processColor, 20 | View, 21 | Text, 22 | StyleSheet 23 | } from 'react-native'; 24 | 25 | var FancyLabelOwnPropTypes = { 26 | fadeTruncatingMode: ReactPropTypes.oneOf( 27 | [ 'None', 'Tail', 'Head', 'HeadAndTail'] 28 | ), 29 | textInsets: ReactPropTypes.object, 30 | automaticallyAdjustTextInsets: ReactPropTypes.bool, 31 | letterSpacing: ReactPropTypes.number, 32 | baselineAdjustment: ReactPropTypes.oneOf( 33 | [ 'AlignBaselines', 'AlignCenters', 'None'] 34 | ), 35 | minimumScaleFactor: ReactPropTypes.number, 36 | textAlign: ReactPropTypes.oneOf( 37 | ['auto', 'left', 'right', 'center', 'justify'] 38 | ), 39 | strokeSize: ReactPropTypes.number, 40 | strokeColor: ColorPropType, 41 | strokePosition: ReactPropTypes.oneOf( 42 | ["Outside", "Center", "Inside"] 43 | ), 44 | 45 | textShadowOffset: PointPropType, 46 | textShadowBlur: ReactPropTypes.number, 47 | textShadowColor: ColorPropType, 48 | 49 | innerTextShadowOffset: PointPropType, 50 | innerTextShadowBlur: ReactPropTypes.number, 51 | innerTextShadowColor: ColorPropType, 52 | 53 | gradientStartPoint: PointPropType, 54 | gradientEndPoint: PointPropType, 55 | 56 | gradientColors: ReactPropTypes.arrayOf(ColorPropType), 57 | 58 | fontFamily: ReactPropTypes.string, 59 | fontSize: ReactPropTypes.number, 60 | color: ColorPropType, 61 | adjustsFontSizeToFitWidth: ReactPropTypes.bool 62 | }; 63 | 64 | var FancyLabelPropTypes = Object.assign( 65 | Object.create(ViewStylePropTypes), FancyLabelOwnPropTypes); 66 | 67 | class FancyLabel extends React.Component { 68 | static propTypes = { 69 | ...View.propTypes, 70 | style: StyleSheetPropType(FancyLabelPropTypes) 71 | }; 72 | 73 | render() { 74 | let styleProps = StyleSheet.flatten(this.props.style); 75 | 76 | let viewProps = { 77 | ...this.props, 78 | style: { 79 | ..._.omit(styleProps, _.keys(FancyLabelOwnPropTypes)) 80 | } 81 | }; 82 | 83 | let labelProps = _.pick(styleProps, _.keys(FancyLabelOwnPropTypes)); 84 | let textProps = _.pick(styleProps, ['fontSize', 'fontFamily', 'letterSpacing']); 85 | 86 | if (processColor) { 87 | const colorPropKeys = ["gradientColors", "strokeColor", "textShadowColor", "innerTextShadowColor", "color"]; 88 | _.assign(labelProps, _.mapValues(_.pick(styleProps, colorPropKeys), c => processColor(c))); 89 | } 90 | 91 | return ( 92 | 93 | 94 | {this.props.children} 95 | 96 | 97 | ); 98 | } 99 | } 100 | 101 | var RNFancyLabel = requireNativeComponent('MFLReactFancyLabel', FancyLabel, { 102 | nativeOnly : _.mapValues(FancyLabelOwnPropTypes, (o) => true) 103 | }); 104 | 105 | StyleSheetValidation.addValidStylePropTypes(FancyLabelPropTypes); 106 | 107 | module.exports = FancyLabel; 108 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-fancy-label", 3 | "version": "0.0.9", 4 | "private": false, 5 | "scripts": { 6 | "start": "node_modules/react-native/packager/packager.sh" 7 | }, 8 | "keywords": [ 9 | "react-component", 10 | "react-native", 11 | "ios" 12 | ], 13 | "repository": { 14 | "type": "git", 15 | "url": "git@github.com:MattFoley/react-native-fancy-label.git" 16 | }, 17 | "author": "iOSGuy (http://github.com/MattFoley)", 18 | "dependencies": { 19 | "lodash": "^4.5.1" 20 | } 21 | } 22 | --------------------------------------------------------------------------------