├── .dockerignore ├── .gitattributes ├── .github └── issue_template.md ├── .gitignore ├── LICENSE ├── README.md ├── RELEASE_NOTES.md ├── RNTextGradientView.podspec ├── TextGradientExample ├── .flowconfig ├── .gitattributes ├── .gitignore ├── .watchmanconfig ├── App.js ├── Dockerfile ├── README.md ├── android │ ├── .gitignore │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── build_defs.bzl │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets │ │ │ └── .gitkeep │ │ │ ├── java │ │ │ └── com │ │ │ │ └── textgradientexample │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── keystores │ │ ├── BUCK │ │ └── debug.keystore.properties │ └── settings.gradle ├── app.json ├── babel.config.js ├── index.js ├── ios │ ├── .gitignore │ ├── TextGradientExample.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── TextGradientExample-tvOS.xcscheme │ │ │ └── TextGradientExample.xcscheme │ └── TextGradientExample │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m ├── metro.config.js ├── package-lock.json └── package.json ├── android ├── .gitignore ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── iyegoroff │ └── RNTextGradient │ ├── Linear │ ├── RNLinearTextGradientManager.java │ ├── RNLinearTextGradientSpan.java │ ├── RNShadowLinearTextGradient.java │ ├── RNVirtualLinearTextGradientManager.java │ └── RNVirtualShadowLinearTextGradient.java │ ├── OneOffListener.java │ ├── RNSetGradientSpanOperation.java │ ├── RNShadowTextGradient.java │ ├── RNTextGradient.java │ ├── RNTextGradientManager.java │ ├── RNTextGradientPackage.java │ ├── RNVirtualTextGradientManager.java │ └── ReflectUtils.java ├── img ├── android.jpg ├── ios.png └── useViewFrame.png ├── ios ├── .gitignore ├── RNLinearGradientUtils.h ├── RNLinearGradientUtils.m ├── RNLinearTextGradientShadowView.h ├── RNLinearTextGradientShadowView.m ├── RNLinearTextGradientShadowViewDelegate.h ├── RNLinearTextGradientViewManager.h ├── RNLinearTextGradientViewManager.m ├── RNTextGradient.xcodeproj │ └── project.pbxproj ├── RNTextGradientShadowView.h ├── RNTextGradientShadowView.m ├── RNTextGradientShadowViewDelegate.h ├── RNTextGradientUtils.h ├── RNTextGradientUtils.m ├── RNTextGradientValue.h ├── RNTextGradientValue.m ├── RNTextGradientView.h ├── RNTextGradientView.m ├── RNTextGradientViewManager.h ├── RNTextGradientViewManager.m ├── RNVirtualLinearTextGradientShadowView.h ├── RNVirtualLinearTextGradientShadowView.m ├── RNVirtualLinearTextGradientViewManager.h ├── RNVirtualLinearTextGradientViewManager.m ├── RNVirtualTextGradientShadowView.h ├── RNVirtualTextGradientShadowView.m ├── RNVirtualTextGradientViewManager.h └── RNVirtualTextGradientViewManager.m ├── manual_installation.md ├── package.json ├── patch-rn.js └── src ├── create-text-gradient-class.js ├── index.d.ts ├── index.js └── linear-text-gradient.js /.dockerignore: -------------------------------------------------------------------------------- 1 | **/node_modules 2 | .github 3 | .git 4 | img 5 | LICENSE 6 | **/*.md 7 | *.tgz 8 | **/.gitignore 9 | 10 | **/bin 11 | **/obj 12 | **/packages 13 | **/paket-files 14 | fable-typed/paket.* 15 | fable-typed/*.fsproj 16 | fable-typed/publish.js 17 | fable-typed/.paket 18 | 19 | **/android/build 20 | **/android/app/build 21 | **/android/app/src/main/assets/*.bundle 22 | **/android/local.properties 23 | **/.gradle 24 | **/.idea 25 | **/*.iml 26 | **/*.apk 27 | 28 | **/ios/build 29 | **/ios/infer-out 30 | 31 | **/out 32 | 33 | **/infer-out 34 | **/compile_commands.json 35 | **/xcodebuild.log 36 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # OSX 3 | # 4 | .DS_Store 5 | 6 | # node.js 7 | # 8 | node_modules/ 9 | npm-debug.log 10 | yarn-error.log 11 | 12 | 13 | # Xcode 14 | # 15 | build/ 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | xcuserdata 25 | *.xccheckout 26 | *.moved-aside 27 | DerivedData 28 | *.hmap 29 | *.ipa 30 | *.xcuserstate 31 | project.xcworkspace 32 | 33 | 34 | # Android/IntelliJ 35 | # 36 | build/ 37 | .idea 38 | .gradle 39 | local.properties 40 | *.iml 41 | 42 | # BUCK 43 | buck-out/ 44 | \.buckd/ 45 | *.keystore 46 | 47 | .vscode/ 48 | 49 | android/build/ 50 | 51 | *.tgz 52 | .ionide 53 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 iyegoroff 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-native-text-gradient 2 | 3 | [![npm version](https://badge.fury.io/js/react-native-text-gradient.svg?t=1495378566925)](https://badge.fury.io/js/react-native-text-gradient) 4 | [![Dependency Status](https://david-dm.org/iyegoroff/react-native-text-gradient.svg?t=1495378566925)](https://david-dm.org/iyegoroff/react-native-text-gradient) 5 | [![typings included](https://img.shields.io/badge/typings-included-brightgreen.svg?t=1495378566925)](src/index.d.ts) 6 | [![npm](https://img.shields.io/npm/l/express.svg?t=1495378566925)](https://www.npmjs.com/package/react-native-text-gradient) 7 | 8 | React-Native text gradient component for iOS & Android. 9 | 10 | ## Status 11 | 12 | 🚧🚧🚧 13 | 14 | Currently rntg is on hiatus, but I'll update it someday. Last supported react-native version is "0.59.10". 15 | 16 | 🚧🚧🚧 17 | - Component works as drop-in replacement for standard `Text` component and it is possible to have nested gradients. 18 | - React-Native: 19 | - with rn >= 0.59.0 use latest version and [patch](#usage-with-rn--0560); 20 | - with rn >= 0.56.0 use 0.0.17 and [patch](#usage-with-rn--0560); 21 | - with rn >= 0.55.0 use 0.0.9; 22 | - with rn >= 0.54.0 use 0.0.7; 23 | - with rn >= 0.53.1 use 0.0.4; 24 | - rn 0.53.0 is not supported; 25 | - with rn >= 0.50.0 use 0.0.3. 26 | 27 | ## Getting started 28 | 29 | `$ npm install react-native-text-gradient --save` 30 | 31 | ### Mostly automatic installation 32 | 33 | `$ react-native link react-native-text-gradient` 34 | 35 | ### Manual installation 36 | 37 | [link](manual_installation.md) 38 | 39 | > If you are using Cocoapods you need to follow the manual installation guide. 40 | 41 | ## Example 42 | 43 | ```javascript 44 | import { LinearTextGradient } from "react-native-text-gradient"; 45 | 46 | 53 | THIS IS TEXT GRADIENT 54 | ; 55 | ``` 56 | 57 | | iOS | Android | 58 | | :-----------------------------------------------: | :----------------------------------------------------: | 59 | | | | 60 | 61 | ## Usage 62 | 63 | ### LinearTextGradient 64 | 65 | Interface is similar to `Text` & [LinearGradient](https://github.com/react-native-community/react-native-linear-gradient) 66 | 67 | #### colors 68 | 69 | An array of at least two color values that represent gradient colors. Example: `['red', 'blue']` sets gradient from red to blue. 70 | 71 | #### start 72 | 73 | An optional object of the following type: `{ x: number, y: number }`. Coordinates declare the position that the gradient starts at, as a fraction of the overall size of the gradient, starting from the top left corner. Example: `{ x: 0.1, y: 0.1 }` means that the gradient will start 10% from the top and 10% from the left. 74 | 75 | #### end 76 | 77 | Same as start, but for the end of the gradient. 78 | 79 | #### locations 80 | 81 | An optional array of numbers defining the location of each gradient color stop, mapping to the color with the same index in `colors` prop. Example: `[0.1, 0.75, 1]` means that first color will take 0% - 10%, second color will take 10% - 75% and finally third color will occupy 75% - 100%. 82 | 83 | #### useViewFrame 84 | 85 | Optional. If true gradient will be calculated for text view background frame rather than text frame. 86 | 87 | ```javascript 88 | 97 | %%%%%%%%%%%%%%%%%%%%%% 98 | 99 | ``` 100 | 101 | 102 | 103 | ## Usage with rn >= 0.56.0 104 | 105 | Wait until https://github.com/facebook/react/pull/13211 will be merged or patch react-native to remove failing invariant checks 106 | 107 | `$ node node_modules/react-native-text-gradient/patch-rn.js` 108 | 109 | ## Caveats 110 | 111 | When mixing several text gradients and `Text`s top component always should be text gradient. 112 | 113 | ```javascript 114 | 115 | 123 116 | qwerty 117 | 321 118 | 119 | ``` 120 | 121 | This is necessary because only top text component is 'mapped' to actual native node and its children are 'virtual' from the native perspective. 122 | -------------------------------------------------------------------------------- /RELEASE_NOTES.md: -------------------------------------------------------------------------------- 1 | [release notes](https://github.com/iyegoroff/react-native-text-gradient/releases) -------------------------------------------------------------------------------- /RNTextGradientView.podspec: -------------------------------------------------------------------------------- 1 | require 'json' 2 | 3 | package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) 4 | 5 | Pod::Spec.new do |s| 6 | s.name = "RNTextGradientView" 7 | s.version = package['version'] 8 | s.summary = "Text gradient for React-Native" 9 | 10 | s.authors = { "iyegoroff" => "iegoroff@gmail.com" } 11 | s.homepage = "https://github.com/iyegoroff/react-native-text-gradient" 12 | s.license = "MIT" 13 | s.platform = :ios, "8.0" 14 | 15 | s.source = { :git => "https://github.com/iyegoroff/react-native-text-gradient.git" } 16 | s.source_files = "ios/**/*.{h,m}" 17 | 18 | s.dependency 'React' 19 | end -------------------------------------------------------------------------------- /TextGradientExample/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore unexpected extra "@providesModule" 9 | .*/node_modules/.*/node_modules/fbjs/.* 10 | 11 | ; Ignore duplicate module providers 12 | ; For RN Apps installed via npm, "Libraries" folder is inside 13 | ; "node_modules/react-native" but in the source repo it is in the root 14 | .*/Libraries/react-native/React.js 15 | 16 | ; Ignore polyfills 17 | .*/Libraries/polyfills/.* 18 | 19 | ; Ignore metro 20 | .*/node_modules/metro/.* 21 | 22 | [include] 23 | 24 | [libs] 25 | node_modules/react-native/Libraries/react-native/react-native-interface.js 26 | node_modules/react-native/flow/ 27 | 28 | [options] 29 | emoji=true 30 | 31 | esproposal.optional_chaining=enable 32 | esproposal.nullish_coalescing=enable 33 | 34 | module.system=haste 35 | module.system.haste.use_name_reducers=true 36 | # get basename 37 | module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' 38 | # strip .js or .js.flow suffix 39 | module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' 40 | # strip .ios suffix 41 | module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' 42 | module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' 43 | module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' 44 | module.system.haste.paths.blacklist=.*/__tests__/.* 45 | module.system.haste.paths.blacklist=.*/__mocks__/.* 46 | module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.* 47 | module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.* 48 | 49 | munge_underscores=true 50 | 51 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' 52 | 53 | module.file_ext=.js 54 | module.file_ext=.jsx 55 | module.file_ext=.json 56 | module.file_ext=.native.js 57 | 58 | suppress_type=$FlowIssue 59 | suppress_type=$FlowFixMe 60 | suppress_type=$FlowFixMeProps 61 | suppress_type=$FlowFixMeState 62 | 63 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 64 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 65 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 66 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 67 | 68 | [version] 69 | ^0.92.0 70 | -------------------------------------------------------------------------------- /TextGradientExample/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /TextGradientExample/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | infer-out/ 3 | xcodebuild.log 4 | src/obj/ 5 | src/bin/ 6 | **/.DS_Store 7 | .gradle/ 8 | compile_commands.json 9 | rn-cli.config.js 10 | *.apk 11 | -------------------------------------------------------------------------------- /TextGradientExample/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /TextGradientExample/App.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | * @flow 7 | */ 8 | 9 | import React, {Component} from 'react'; 10 | import {Platform, StyleSheet, Text, View} from 'react-native'; 11 | import {LinearTextGradient} from 'react-native-text-gradient' 12 | 13 | const instructions = Platform.select({ 14 | ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu', 15 | android: 16 | 'Double tap R on your keyboard to reload,\n' + 17 | 'Shake or press menu button for dev menu', 18 | }); 19 | 20 | type Props = {}; 21 | export default class App extends Component { 22 | render() { 23 | return ( 24 | 25 | 33 | Welcome to React Native! 34 | 35 | To get started, edit App.js 36 | {instructions} 37 | 38 | ); 39 | } 40 | } 41 | 42 | const styles = StyleSheet.create({ 43 | container: { 44 | flex: 1, 45 | justifyContent: 'center', 46 | alignItems: 'center', 47 | backgroundColor: '#F5FCFF', 48 | }, 49 | welcome: { 50 | fontSize: 20, 51 | // width: '100%', 52 | // textAlign: 'right', 53 | // backgroundColor: 'lightgray', 54 | margin: 10, 55 | }, 56 | instructions: { 57 | textAlign: 'center', 58 | color: '#333333', 59 | marginBottom: 5, 60 | }, 61 | }); 62 | -------------------------------------------------------------------------------- /TextGradientExample/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM iyegoroff/ubuntu-node-android-git:1 2 | 3 | RUN mkdir /package 4 | COPY . /package 5 | WORKDIR /package/TextGradientExample 6 | 7 | RUN npm i --unsafe-perm 8 | RUN npm run generate:android:bundle 9 | RUN rm -rf node_modules/.bin && rm -rf ../node_modules/.bin 10 | RUN cd android && ./gradlew assembleRelease 11 | -------------------------------------------------------------------------------- /TextGradientExample/README.md: -------------------------------------------------------------------------------- 1 | ### Run debug version 2 | - Go to example folder `cd react-native-text-gradient/TextGradientExample` 3 | - Run `npm i && npm run run:android` 4 | 5 | ### Build signed release apk with Docker 6 | - Go to TextGradientExample folder `cd react-native-text-gradient/TextGradientExample` 7 | - Generate keystore `npm run generate:android:signing-key` 8 | - Open `TextGradientExample/android/gradle.properties` file and replace `qwerty`s with your passwords 9 | - Run `npm run build:release:docker` - upon script completion apk will be copied to `TextGradientExample/text-gradient.apk` file -------------------------------------------------------------------------------- /TextGradientExample/android/.gitignore: -------------------------------------------------------------------------------- 1 | **/build/ 2 | **/infer-out/ 3 | .idea 4 | .gradle 5 | local.properties 6 | *.iml 7 | .DS_Store 8 | app/*.keystore 9 | app/src/main/assets/*.bundle 10 | app/src/main/res/drawable-* 11 | gradle-yandex.properties -------------------------------------------------------------------------------- /TextGradientExample/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") 12 | 13 | lib_deps = [] 14 | 15 | create_aar_targets(glob(["libs/*.aar"])) 16 | 17 | create_jar_targets(glob(["libs/*.jar"])) 18 | 19 | android_library( 20 | name = "all-libs", 21 | exported_deps = lib_deps, 22 | ) 23 | 24 | android_library( 25 | name = "app-code", 26 | srcs = glob([ 27 | "src/main/java/**/*.java", 28 | ]), 29 | deps = [ 30 | ":all-libs", 31 | ":build_config", 32 | ":res", 33 | ], 34 | ) 35 | 36 | android_build_config( 37 | name = "build_config", 38 | package = "com.textgradientexample", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.textgradientexample", 44 | res = "src/main/res", 45 | ) 46 | 47 | android_binary( 48 | name = "app", 49 | keystore = "//android/keystores:debug", 50 | manifest = "src/main/AndroidManifest.xml", 51 | package_type = "debug", 52 | deps = [ 53 | ":app-code", 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /TextGradientExample/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation 19 | * entryFile: "index.android.js", 20 | * 21 | * // whether to bundle JS and assets in debug mode 22 | * bundleInDebug: false, 23 | * 24 | * // whether to bundle JS and assets in release mode 25 | * bundleInRelease: true, 26 | * 27 | * // whether to bundle JS and assets in another build variant (if configured). 28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 29 | * // The configuration property can be in the following formats 30 | * // 'bundleIn${productFlavor}${buildType}' 31 | * // 'bundleIn${buildType}' 32 | * // bundleInFreeDebug: true, 33 | * // bundleInPaidRelease: true, 34 | * // bundleInBeta: true, 35 | * 36 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 37 | * // for example: to disable dev mode in the staging build type (if configured) 38 | * devDisabledInStaging: true, 39 | * // The configuration property can be in the following formats 40 | * // 'devDisabledIn${productFlavor}${buildType}' 41 | * // 'devDisabledIn${buildType}' 42 | * 43 | * // the root of your project, i.e. where "package.json" lives 44 | * root: "../../", 45 | * 46 | * // where to put the JS bundle asset in debug mode 47 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 48 | * 49 | * // where to put the JS bundle asset in release mode 50 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 51 | * 52 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 53 | * // require('./image.png')), in debug mode 54 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 55 | * 56 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 57 | * // require('./image.png')), in release mode 58 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 59 | * 60 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 61 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 62 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 63 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 64 | * // for example, you might want to remove it from here. 65 | * inputExcludes: ["android/**", "ios/**"], 66 | * 67 | * // override which node gets called and with what additional arguments 68 | * nodeExecutableAndArgs: ["node"], 69 | * 70 | * // supply additional arguments to the packager 71 | * extraPackagerArgs: [] 72 | * ] 73 | */ 74 | 75 | project.ext.react = [ 76 | entryFile: "index.js" 77 | ] 78 | 79 | apply from: "../../node_modules/react-native/react.gradle" 80 | 81 | /** 82 | * Set this to true to create two separate APKs instead of one: 83 | * - An APK that only works on ARM devices 84 | * - An APK that only works on x86 devices 85 | * The advantage is the size of the APK is reduced by about 4MB. 86 | * Upload all the APKs to the Play Store and people will download 87 | * the correct one based on the CPU architecture of their device. 88 | */ 89 | def enableSeparateBuildPerCPUArchitecture = false 90 | 91 | /** 92 | * Run Proguard to shrink the Java bytecode in release builds. 93 | */ 94 | def enableProguardInReleaseBuilds = false 95 | 96 | android { 97 | compileSdkVersion rootProject.ext.compileSdkVersion 98 | 99 | compileOptions { 100 | sourceCompatibility JavaVersion.VERSION_1_8 101 | targetCompatibility JavaVersion.VERSION_1_8 102 | } 103 | 104 | defaultConfig { 105 | applicationId "com.textgradientexample" 106 | minSdkVersion rootProject.ext.minSdkVersion 107 | targetSdkVersion rootProject.ext.targetSdkVersion 108 | versionCode 1 109 | versionName "1.0" 110 | } 111 | 112 | signingConfigs { 113 | release { 114 | if (project.hasProperty('EXAMPLE_RELEASE_STORE_FILE')) { 115 | storeFile file(EXAMPLE_RELEASE_STORE_FILE) 116 | storePassword EXAMPLE_RELEASE_STORE_PASSWORD 117 | keyAlias EXAMPLE_RELEASE_KEY_ALIAS 118 | keyPassword EXAMPLE_RELEASE_KEY_PASSWORD 119 | } 120 | } 121 | } 122 | 123 | splits { 124 | abi { 125 | reset() 126 | enable enableSeparateBuildPerCPUArchitecture 127 | universalApk false // If true, also generate a universal APK 128 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" 129 | } 130 | } 131 | buildTypes { 132 | release { 133 | minifyEnabled enableProguardInReleaseBuilds 134 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 135 | signingConfig signingConfigs.release 136 | } 137 | } 138 | // applicationVariants are e.g. debug, release 139 | applicationVariants.all { variant -> 140 | variant.outputs.each { output -> 141 | // For each separate APK per architecture, set a unique version code as described here: 142 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits 143 | def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4] 144 | def abi = output.getFilter(OutputFile.ABI) 145 | if (abi != null) { // null for the universal-debug, universal-release variants 146 | output.versionCodeOverride = 147 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 148 | } 149 | } 150 | } 151 | 152 | // lintOptions { 153 | // checkReleaseBuilds false 154 | // abortOnError false 155 | // } 156 | 157 | // aaptOptions { 158 | // cruncherEnabled false 159 | // } 160 | } 161 | 162 | dependencies { 163 | implementation project(':react-native-text-gradient') 164 | implementation fileTree(dir: "libs", include: ["*.jar"]) 165 | implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" 166 | implementation "com.facebook.react:react-native:+" // From node_modules 167 | } 168 | 169 | // Run this once to be able to run the application with BUCK 170 | // puts all compile dependencies into folder libs for BUCK to use 171 | task copyDownloadableDepsToLibs(type: Copy) { 172 | from configurations.compile 173 | into 'libs' 174 | } 175 | -------------------------------------------------------------------------------- /TextGradientExample/android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /TextGradientExample/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 | -------------------------------------------------------------------------------- /TextGradientExample/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TextGradientExample/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /TextGradientExample/android/app/src/main/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/react-native-text-gradient/8442405fc3ee155ff52788c6f1f990b3146c1f57/TextGradientExample/android/app/src/main/assets/.gitkeep -------------------------------------------------------------------------------- /TextGradientExample/android/app/src/main/java/com/textgradientexample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.textgradientexample; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. 9 | * This is used to schedule rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "TextGradientExample"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /TextGradientExample/android/app/src/main/java/com/textgradientexample/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.textgradientexample; 2 | 3 | import android.app.Application; 4 | 5 | import com.facebook.react.ReactApplication; 6 | import iyegoroff.RNTextGradient.RNTextGradientPackage; 7 | import com.facebook.react.ReactNativeHost; 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.react.shell.MainReactPackage; 10 | import com.facebook.soloader.SoLoader; 11 | 12 | import java.util.Arrays; 13 | import java.util.List; 14 | 15 | public class MainApplication extends Application implements ReactApplication { 16 | 17 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 18 | @Override 19 | public boolean getUseDeveloperSupport() { 20 | return BuildConfig.DEBUG; 21 | } 22 | 23 | @Override 24 | protected List getPackages() { 25 | return Arrays.asList( 26 | new MainReactPackage(), 27 | new RNTextGradientPackage() 28 | ); 29 | } 30 | 31 | @Override 32 | protected String getJSMainModuleName() { 33 | return "index"; 34 | } 35 | }; 36 | 37 | @Override 38 | public ReactNativeHost getReactNativeHost() { 39 | return mReactNativeHost; 40 | } 41 | 42 | @Override 43 | public void onCreate() { 44 | super.onCreate(); 45 | SoLoader.init(this, /* native exopackage */ false); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /TextGradientExample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/react-native-text-gradient/8442405fc3ee155ff52788c6f1f990b3146c1f57/TextGradientExample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /TextGradientExample/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/react-native-text-gradient/8442405fc3ee155ff52788c6f1f990b3146c1f57/TextGradientExample/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /TextGradientExample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/react-native-text-gradient/8442405fc3ee155ff52788c6f1f990b3146c1f57/TextGradientExample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /TextGradientExample/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/react-native-text-gradient/8442405fc3ee155ff52788c6f1f990b3146c1f57/TextGradientExample/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /TextGradientExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/react-native-text-gradient/8442405fc3ee155ff52788c6f1f990b3146c1f57/TextGradientExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /TextGradientExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/react-native-text-gradient/8442405fc3ee155ff52788c6f1f990b3146c1f57/TextGradientExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /TextGradientExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/react-native-text-gradient/8442405fc3ee155ff52788c6f1f990b3146c1f57/TextGradientExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /TextGradientExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/react-native-text-gradient/8442405fc3ee155ff52788c6f1f990b3146c1f57/TextGradientExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /TextGradientExample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/react-native-text-gradient/8442405fc3ee155ff52788c6f1f990b3146c1f57/TextGradientExample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /TextGradientExample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/react-native-text-gradient/8442405fc3ee155ff52788c6f1f990b3146c1f57/TextGradientExample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /TextGradientExample/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | TextGradientExample 3 | 4 | -------------------------------------------------------------------------------- /TextGradientExample/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /TextGradientExample/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "28.0.3" 6 | minSdkVersion = 16 7 | compileSdkVersion = 28 8 | targetSdkVersion = 28 9 | supportLibVersion = "28.0.0" 10 | } 11 | repositories { 12 | google() 13 | jcenter() 14 | } 15 | dependencies { 16 | classpath("com.android.tools.build:gradle:3.4.0") 17 | 18 | // NOTE: Do not place your application dependencies here; they belong 19 | // in the individual module build.gradle files 20 | } 21 | } 22 | 23 | allprojects { 24 | repositories { 25 | mavenLocal() 26 | google() 27 | jcenter() 28 | maven { 29 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 30 | url "$rootDir/../node_modules/react-native/android" 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /TextGradientExample/android/gradle.properties: -------------------------------------------------------------------------------- 1 | EXAMPLE_RELEASE_STORE_FILE=example.keystore 2 | EXAMPLE_RELEASE_KEY_ALIAS=example 3 | EXAMPLE_RELEASE_STORE_PASSWORD=qwerty 4 | EXAMPLE_RELEASE_KEY_PASSWORD=qwerty -------------------------------------------------------------------------------- /TextGradientExample/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/react-native-text-gradient/8442405fc3ee155ff52788c6f1f990b3146c1f57/TextGradientExample/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /TextGradientExample/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /TextGradientExample/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin, switch paths to Windows format before running java 129 | if $cygwin ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=$((i+1)) 158 | done 159 | case $i in 160 | (0) set -- ;; 161 | (1) set -- "$args0" ;; 162 | (2) set -- "$args0" "$args1" ;; 163 | (3) set -- "$args0" "$args1" "$args2" ;; 164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=$(save "$@") 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 185 | cd "$(dirname "$0")" 186 | fi 187 | 188 | exec "$JAVACMD" "$@" 189 | -------------------------------------------------------------------------------- /TextGradientExample/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem http://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /TextGradientExample/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /TextGradientExample/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /TextGradientExample/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'TextGradientExample' 2 | include ':react-native-text-gradient' 3 | project(':react-native-text-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-text-gradient/android') 4 | 5 | include ':app' 6 | -------------------------------------------------------------------------------- /TextGradientExample/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TextGradientExample", 3 | "displayName": "TextGradientExample" 4 | } -------------------------------------------------------------------------------- /TextGradientExample/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /TextGradientExample/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import {AppRegistry} from 'react-native'; 6 | import App from './App'; 7 | import {name as appName} from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /TextGradientExample/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/build/ 2 | **/infer-out/ 3 | *.pbxuser 4 | !default.pbxuser 5 | *.mode1v3 6 | !default.mode1v3 7 | *.mode2v3 8 | !default.mode2v3 9 | *.perspectivev3 10 | !default.perspectivev3 11 | xcuserdata 12 | *.xccheckout 13 | *.moved-aside 14 | DerivedData 15 | *.hmap 16 | *.ipa 17 | *.xcuserstate 18 | project.xcworkspace 19 | compile_commands.json 20 | xcodebuild.log 21 | .DS_Store -------------------------------------------------------------------------------- /TextGradientExample/ios/TextGradientExample.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 | 11D1A2F320CAFA9E000508D9 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; }; 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 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; 25 | ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; }; 26 | ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED297162215061F000B7C4FE /* JavaScriptCore.framework */; }; 27 | FD19762A79274F90A6E0120D /* libRNTextGradient.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AD10EFADD087469DA4175C92 /* libRNTextGradient.a */; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXContainerItemProxy section */ 31 | 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = { 32 | isa = PBXContainerItemProxy; 33 | containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; 34 | proxyType = 2; 35 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 36 | remoteInfo = RCTActionSheet; 37 | }; 38 | 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = { 39 | isa = PBXContainerItemProxy; 40 | containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; 41 | proxyType = 2; 42 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 43 | remoteInfo = RCTGeolocation; 44 | }; 45 | 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = { 46 | isa = PBXContainerItemProxy; 47 | containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 48 | proxyType = 2; 49 | remoteGlobalIDString = 58B5115D1A9E6B3D00147676; 50 | remoteInfo = RCTImage; 51 | }; 52 | 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = { 53 | isa = PBXContainerItemProxy; 54 | containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 55 | proxyType = 2; 56 | remoteGlobalIDString = 58B511DB1A9E6C8500147676; 57 | remoteInfo = RCTNetwork; 58 | }; 59 | 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = { 60 | isa = PBXContainerItemProxy; 61 | containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; 62 | proxyType = 2; 63 | remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; 64 | remoteInfo = RCTVibration; 65 | }; 66 | 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = { 67 | isa = PBXContainerItemProxy; 68 | containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 69 | proxyType = 2; 70 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 71 | remoteInfo = RCTSettings; 72 | }; 73 | 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = { 74 | isa = PBXContainerItemProxy; 75 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 76 | proxyType = 2; 77 | remoteGlobalIDString = 3C86DF461ADF2C930047B81A; 78 | remoteInfo = RCTWebSocket; 79 | }; 80 | 146834031AC3E56700842450 /* PBXContainerItemProxy */ = { 81 | isa = PBXContainerItemProxy; 82 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 83 | proxyType = 2; 84 | remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; 85 | remoteInfo = React; 86 | }; 87 | 2D16E6711FA4F8DC00B85C8A /* PBXContainerItemProxy */ = { 88 | isa = PBXContainerItemProxy; 89 | containerPortal = ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */; 90 | proxyType = 2; 91 | remoteGlobalIDString = ADD01A681E09402E00F6D226; 92 | remoteInfo = "RCTBlob-tvOS"; 93 | }; 94 | 2D16E6831FA4F8DC00B85C8A /* PBXContainerItemProxy */ = { 95 | isa = PBXContainerItemProxy; 96 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 97 | proxyType = 2; 98 | remoteGlobalIDString = 3DBE0D001F3B181A0099AA32; 99 | remoteInfo = fishhook; 100 | }; 101 | 2D16E6851FA4F8DC00B85C8A /* PBXContainerItemProxy */ = { 102 | isa = PBXContainerItemProxy; 103 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 104 | proxyType = 2; 105 | remoteGlobalIDString = 3DBE0D0D1F3B181C0099AA32; 106 | remoteInfo = "fishhook-tvOS"; 107 | }; 108 | 2DF0FFDE2056DD460020B375 /* PBXContainerItemProxy */ = { 109 | isa = PBXContainerItemProxy; 110 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 111 | proxyType = 2; 112 | remoteGlobalIDString = EBF21BDC1FC498900052F4D5; 113 | remoteInfo = jsinspector; 114 | }; 115 | 2DF0FFE02056DD460020B375 /* PBXContainerItemProxy */ = { 116 | isa = PBXContainerItemProxy; 117 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 118 | proxyType = 2; 119 | remoteGlobalIDString = EBF21BFA1FC4989A0052F4D5; 120 | remoteInfo = "jsinspector-tvOS"; 121 | }; 122 | 2DF0FFE22056DD460020B375 /* PBXContainerItemProxy */ = { 123 | isa = PBXContainerItemProxy; 124 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 125 | proxyType = 2; 126 | remoteGlobalIDString = 139D7ECE1E25DB7D00323FB7; 127 | remoteInfo = "third-party"; 128 | }; 129 | 2DF0FFE42056DD460020B375 /* PBXContainerItemProxy */ = { 130 | isa = PBXContainerItemProxy; 131 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 132 | proxyType = 2; 133 | remoteGlobalIDString = 3D383D3C1EBD27B6005632C8; 134 | remoteInfo = "third-party-tvOS"; 135 | }; 136 | 2DF0FFE62056DD460020B375 /* PBXContainerItemProxy */ = { 137 | isa = PBXContainerItemProxy; 138 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 139 | proxyType = 2; 140 | remoteGlobalIDString = 139D7E881E25C6D100323FB7; 141 | remoteInfo = "double-conversion"; 142 | }; 143 | 2DF0FFE82056DD460020B375 /* PBXContainerItemProxy */ = { 144 | isa = PBXContainerItemProxy; 145 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 146 | proxyType = 2; 147 | remoteGlobalIDString = 3D383D621EBD27B9005632C8; 148 | remoteInfo = "double-conversion-tvOS"; 149 | }; 150 | 3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */ = { 151 | isa = PBXContainerItemProxy; 152 | containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 153 | proxyType = 2; 154 | remoteGlobalIDString = 2D2A283A1D9B042B00D4039D; 155 | remoteInfo = "RCTImage-tvOS"; 156 | }; 157 | 3DAD3E871DF850E9000B6D8A /* PBXContainerItemProxy */ = { 158 | isa = PBXContainerItemProxy; 159 | containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 160 | proxyType = 2; 161 | remoteGlobalIDString = 2D2A28471D9B043800D4039D; 162 | remoteInfo = "RCTLinking-tvOS"; 163 | }; 164 | 3DAD3E8B1DF850E9000B6D8A /* PBXContainerItemProxy */ = { 165 | isa = PBXContainerItemProxy; 166 | containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 167 | proxyType = 2; 168 | remoteGlobalIDString = 2D2A28541D9B044C00D4039D; 169 | remoteInfo = "RCTNetwork-tvOS"; 170 | }; 171 | 3DAD3E8F1DF850E9000B6D8A /* PBXContainerItemProxy */ = { 172 | isa = PBXContainerItemProxy; 173 | containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 174 | proxyType = 2; 175 | remoteGlobalIDString = 2D2A28611D9B046600D4039D; 176 | remoteInfo = "RCTSettings-tvOS"; 177 | }; 178 | 3DAD3E931DF850E9000B6D8A /* PBXContainerItemProxy */ = { 179 | isa = PBXContainerItemProxy; 180 | containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 181 | proxyType = 2; 182 | remoteGlobalIDString = 2D2A287B1D9B048500D4039D; 183 | remoteInfo = "RCTText-tvOS"; 184 | }; 185 | 3DAD3E981DF850E9000B6D8A /* PBXContainerItemProxy */ = { 186 | isa = PBXContainerItemProxy; 187 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 188 | proxyType = 2; 189 | remoteGlobalIDString = 2D2A28881D9B049200D4039D; 190 | remoteInfo = "RCTWebSocket-tvOS"; 191 | }; 192 | 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */ = { 193 | isa = PBXContainerItemProxy; 194 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 195 | proxyType = 2; 196 | remoteGlobalIDString = 2D2A28131D9B038B00D4039D; 197 | remoteInfo = "React-tvOS"; 198 | }; 199 | 3DAD3EA41DF850E9000B6D8A /* PBXContainerItemProxy */ = { 200 | isa = PBXContainerItemProxy; 201 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 202 | proxyType = 2; 203 | remoteGlobalIDString = 3D3C059A1DE3340900C268FA; 204 | remoteInfo = yoga; 205 | }; 206 | 3DAD3EA61DF850E9000B6D8A /* PBXContainerItemProxy */ = { 207 | isa = PBXContainerItemProxy; 208 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 209 | proxyType = 2; 210 | remoteGlobalIDString = 3D3C06751DE3340C00C268FA; 211 | remoteInfo = "yoga-tvOS"; 212 | }; 213 | 3DAD3EA81DF850E9000B6D8A /* PBXContainerItemProxy */ = { 214 | isa = PBXContainerItemProxy; 215 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 216 | proxyType = 2; 217 | remoteGlobalIDString = 3D3CD9251DE5FBEC00167DC4; 218 | remoteInfo = cxxreact; 219 | }; 220 | 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */ = { 221 | isa = PBXContainerItemProxy; 222 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 223 | proxyType = 2; 224 | remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4; 225 | remoteInfo = "cxxreact-tvOS"; 226 | }; 227 | 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = { 228 | isa = PBXContainerItemProxy; 229 | containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; 230 | proxyType = 2; 231 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 232 | remoteInfo = RCTAnimation; 233 | }; 234 | 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = { 235 | isa = PBXContainerItemProxy; 236 | containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; 237 | proxyType = 2; 238 | remoteGlobalIDString = 2D2A28201D9B03D100D4039D; 239 | remoteInfo = "RCTAnimation-tvOS"; 240 | }; 241 | 7491267622CC050B00A81C37 /* PBXContainerItemProxy */ = { 242 | isa = PBXContainerItemProxy; 243 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 244 | proxyType = 2; 245 | remoteGlobalIDString = EDEBC6D6214B3E7000DD5AC8; 246 | remoteInfo = jsi; 247 | }; 248 | 7491267822CC050B00A81C37 /* PBXContainerItemProxy */ = { 249 | isa = PBXContainerItemProxy; 250 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 251 | proxyType = 2; 252 | remoteGlobalIDString = EDEBC73B214B45A300DD5AC8; 253 | remoteInfo = jsiexecutor; 254 | }; 255 | 7491267A22CC050B00A81C37 /* PBXContainerItemProxy */ = { 256 | isa = PBXContainerItemProxy; 257 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 258 | proxyType = 2; 259 | remoteGlobalIDString = ED296FB6214C9A0900B7C4FE; 260 | remoteInfo = "jsi-tvOS"; 261 | }; 262 | 7491267C22CC050B00A81C37 /* PBXContainerItemProxy */ = { 263 | isa = PBXContainerItemProxy; 264 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 265 | proxyType = 2; 266 | remoteGlobalIDString = ED296FEE214C9CF800B7C4FE; 267 | remoteInfo = "jsiexecutor-tvOS"; 268 | }; 269 | 7491268122CC050C00A81C37 /* PBXContainerItemProxy */ = { 270 | isa = PBXContainerItemProxy; 271 | containerPortal = 9047C94DE81B4B118317963C /* RNTextGradient.xcodeproj */; 272 | proxyType = 2; 273 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 274 | remoteInfo = RNTextGradient; 275 | }; 276 | 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { 277 | isa = PBXContainerItemProxy; 278 | containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 279 | proxyType = 2; 280 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 281 | remoteInfo = RCTLinking; 282 | }; 283 | 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = { 284 | isa = PBXContainerItemProxy; 285 | containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 286 | proxyType = 2; 287 | remoteGlobalIDString = 58B5119B1A9E6C1200147676; 288 | remoteInfo = RCTText; 289 | }; 290 | ADBDB9261DFEBF0700ED6528 /* PBXContainerItemProxy */ = { 291 | isa = PBXContainerItemProxy; 292 | containerPortal = ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */; 293 | proxyType = 2; 294 | remoteGlobalIDString = 358F4ED71D1E81A9004DF814; 295 | remoteInfo = RCTBlob; 296 | }; 297 | /* End PBXContainerItemProxy section */ 298 | 299 | /* Begin PBXFileReference section */ 300 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; 301 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; }; 302 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; }; 303 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; }; 304 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; }; 305 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; }; 306 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; }; 307 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; }; 308 | 13B07F961A680F5B00A75B9A /* TextGradientExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TextGradientExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 309 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = TextGradientExample/AppDelegate.h; sourceTree = ""; }; 310 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = TextGradientExample/AppDelegate.m; sourceTree = ""; }; 311 | 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 312 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = TextGradientExample/Images.xcassets; sourceTree = ""; }; 313 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = TextGradientExample/Info.plist; sourceTree = ""; }; 314 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = TextGradientExample/main.m; sourceTree = ""; }; 315 | 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; 316 | 2D16E6891FA4F8E400B85C8A /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; }; 317 | 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = ""; }; 318 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; 319 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; 320 | 9047C94DE81B4B118317963C /* RNTextGradient.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNTextGradient.xcodeproj; path = "../node_modules/react-native-text-gradient/ios/RNTextGradient.xcodeproj"; sourceTree = ""; }; 321 | AD10EFADD087469DA4175C92 /* libRNTextGradient.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNTextGradient.a; sourceTree = ""; }; 322 | ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTBlob.xcodeproj; path = "../node_modules/react-native/Libraries/Blob/RCTBlob.xcodeproj"; sourceTree = ""; }; 323 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; 324 | ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; }; 325 | /* End PBXFileReference section */ 326 | 327 | /* Begin PBXFrameworksBuildPhase section */ 328 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 329 | isa = PBXFrameworksBuildPhase; 330 | buildActionMask = 2147483647; 331 | files = ( 332 | ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */, 333 | ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */, 334 | 11D1A2F320CAFA9E000508D9 /* libRCTAnimation.a in Frameworks */, 335 | 146834051AC3E58100842450 /* libReact.a in Frameworks */, 336 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, 337 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, 338 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, 339 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, 340 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */, 341 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, 342 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, 343 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 344 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, 345 | FD19762A79274F90A6E0120D /* libRNTextGradient.a in Frameworks */, 346 | ); 347 | runOnlyForDeploymentPostprocessing = 0; 348 | }; 349 | /* End PBXFrameworksBuildPhase section */ 350 | 351 | /* Begin PBXGroup section */ 352 | 00C302A81ABCB8CE00DB3ED1 /* Products */ = { 353 | isa = PBXGroup; 354 | children = ( 355 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */, 356 | ); 357 | name = Products; 358 | sourceTree = ""; 359 | }; 360 | 00C302B61ABCB90400DB3ED1 /* Products */ = { 361 | isa = PBXGroup; 362 | children = ( 363 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */, 364 | ); 365 | name = Products; 366 | sourceTree = ""; 367 | }; 368 | 00C302BC1ABCB91800DB3ED1 /* Products */ = { 369 | isa = PBXGroup; 370 | children = ( 371 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, 372 | 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */, 373 | ); 374 | name = Products; 375 | sourceTree = ""; 376 | }; 377 | 00C302D41ABCB9D200DB3ED1 /* Products */ = { 378 | isa = PBXGroup; 379 | children = ( 380 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, 381 | 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */, 382 | ); 383 | name = Products; 384 | sourceTree = ""; 385 | }; 386 | 00C302E01ABCB9EE00DB3ED1 /* Products */ = { 387 | isa = PBXGroup; 388 | children = ( 389 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */, 390 | ); 391 | name = Products; 392 | sourceTree = ""; 393 | }; 394 | 139105B71AF99BAD00B5F7CC /* Products */ = { 395 | isa = PBXGroup; 396 | children = ( 397 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, 398 | 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */, 399 | ); 400 | name = Products; 401 | sourceTree = ""; 402 | }; 403 | 139FDEE71B06529A00C62182 /* Products */ = { 404 | isa = PBXGroup; 405 | children = ( 406 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, 407 | 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */, 408 | 2D16E6841FA4F8DC00B85C8A /* libfishhook.a */, 409 | 2D16E6861FA4F8DC00B85C8A /* libfishhook-tvOS.a */, 410 | ); 411 | name = Products; 412 | sourceTree = ""; 413 | }; 414 | 13B07FAE1A68108700A75B9A /* TextGradientExample */ = { 415 | isa = PBXGroup; 416 | children = ( 417 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 418 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 419 | 13B07FB01A68108700A75B9A /* AppDelegate.m */, 420 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 421 | 13B07FB61A68108700A75B9A /* Info.plist */, 422 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, 423 | 13B07FB71A68108700A75B9A /* main.m */, 424 | ); 425 | name = TextGradientExample; 426 | sourceTree = ""; 427 | }; 428 | 146834001AC3E56700842450 /* Products */ = { 429 | isa = PBXGroup; 430 | children = ( 431 | 146834041AC3E56700842450 /* libReact.a */, 432 | 3DAD3EA31DF850E9000B6D8A /* libReact.a */, 433 | 3DAD3EA51DF850E9000B6D8A /* libyoga.a */, 434 | 3DAD3EA71DF850E9000B6D8A /* libyoga.a */, 435 | 3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */, 436 | 3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */, 437 | 2DF0FFDF2056DD460020B375 /* libjsinspector.a */, 438 | 2DF0FFE12056DD460020B375 /* libjsinspector-tvOS.a */, 439 | 2DF0FFE32056DD460020B375 /* libthird-party.a */, 440 | 2DF0FFE52056DD460020B375 /* libthird-party.a */, 441 | 2DF0FFE72056DD460020B375 /* libdouble-conversion.a */, 442 | 2DF0FFE92056DD460020B375 /* libdouble-conversion.a */, 443 | 7491267722CC050B00A81C37 /* libjsi.a */, 444 | 7491267922CC050B00A81C37 /* libjsiexecutor.a */, 445 | 7491267B22CC050B00A81C37 /* libjsi-tvOS.a */, 446 | 7491267D22CC050B00A81C37 /* libjsiexecutor-tvOS.a */, 447 | ); 448 | name = Products; 449 | sourceTree = ""; 450 | }; 451 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { 452 | isa = PBXGroup; 453 | children = ( 454 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */, 455 | ED2971642150620600B7C4FE /* JavaScriptCore.framework */, 456 | 2D16E6891FA4F8E400B85C8A /* libReact.a */, 457 | ); 458 | name = Frameworks; 459 | sourceTree = ""; 460 | }; 461 | 5E91572E1DD0AC6500FF2AA8 /* Products */ = { 462 | isa = PBXGroup; 463 | children = ( 464 | 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */, 465 | 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */, 466 | ); 467 | name = Products; 468 | sourceTree = ""; 469 | }; 470 | 7491265022CC04FD00A81C37 /* Recovered References */ = { 471 | isa = PBXGroup; 472 | children = ( 473 | AD10EFADD087469DA4175C92 /* libRNTextGradient.a */, 474 | ); 475 | name = "Recovered References"; 476 | sourceTree = ""; 477 | }; 478 | 7491267E22CC050B00A81C37 /* Products */ = { 479 | isa = PBXGroup; 480 | children = ( 481 | 7491268222CC050C00A81C37 /* libRNTextGradient.a */, 482 | ); 483 | name = Products; 484 | sourceTree = ""; 485 | }; 486 | 78C398B11ACF4ADC00677621 /* Products */ = { 487 | isa = PBXGroup; 488 | children = ( 489 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, 490 | 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */, 491 | ); 492 | name = Products; 493 | sourceTree = ""; 494 | }; 495 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 496 | isa = PBXGroup; 497 | children = ( 498 | 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */, 499 | 146833FF1AC3E56700842450 /* React.xcodeproj */, 500 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, 501 | ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */, 502 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, 503 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, 504 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */, 505 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */, 506 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */, 507 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, 508 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 509 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, 510 | 9047C94DE81B4B118317963C /* RNTextGradient.xcodeproj */, 511 | ); 512 | name = Libraries; 513 | sourceTree = ""; 514 | }; 515 | 832341B11AAA6A8300B99B32 /* Products */ = { 516 | isa = PBXGroup; 517 | children = ( 518 | 832341B51AAA6A8300B99B32 /* libRCTText.a */, 519 | 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */, 520 | ); 521 | name = Products; 522 | sourceTree = ""; 523 | }; 524 | 83CBB9F61A601CBA00E9B192 = { 525 | isa = PBXGroup; 526 | children = ( 527 | 13B07FAE1A68108700A75B9A /* TextGradientExample */, 528 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 529 | 83CBBA001A601CBA00E9B192 /* Products */, 530 | 2D16E6871FA4F8E400B85C8A /* Frameworks */, 531 | 7491265022CC04FD00A81C37 /* Recovered References */, 532 | ); 533 | indentWidth = 2; 534 | sourceTree = ""; 535 | tabWidth = 2; 536 | usesTabs = 0; 537 | }; 538 | 83CBBA001A601CBA00E9B192 /* Products */ = { 539 | isa = PBXGroup; 540 | children = ( 541 | 13B07F961A680F5B00A75B9A /* TextGradientExample.app */, 542 | ); 543 | name = Products; 544 | sourceTree = ""; 545 | }; 546 | ADBDB9201DFEBF0600ED6528 /* Products */ = { 547 | isa = PBXGroup; 548 | children = ( 549 | ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */, 550 | 2D16E6721FA4F8DC00B85C8A /* libRCTBlob-tvOS.a */, 551 | ); 552 | name = Products; 553 | sourceTree = ""; 554 | }; 555 | /* End PBXGroup section */ 556 | 557 | /* Begin PBXNativeTarget section */ 558 | 13B07F861A680F5B00A75B9A /* TextGradientExample */ = { 559 | isa = PBXNativeTarget; 560 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "TextGradientExample" */; 561 | buildPhases = ( 562 | 13B07F871A680F5B00A75B9A /* Sources */, 563 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 564 | 13B07F8E1A680F5B00A75B9A /* Resources */, 565 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 566 | ); 567 | buildRules = ( 568 | ); 569 | dependencies = ( 570 | ); 571 | name = TextGradientExample; 572 | productName = "Hello World"; 573 | productReference = 13B07F961A680F5B00A75B9A /* TextGradientExample.app */; 574 | productType = "com.apple.product-type.application"; 575 | }; 576 | /* End PBXNativeTarget section */ 577 | 578 | /* Begin PBXProject section */ 579 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 580 | isa = PBXProject; 581 | attributes = { 582 | LastUpgradeCheck = 940; 583 | ORGANIZATIONNAME = Facebook; 584 | TargetAttributes = { 585 | 13B07F861A680F5B00A75B9A = { 586 | DevelopmentTeam = N9JQ8J5UME; 587 | }; 588 | }; 589 | }; 590 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "TextGradientExample" */; 591 | compatibilityVersion = "Xcode 3.2"; 592 | developmentRegion = English; 593 | hasScannedForEncodings = 0; 594 | knownRegions = ( 595 | en, 596 | Base, 597 | ); 598 | mainGroup = 83CBB9F61A601CBA00E9B192; 599 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 600 | projectDirPath = ""; 601 | projectReferences = ( 602 | { 603 | ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; 604 | ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; 605 | }, 606 | { 607 | ProductGroup = 5E91572E1DD0AC6500FF2AA8 /* Products */; 608 | ProjectRef = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; 609 | }, 610 | { 611 | ProductGroup = ADBDB9201DFEBF0600ED6528 /* Products */; 612 | ProjectRef = ADBDB91F1DFEBF0600ED6528 /* RCTBlob.xcodeproj */; 613 | }, 614 | { 615 | ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; 616 | ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; 617 | }, 618 | { 619 | ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */; 620 | ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 621 | }, 622 | { 623 | ProductGroup = 78C398B11ACF4ADC00677621 /* Products */; 624 | ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 625 | }, 626 | { 627 | ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */; 628 | ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 629 | }, 630 | { 631 | ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */; 632 | ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 633 | }, 634 | { 635 | ProductGroup = 832341B11AAA6A8300B99B32 /* Products */; 636 | ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 637 | }, 638 | { 639 | ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */; 640 | ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; 641 | }, 642 | { 643 | ProductGroup = 139FDEE71B06529A00C62182 /* Products */; 644 | ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 645 | }, 646 | { 647 | ProductGroup = 146834001AC3E56700842450 /* Products */; 648 | ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; 649 | }, 650 | { 651 | ProductGroup = 7491267E22CC050B00A81C37 /* Products */; 652 | ProjectRef = 9047C94DE81B4B118317963C /* RNTextGradient.xcodeproj */; 653 | }, 654 | ); 655 | projectRoot = ""; 656 | targets = ( 657 | 13B07F861A680F5B00A75B9A /* TextGradientExample */, 658 | ); 659 | }; 660 | /* End PBXProject section */ 661 | 662 | /* Begin PBXReferenceProxy section */ 663 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = { 664 | isa = PBXReferenceProxy; 665 | fileType = archive.ar; 666 | path = libRCTActionSheet.a; 667 | remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */; 668 | sourceTree = BUILT_PRODUCTS_DIR; 669 | }; 670 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = { 671 | isa = PBXReferenceProxy; 672 | fileType = archive.ar; 673 | path = libRCTGeolocation.a; 674 | remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */; 675 | sourceTree = BUILT_PRODUCTS_DIR; 676 | }; 677 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = { 678 | isa = PBXReferenceProxy; 679 | fileType = archive.ar; 680 | path = libRCTImage.a; 681 | remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */; 682 | sourceTree = BUILT_PRODUCTS_DIR; 683 | }; 684 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = { 685 | isa = PBXReferenceProxy; 686 | fileType = archive.ar; 687 | path = libRCTNetwork.a; 688 | remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */; 689 | sourceTree = BUILT_PRODUCTS_DIR; 690 | }; 691 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = { 692 | isa = PBXReferenceProxy; 693 | fileType = archive.ar; 694 | path = libRCTVibration.a; 695 | remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; 696 | sourceTree = BUILT_PRODUCTS_DIR; 697 | }; 698 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = { 699 | isa = PBXReferenceProxy; 700 | fileType = archive.ar; 701 | path = libRCTSettings.a; 702 | remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */; 703 | sourceTree = BUILT_PRODUCTS_DIR; 704 | }; 705 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = { 706 | isa = PBXReferenceProxy; 707 | fileType = archive.ar; 708 | path = libRCTWebSocket.a; 709 | remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */; 710 | sourceTree = BUILT_PRODUCTS_DIR; 711 | }; 712 | 146834041AC3E56700842450 /* libReact.a */ = { 713 | isa = PBXReferenceProxy; 714 | fileType = archive.ar; 715 | path = libReact.a; 716 | remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; 717 | sourceTree = BUILT_PRODUCTS_DIR; 718 | }; 719 | 2D16E6721FA4F8DC00B85C8A /* libRCTBlob-tvOS.a */ = { 720 | isa = PBXReferenceProxy; 721 | fileType = archive.ar; 722 | path = "libRCTBlob-tvOS.a"; 723 | remoteRef = 2D16E6711FA4F8DC00B85C8A /* PBXContainerItemProxy */; 724 | sourceTree = BUILT_PRODUCTS_DIR; 725 | }; 726 | 2D16E6841FA4F8DC00B85C8A /* libfishhook.a */ = { 727 | isa = PBXReferenceProxy; 728 | fileType = archive.ar; 729 | path = libfishhook.a; 730 | remoteRef = 2D16E6831FA4F8DC00B85C8A /* PBXContainerItemProxy */; 731 | sourceTree = BUILT_PRODUCTS_DIR; 732 | }; 733 | 2D16E6861FA4F8DC00B85C8A /* libfishhook-tvOS.a */ = { 734 | isa = PBXReferenceProxy; 735 | fileType = archive.ar; 736 | path = "libfishhook-tvOS.a"; 737 | remoteRef = 2D16E6851FA4F8DC00B85C8A /* PBXContainerItemProxy */; 738 | sourceTree = BUILT_PRODUCTS_DIR; 739 | }; 740 | 2DF0FFDF2056DD460020B375 /* libjsinspector.a */ = { 741 | isa = PBXReferenceProxy; 742 | fileType = archive.ar; 743 | path = libjsinspector.a; 744 | remoteRef = 2DF0FFDE2056DD460020B375 /* PBXContainerItemProxy */; 745 | sourceTree = BUILT_PRODUCTS_DIR; 746 | }; 747 | 2DF0FFE12056DD460020B375 /* libjsinspector-tvOS.a */ = { 748 | isa = PBXReferenceProxy; 749 | fileType = archive.ar; 750 | path = "libjsinspector-tvOS.a"; 751 | remoteRef = 2DF0FFE02056DD460020B375 /* PBXContainerItemProxy */; 752 | sourceTree = BUILT_PRODUCTS_DIR; 753 | }; 754 | 2DF0FFE32056DD460020B375 /* libthird-party.a */ = { 755 | isa = PBXReferenceProxy; 756 | fileType = archive.ar; 757 | path = "libthird-party.a"; 758 | remoteRef = 2DF0FFE22056DD460020B375 /* PBXContainerItemProxy */; 759 | sourceTree = BUILT_PRODUCTS_DIR; 760 | }; 761 | 2DF0FFE52056DD460020B375 /* libthird-party.a */ = { 762 | isa = PBXReferenceProxy; 763 | fileType = archive.ar; 764 | path = "libthird-party.a"; 765 | remoteRef = 2DF0FFE42056DD460020B375 /* PBXContainerItemProxy */; 766 | sourceTree = BUILT_PRODUCTS_DIR; 767 | }; 768 | 2DF0FFE72056DD460020B375 /* libdouble-conversion.a */ = { 769 | isa = PBXReferenceProxy; 770 | fileType = archive.ar; 771 | path = "libdouble-conversion.a"; 772 | remoteRef = 2DF0FFE62056DD460020B375 /* PBXContainerItemProxy */; 773 | sourceTree = BUILT_PRODUCTS_DIR; 774 | }; 775 | 2DF0FFE92056DD460020B375 /* libdouble-conversion.a */ = { 776 | isa = PBXReferenceProxy; 777 | fileType = archive.ar; 778 | path = "libdouble-conversion.a"; 779 | remoteRef = 2DF0FFE82056DD460020B375 /* PBXContainerItemProxy */; 780 | sourceTree = BUILT_PRODUCTS_DIR; 781 | }; 782 | 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */ = { 783 | isa = PBXReferenceProxy; 784 | fileType = archive.ar; 785 | path = "libRCTImage-tvOS.a"; 786 | remoteRef = 3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */; 787 | sourceTree = BUILT_PRODUCTS_DIR; 788 | }; 789 | 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */ = { 790 | isa = PBXReferenceProxy; 791 | fileType = archive.ar; 792 | path = "libRCTLinking-tvOS.a"; 793 | remoteRef = 3DAD3E871DF850E9000B6D8A /* PBXContainerItemProxy */; 794 | sourceTree = BUILT_PRODUCTS_DIR; 795 | }; 796 | 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */ = { 797 | isa = PBXReferenceProxy; 798 | fileType = archive.ar; 799 | path = "libRCTNetwork-tvOS.a"; 800 | remoteRef = 3DAD3E8B1DF850E9000B6D8A /* PBXContainerItemProxy */; 801 | sourceTree = BUILT_PRODUCTS_DIR; 802 | }; 803 | 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */ = { 804 | isa = PBXReferenceProxy; 805 | fileType = archive.ar; 806 | path = "libRCTSettings-tvOS.a"; 807 | remoteRef = 3DAD3E8F1DF850E9000B6D8A /* PBXContainerItemProxy */; 808 | sourceTree = BUILT_PRODUCTS_DIR; 809 | }; 810 | 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */ = { 811 | isa = PBXReferenceProxy; 812 | fileType = archive.ar; 813 | path = "libRCTText-tvOS.a"; 814 | remoteRef = 3DAD3E931DF850E9000B6D8A /* PBXContainerItemProxy */; 815 | sourceTree = BUILT_PRODUCTS_DIR; 816 | }; 817 | 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */ = { 818 | isa = PBXReferenceProxy; 819 | fileType = archive.ar; 820 | path = "libRCTWebSocket-tvOS.a"; 821 | remoteRef = 3DAD3E981DF850E9000B6D8A /* PBXContainerItemProxy */; 822 | sourceTree = BUILT_PRODUCTS_DIR; 823 | }; 824 | 3DAD3EA31DF850E9000B6D8A /* libReact.a */ = { 825 | isa = PBXReferenceProxy; 826 | fileType = archive.ar; 827 | path = libReact.a; 828 | remoteRef = 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */; 829 | sourceTree = BUILT_PRODUCTS_DIR; 830 | }; 831 | 3DAD3EA51DF850E9000B6D8A /* libyoga.a */ = { 832 | isa = PBXReferenceProxy; 833 | fileType = archive.ar; 834 | path = libyoga.a; 835 | remoteRef = 3DAD3EA41DF850E9000B6D8A /* PBXContainerItemProxy */; 836 | sourceTree = BUILT_PRODUCTS_DIR; 837 | }; 838 | 3DAD3EA71DF850E9000B6D8A /* libyoga.a */ = { 839 | isa = PBXReferenceProxy; 840 | fileType = archive.ar; 841 | path = libyoga.a; 842 | remoteRef = 3DAD3EA61DF850E9000B6D8A /* PBXContainerItemProxy */; 843 | sourceTree = BUILT_PRODUCTS_DIR; 844 | }; 845 | 3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */ = { 846 | isa = PBXReferenceProxy; 847 | fileType = archive.ar; 848 | path = libcxxreact.a; 849 | remoteRef = 3DAD3EA81DF850E9000B6D8A /* PBXContainerItemProxy */; 850 | sourceTree = BUILT_PRODUCTS_DIR; 851 | }; 852 | 3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */ = { 853 | isa = PBXReferenceProxy; 854 | fileType = archive.ar; 855 | path = libcxxreact.a; 856 | remoteRef = 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */; 857 | sourceTree = BUILT_PRODUCTS_DIR; 858 | }; 859 | 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */ = { 860 | isa = PBXReferenceProxy; 861 | fileType = archive.ar; 862 | path = libRCTAnimation.a; 863 | remoteRef = 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */; 864 | sourceTree = BUILT_PRODUCTS_DIR; 865 | }; 866 | 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */ = { 867 | isa = PBXReferenceProxy; 868 | fileType = archive.ar; 869 | path = libRCTAnimation.a; 870 | remoteRef = 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */; 871 | sourceTree = BUILT_PRODUCTS_DIR; 872 | }; 873 | 7491267722CC050B00A81C37 /* libjsi.a */ = { 874 | isa = PBXReferenceProxy; 875 | fileType = archive.ar; 876 | path = libjsi.a; 877 | remoteRef = 7491267622CC050B00A81C37 /* PBXContainerItemProxy */; 878 | sourceTree = BUILT_PRODUCTS_DIR; 879 | }; 880 | 7491267922CC050B00A81C37 /* libjsiexecutor.a */ = { 881 | isa = PBXReferenceProxy; 882 | fileType = archive.ar; 883 | path = libjsiexecutor.a; 884 | remoteRef = 7491267822CC050B00A81C37 /* PBXContainerItemProxy */; 885 | sourceTree = BUILT_PRODUCTS_DIR; 886 | }; 887 | 7491267B22CC050B00A81C37 /* libjsi-tvOS.a */ = { 888 | isa = PBXReferenceProxy; 889 | fileType = archive.ar; 890 | path = "libjsi-tvOS.a"; 891 | remoteRef = 7491267A22CC050B00A81C37 /* PBXContainerItemProxy */; 892 | sourceTree = BUILT_PRODUCTS_DIR; 893 | }; 894 | 7491267D22CC050B00A81C37 /* libjsiexecutor-tvOS.a */ = { 895 | isa = PBXReferenceProxy; 896 | fileType = archive.ar; 897 | path = "libjsiexecutor-tvOS.a"; 898 | remoteRef = 7491267C22CC050B00A81C37 /* PBXContainerItemProxy */; 899 | sourceTree = BUILT_PRODUCTS_DIR; 900 | }; 901 | 7491268222CC050C00A81C37 /* libRNTextGradient.a */ = { 902 | isa = PBXReferenceProxy; 903 | fileType = archive.ar; 904 | path = libRNTextGradient.a; 905 | remoteRef = 7491268122CC050C00A81C37 /* PBXContainerItemProxy */; 906 | sourceTree = BUILT_PRODUCTS_DIR; 907 | }; 908 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { 909 | isa = PBXReferenceProxy; 910 | fileType = archive.ar; 911 | path = libRCTLinking.a; 912 | remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */; 913 | sourceTree = BUILT_PRODUCTS_DIR; 914 | }; 915 | 832341B51AAA6A8300B99B32 /* libRCTText.a */ = { 916 | isa = PBXReferenceProxy; 917 | fileType = archive.ar; 918 | path = libRCTText.a; 919 | remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; 920 | sourceTree = BUILT_PRODUCTS_DIR; 921 | }; 922 | ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */ = { 923 | isa = PBXReferenceProxy; 924 | fileType = archive.ar; 925 | path = libRCTBlob.a; 926 | remoteRef = ADBDB9261DFEBF0700ED6528 /* PBXContainerItemProxy */; 927 | sourceTree = BUILT_PRODUCTS_DIR; 928 | }; 929 | /* End PBXReferenceProxy section */ 930 | 931 | /* Begin PBXResourcesBuildPhase section */ 932 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 933 | isa = PBXResourcesBuildPhase; 934 | buildActionMask = 2147483647; 935 | files = ( 936 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 937 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, 938 | ); 939 | runOnlyForDeploymentPostprocessing = 0; 940 | }; 941 | /* End PBXResourcesBuildPhase section */ 942 | 943 | /* Begin PBXShellScriptBuildPhase section */ 944 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 945 | isa = PBXShellScriptBuildPhase; 946 | buildActionMask = 2147483647; 947 | files = ( 948 | ); 949 | inputPaths = ( 950 | ); 951 | name = "Bundle React Native code and images"; 952 | outputPaths = ( 953 | ); 954 | runOnlyForDeploymentPostprocessing = 0; 955 | shellPath = /bin/sh; 956 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; 957 | }; 958 | /* End PBXShellScriptBuildPhase section */ 959 | 960 | /* Begin PBXSourcesBuildPhase section */ 961 | 13B07F871A680F5B00A75B9A /* Sources */ = { 962 | isa = PBXSourcesBuildPhase; 963 | buildActionMask = 2147483647; 964 | files = ( 965 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 966 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 967 | ); 968 | runOnlyForDeploymentPostprocessing = 0; 969 | }; 970 | /* End PBXSourcesBuildPhase section */ 971 | 972 | /* Begin PBXVariantGroup section */ 973 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { 974 | isa = PBXVariantGroup; 975 | children = ( 976 | 13B07FB21A68108700A75B9A /* Base */, 977 | ); 978 | name = LaunchScreen.xib; 979 | path = TextGradientExample; 980 | sourceTree = ""; 981 | }; 982 | /* End PBXVariantGroup section */ 983 | 984 | /* Begin XCBuildConfiguration section */ 985 | 13B07F941A680F5B00A75B9A /* Debug */ = { 986 | isa = XCBuildConfiguration; 987 | buildSettings = { 988 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 989 | CURRENT_PROJECT_VERSION = 1; 990 | DEAD_CODE_STRIPPING = NO; 991 | DEVELOPMENT_TEAM = N9JQ8J5UME; 992 | HEADER_SEARCH_PATHS = ( 993 | "$(inherited)", 994 | "$(SRCROOT)/../node_modules/react-native-text-gradient/ios/**", 995 | ); 996 | INFOPLIST_FILE = TextGradientExample/Info.plist; 997 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 998 | OTHER_LDFLAGS = ( 999 | "$(inherited)", 1000 | "-ObjC", 1001 | "-lc++", 1002 | ); 1003 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 1004 | PRODUCT_NAME = TextGradientExample; 1005 | VERSIONING_SYSTEM = "apple-generic"; 1006 | }; 1007 | name = Debug; 1008 | }; 1009 | 13B07F951A680F5B00A75B9A /* Release */ = { 1010 | isa = XCBuildConfiguration; 1011 | buildSettings = { 1012 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 1013 | CURRENT_PROJECT_VERSION = 1; 1014 | DEVELOPMENT_TEAM = N9JQ8J5UME; 1015 | HEADER_SEARCH_PATHS = ( 1016 | "$(inherited)", 1017 | "$(SRCROOT)/../node_modules/react-native-text-gradient/ios/**", 1018 | ); 1019 | INFOPLIST_FILE = TextGradientExample/Info.plist; 1020 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 1021 | OTHER_LDFLAGS = ( 1022 | "$(inherited)", 1023 | "-ObjC", 1024 | "-lc++", 1025 | ); 1026 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 1027 | PRODUCT_NAME = TextGradientExample; 1028 | VERSIONING_SYSTEM = "apple-generic"; 1029 | }; 1030 | name = Release; 1031 | }; 1032 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 1033 | isa = XCBuildConfiguration; 1034 | buildSettings = { 1035 | ALWAYS_SEARCH_USER_PATHS = NO; 1036 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 1037 | CLANG_CXX_LIBRARY = "libc++"; 1038 | CLANG_ENABLE_MODULES = YES; 1039 | CLANG_ENABLE_OBJC_ARC = YES; 1040 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 1041 | CLANG_WARN_BOOL_CONVERSION = YES; 1042 | CLANG_WARN_COMMA = YES; 1043 | CLANG_WARN_CONSTANT_CONVERSION = YES; 1044 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 1045 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 1046 | CLANG_WARN_EMPTY_BODY = YES; 1047 | CLANG_WARN_ENUM_CONVERSION = YES; 1048 | CLANG_WARN_INFINITE_RECURSION = YES; 1049 | CLANG_WARN_INT_CONVERSION = YES; 1050 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 1051 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 1052 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 1053 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 1054 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 1055 | CLANG_WARN_STRICT_PROTOTYPES = YES; 1056 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 1057 | CLANG_WARN_UNREACHABLE_CODE = YES; 1058 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 1059 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 1060 | COPY_PHASE_STRIP = NO; 1061 | ENABLE_STRICT_OBJC_MSGSEND = YES; 1062 | ENABLE_TESTABILITY = YES; 1063 | GCC_C_LANGUAGE_STANDARD = gnu99; 1064 | GCC_DYNAMIC_NO_PIC = NO; 1065 | GCC_NO_COMMON_BLOCKS = YES; 1066 | GCC_OPTIMIZATION_LEVEL = 0; 1067 | GCC_PREPROCESSOR_DEFINITIONS = ( 1068 | "DEBUG=1", 1069 | "$(inherited)", 1070 | ); 1071 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 1072 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 1073 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 1074 | GCC_WARN_UNDECLARED_SELECTOR = YES; 1075 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 1076 | GCC_WARN_UNUSED_FUNCTION = YES; 1077 | GCC_WARN_UNUSED_VARIABLE = YES; 1078 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 1079 | MTL_ENABLE_DEBUG_INFO = YES; 1080 | ONLY_ACTIVE_ARCH = YES; 1081 | SDKROOT = iphoneos; 1082 | }; 1083 | name = Debug; 1084 | }; 1085 | 83CBBA211A601CBA00E9B192 /* Release */ = { 1086 | isa = XCBuildConfiguration; 1087 | buildSettings = { 1088 | ALWAYS_SEARCH_USER_PATHS = NO; 1089 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 1090 | CLANG_CXX_LIBRARY = "libc++"; 1091 | CLANG_ENABLE_MODULES = YES; 1092 | CLANG_ENABLE_OBJC_ARC = YES; 1093 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 1094 | CLANG_WARN_BOOL_CONVERSION = YES; 1095 | CLANG_WARN_COMMA = YES; 1096 | CLANG_WARN_CONSTANT_CONVERSION = YES; 1097 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 1098 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 1099 | CLANG_WARN_EMPTY_BODY = YES; 1100 | CLANG_WARN_ENUM_CONVERSION = YES; 1101 | CLANG_WARN_INFINITE_RECURSION = YES; 1102 | CLANG_WARN_INT_CONVERSION = YES; 1103 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 1104 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 1105 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 1106 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 1107 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 1108 | CLANG_WARN_STRICT_PROTOTYPES = YES; 1109 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 1110 | CLANG_WARN_UNREACHABLE_CODE = YES; 1111 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 1112 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 1113 | COPY_PHASE_STRIP = YES; 1114 | ENABLE_NS_ASSERTIONS = NO; 1115 | ENABLE_STRICT_OBJC_MSGSEND = YES; 1116 | GCC_C_LANGUAGE_STANDARD = gnu99; 1117 | GCC_NO_COMMON_BLOCKS = YES; 1118 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 1119 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 1120 | GCC_WARN_UNDECLARED_SELECTOR = YES; 1121 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 1122 | GCC_WARN_UNUSED_FUNCTION = YES; 1123 | GCC_WARN_UNUSED_VARIABLE = YES; 1124 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 1125 | MTL_ENABLE_DEBUG_INFO = NO; 1126 | SDKROOT = iphoneos; 1127 | VALIDATE_PRODUCT = YES; 1128 | }; 1129 | name = Release; 1130 | }; 1131 | /* End XCBuildConfiguration section */ 1132 | 1133 | /* Begin XCConfigurationList section */ 1134 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "TextGradientExample" */ = { 1135 | isa = XCConfigurationList; 1136 | buildConfigurations = ( 1137 | 13B07F941A680F5B00A75B9A /* Debug */, 1138 | 13B07F951A680F5B00A75B9A /* Release */, 1139 | ); 1140 | defaultConfigurationIsVisible = 0; 1141 | defaultConfigurationName = Release; 1142 | }; 1143 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "TextGradientExample" */ = { 1144 | isa = XCConfigurationList; 1145 | buildConfigurations = ( 1146 | 83CBBA201A601CBA00E9B192 /* Debug */, 1147 | 83CBBA211A601CBA00E9B192 /* Release */, 1148 | ); 1149 | defaultConfigurationIsVisible = 0; 1150 | defaultConfigurationName = Release; 1151 | }; 1152 | /* End XCConfigurationList section */ 1153 | }; 1154 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 1155 | } 1156 | -------------------------------------------------------------------------------- /TextGradientExample/ios/TextGradientExample.xcodeproj/xcshareddata/xcschemes/TextGradientExample-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /TextGradientExample/ios/TextGradientExample.xcodeproj/xcshareddata/xcschemes/TextGradientExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /TextGradientExample/ios/TextGradientExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (nonatomic, strong) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /TextGradientExample/ios/TextGradientExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | 10 | #import 11 | #import 12 | #import 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 19 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 20 | moduleName:@"TextGradientExample" 21 | initialProperties:nil]; 22 | 23 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 24 | 25 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 26 | UIViewController *rootViewController = [UIViewController new]; 27 | rootViewController.view = rootView; 28 | self.window.rootViewController = rootViewController; 29 | [self.window makeKeyAndVisible]; 30 | return YES; 31 | } 32 | 33 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 34 | { 35 | #if DEBUG 36 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 37 | #else 38 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 39 | #endif 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /TextGradientExample/ios/TextGradientExample/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 | -------------------------------------------------------------------------------- /TextGradientExample/ios/TextGradientExample/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 | } -------------------------------------------------------------------------------- /TextGradientExample/ios/TextGradientExample/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /TextGradientExample/ios/TextGradientExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | TextGradientExample 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSLocationWhenInUseUsageDescription 28 | 29 | UILaunchStoryboardName 30 | LaunchScreen 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UIViewControllerBasedStatusBarAppearance 42 | 43 | NSLocationWhenInUseUsageDescription 44 | 45 | NSAppTransportSecurity 46 | 47 | 48 | NSAllowsArbitraryLoads 49 | 50 | NSExceptionDomains 51 | 52 | localhost 53 | 54 | NSExceptionAllowsInsecureHTTPLoads 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /TextGradientExample/ios/TextGradientExample/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /TextGradientExample/metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | 8 | const path = require('path'); 9 | 10 | const extraNodeModules = { 11 | 'react': path.resolve(__dirname, 'node_modules/react'), 12 | 'fbjs': path.resolve(__dirname, 'node_modules/fbjs'), 13 | 'react-native': path.resolve(__dirname, 'node_modules/react-native'), 14 | '@babel/runtime': path.resolve(__dirname, 'node_modules/@babel/runtime'), 15 | 'react-native-text-gradient': path.resolve(__dirname, '../') 16 | }; 17 | const watchFolders = [ 18 | path.resolve(__dirname, '../') 19 | ]; 20 | 21 | module.exports = { 22 | resolver: { 23 | extraNodeModules, 24 | }, 25 | watchFolders, 26 | transformer: { 27 | getTransformOptions: async () => ({ 28 | transform: { 29 | experimentalImportSupport: false, 30 | inlineRequires: false, 31 | }, 32 | }), 33 | }, 34 | }; 35 | -------------------------------------------------------------------------------- /TextGradientExample/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TextGradientExample", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "postinstall": "npm run patch:rn", 7 | "patch:rn": "node node_modules/react-native-text-gradient/patch-rn.js", 8 | "run:android": "cd android && ./gradlew clean && cd .. && react-native run-android", 9 | "reset:packager": "watchman watch-del-all && node_modules/react-native/scripts/packager.sh --reset-cache", 10 | "start": "node node_modules/react-native/local-cli/cli.js start", 11 | "generate:android:signing-key": "keytool -genkey -v -keystore example.keystore -alias example -keyalg RSA -keysize 2048 -validity 10000 && mv example.keystore android/app", 12 | "generate:android:apk": "npm run generate:android:bundle && cd android && ./gradlew assembleRelease", 13 | "generate:android:bundle": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res/", 14 | "build:docker:image": "docker build -t text-gradient-android.image -f ./Dockerfile ../", 15 | "extract:docker:apk": "docker create -ti --name text-gradient-android-container text-gradient-android.image /bin/bash && docker cp text-gradient-android-container:/package/TextGradientExample/android/app/build/outputs/apk/release/app-release.apk text-gradient.apk && docker rm -fv text-gradient-android-container", 16 | "build:release:docker": "npm run build:docker:image && npm run extract:docker:apk", 17 | "devmenu": "adb shell input keyevent KEYCODE_MENU" 18 | }, 19 | "dependencies": { 20 | "react": "16.8.3", 21 | "react-native": "0.59.10", 22 | "react-native-text-gradient": "file:../" 23 | }, 24 | "devDependencies": { 25 | "@babel/core": "^7.4.5", 26 | "@babel/runtime": "^7.4.5", 27 | "metro-react-native-babel-preset": "^0.54.1" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | .idea 3 | .gradle 4 | local.properties 5 | *.iml 6 | .DS_Store -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | import org.gradle.util.GradleVersion 2 | 3 | apply plugin: 'com.android.library' 4 | 5 | def _ext = rootProject.ext; 6 | 7 | def _reactNativeVersion = _ext.has('reactNative') ? _ext.reactNative : '+'; 8 | def _compileSdkVersion = _ext.has('compileSdkVersion') ? _ext.compileSdkVersion : 28; 9 | def _buildToolsVersion = _ext.has('buildToolsVersion') ? _ext.buildToolsVersion : '28.0.3'; 10 | def _minSdkVersion = _ext.has('minSdkVersion') ? _ext.minSdkVersion : 16; 11 | def _targetSdkVersion = _ext.has('targetSdkVersion') ? _ext.targetSdkVersion : 28; 12 | 13 | android { 14 | compileSdkVersion _compileSdkVersion 15 | buildToolsVersion _buildToolsVersion 16 | 17 | defaultConfig { 18 | minSdkVersion _minSdkVersion 19 | targetSdkVersion _targetSdkVersion 20 | versionCode 1 21 | versionName "1.0" 22 | } 23 | lintOptions { 24 | abortOnError false 25 | } 26 | } 27 | 28 | dependencies { 29 | if (GradleVersion.current() >= GradleVersion.version('4.1')) { 30 | compileOnly "com.facebook.react:react-native:${_reactNativeVersion}" 31 | } else { 32 | compile "com.facebook.react:react-native:${_reactNativeVersion}" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/src/main/java/iyegoroff/RNTextGradient/Linear/RNLinearTextGradientManager.java: -------------------------------------------------------------------------------- 1 | package iyegoroff.RNTextGradient.Linear; 2 | 3 | import iyegoroff.RNTextGradient.RNTextGradientManager; 4 | import iyegoroff.RNTextGradient.RNShadowTextGradient; 5 | 6 | import com.facebook.react.bridge.ReactApplicationContext; 7 | import com.facebook.react.common.annotations.VisibleForTesting; 8 | import com.facebook.react.module.annotations.ReactModule; 9 | 10 | import javax.annotation.Nonnull; 11 | 12 | @ReactModule(name = RNLinearTextGradientManager.REACT_CLASS) 13 | public class RNLinearTextGradientManager extends RNTextGradientManager { 14 | 15 | @VisibleForTesting 16 | static final String REACT_CLASS = "RNLinearTextGradient"; 17 | 18 | @Override 19 | public @Nonnull String getName() { 20 | return REACT_CLASS; 21 | } 22 | 23 | @Override 24 | public @Nonnull RNShadowTextGradient createShadowNodeInstance( 25 | @Nonnull ReactApplicationContext context 26 | ) { 27 | return new RNShadowLinearTextGradient(context); 28 | } 29 | 30 | @Override 31 | public Class getShadowNodeClass() { 32 | return RNShadowLinearTextGradient.class; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /android/src/main/java/iyegoroff/RNTextGradient/Linear/RNLinearTextGradientSpan.java: -------------------------------------------------------------------------------- 1 | package iyegoroff.RNTextGradient.Linear; 2 | 3 | import android.graphics.LinearGradient; 4 | import android.graphics.Path; 5 | import android.graphics.RectF; 6 | import android.graphics.Shader; 7 | import android.graphics.Paint; 8 | import android.text.Layout; 9 | import android.text.TextPaint; 10 | import android.text.style.CharacterStyle; 11 | import android.text.style.UpdateAppearance; 12 | 13 | import java.lang.String; 14 | 15 | import com.facebook.yoga.YogaConstants; 16 | 17 | public class RNLinearTextGradientSpan extends CharacterStyle implements UpdateAppearance { 18 | 19 | private LinearGradient mGradient; 20 | 21 | RNLinearTextGradientSpan( 22 | float[] locations, 23 | int[] colors, 24 | float[] start, 25 | float[] end, 26 | boolean useViewFrame, 27 | Layout layout, 28 | int textStart, 29 | int textEnd, 30 | float maxWidth, 31 | float maxHeight, 32 | String text 33 | ) { 34 | if ( 35 | start != null && 36 | end != null && 37 | colors != null && 38 | locations != null && 39 | text != null && 40 | !YogaConstants.isUndefined(maxWidth) && 41 | maxWidth != 0 && 42 | maxHeight != 0 && 43 | layout != null 44 | ) { 45 | Path path = new Path(); 46 | RectF bounds = new RectF(); 47 | layout.getSelectionPath(textStart, textEnd, path); 48 | path.computeBounds(bounds, true); 49 | 50 | if (layout.getLineForOffset(textEnd - 1) != layout.getLineForOffset(textEnd)) { 51 | RectF lastSymbolBounds = new RectF(); 52 | layout.getSelectionPath(textEnd - 1, textEnd, path); 53 | path.computeBounds(lastSymbolBounds, true); 54 | 55 | if (lastSymbolBounds.contains(bounds) && bounds.contains(lastSymbolBounds)) { 56 | layout.getSelectionPath(textStart, textEnd - 1, path); 57 | path.computeBounds(bounds, true); 58 | } 59 | } 60 | 61 | float width = useViewFrame ? maxWidth : bounds.width(); 62 | float height = useViewFrame ? maxHeight : bounds.height(); 63 | float x0 = (useViewFrame ? 0 : bounds.left) + start[0] * width; 64 | float y0 = (useViewFrame ? 0 : bounds.top) + start[1] * height; 65 | float x1 = (useViewFrame ? 0 : bounds.left) + end[0] * width; 66 | float y1 = (useViewFrame ? 0 : bounds.top) + end[1] * height; 67 | 68 | mGradient = new LinearGradient(x0, y0, x1, y1, colors, locations, Shader.TileMode.CLAMP); 69 | } 70 | } 71 | 72 | @Override 73 | public void updateDrawState(TextPaint paint) { 74 | if (mGradient != null) { 75 | paint.setStyle(Paint.Style.FILL); 76 | paint.setShader(mGradient); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /android/src/main/java/iyegoroff/RNTextGradient/Linear/RNShadowLinearTextGradient.java: -------------------------------------------------------------------------------- 1 | package iyegoroff.RNTextGradient.Linear; 2 | 3 | import android.text.Layout; 4 | import android.text.SpannableStringBuilder; 5 | 6 | import iyegoroff.RNTextGradient.RNShadowTextGradient; 7 | 8 | import com.facebook.react.bridge.ReactApplicationContext; 9 | import com.facebook.react.bridge.ReadableArray; 10 | import com.facebook.react.uimanager.annotations.ReactProp; 11 | import iyegoroff.RNTextGradient.RNSetGradientSpanOperation; 12 | 13 | public class RNShadowLinearTextGradient extends RNShadowTextGradient { 14 | 15 | private float[] mStart; 16 | private float[] mEnd; 17 | 18 | RNShadowLinearTextGradient(ReactApplicationContext context) { 19 | super(context); 20 | } 21 | 22 | @SuppressWarnings("unused") 23 | @ReactProp(name = "gradientStart") 24 | public void setStart(ReadableArray start) { 25 | if (start != null) { 26 | mStart = new float[] { 27 | (float) start.getDouble(0), 28 | (float) start.getDouble(1) 29 | }; 30 | 31 | markUpdated(); 32 | } 33 | } 34 | 35 | @SuppressWarnings("unused") 36 | @ReactProp(name = "gradientEnd") 37 | public void setEnd(ReadableArray end) { 38 | if (end != null) { 39 | mEnd = new float[] { 40 | (float) end.getDouble(0), 41 | (float) end.getDouble(1) 42 | }; 43 | 44 | markUpdated(); 45 | } 46 | } 47 | 48 | @Override 49 | protected RNSetGradientSpanOperation createSpan( 50 | SpannableStringBuilder builder, 51 | int start, 52 | int end, 53 | float maxWidth, 54 | float maxHeight, 55 | Layout layout 56 | ) { 57 | RNLinearTextGradientSpan span = new RNLinearTextGradientSpan( 58 | mLocations, 59 | mColors, 60 | mStart, 61 | mEnd, 62 | mUseViewFrame, 63 | layout, 64 | start, 65 | end, 66 | maxWidth, 67 | maxHeight, 68 | builder.toString() 69 | ); 70 | 71 | return new RNSetGradientSpanOperation(start, end, span); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /android/src/main/java/iyegoroff/RNTextGradient/Linear/RNVirtualLinearTextGradientManager.java: -------------------------------------------------------------------------------- 1 | package iyegoroff.RNTextGradient.Linear; 2 | 3 | import com.facebook.react.bridge.ReactApplicationContext; 4 | import com.facebook.react.common.annotations.VisibleForTesting; 5 | import com.facebook.react.module.annotations.ReactModule; 6 | import iyegoroff.RNTextGradient.RNVirtualTextGradientManager; 7 | import java.lang.String; 8 | 9 | import javax.annotation.Nonnull; 10 | 11 | @ReactModule(name = RNVirtualLinearTextGradientManager.REACT_CLASS) 12 | public class RNVirtualLinearTextGradientManager extends RNVirtualTextGradientManager< 13 | RNVirtualShadowLinearTextGradient 14 | > { 15 | 16 | @VisibleForTesting 17 | static final String REACT_CLASS = "RNVirtualLinearTextGradient"; 18 | 19 | @Override 20 | public @Nonnull String getName() { 21 | return REACT_CLASS; 22 | } 23 | 24 | @Override 25 | public @Nonnull RNVirtualShadowLinearTextGradient createShadowNodeInstance( 26 | @Nonnull ReactApplicationContext context 27 | ) { 28 | return new RNVirtualShadowLinearTextGradient(context); 29 | } 30 | 31 | @Override 32 | public Class getShadowNodeClass() { 33 | return RNVirtualShadowLinearTextGradient.class; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /android/src/main/java/iyegoroff/RNTextGradient/Linear/RNVirtualShadowLinearTextGradient.java: -------------------------------------------------------------------------------- 1 | package iyegoroff.RNTextGradient.Linear; 2 | 3 | import com.facebook.react.bridge.ReactApplicationContext; 4 | 5 | public class RNVirtualShadowLinearTextGradient extends RNShadowLinearTextGradient { 6 | 7 | RNVirtualShadowLinearTextGradient(ReactApplicationContext context) { 8 | super(context); 9 | } 10 | 11 | @Override 12 | public boolean isVirtual() { 13 | return true; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /android/src/main/java/iyegoroff/RNTextGradient/OneOffListener.java: -------------------------------------------------------------------------------- 1 | package iyegoroff.RNTextGradient; 2 | 3 | class OneOffListener { 4 | private Runnable mRemoval; 5 | private Runnable mUpdate; 6 | 7 | OneOffListener(Runnable update) { 8 | mUpdate = update; 9 | } 10 | 11 | void addRemoval(Runnable removal) { 12 | mRemoval = removal; 13 | } 14 | 15 | void trigger() { 16 | if (mUpdate != null) { 17 | mUpdate.run(); 18 | } 19 | 20 | if (mRemoval != null) { 21 | mRemoval.run(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /android/src/main/java/iyegoroff/RNTextGradient/RNSetGradientSpanOperation.java: -------------------------------------------------------------------------------- 1 | package iyegoroff.RNTextGradient; 2 | 3 | import android.text.Spannable; 4 | import android.text.SpannableStringBuilder; 5 | 6 | public class RNSetGradientSpanOperation { 7 | private int start, end; 8 | private Object what; 9 | 10 | public RNSetGradientSpanOperation(int start, int end, Object what) { 11 | this.start = start; 12 | this.end = end; 13 | this.what = what; 14 | } 15 | 16 | void execute(SpannableStringBuilder sb) { 17 | // All spans will automatically extend to the right of the text, but not the left - except 18 | // for spans that start at the beginning of the text. 19 | int spanFlags = Spannable.SPAN_EXCLUSIVE_INCLUSIVE; 20 | if (start == 0) { 21 | spanFlags = Spannable.SPAN_INCLUSIVE_INCLUSIVE; 22 | } 23 | 24 | if (end <= sb.length()) { 25 | sb.setSpan(what, start, end, spanFlags); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /android/src/main/java/iyegoroff/RNTextGradient/RNShadowTextGradient.java: -------------------------------------------------------------------------------- 1 | package iyegoroff.RNTextGradient; 2 | 3 | import com.facebook.react.bridge.ReactApplicationContext; 4 | import com.facebook.react.bridge.UiThreadUtil; 5 | import com.facebook.react.uimanager.NativeViewHierarchyManager; 6 | import com.facebook.react.uimanager.Spacing; 7 | import com.facebook.react.uimanager.UIBlock; 8 | import com.facebook.react.uimanager.UIManagerModule; 9 | import com.facebook.react.views.text.ReactTextShadowNode; 10 | import com.facebook.react.views.text.ReactBaseTextShadowNode; 11 | import com.facebook.react.views.text.ReactRawTextShadowNode; 12 | import com.facebook.react.views.text.ReactTextInlineImageShadowNode; 13 | import com.facebook.react.uimanager.ReactShadowNode; 14 | import com.facebook.react.uimanager.NativeViewHierarchyOptimizer; 15 | import com.facebook.react.bridge.ReadableArray; 16 | import com.facebook.react.uimanager.annotations.ReactProp; 17 | import java.lang.ref.WeakReference; 18 | 19 | import androidx.annotation.Nullable; 20 | import android.text.Editable; 21 | import android.text.Layout; 22 | import java.lang.String; 23 | import android.text.Spannable; 24 | import android.text.SpannableStringBuilder; 25 | import java.util.ArrayList; 26 | import java.util.List; 27 | 28 | import com.facebook.react.uimanager.UIViewOperationQueue; 29 | 30 | import android.text.TextWatcher; 31 | import android.view.View; 32 | 33 | import com.facebook.react.views.text.ReactTextUpdate; 34 | 35 | public abstract class RNShadowTextGradient extends ReactTextShadowNode { 36 | 37 | private static class TextChangeListener extends OneOffListener implements TextWatcher { 38 | 39 | TextChangeListener(Runnable update) { 40 | super(update); 41 | } 42 | 43 | @Override 44 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { } 45 | 46 | @Override 47 | public void onTextChanged(CharSequence s, int start, int before, int count) { } 48 | 49 | @Override 50 | public void afterTextChanged(Editable s) { 51 | trigger(); 52 | } 53 | } 54 | 55 | private static class LayoutChangeListener extends OneOffListener implements View.OnLayoutChangeListener { 56 | 57 | LayoutChangeListener(Runnable update) { 58 | super(update); 59 | } 60 | 61 | @Override 62 | public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { 63 | trigger(); 64 | } 65 | } 66 | 67 | private final static String sSpannableField = "mPreparedSpannableText"; 68 | 69 | protected float[] mLocations; 70 | protected int[] mColors; 71 | protected boolean mUseViewFrame; 72 | private WeakReference mContext; 73 | 74 | public RNShadowTextGradient(ReactApplicationContext context) { 75 | super(); 76 | 77 | mContext = new WeakReference<>(context); 78 | } 79 | 80 | private @Nullable View resolveView(int tag) { 81 | UiThreadUtil.assertOnUiThread(); 82 | ReactApplicationContext context = mContext.get(); 83 | 84 | if (context != null) { 85 | UIManagerModule uiManager = context.getNativeModule(UIManagerModule.class); 86 | 87 | NativeViewHierarchyManager manager = ReflectUtils.getFieldValue( 88 | ReflectUtils.getFieldValue( 89 | uiManager.getUIImplementation(), 90 | "mOperationsQueue", 91 | null 92 | ), 93 | "mNativeViewHierarchyManager", 94 | null 95 | ); 96 | 97 | if (manager != null) { 98 | return manager.resolveView(tag); 99 | } 100 | } 101 | 102 | return null; 103 | } 104 | 105 | @SuppressWarnings("unused") 106 | @ReactProp(name = "locations") 107 | public void setLocations(ReadableArray locations) { 108 | if (locations != null) { 109 | float[] _locations = new float[locations.size()]; 110 | 111 | for (int i = 0; i < _locations.length; i++) { 112 | _locations[i] = (float) locations.getDouble(i); 113 | } 114 | 115 | mLocations = _locations; 116 | 117 | } else { 118 | mLocations = null; 119 | } 120 | 121 | markUpdated(); 122 | } 123 | 124 | @SuppressWarnings("unused") 125 | @ReactProp(name = "colors") 126 | public void setColors(ReadableArray colors) { 127 | if (colors != null) { 128 | int[] _colors = new int[colors.size()]; 129 | 130 | for (int i = 0; i < _colors.length; i++) { 131 | _colors[i] = colors.getInt(i); 132 | } 133 | 134 | mColors = _colors; 135 | 136 | } else { 137 | mColors = null; 138 | } 139 | 140 | markUpdated(); 141 | } 142 | 143 | @SuppressWarnings("unused") 144 | @ReactProp(name = "useViewFrame") 145 | public void setUseViewFrame(boolean useViewFrame) { 146 | mUseViewFrame = useViewFrame; 147 | 148 | markUpdated(); 149 | } 150 | 151 | @Override 152 | public boolean dispatchUpdates( 153 | float absoluteX, 154 | float absoluteY, 155 | UIViewOperationQueue uiViewOperationQueue, 156 | NativeViewHierarchyOptimizer nativeViewHierarchyOptimizer 157 | ) { 158 | boolean layoutHasChanged = super.dispatchUpdates( 159 | absoluteX, 160 | absoluteY, 161 | uiViewOperationQueue, 162 | nativeViewHierarchyOptimizer 163 | ); 164 | 165 | if (layoutHasChanged) { 166 | markUpdated(); 167 | } 168 | 169 | return layoutHasChanged; 170 | } 171 | 172 | private Spannable updatedSpannable(Layout layout) { 173 | return spannableWithGradient( 174 | getSpannable(), 175 | this, 176 | getLayoutWidth(), 177 | getLayoutHeight(), 178 | layout 179 | ); 180 | } 181 | 182 | private Spannable getSpannable() { 183 | return ReflectUtils.getFieldValue(this, sSpannableField, ReactTextShadowNode.class); 184 | } 185 | 186 | @Override 187 | public void onCollectExtraUpdates(final UIViewOperationQueue uiViewOperationQueue) { 188 | final RNShadowTextGradient that = this; 189 | 190 | uiViewOperationQueue.enqueueUIBlock(new UIBlock() { 191 | @Override 192 | public void execute(NativeViewHierarchyManager nativeViewHierarchyManager) { 193 | final RNTextGradient view = (RNTextGradient) that.resolveView(getReactTag()); 194 | 195 | if (view != null) { 196 | Layout layout = view.getLayout(); 197 | 198 | if (layout != null) { 199 | ReactTextUpdate textUpdate = new ReactTextUpdate( 200 | that.updatedSpannable(layout), 201 | UNSET, 202 | that.mContainsImages, 203 | that.getPadding(Spacing.START), 204 | that.getPadding(Spacing.TOP), 205 | that.getPadding(Spacing.END), 206 | that.getPadding(Spacing.BOTTOM), 207 | (int) ReflectUtils.invokeMethod(that, "getTextAlign", ReactTextShadowNode.class), 208 | that.mTextBreakStrategy, 209 | that.mJustificationMode 210 | ); 211 | 212 | view.setText(textUpdate); 213 | } 214 | 215 | Runnable update = new Runnable() { 216 | @Override 217 | public void run() { 218 | Runnable exec = new Runnable() { 219 | @Override 220 | public void run() { 221 | Layout layout = view.getLayout(); 222 | 223 | ReactTextUpdate textUpdate = new ReactTextUpdate( 224 | that.updatedSpannable(layout), 225 | UNSET, 226 | that.mContainsImages, 227 | that.getPadding(Spacing.START), 228 | that.getPadding(Spacing.TOP), 229 | that.getPadding(Spacing.END), 230 | that.getPadding(Spacing.BOTTOM), 231 | (int) ReflectUtils.invokeMethod( 232 | that, 233 | "getTextAlign", 234 | ReactTextShadowNode.class 235 | ), 236 | that.mTextBreakStrategy, 237 | that.mJustificationMode 238 | ); 239 | 240 | view.setText(textUpdate); 241 | } 242 | }; 243 | 244 | if (view.getLayout() != null) { 245 | exec.run(); 246 | } else { 247 | UiThreadUtil.runOnUiThread(exec); 248 | } 249 | } 250 | }; 251 | 252 | final LayoutChangeListener layoutListener = new LayoutChangeListener(update); 253 | 254 | view.addOnLayoutChangeListener(layoutListener); 255 | 256 | layoutListener.addRemoval(new Runnable() { 257 | @Override 258 | public void run() { 259 | view.removeOnLayoutChangeListener(layoutListener); 260 | } 261 | }); 262 | 263 | final TextChangeListener textListener = new TextChangeListener(update); 264 | 265 | view.addTextChangedListener(textListener); 266 | 267 | textListener.addRemoval(new Runnable() { 268 | @Override 269 | public void run() { 270 | view.removeTextChangedListener(textListener); 271 | } 272 | }); 273 | } 274 | } 275 | }); 276 | 277 | super.onCollectExtraUpdates(uiViewOperationQueue); 278 | } 279 | 280 | protected abstract RNSetGradientSpanOperation createSpan( 281 | SpannableStringBuilder builder, 282 | int start, 283 | int end, 284 | float maxWidth, 285 | float maxHeight, 286 | Layout layout 287 | ); 288 | 289 | private static Spannable spannableWithGradient( 290 | Spannable spannable, 291 | RNShadowTextGradient textCSSNode, 292 | float maxWidth, 293 | float maxHeight, 294 | Layout layout 295 | ) { 296 | List ops = new ArrayList<>(); 297 | SpannableStringBuilder gradientBuilder = new SpannableStringBuilder(); 298 | buildSpannedGradientFromTextCSSNode( 299 | textCSSNode, 300 | gradientBuilder, 301 | ops, 302 | maxWidth, 303 | maxHeight, 304 | layout 305 | ); 306 | 307 | for (int i = ops.size() - 1; i >= 0; i--) { 308 | ops.get(i).execute((SpannableStringBuilder) spannable); 309 | } 310 | 311 | return spannable; 312 | } 313 | 314 | private static void buildSpannedGradientFromTextCSSNode( 315 | ReactBaseTextShadowNode textGradientShadowNode, 316 | SpannableStringBuilder builder, 317 | List ops, 318 | float maxWidth, 319 | float maxHeight, 320 | Layout layout 321 | ) { 322 | int start = builder.length(); 323 | 324 | for (int i = 0; i < textGradientShadowNode.getChildCount(); i++) { 325 | ReactShadowNode child = textGradientShadowNode.getChildAt(i); 326 | 327 | if (child instanceof ReactRawTextShadowNode) { 328 | builder.append(((ReactRawTextShadowNode) child).getText()); 329 | 330 | } else if (child instanceof ReactBaseTextShadowNode) { 331 | buildSpannedGradientFromTextCSSNode( 332 | (ReactBaseTextShadowNode) child, 333 | builder, 334 | ops, 335 | maxWidth, 336 | maxHeight, 337 | layout 338 | ); 339 | 340 | } else if (child instanceof ReactTextInlineImageShadowNode) { 341 | builder.append( 342 | (String) ReflectUtils.getFieldValue( 343 | textGradientShadowNode, 344 | "INLINE_IMAGE_PLACEHOLDER", 345 | ReactTextShadowNode.class 346 | ) 347 | ); 348 | } 349 | 350 | child.markUpdateSeen(); 351 | } 352 | 353 | int end = builder.length(); 354 | 355 | if (end >= start && textGradientShadowNode instanceof RNShadowTextGradient) { 356 | RNSetGradientSpanOperation spanOp = ((RNShadowTextGradient) textGradientShadowNode) 357 | .createSpan(builder, start, end, maxWidth, maxHeight, layout); 358 | 359 | ops.add(spanOp); 360 | } 361 | } 362 | } 363 | -------------------------------------------------------------------------------- /android/src/main/java/iyegoroff/RNTextGradient/RNTextGradient.java: -------------------------------------------------------------------------------- 1 | package iyegoroff.RNTextGradient; 2 | 3 | import android.content.Context; 4 | 5 | import com.facebook.react.views.text.ReactTextView; 6 | 7 | 8 | public class RNTextGradient extends ReactTextView { 9 | 10 | public RNTextGradient(Context context) { 11 | super(context); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /android/src/main/java/iyegoroff/RNTextGradient/RNTextGradientManager.java: -------------------------------------------------------------------------------- 1 | package iyegoroff.RNTextGradient; 2 | 3 | import com.facebook.react.views.text.ReactTextViewManager; 4 | import com.facebook.react.views.text.ReactTextAnchorViewManager; 5 | import com.facebook.react.uimanager.ThemedReactContext; 6 | 7 | import javax.annotation.Nonnull; 8 | 9 | public abstract class RNTextGradientManager extends ReactTextAnchorViewManager< 10 | RNTextGradient, 11 | RNShadowTextGradient 12 | > { 13 | 14 | private ReactTextViewManager mManager = new ReactTextViewManager(); 15 | 16 | @Override 17 | public @Nonnull RNTextGradient createViewInstance( 18 | @Nonnull ThemedReactContext context 19 | ) { 20 | return new RNTextGradient(context); 21 | } 22 | 23 | @Override 24 | public void updateExtraData(@Nonnull RNTextGradient view, Object extraData) { 25 | mManager.updateExtraData(view, extraData); 26 | } 27 | } -------------------------------------------------------------------------------- /android/src/main/java/iyegoroff/RNTextGradient/RNTextGradientPackage.java: -------------------------------------------------------------------------------- 1 | package iyegoroff.RNTextGradient; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collections; 5 | import java.util.List; 6 | 7 | import com.facebook.react.ReactPackage; 8 | import com.facebook.react.bridge.NativeModule; 9 | import com.facebook.react.bridge.ReactApplicationContext; 10 | import com.facebook.react.uimanager.ViewManager; 11 | 12 | import javax.annotation.Nonnull; 13 | 14 | import iyegoroff.RNTextGradient.Linear.RNLinearTextGradientManager; 15 | import iyegoroff.RNTextGradient.Linear.RNVirtualLinearTextGradientManager; 16 | 17 | public class RNTextGradientPackage implements ReactPackage { 18 | @Override 19 | public @Nonnull List createNativeModules( 20 | @Nonnull ReactApplicationContext reactContext 21 | ) { 22 | return Collections.emptyList(); 23 | } 24 | 25 | @Override 26 | public @Nonnull List createViewManagers( 27 | @Nonnull ReactApplicationContext reactContext 28 | ) { 29 | return Arrays.asList( 30 | new RNLinearTextGradientManager(), 31 | new RNVirtualLinearTextGradientManager() 32 | ); 33 | } 34 | } -------------------------------------------------------------------------------- /android/src/main/java/iyegoroff/RNTextGradient/RNVirtualTextGradientManager.java: -------------------------------------------------------------------------------- 1 | package iyegoroff.RNTextGradient; 2 | 3 | import com.facebook.react.uimanager.ThemedReactContext; 4 | import com.facebook.react.uimanager.BaseViewManager; 5 | import android.view.View; 6 | 7 | import javax.annotation.Nonnull; 8 | 9 | public abstract class RNVirtualTextGradientManager< 10 | T extends RNShadowTextGradient 11 | > extends BaseViewManager { 12 | 13 | @Override 14 | public @Nonnull RNTextGradient createViewInstance(@Nonnull ThemedReactContext context) { 15 | throw new IllegalStateException("RNVirtualTextGradientManager doesn't have a native view"); 16 | } 17 | 18 | @Override 19 | public void updateExtraData(@Nonnull View view, Object extraData) { 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /android/src/main/java/iyegoroff/RNTextGradient/ReflectUtils.java: -------------------------------------------------------------------------------- 1 | package iyegoroff.RNTextGradient; 2 | 3 | import androidx.annotation.Nullable; 4 | 5 | import com.facebook.common.logging.FLog; 6 | import com.facebook.react.common.ReactConstants; 7 | 8 | import java.lang.reflect.Field; 9 | import java.lang.reflect.Method; 10 | 11 | class ReflectUtils { 12 | 13 | @SuppressWarnings("unchecked") 14 | static T getFieldValue(Object target, String name, @Nullable Class type) { 15 | type = type == null ? target.getClass() : type; 16 | 17 | try { 18 | Field field = type.getDeclaredField(name); 19 | field.setAccessible(true); 20 | 21 | return (T) field.get(target); 22 | 23 | } catch (Exception e) { 24 | FLog.w(ReactConstants.TAG, "Can't get " + type.getName() + " field " + name); 25 | FLog.w(ReactConstants.TAG, e.getMessage()); 26 | } 27 | 28 | return null; 29 | } 30 | 31 | @SuppressWarnings({"unchecked", "SameParameterValue"}) 32 | static T invokeMethod(Object target, String name, @Nullable Class type) { 33 | type = type == null ? target.getClass() : type; 34 | 35 | try { 36 | Method method = type.getDeclaredMethod(name); 37 | method.setAccessible(true); 38 | 39 | return (T) method.invoke(target); 40 | 41 | } catch (Exception e) { 42 | FLog.w(ReactConstants.TAG, "Can't invoke " + type.getName() + " method " + name); 43 | FLog.w(ReactConstants.TAG, e.getMessage()); 44 | } 45 | 46 | return null; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /img/android.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/react-native-text-gradient/8442405fc3ee155ff52788c6f1f990b3146c1f57/img/android.jpg -------------------------------------------------------------------------------- /img/ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/react-native-text-gradient/8442405fc3ee155ff52788c6f1f990b3146c1f57/img/ios.png -------------------------------------------------------------------------------- /img/useViewFrame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/react-native-text-gradient/8442405fc3ee155ff52788c6f1f990b3146c1f57/img/useViewFrame.png -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.pbxuser 2 | !default.pbxuser 3 | *.mode1v3 4 | !default.mode1v3 5 | *.mode2v3 6 | !default.mode2v3 7 | *.perspectivev3 8 | !default.perspectivev3 9 | xcuserdata 10 | *.xccheckout 11 | *.moved-aside 12 | DerivedData 13 | *.hmap 14 | *.ipa 15 | *.xcuserstate 16 | project.xcworkspace 17 | .DS_Store -------------------------------------------------------------------------------- /ios/RNLinearGradientUtils.h: -------------------------------------------------------------------------------- 1 | #import "RNLinearTextGradientShadowViewDelegate.h" 2 | #import "RCTBaseTextShadowView.h" 3 | 4 | @interface RNLinearGradientUtils : NSObject 5 | 6 | + (UIColor *)gradientWithFrame:(CGRect)frame 7 | shadowView:(RCTBaseTextShadowView *)shadowView; 8 | 9 | + (NSDictionary *)gradientComparisonKey:(CGRect)frame 10 | shadowView:(RCTBaseTextShadowView *)shadowView; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /ios/RNLinearGradientUtils.m: -------------------------------------------------------------------------------- 1 | #import "RNLinearGradientUtils.h" 2 | 3 | // based on this: https://github.com/ViccAlexander/Chameleon/blob/master/Pod/Classes/Objective-C/UIColor%2BChameleon.m 4 | 5 | @implementation RNLinearGradientUtils 6 | 7 | + (UIColor *)gradientWithFrame:(CGRect)frame 8 | shadowView:(RCTBaseTextShadowView *)shadowView 9 | { 10 | NSMutableArray *cgColors = [[NSMutableArray alloc] init]; 11 | for (UIColor *color in [shadowView colors]) { 12 | [cgColors addObject:(id)[color CGColor]]; 13 | } 14 | 15 | CGSize contextSize = CGSizeMake(frame.size.width + frame.origin.x, 16 | frame.size.height + frame.origin.y); 17 | UIGraphicsBeginImageContextWithOptions(contextSize, NO, [UIScreen mainScreen].scale); 18 | 19 | //Default to the RGB Colorspace 20 | CGColorSpaceRef myColorspace = CGColorSpaceCreateDeviceRGB(); 21 | CFArrayRef arrayRef = (__bridge CFArrayRef)cgColors; 22 | 23 | NSUInteger locationsCount = [[shadowView locations] count]; 24 | CGFloat locations[locationsCount]; 25 | for (int i = 0; i < locationsCount; ++i) { 26 | locations[i] = [[shadowView locations] objectAtIndex:i].floatValue; 27 | } 28 | 29 | //Create our Fradient 30 | CGGradientRef myGradient = CGGradientCreateWithColors(myColorspace, arrayRef, locations); 31 | 32 | CGPoint start = CGPointMake([shadowView gradientStart].x * frame.size.width + frame.origin.x, 33 | [shadowView gradientStart].y * frame.size.height + frame.origin.y); 34 | CGPoint end = CGPointMake([shadowView gradientEnd].x * frame.size.width + frame.origin.x, 35 | [shadowView gradientEnd].y * frame.size.height + frame.origin.y); 36 | 37 | // Draw our Gradient 38 | CGContextDrawLinearGradient(UIGraphicsGetCurrentContext(), 39 | myGradient, 40 | start, 41 | end, 42 | kCGGradientDrawsAfterEndLocation); 43 | // Grab it as an Image 44 | UIImage *backgroundColorImage = UIGraphicsGetImageFromCurrentImageContext(); 45 | 46 | // Clean up 47 | CGColorSpaceRelease(myColorspace); // Necessary? 48 | CGGradientRelease(myGradient); // Necessary? 49 | UIGraphicsEndImageContext(); 50 | return [UIColor colorWithPatternImage:backgroundColorImage]; 51 | } 52 | 53 | + (NSDictionary *)gradientComparisonKey:(CGRect)frame 54 | shadowView:(RCTBaseTextShadowView *)shadowView 55 | { 56 | return @{@"locations": [shadowView locations] ?: @[], 57 | @"colors": [shadowView colors] ?: @[], 58 | @"start": [NSValue valueWithCGPoint:[shadowView gradientStart]], 59 | @"end": [NSValue valueWithCGPoint:[shadowView gradientEnd]], 60 | @"frame": [NSValue valueWithCGRect:frame]}; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /ios/RNLinearTextGradientShadowView.h: -------------------------------------------------------------------------------- 1 | #import "RNLinearTextGradientShadowViewDelegate.h" 2 | #import "RNTextGradientShadowView.h" 3 | 4 | @interface RNLinearTextGradientShadowView : RNTextGradientShadowView 5 | 6 | @property (nonatomic, assign) CGPoint gradientStart; 7 | @property (nonatomic, assign) CGPoint gradientEnd; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /ios/RNLinearTextGradientShadowView.m: -------------------------------------------------------------------------------- 1 | #import "RNLinearGradientUtils.h" 2 | #import "RNLinearTextGradientShadowView.h" 3 | 4 | @implementation RNLinearTextGradientShadowView 5 | 6 | - (UIColor *)gradientWithFrame:(CGRect)frame 7 | { 8 | return [RNLinearGradientUtils gradientWithFrame:frame shadowView:self]; 9 | } 10 | 11 | - (NSDictionary *)gradientComparisonKey:(CGRect)frame 12 | { 13 | return [RNLinearGradientUtils gradientComparisonKey:frame shadowView:self]; 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ios/RNLinearTextGradientShadowViewDelegate.h: -------------------------------------------------------------------------------- 1 | #import "RNTextGradientShadowViewDelegate.h" 2 | 3 | #ifndef RNLinearTextGradientShadowViewDelegate_h 4 | #define RNLinearTextGradientShadowViewDelegate_h 5 | 6 | @protocol RNLinearTextGradientShadowViewDelegate 7 | 8 | - (CGPoint)gradientStart; 9 | - (CGPoint)gradientEnd; 10 | 11 | @end 12 | 13 | #endif /* RNLinearTextGradientShadowViewDelegate_h */ 14 | -------------------------------------------------------------------------------- /ios/RNLinearTextGradientViewManager.h: -------------------------------------------------------------------------------- 1 | #import "RNTextGradientViewManager.h" 2 | 3 | @interface RNLinearTextGradientViewManager : RNTextGradientViewManager 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /ios/RNLinearTextGradientViewManager.m: -------------------------------------------------------------------------------- 1 | #import "RNLinearTextGradientShadowView.h" 2 | #import "RNLinearTextGradientViewManager.h" 3 | 4 | @implementation RNLinearTextGradientViewManager 5 | 6 | - (RNLinearTextGradientShadowView *)createShadowView 7 | { 8 | return [[RNLinearTextGradientShadowView alloc] initWithBridge:self.bridge]; 9 | } 10 | 11 | RCT_EXPORT_MODULE(RNLinearTextGradient); 12 | 13 | RCT_EXPORT_SHADOW_PROPERTY(gradientStart, CGPoint); 14 | RCT_EXPORT_SHADOW_PROPERTY(gradientEnd, CGPoint); 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ios/RNTextGradient.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 743353E8205685D500A5042E /* RNTextGradientUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 743353E7205685D500A5042E /* RNTextGradientUtils.m */; }; 11 | 743353EC20568ABE00A5042E /* RNVirtualTextGradientShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 743353EB20568ABE00A5042E /* RNVirtualTextGradientShadowView.m */; }; 12 | 743353F0205693AB00A5042E /* RNVirtualTextGradientViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 743353EF205693AA00A5042E /* RNVirtualTextGradientViewManager.m */; }; 13 | 743353F52056A46500A5042E /* RNVirtualLinearTextGradientShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 743353F42056A46500A5042E /* RNVirtualLinearTextGradientShadowView.m */; }; 14 | 743353F82056A99000A5042E /* RNLinearGradientUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 743353F72056A99000A5042E /* RNLinearGradientUtils.m */; }; 15 | 7479685620553C4F00E65937 /* RNTextGradientValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 7479685520553C4F00E65937 /* RNTextGradientValue.m */; }; 16 | 7479685D2055CDF400E65937 /* RNLinearTextGradientShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7479685C2055CDF400E65937 /* RNLinearTextGradientShadowView.m */; }; 17 | 747968602055CE1900E65937 /* RNVirtualLinearTextGradientViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7479685F2055CE1900E65937 /* RNVirtualLinearTextGradientViewManager.m */; }; 18 | 747968632055CEAD00E65937 /* RNLinearTextGradientViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 747968622055CEAD00E65937 /* RNLinearTextGradientViewManager.m */; }; 19 | 74BC8BF8205466D500D327F3 /* RNTextGradientShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 74BC8BF7205466D500D327F3 /* RNTextGradientShadowView.m */; }; 20 | 74BC8BFB205466EB00D327F3 /* RNTextGradientView.m in Sources */ = {isa = PBXBuildFile; fileRef = 74BC8BFA205466EB00D327F3 /* RNTextGradientView.m */; }; 21 | 74BC8BFF2054753800D327F3 /* RNTextGradientViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 74BC8BFE2054753800D327F3 /* RNTextGradientViewManager.m */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXCopyFilesBuildPhase section */ 25 | 58B511D91A9E6C8500147676 /* CopyFiles */ = { 26 | isa = PBXCopyFilesBuildPhase; 27 | buildActionMask = 2147483647; 28 | dstPath = "include/$(PRODUCT_NAME)"; 29 | dstSubfolderSpec = 16; 30 | files = ( 31 | ); 32 | runOnlyForDeploymentPostprocessing = 0; 33 | }; 34 | /* End PBXCopyFilesBuildPhase section */ 35 | 36 | /* Begin PBXFileReference section */ 37 | 134814201AA4EA6300B7C361 /* libRNTextGradient.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNTextGradient.a; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | 743353E6205685D500A5042E /* RNTextGradientUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNTextGradientUtils.h; sourceTree = ""; }; 39 | 743353E7205685D500A5042E /* RNTextGradientUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNTextGradientUtils.m; sourceTree = ""; }; 40 | 743353EA20568ABE00A5042E /* RNVirtualTextGradientShadowView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNVirtualTextGradientShadowView.h; sourceTree = ""; }; 41 | 743353EB20568ABE00A5042E /* RNVirtualTextGradientShadowView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNVirtualTextGradientShadowView.m; sourceTree = ""; }; 42 | 743353ED20568F3E00A5042E /* RNTextGradientShadowViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNTextGradientShadowViewDelegate.h; sourceTree = ""; }; 43 | 743353EE205693AA00A5042E /* RNVirtualTextGradientViewManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNVirtualTextGradientViewManager.h; sourceTree = ""; }; 44 | 743353EF205693AA00A5042E /* RNVirtualTextGradientViewManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNVirtualTextGradientViewManager.m; sourceTree = ""; }; 45 | 743353F32056A46500A5042E /* RNVirtualLinearTextGradientShadowView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNVirtualLinearTextGradientShadowView.h; sourceTree = ""; }; 46 | 743353F42056A46500A5042E /* RNVirtualLinearTextGradientShadowView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNVirtualLinearTextGradientShadowView.m; sourceTree = ""; }; 47 | 743353F62056A99000A5042E /* RNLinearGradientUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNLinearGradientUtils.h; sourceTree = ""; }; 48 | 743353F72056A99000A5042E /* RNLinearGradientUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNLinearGradientUtils.m; sourceTree = ""; }; 49 | 743353FB2056AAB400A5042E /* RNLinearTextGradientShadowViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNLinearTextGradientShadowViewDelegate.h; sourceTree = ""; }; 50 | 7479685420553C4F00E65937 /* RNTextGradientValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNTextGradientValue.h; sourceTree = ""; }; 51 | 7479685520553C4F00E65937 /* RNTextGradientValue.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNTextGradientValue.m; sourceTree = ""; }; 52 | 7479685B2055CDF400E65937 /* RNLinearTextGradientShadowView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNLinearTextGradientShadowView.h; sourceTree = ""; }; 53 | 7479685C2055CDF400E65937 /* RNLinearTextGradientShadowView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNLinearTextGradientShadowView.m; sourceTree = ""; }; 54 | 7479685E2055CE1900E65937 /* RNVirtualLinearTextGradientViewManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNVirtualLinearTextGradientViewManager.h; sourceTree = ""; }; 55 | 7479685F2055CE1900E65937 /* RNVirtualLinearTextGradientViewManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNVirtualLinearTextGradientViewManager.m; sourceTree = ""; }; 56 | 747968612055CEAD00E65937 /* RNLinearTextGradientViewManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNLinearTextGradientViewManager.h; sourceTree = ""; }; 57 | 747968622055CEAD00E65937 /* RNLinearTextGradientViewManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNLinearTextGradientViewManager.m; sourceTree = ""; }; 58 | 74BC8BF6205466D500D327F3 /* RNTextGradientShadowView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNTextGradientShadowView.h; sourceTree = ""; }; 59 | 74BC8BF7205466D500D327F3 /* RNTextGradientShadowView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNTextGradientShadowView.m; sourceTree = ""; }; 60 | 74BC8BF9205466EB00D327F3 /* RNTextGradientView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNTextGradientView.h; sourceTree = ""; }; 61 | 74BC8BFA205466EB00D327F3 /* RNTextGradientView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNTextGradientView.m; sourceTree = ""; }; 62 | 74BC8BFD2054753800D327F3 /* RNTextGradientViewManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNTextGradientViewManager.h; sourceTree = ""; }; 63 | 74BC8BFE2054753800D327F3 /* RNTextGradientViewManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNTextGradientViewManager.m; sourceTree = ""; }; 64 | /* End PBXFileReference section */ 65 | 66 | /* Begin PBXFrameworksBuildPhase section */ 67 | 58B511D81A9E6C8500147676 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXFrameworksBuildPhase section */ 75 | 76 | /* Begin PBXGroup section */ 77 | 134814211AA4EA7D00B7C361 /* Products */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 134814201AA4EA6300B7C361 /* libRNTextGradient.a */, 81 | ); 82 | name = Products; 83 | sourceTree = ""; 84 | }; 85 | 58B511D21A9E6C8500147676 = { 86 | isa = PBXGroup; 87 | children = ( 88 | 74BC8BF5205466B800D327F3 /* TextGradient */, 89 | 747968572055CD7000E65937 /* LinearTextGradient */, 90 | 7479685420553C4F00E65937 /* RNTextGradientValue.h */, 91 | 7479685520553C4F00E65937 /* RNTextGradientValue.m */, 92 | 134814211AA4EA7D00B7C361 /* Products */, 93 | ); 94 | sourceTree = ""; 95 | }; 96 | 743353F92056A9C400A5042E /* VirtualTextGradient */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 743353EE205693AA00A5042E /* RNVirtualTextGradientViewManager.h */, 100 | 743353EF205693AA00A5042E /* RNVirtualTextGradientViewManager.m */, 101 | 743353EA20568ABE00A5042E /* RNVirtualTextGradientShadowView.h */, 102 | 743353EB20568ABE00A5042E /* RNVirtualTextGradientShadowView.m */, 103 | ); 104 | name = VirtualTextGradient; 105 | sourceTree = ""; 106 | }; 107 | 743353FA2056A9EB00A5042E /* VirtualLinearTextGradient */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 7479685E2055CE1900E65937 /* RNVirtualLinearTextGradientViewManager.h */, 111 | 7479685F2055CE1900E65937 /* RNVirtualLinearTextGradientViewManager.m */, 112 | 743353F32056A46500A5042E /* RNVirtualLinearTextGradientShadowView.h */, 113 | 743353F42056A46500A5042E /* RNVirtualLinearTextGradientShadowView.m */, 114 | ); 115 | name = VirtualLinearTextGradient; 116 | sourceTree = ""; 117 | }; 118 | 747968572055CD7000E65937 /* LinearTextGradient */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 743353FA2056A9EB00A5042E /* VirtualLinearTextGradient */, 122 | 747968612055CEAD00E65937 /* RNLinearTextGradientViewManager.h */, 123 | 747968622055CEAD00E65937 /* RNLinearTextGradientViewManager.m */, 124 | 7479685B2055CDF400E65937 /* RNLinearTextGradientShadowView.h */, 125 | 7479685C2055CDF400E65937 /* RNLinearTextGradientShadowView.m */, 126 | 743353F62056A99000A5042E /* RNLinearGradientUtils.h */, 127 | 743353F72056A99000A5042E /* RNLinearGradientUtils.m */, 128 | 743353FB2056AAB400A5042E /* RNLinearTextGradientShadowViewDelegate.h */, 129 | ); 130 | name = LinearTextGradient; 131 | sourceTree = ""; 132 | }; 133 | 74BC8BF5205466B800D327F3 /* TextGradient */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 743353F92056A9C400A5042E /* VirtualTextGradient */, 137 | 74BC8BFD2054753800D327F3 /* RNTextGradientViewManager.h */, 138 | 74BC8BFE2054753800D327F3 /* RNTextGradientViewManager.m */, 139 | 74BC8BF6205466D500D327F3 /* RNTextGradientShadowView.h */, 140 | 74BC8BF7205466D500D327F3 /* RNTextGradientShadowView.m */, 141 | 74BC8BF9205466EB00D327F3 /* RNTextGradientView.h */, 142 | 74BC8BFA205466EB00D327F3 /* RNTextGradientView.m */, 143 | 743353E6205685D500A5042E /* RNTextGradientUtils.h */, 144 | 743353E7205685D500A5042E /* RNTextGradientUtils.m */, 145 | 743353ED20568F3E00A5042E /* RNTextGradientShadowViewDelegate.h */, 146 | ); 147 | name = TextGradient; 148 | sourceTree = ""; 149 | }; 150 | /* End PBXGroup section */ 151 | 152 | /* Begin PBXNativeTarget section */ 153 | 58B511DA1A9E6C8500147676 /* RNTextGradient */ = { 154 | isa = PBXNativeTarget; 155 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNTextGradient" */; 156 | buildPhases = ( 157 | 58B511D71A9E6C8500147676 /* Sources */, 158 | 58B511D81A9E6C8500147676 /* Frameworks */, 159 | 58B511D91A9E6C8500147676 /* CopyFiles */, 160 | ); 161 | buildRules = ( 162 | ); 163 | dependencies = ( 164 | ); 165 | name = RNTextGradient; 166 | productName = RCTDataManager; 167 | productReference = 134814201AA4EA6300B7C361 /* libRNTextGradient.a */; 168 | productType = "com.apple.product-type.library.static"; 169 | }; 170 | /* End PBXNativeTarget section */ 171 | 172 | /* Begin PBXProject section */ 173 | 58B511D31A9E6C8500147676 /* Project object */ = { 174 | isa = PBXProject; 175 | attributes = { 176 | LastUpgradeCheck = 0610; 177 | ORGANIZATIONNAME = Facebook; 178 | TargetAttributes = { 179 | 58B511DA1A9E6C8500147676 = { 180 | CreatedOnToolsVersion = 6.1.1; 181 | }; 182 | }; 183 | }; 184 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNTextGradient" */; 185 | compatibilityVersion = "Xcode 3.2"; 186 | developmentRegion = English; 187 | hasScannedForEncodings = 0; 188 | knownRegions = ( 189 | en, 190 | ); 191 | mainGroup = 58B511D21A9E6C8500147676; 192 | productRefGroup = 58B511D21A9E6C8500147676; 193 | projectDirPath = ""; 194 | projectRoot = ""; 195 | targets = ( 196 | 58B511DA1A9E6C8500147676 /* RNTextGradient */, 197 | ); 198 | }; 199 | /* End PBXProject section */ 200 | 201 | /* Begin PBXSourcesBuildPhase section */ 202 | 58B511D71A9E6C8500147676 /* Sources */ = { 203 | isa = PBXSourcesBuildPhase; 204 | buildActionMask = 2147483647; 205 | files = ( 206 | 743353F82056A99000A5042E /* RNLinearGradientUtils.m in Sources */, 207 | 743353F52056A46500A5042E /* RNVirtualLinearTextGradientShadowView.m in Sources */, 208 | 743353EC20568ABE00A5042E /* RNVirtualTextGradientShadowView.m in Sources */, 209 | 74BC8BFF2054753800D327F3 /* RNTextGradientViewManager.m in Sources */, 210 | 74BC8BF8205466D500D327F3 /* RNTextGradientShadowView.m in Sources */, 211 | 7479685D2055CDF400E65937 /* RNLinearTextGradientShadowView.m in Sources */, 212 | 7479685620553C4F00E65937 /* RNTextGradientValue.m in Sources */, 213 | 743353F0205693AB00A5042E /* RNVirtualTextGradientViewManager.m in Sources */, 214 | 743353E8205685D500A5042E /* RNTextGradientUtils.m in Sources */, 215 | 747968602055CE1900E65937 /* RNVirtualLinearTextGradientViewManager.m in Sources */, 216 | 74BC8BFB205466EB00D327F3 /* RNTextGradientView.m in Sources */, 217 | 747968632055CEAD00E65937 /* RNLinearTextGradientViewManager.m in Sources */, 218 | ); 219 | runOnlyForDeploymentPostprocessing = 0; 220 | }; 221 | /* End PBXSourcesBuildPhase section */ 222 | 223 | /* Begin XCBuildConfiguration section */ 224 | 58B511ED1A9E6C8500147676 /* Debug */ = { 225 | isa = XCBuildConfiguration; 226 | buildSettings = { 227 | ALWAYS_SEARCH_USER_PATHS = NO; 228 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 229 | CLANG_CXX_LIBRARY = "libc++"; 230 | CLANG_ENABLE_MODULES = YES; 231 | CLANG_ENABLE_OBJC_ARC = YES; 232 | CLANG_WARN_BOOL_CONVERSION = YES; 233 | CLANG_WARN_CONSTANT_CONVERSION = YES; 234 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 235 | CLANG_WARN_EMPTY_BODY = YES; 236 | CLANG_WARN_ENUM_CONVERSION = YES; 237 | CLANG_WARN_INT_CONVERSION = YES; 238 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 239 | CLANG_WARN_UNREACHABLE_CODE = YES; 240 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 241 | COPY_PHASE_STRIP = NO; 242 | ENABLE_STRICT_OBJC_MSGSEND = YES; 243 | GCC_C_LANGUAGE_STANDARD = gnu99; 244 | GCC_DYNAMIC_NO_PIC = NO; 245 | GCC_OPTIMIZATION_LEVEL = 0; 246 | GCC_PREPROCESSOR_DEFINITIONS = ( 247 | "DEBUG=1", 248 | "$(inherited)", 249 | ); 250 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 251 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 252 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 253 | GCC_WARN_UNDECLARED_SELECTOR = YES; 254 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 255 | GCC_WARN_UNUSED_FUNCTION = YES; 256 | GCC_WARN_UNUSED_VARIABLE = YES; 257 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 258 | MTL_ENABLE_DEBUG_INFO = YES; 259 | ONLY_ACTIVE_ARCH = YES; 260 | SDKROOT = iphoneos; 261 | }; 262 | name = Debug; 263 | }; 264 | 58B511EE1A9E6C8500147676 /* Release */ = { 265 | isa = XCBuildConfiguration; 266 | buildSettings = { 267 | ALWAYS_SEARCH_USER_PATHS = NO; 268 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 269 | CLANG_CXX_LIBRARY = "libc++"; 270 | CLANG_ENABLE_MODULES = YES; 271 | CLANG_ENABLE_OBJC_ARC = YES; 272 | CLANG_WARN_BOOL_CONVERSION = YES; 273 | CLANG_WARN_CONSTANT_CONVERSION = YES; 274 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 275 | CLANG_WARN_EMPTY_BODY = YES; 276 | CLANG_WARN_ENUM_CONVERSION = YES; 277 | CLANG_WARN_INT_CONVERSION = YES; 278 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 279 | CLANG_WARN_UNREACHABLE_CODE = YES; 280 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 281 | COPY_PHASE_STRIP = YES; 282 | ENABLE_NS_ASSERTIONS = NO; 283 | ENABLE_STRICT_OBJC_MSGSEND = YES; 284 | GCC_C_LANGUAGE_STANDARD = gnu99; 285 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 286 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 287 | GCC_WARN_UNDECLARED_SELECTOR = YES; 288 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 289 | GCC_WARN_UNUSED_FUNCTION = YES; 290 | GCC_WARN_UNUSED_VARIABLE = YES; 291 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 292 | MTL_ENABLE_DEBUG_INFO = NO; 293 | SDKROOT = iphoneos; 294 | VALIDATE_PRODUCT = YES; 295 | }; 296 | name = Release; 297 | }; 298 | 58B511F01A9E6C8500147676 /* Debug */ = { 299 | isa = XCBuildConfiguration; 300 | buildSettings = { 301 | HEADER_SEARCH_PATHS = ( 302 | "$(inherited)", 303 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 304 | "$(SRCROOT)/../../../React/**", 305 | "$(SRCROOT)/../../react-native/React/**", 306 | "$(SRCROOT)/../../react-native/Libraries/**", 307 | "$(SRCROOT)/../../../node_modules/react-native/React/**", 308 | "$(SRCROOT)/../../../node_modules/react-native/Libraries/**", 309 | ); 310 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 311 | OTHER_LDFLAGS = "-ObjC"; 312 | PRODUCT_NAME = RNTextGradient; 313 | SKIP_INSTALL = YES; 314 | }; 315 | name = Debug; 316 | }; 317 | 58B511F11A9E6C8500147676 /* Release */ = { 318 | isa = XCBuildConfiguration; 319 | buildSettings = { 320 | HEADER_SEARCH_PATHS = ( 321 | "$(inherited)", 322 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 323 | "$(SRCROOT)/../../../React/**", 324 | "$(SRCROOT)/../../react-native/React/**", 325 | "$(SRCROOT)/../../react-native/Libraries/**", 326 | "$(SRCROOT)/../../../node_modules/react-native/React/**", 327 | "$(SRCROOT)/../../../node_modules/react-native/Libraries/**", 328 | ); 329 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 330 | OTHER_LDFLAGS = "-ObjC"; 331 | PRODUCT_NAME = RNTextGradient; 332 | SKIP_INSTALL = YES; 333 | }; 334 | name = Release; 335 | }; 336 | /* End XCBuildConfiguration section */ 337 | 338 | /* Begin XCConfigurationList section */ 339 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNTextGradient" */ = { 340 | isa = XCConfigurationList; 341 | buildConfigurations = ( 342 | 58B511ED1A9E6C8500147676 /* Debug */, 343 | 58B511EE1A9E6C8500147676 /* Release */, 344 | ); 345 | defaultConfigurationIsVisible = 0; 346 | defaultConfigurationName = Release; 347 | }; 348 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNTextGradient" */ = { 349 | isa = XCConfigurationList; 350 | buildConfigurations = ( 351 | 58B511F01A9E6C8500147676 /* Debug */, 352 | 58B511F11A9E6C8500147676 /* Release */, 353 | ); 354 | defaultConfigurationIsVisible = 0; 355 | defaultConfigurationName = Release; 356 | }; 357 | /* End XCConfigurationList section */ 358 | }; 359 | rootObject = 58B511D31A9E6C8500147676 /* Project object */; 360 | } 361 | -------------------------------------------------------------------------------- /ios/RNTextGradientShadowView.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "RCTTextShadowView.h" 3 | #import "RNTextGradientShadowViewDelegate.h" 4 | 5 | NS_ASSUME_NONNULL_BEGIN 6 | 7 | @interface RNTextGradientShadowView : RCTTextShadowView 8 | 9 | @property (nonatomic, copy) NSArray *locations; 10 | @property (nonatomic, copy) NSArray *colors; 11 | @property (nonatomic, assign) BOOL useViewFrame; 12 | @property (nonatomic, assign) BOOL useGlobalCache; 13 | 14 | @property (nonatomic, copy) NSDictionary* previousComparisonKey; 15 | 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | 20 | -------------------------------------------------------------------------------- /ios/RNTextGradientShadowView.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "RCTRawTextShadowView.h" 4 | #import "RCTTextShadowView.h" 5 | #import "RNTextGradientView.h" 6 | #import "RNTextGradientValue.h" 7 | #import "RNTextGradientShadowView.h" 8 | #import "RNTextGradientUtils.h" 9 | 10 | @interface RCTTextShadowView () 11 | { 12 | @protected 13 | __weak RCTBridge *_bridge; 14 | } 15 | 16 | - (UIEdgeInsets)paddingAsInsets; 17 | 18 | @end 19 | 20 | @implementation RNTextGradientShadowView 21 | 22 | - (UIColor *)gradientWithFrame:(CGRect)frame 23 | { 24 | MUST_BE_OVERRIDEN() 25 | } 26 | 27 | - (NSDictionary *)gradientComparisonKey:(CGRect)frame 28 | { 29 | MUST_BE_OVERRIDEN() 30 | } 31 | 32 | - (UIColor *)calculateGradient:(CGRect)frame 33 | { 34 | static NSMutableDictionary *patternCache; 35 | 36 | return [RNTextGradientUtils calculateGradient:frame shadowView:self patternCache:patternCache]; 37 | } 38 | 39 | - (void)setColors:(NSArray *)colors 40 | { 41 | _colors = [RNTextGradientUtils convertColors:colors]; 42 | } 43 | 44 | - (void)uiManagerWillPerformMounting 45 | { 46 | if (YGNodeIsDirty(self.yogaNode)) { 47 | return; 48 | } 49 | 50 | [super uiManagerWillPerformMounting]; 51 | 52 | [_bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { 53 | RNTextGradientView *view = (RNTextGradientView *)viewRegistry[self.reactTag]; 54 | 55 | if (view && ![self.superview isKindOfClass:[RNTextGradientShadowView class]]) { 56 | view.colors = [RNTextGradientShadowView extractColorsForSubviews:self]; 57 | } 58 | }]; 59 | 60 | } 61 | 62 | + (NSArray *)extractColorsForSubviews:(RCTShadowView *)view 63 | { 64 | NSMutableArray *colors = [NSMutableArray new]; 65 | 66 | int (^__block iter)(RCTShadowView *, int) = ^(RCTShadowView *view, int textIndex) { 67 | if ([view isKindOfClass:[RCTRawTextShadowView class]]) { 68 | BOOL parentIsGradient = [RNTextGradientUtils isTextGradientShadowView:view.superview]; 69 | NSString *text = ((RCTRawTextShadowView *)view).text; 70 | 71 | if (parentIsGradient) { 72 | RNTextGradientBlock colorForFrame = ^(CGRect textFrame) { 73 | return ((RCTBaseTextShadowView *)view.superview).textAttributes.foregroundColor; 74 | }; 75 | 76 | [colors addObject:[[RNTextGradientValue alloc] initWithRange:NSMakeRange(textIndex, text.length) 77 | isRawText:YES 78 | colorForFrame:colorForFrame]]; 79 | } 80 | 81 | return (int)(textIndex + text.length); 82 | 83 | } else if ([view isKindOfClass:[RCTBaseTextShadowView class]]) { 84 | int nextTextIndex = textIndex; 85 | 86 | if ([RNTextGradientUtils isTextGradientShadowView:view]) { 87 | RCTBaseTextShadowView *gradientView = 88 | (RCTBaseTextShadowView *)view; 89 | NSRange range = NSMakeRange(textIndex, [RNTextGradientShadowView textLength:gradientView]); 90 | RNTextGradientBlock colorForFrame = ^(CGRect textFrame) { 91 | CGRect actualFrame; 92 | 93 | if ([gradientView useViewFrame]) { 94 | CGRect viewFrame = gradientView.layoutMetrics.frame; 95 | actualFrame = CGRectMake(0, 0, viewFrame.size.width, viewFrame.size.height); 96 | 97 | } else { 98 | UIEdgeInsets insets = [gradientView paddingAsInsets]; 99 | RCTShadowView *parent = [gradientView reactSuperview]; 100 | 101 | while ([RNTextGradientUtils isTextGradientShadowView:parent]) { 102 | insets = [(RCTBaseTextShadowView *)parent paddingAsInsets]; 103 | parent = [parent reactSuperview]; 104 | } 105 | 106 | actualFrame = CGRectMake(textFrame.origin.x + insets.left, 107 | textFrame.origin.y + insets.top, 108 | textFrame.size.width, 109 | textFrame.size.height); 110 | } 111 | 112 | NSDictionary *comparisonKey = [gradientView gradientComparisonKey:actualFrame]; 113 | 114 | if (![comparisonKey isEqualToDictionary: gradientView.previousComparisonKey]) { 115 | gradientView.previousComparisonKey = comparisonKey; 116 | gradientView.textAttributes.foregroundColor = [gradientView calculateGradient:actualFrame]; 117 | } 118 | 119 | return gradientView.textAttributes.foregroundColor; 120 | }; 121 | 122 | [colors addObject:[[RNTextGradientValue alloc] initWithRange:range 123 | isRawText:NO 124 | colorForFrame:colorForFrame]]; 125 | } 126 | 127 | for (RCTShadowView *subview in view.reactSubviews) { 128 | nextTextIndex = iter(subview, nextTextIndex); 129 | } 130 | 131 | return nextTextIndex; 132 | } 133 | 134 | return textIndex; 135 | }; 136 | 137 | iter(view, 0); 138 | 139 | return colors; 140 | } 141 | 142 | + (int)textLength:(RCTBaseTextShadowView *)view 143 | { 144 | int length = 0; 145 | 146 | for (RCTShadowView *subview in view.reactSubviews) { 147 | if ([subview isKindOfClass:[RCTRawTextShadowView class]]) { 148 | length += ((RCTRawTextShadowView *)subview).text.length; 149 | 150 | } else if ([subview isKindOfClass:[RCTBaseTextShadowView class]]) { 151 | length += [RNTextGradientShadowView textLength:(RCTBaseTextShadowView *)subview]; 152 | } 153 | } 154 | 155 | return length; 156 | } 157 | 158 | @end 159 | -------------------------------------------------------------------------------- /ios/RNTextGradientShadowViewDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #ifndef RNTextGradientShadowViewDelegate_h 4 | #define RNTextGradientShadowViewDelegate_h 5 | 6 | @protocol RNTextGradientShadowViewDelegate 7 | 8 | @property (nonatomic, copy) NSDictionary* previousComparisonKey; 9 | 10 | - (BOOL) useGlobalCache; 11 | - (NSArray *)colors; 12 | - (NSArray *)locations; 13 | - (BOOL)useViewFrame; 14 | - (UIEdgeInsets)paddingAsInsets; 15 | - (UIColor *)calculateGradient:(CGRect)frame; 16 | - (UIColor *)gradientWithFrame:(CGRect)frame; 17 | - (NSDictionary *)gradientComparisonKey:(CGRect)frame; 18 | 19 | @end 20 | 21 | #endif /* RNTextGradientShadowViewDelegate_h */ 22 | -------------------------------------------------------------------------------- /ios/RNTextGradientUtils.h: -------------------------------------------------------------------------------- 1 | #import "RNTextGradientShadowViewDelegate.h" 2 | #import "RCTBaseTextShadowView.h" 3 | 4 | @interface RNTextGradientUtils : NSObject 5 | 6 | + (UIColor *)calculateGradient:(CGRect)frame 7 | shadowView:(RCTBaseTextShadowView *)shadowView 8 | patternCache:(NSMutableDictionary *)patternCache; 9 | 10 | + (NSArray *)convertColors:(NSArray *)colors; 11 | 12 | + (BOOL)isTextGradientShadowView:(RCTShadowView *)shadowView; 13 | 14 | @end 15 | 16 | #define MUST_BE_OVERRIDEN() \ 17 | NSString *reason = [NSString stringWithFormat:@"Method %@ must be overriden in %@ class", NSStringFromSelector(_cmd), NSStringFromClass([self class])]; \ 18 | @throw [NSException exceptionWithName:NSInternalInconsistencyException reason:reason userInfo:nil]; 19 | -------------------------------------------------------------------------------- /ios/RNTextGradientUtils.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "RNTextGradientUtils.h" 3 | #import "RNTextGradientShadowView.h" 4 | #import "RNVirtualTextGradientShadowView.h" 5 | 6 | @implementation RNTextGradientUtils 7 | 8 | + (UIColor *)calculateGradient:(CGRect)frame 9 | shadowView:(RCTBaseTextShadowView *)shadowView 10 | patternCache:(NSMutableDictionary *)patternCache 11 | { 12 | UIColor *color = shadowView.textAttributes.foregroundColor ?: [UIColor blackColor]; 13 | NSArray *locations = [shadowView locations]; 14 | NSArray *colors = [shadowView colors]; 15 | BOOL hasGradient = colors && locations && colors.count == locations.count; 16 | 17 | if (hasGradient) { 18 | if ([shadowView useGlobalCache]) { 19 | NSString *className = NSStringFromClass([shadowView class]); 20 | patternCache = patternCache ?: [NSMutableDictionary new]; 21 | patternCache[className] = patternCache[className] ?: [NSMutableDictionary new]; 22 | NSMutableDictionary *cache = patternCache[className]; 23 | NSDictionary *comparisonKey = [shadowView gradientComparisonKey:frame]; 24 | 25 | color = cache[comparisonKey] ?: [shadowView gradientWithFrame:frame]; 26 | cache[comparisonKey] = color; 27 | 28 | } else { 29 | color = [shadowView gradientWithFrame:frame]; 30 | } 31 | } 32 | 33 | return color; 34 | } 35 | 36 | + (NSArray *)convertColors:(NSArray *)colors 37 | { 38 | NSMutableArray *gradientColors = [NSMutableArray arrayWithCapacity:colors.count]; 39 | 40 | for (NSString *color in colors) { 41 | [gradientColors addObject:[RCTConvert UIColor:color]]; 42 | } 43 | 44 | return gradientColors; 45 | } 46 | 47 | + (BOOL)isTextGradientShadowView:(RCTShadowView *)shadowView 48 | { 49 | return [shadowView isKindOfClass:[RNTextGradientShadowView class]] || 50 | [shadowView isKindOfClass:[RNVirtualTextGradientShadowView class]]; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /ios/RNTextGradientValue.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | typedef UIColor *(^RNTextGradientBlock)(CGRect frame); 4 | 5 | @interface RNTextGradientValue : NSObject 6 | 7 | @property (nonatomic, assign) NSRange range; 8 | @property (nonatomic, assign) BOOL isRawText; 9 | @property (nonatomic, copy) RNTextGradientBlock colorForFrame; 10 | 11 | - (instancetype)initWithRange:(NSRange)range 12 | isRawText:(BOOL)isRawText 13 | colorForFrame:(RNTextGradientBlock)colorForFrame; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /ios/RNTextGradientValue.m: -------------------------------------------------------------------------------- 1 | #import "RNTextGradientValue.h" 2 | 3 | @implementation RNTextGradientValue 4 | 5 | - (instancetype)initWithRange:(NSRange)range 6 | isRawText:(BOOL)isRawText 7 | colorForFrame:(RNTextGradientBlock)colorForFrame 8 | { 9 | if ((self = [super init])) { 10 | self.range = range; 11 | self.isRawText = isRawText; 12 | self.colorForFrame = colorForFrame; 13 | } 14 | 15 | return self; 16 | } 17 | 18 | @end 19 | 20 | -------------------------------------------------------------------------------- /ios/RNTextGradientView.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "RCTTextView.h" 3 | #import "RNTextGradientValue.h" 4 | 5 | NS_ASSUME_NONNULL_BEGIN 6 | 7 | @interface RNTextGradientView : RCTTextView 8 | 9 | @property (nonatomic, strong) NSArray *colors; 10 | 11 | @end 12 | 13 | NS_ASSUME_NONNULL_END 14 | 15 | -------------------------------------------------------------------------------- /ios/RNTextGradientView.m: -------------------------------------------------------------------------------- 1 | #import "RNTextGradientView.h" 2 | 3 | @interface RCTTextView () 4 | { 5 | @protected 6 | NSTextStorage *_Nullable _textStorage; 7 | } 8 | @end 9 | 10 | @implementation RNTextGradientView 11 | 12 | - (instancetype)initWithFrame:(CGRect)frame 13 | { 14 | if ((self = [super initWithFrame:frame])) { 15 | self.colors = [NSMutableArray new]; 16 | } 17 | return self; 18 | } 19 | 20 | - (void)drawRect:(CGRect)rect { 21 | NSLayoutManager *layoutManager = [_textStorage.layoutManagers firstObject]; 22 | NSTextContainer *textContainer = [layoutManager.textContainers firstObject]; 23 | 24 | for (RNTextGradientValue *gradient in self.colors) { 25 | CGRect frame = [layoutManager boundingRectForGlyphRange:gradient.range 26 | inTextContainer:textContainer]; 27 | UIColor* color = gradient.colorForFrame(frame); 28 | 29 | if (gradient.isRawText) { 30 | [_textStorage addAttribute:NSForegroundColorAttributeName 31 | value:color 32 | range:gradient.range]; 33 | } 34 | } 35 | 36 | [super drawRect:rect]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /ios/RNTextGradientViewManager.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "RCTTextViewManager.h" 4 | 5 | @interface RNTextGradientViewManager : RCTTextViewManager 6 | 7 | @end 8 | 9 | -------------------------------------------------------------------------------- /ios/RNTextGradientViewManager.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "RNTextGradientView.h" 3 | #import "RNTextGradientShadowView.h" 4 | #import "RNTextGradientViewManager.h" 5 | #import "RNTextGradientUtils.h" 6 | 7 | @interface RCTTextViewManager () 8 | { 9 | @protected 10 | NSHashTable *_shadowViews; 11 | } 12 | 13 | @end 14 | 15 | @implementation RNTextGradientViewManager 16 | 17 | - (RNTextGradientView *)view 18 | { 19 | return [RNTextGradientView new]; 20 | } 21 | 22 | - (RNTextGradientShadowView *)shadowView 23 | { 24 | RNTextGradientShadowView *shadowView = [self createShadowView]; 25 | shadowView.textAttributes.fontSizeMultiplier = self.bridge.accessibilityManager.multiplier; 26 | [_shadowViews addObject:shadowView]; 27 | return shadowView; 28 | } 29 | 30 | - (RNTextGradientShadowView *)createShadowView 31 | { 32 | MUST_BE_OVERRIDEN() 33 | } 34 | 35 | RCT_EXPORT_SHADOW_PROPERTY(colors, NSArray); 36 | RCT_EXPORT_SHADOW_PROPERTY(locations, NSArray); 37 | RCT_EXPORT_SHADOW_PROPERTY(useViewFrame, BOOL); 38 | RCT_EXPORT_SHADOW_PROPERTY(useGlobalCache, BOOL); 39 | 40 | @end 41 | 42 | -------------------------------------------------------------------------------- /ios/RNVirtualLinearTextGradientShadowView.h: -------------------------------------------------------------------------------- 1 | #import "RNLinearTextGradientShadowViewDelegate.h" 2 | #import "RNVirtualTextGradientShadowView.h" 3 | 4 | @interface RNVirtualLinearTextGradientShadowView : RNVirtualTextGradientShadowView 5 | 6 | @property (nonatomic, assign) CGPoint gradientStart; 7 | @property (nonatomic, assign) CGPoint gradientEnd; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /ios/RNVirtualLinearTextGradientShadowView.m: -------------------------------------------------------------------------------- 1 | #import "RNLinearGradientUtils.h" 2 | #import "RNVirtualLinearTextGradientShadowView.h" 3 | 4 | @implementation RNVirtualLinearTextGradientShadowView 5 | 6 | - (UIColor *)gradientWithFrame:(CGRect)frame 7 | { 8 | return [RNLinearGradientUtils gradientWithFrame:frame shadowView:self]; 9 | } 10 | 11 | - (NSDictionary *)gradientComparisonKey:(CGRect)frame 12 | { 13 | return [RNLinearGradientUtils gradientComparisonKey:frame shadowView:self]; 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ios/RNVirtualLinearTextGradientViewManager.h: -------------------------------------------------------------------------------- 1 | #import "RNVirtualTextGradientViewManager.h" 2 | 3 | @interface RNVirtualLinearTextGradientViewManager : RNVirtualTextGradientViewManager 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /ios/RNVirtualLinearTextGradientViewManager.m: -------------------------------------------------------------------------------- 1 | #import "RNVirtualLinearTextGradientShadowView.h" 2 | #import "RNVirtualLinearTextGradientViewManager.h" 3 | 4 | @implementation RNVirtualLinearTextGradientViewManager 5 | 6 | - (RCTShadowView *)shadowView 7 | { 8 | return [RNVirtualLinearTextGradientShadowView new]; 9 | } 10 | 11 | RCT_EXPORT_MODULE(RNVirtualLinearTextGradient) 12 | 13 | RCT_EXPORT_SHADOW_PROPERTY(gradientStart, CGPoint); 14 | RCT_EXPORT_SHADOW_PROPERTY(gradientEnd, CGPoint); 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ios/RNVirtualTextGradientShadowView.h: -------------------------------------------------------------------------------- 1 | #import "RCTVirtualTextShadowView.h" 2 | #import "RNTextGradientShadowViewDelegate.h" 3 | 4 | @interface RNVirtualTextGradientShadowView : RCTVirtualTextShadowView 5 | 6 | @property (nonatomic, copy) NSArray *locations; 7 | @property (nonatomic, copy) NSArray *colors; 8 | @property (nonatomic, assign) BOOL useGlobalCache; 9 | 10 | @property (nonatomic, copy) NSDictionary* previousComparisonKey; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /ios/RNVirtualTextGradientShadowView.m: -------------------------------------------------------------------------------- 1 | #import "RNTextGradientUtils.h" 2 | #import "RNVirtualTextGradientShadowView.h" 3 | 4 | @implementation RNVirtualTextGradientShadowView 5 | 6 | - (UIColor *)gradientWithFrame:(CGRect)frame 7 | { 8 | MUST_BE_OVERRIDEN() 9 | } 10 | 11 | - (NSDictionary *)gradientComparisonKey:(CGRect)frame 12 | { 13 | MUST_BE_OVERRIDEN() 14 | } 15 | 16 | - (UIColor *)calculateGradient:(CGRect)frame 17 | { 18 | static NSMutableDictionary *patternCache; 19 | 20 | return [RNTextGradientUtils calculateGradient:frame shadowView:self patternCache:patternCache]; 21 | } 22 | 23 | - (void)setColors:(NSArray *)colors 24 | { 25 | _colors = [RNTextGradientUtils convertColors:colors]; 26 | } 27 | 28 | - (BOOL)useViewFrame 29 | { 30 | return false; 31 | } 32 | 33 | - (UIEdgeInsets)paddingAsInsets 34 | { 35 | return (UIEdgeInsets){ 0.0f, 0.0f, 0.0f, 0.0f }; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /ios/RNVirtualTextGradientViewManager.h: -------------------------------------------------------------------------------- 1 | #import "RCTVirtualTextViewManager.h" 2 | 3 | @interface RNVirtualTextGradientViewManager : RCTVirtualTextViewManager 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /ios/RNVirtualTextGradientViewManager.m: -------------------------------------------------------------------------------- 1 | #import "RNVirtualTextGradientShadowView.h" 2 | #import "RNVirtualTextGradientViewManager.h" 3 | #import "RNTextGradientUtils.h" 4 | 5 | @implementation RNVirtualTextGradientViewManager 6 | 7 | - (RCTShadowView *)shadowView 8 | { 9 | MUST_BE_OVERRIDEN() 10 | } 11 | 12 | RCT_EXPORT_SHADOW_PROPERTY(colors, NSArray); 13 | RCT_EXPORT_SHADOW_PROPERTY(locations, NSArray); 14 | RCT_EXPORT_SHADOW_PROPERTY(useGlobalCache, BOOL); 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /manual_installation.md: -------------------------------------------------------------------------------- 1 | ### Manual installation 2 | 3 | #### iOS 4 | 5 | ##### With Cocoapods 6 | 7 | 1. Open your Podfile in (usually in `[your project's name]` ➜ `ios` ➜ `Podfile`) 8 | 2. Append the following lines to your `Podfile`: 9 | ``` 10 | pod 'RNTextGradientView', 11 | :path => "../node_modules/react-native-text-gradient/RNTextGradientView.podspec" 12 | ``` 13 | 3. Go to `[your project's name]` ➜ `ios` and run the following: 14 | ``` 15 | pod install 16 | ``` 17 | 4. Run your project (`Cmd+R`)< 18 | 19 | ##### Without Cocoapods 20 | 21 | 1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]` 22 | 2. Go to `node_modules` ➜ `react-native-text-gradient` and add `RNTextGradient.xcodeproj` 23 | 3. In XCode, in the project navigator, select your project. Add `libRNTextGradient.a` to your project's `Build Phases` ➜ `Link Binary With Libraries` 24 | 4. Run your project (`Cmd+R`)< 25 | 26 | #### Android 27 | 28 | 1. Open up `android/app/src/main/java/[...]/MainApplication.java` 29 | 30 | - Add `import iyegoroff.RNTextGradient.RNTextGradientPackage;` to the imports at the top of the file 31 | - Add `new RNTextGradientPackage()` to the list returned by the `getPackages()` method 32 | 33 | 2. Append the following lines to `android/settings.gradle`: 34 | ``` 35 | include ':react-native-text-gradient' 36 | project(':react-native-text-gradient').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-text-gradient/android') 37 | ``` 38 | 3. Insert the following lines inside the dependencies block in `android/app/build.gradle`: 39 | ``` 40 | compile project(':react-native-text-gradient') 41 | ``` 42 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-text-gradient", 3 | "version": "0.1.7", 4 | "description": "Text gradient for React-Native", 5 | "main": "src/index.js", 6 | "types": "src/index.d.ts", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1", 9 | "postversion": "git push && git push --tags && npm publish" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/iyegoroff/react-native-text-gradient.git" 14 | }, 15 | "keywords": [ 16 | "react-native", 17 | "text-gradients" 18 | ], 19 | "author": "iyegoroff ", 20 | "license": "MIT", 21 | "bugs": { 22 | "url": "https://github.com/iyegoroff/react-native-text-gradient/issues" 23 | }, 24 | "homepage": "https://github.com/iyegoroff/react-native-text-gradient#readme", 25 | "peerDependencies": { 26 | "react": "*", 27 | "react-native": "*", 28 | "fbjs": "*", 29 | "@babel/runtime": "*" 30 | }, 31 | "files": [ 32 | "android", 33 | "TextGradientExample", 34 | "ios", 35 | "src", 36 | "img", 37 | ".dockerignore", 38 | "*.md", 39 | "*.podspec", 40 | "patch-rn.js" 41 | ] 42 | } 43 | -------------------------------------------------------------------------------- /patch-rn.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const { writeFile, readFile, readdir } = require('fs'); 4 | const { promisify } = require('util'); 5 | const path = require('path'); 6 | 7 | const folder = 'node_modules/react-native/Libraries/Renderer/oss/'; 8 | 9 | const pattern = new RegExp( 10 | 'invariant\\([\\s\\S]{0,20}' + 11 | '(hostContext|type)\\.isInAParentText,[\\s\\S]{0,20}' + 12 | '"Text strings must be rendered within a component\\."[\\s\\S]{0,20}' + 13 | '\\)[;,]' 14 | ); 15 | 16 | const patchFile = async (file) => { 17 | const content = (await promisify(readFile)(file)).toString(); 18 | const patched = content.replace(pattern, ''); 19 | 20 | await promisify(writeFile)(file, patched); 21 | }; 22 | 23 | const patchAll = async () => { 24 | const files = await promisify(readdir)(folder); 25 | 26 | await Promise.all(files.map(file => path.join(folder, file)).map(patchFile)); 27 | }; 28 | 29 | patchAll(); 30 | -------------------------------------------------------------------------------- /src/create-text-gradient-class.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule TextGradient 3 | * @flow 4 | */ 5 | 'use strict'; 6 | 7 | import * as React from 'react'; 8 | import ReactNativeViewAttributes from 'react-native/Libraries/Components/View/ReactNativeViewAttributes'; 9 | import TextAncestor from 'react-native/Libraries/Text/TextAncestor'; 10 | 11 | import createReactNativeComponentClass from 'react-native/Libraries/Renderer/shims/createReactNativeComponentClass'; 12 | import nullthrows from 'fbjs/lib/nullthrows'; 13 | import { Touchable, processColor, UIManager } from 'react-native'; 14 | 15 | const PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30}; 16 | 17 | const createTextGradientClass = ( 18 | uiViewClassName, 19 | uiVirtualViewClassName, 20 | defProps, 21 | convertProps 22 | ) => { 23 | const defaultPropAttributes = Object.keys(defProps) 24 | .reduce((acc, key) => { acc[key] = true; return acc; }, {}); 25 | 26 | const viewConfig = { 27 | validAttributes: { 28 | ...ReactNativeViewAttributes.UIView, 29 | isHighlighted: true, 30 | numberOfLines: true, 31 | ellipsizeMode: true, 32 | allowFontScaling: true, 33 | maxFontSizeMultiplier: true, 34 | disabled: true, 35 | selectable: true, 36 | selectionColor: true, 37 | adjustsFontSizeToFit: true, 38 | minimumFontScale: true, 39 | textBreakStrategy: true, 40 | onTextLayout: true, 41 | colors: true, 42 | locations: true, 43 | useViewFrame: true, 44 | useGlobalCache: true, 45 | ...defaultPropAttributes 46 | }, 47 | directEventTypes: { 48 | topTextLayout: { 49 | registrationName: 'onTextLayout', 50 | }, 51 | }, 52 | uiViewClassName, 53 | }; 54 | 55 | class TouchableTextGradient extends React.Component { 56 | static defaultProps = { 57 | accessible: true, 58 | allowFontScaling: true, 59 | ellipsizeMode: 'tail', 60 | }; 61 | 62 | state = { 63 | ...Touchable.Mixin.touchableGetInitialState(), 64 | isHighlighted: false, 65 | createResponderHandlers: this._createResponseHandlers.bind(this), 66 | responseHandlers: null, 67 | }; 68 | 69 | static getDerivedStateFromProps(nextProps, prevState) { 70 | return prevState.responseHandlers == null && isTouchable(nextProps) 71 | ? { 72 | responseHandlers: prevState.createResponderHandlers(), 73 | } 74 | : null; 75 | } 76 | 77 | static canRenderString = true; 78 | static viewConfig = viewConfig; 79 | 80 | render() { 81 | let props = convertProps({ 82 | ...defProps, 83 | ...this.props, 84 | }); 85 | 86 | if (isTouchable(props)) { 87 | props = { 88 | ...props, 89 | ...this.state.responseHandlers, 90 | isHighlighted: this.state.isHighlighted, 91 | }; 92 | } 93 | 94 | props = { 95 | ...props, 96 | style: [{ color: 'gray' }, props.style], 97 | }; 98 | 99 | if (props.selectionColor != null) { 100 | props = { 101 | ...props, 102 | selectionColor: processColor(props.selectionColor), 103 | }; 104 | } 105 | 106 | if (props.colors != null) { 107 | props = { 108 | ...props, 109 | colors: props.colors.map(processColor) 110 | }; 111 | } 112 | 113 | if (__DEV__) { 114 | if (Touchable.TOUCH_TARGET_DEBUG && props.onPress != null) { 115 | props = { 116 | ...props, 117 | style: [props.style, {color: 'magenta'}], 118 | }; 119 | } 120 | } 121 | 122 | return ( 123 | 124 | {hasTextAncestor => 125 | hasTextAncestor ? ( 126 | 127 | ) : ( 128 | 129 | 130 | 131 | ) 132 | } 133 | 134 | ); 135 | } 136 | 137 | _createResponseHandlers() { 138 | return { 139 | onStartShouldSetResponder: () => { 140 | const {onStartShouldSetResponder} = this.props; 141 | const shouldSetResponder = 142 | (onStartShouldSetResponder == null 143 | ? false 144 | : onStartShouldSetResponder()) || isTouchable(this.props); 145 | 146 | if (shouldSetResponder) { 147 | this._attachTouchHandlers(); 148 | } 149 | return shouldSetResponder; 150 | }, 151 | onResponderGrant: (event, dispatchID) => { 152 | nullthrows(this.touchableHandleResponderGrant)(event, dispatchID); 153 | if (this.props.onResponderGrant != null) { 154 | this.props.onResponderGrant.call(this, event, dispatchID); 155 | } 156 | }, 157 | onResponderMove: (event) => { 158 | nullthrows(this.touchableHandleResponderMove)(event); 159 | if (this.props.onResponderMove != null) { 160 | this.props.onResponderMove.call(this, event); 161 | } 162 | }, 163 | onResponderRelease: (event) => { 164 | nullthrows(this.touchableHandleResponderRelease)(event); 165 | if (this.props.onResponderRelease != null) { 166 | this.props.onResponderRelease.call(this, event); 167 | } 168 | }, 169 | onResponderTerminate: (event) => { 170 | nullthrows(this.touchableHandleResponderTerminate)(event); 171 | if (this.props.onResponderTerminate != null) { 172 | this.props.onResponderTerminate.call(this, event); 173 | } 174 | }, 175 | onResponderTerminationRequest: () => { 176 | const {onResponderTerminationRequest} = this.props; 177 | if (!nullthrows(this.touchableHandleResponderTerminationRequest)()) { 178 | return false; 179 | } 180 | if (onResponderTerminationRequest == null) { 181 | return true; 182 | } 183 | return onResponderTerminationRequest(); 184 | }, 185 | }; 186 | } 187 | 188 | /** 189 | * Lazily attaches Touchable.Mixin handlers. 190 | */ 191 | _attachTouchHandlers() { 192 | if (this.touchableGetPressRectOffset != null) { 193 | return; 194 | } 195 | for (const key in Touchable.Mixin) { 196 | if (typeof Touchable.Mixin[key] === 'function') { 197 | (this)[key] = Touchable.Mixin[key].bind(this); 198 | } 199 | } 200 | this.touchableHandleActivePressIn = () => { 201 | if (!this.props.suppressHighlighting && isTouchable(this.props)) { 202 | this.setState({isHighlighted: true}); 203 | } 204 | }; 205 | this.touchableHandleActivePressOut = () => { 206 | if (!this.props.suppressHighlighting && isTouchable(this.props)) { 207 | this.setState({isHighlighted: false}); 208 | } 209 | }; 210 | this.touchableHandlePress = (event) => { 211 | if (this.props.onPress != null) { 212 | this.props.onPress(event); 213 | } 214 | }; 215 | this.touchableHandleLongPress = (event) => { 216 | if (this.props.onLongPress != null) { 217 | this.props.onLongPress(event); 218 | } 219 | }; 220 | this.touchableGetPressRectOffset = () => 221 | this.props.pressRetentionOffset == null 222 | ? PRESS_RECT_OFFSET 223 | : this.props.pressRetentionOffset; 224 | } 225 | } 226 | 227 | const isTouchable = (props) => 228 | props.onPress != null || 229 | props.onLongPress != null || 230 | props.onStartShouldSetResponder != null; 231 | 232 | const RNTextGradient = createReactNativeComponentClass( 233 | uiViewClassName, 234 | () => viewConfig, 235 | ); 236 | 237 | const RNVirtualTextGradient = 238 | UIManager.getViewManagerConfig(uiVirtualViewClassName) == null 239 | ? RNTextGradient 240 | : createReactNativeComponentClass(uiVirtualViewClassName, () => ({ 241 | validAttributes: { 242 | ...ReactNativeViewAttributes.UIView, 243 | isHighlighted: true, 244 | maxFontSizeMultiplier: true, 245 | colors: true, 246 | locations: true, 247 | useGlobalCache: true, 248 | ...defaultPropAttributes 249 | }, 250 | uiViewClassName: uiVirtualViewClassName, 251 | })); 252 | 253 | // $FlowFixMe - TODO T29156721 `React.forwardRef` is not defined in Flow, yet. 254 | const TextGradient = React.forwardRef((props, ref) => ( 255 | 256 | )); 257 | TextGradient.displayName = uiVirtualViewClassName; 258 | 259 | return TextGradient; 260 | }; 261 | 262 | module.exports = createTextGradientClass; 263 | -------------------------------------------------------------------------------- /src/index.d.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import * as ReactNative from 'react-native'; 3 | 4 | export interface LinearTextGradientProps extends ReactNative.TextProperties { 5 | readonly start?: {x: number; y: number}; 6 | readonly end?: {x: number; y: number}; 7 | readonly locations?: number[]; 8 | readonly colors: string[]; 9 | readonly useViewFrame?: boolean; 10 | readonly useGlobalCache?: boolean; 11 | } 12 | 13 | export class LinearTextGradient extends React.Component { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import LinearTextGradient from './linear-text-gradient'; 2 | 3 | module.exports = { 4 | LinearTextGradient 5 | }; 6 | -------------------------------------------------------------------------------- /src/linear-text-gradient.js: -------------------------------------------------------------------------------- 1 | import { Platform } from 'react-native'; 2 | import createTextGradientClass from './create-text-gradient-class'; 3 | 4 | export default createTextGradientClass( 5 | 'RNLinearTextGradient', 6 | 'RNVirtualLinearTextGradient', 7 | { 8 | gradientStart: { x: 0, y: 0 }, 9 | gradientEnd: { x: 1, y: 0 } 10 | }, 11 | ({ start, end, gradientStart, gradientEnd, ...props }) => { 12 | start = start || gradientStart; 13 | end = end || gradientEnd; 14 | 15 | const isAndroid = Platform.OS === 'android'; 16 | 17 | return { 18 | ...props, 19 | gradientStart: isAndroid ? [start.x, start.y] : start, 20 | gradientEnd: isAndroid ? [end.x, end.y] : end 21 | } 22 | } 23 | ); 24 | --------------------------------------------------------------------------------