├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── ReactNativeAutogrowTextinput.podspec ├── android ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── wix │ │ └── autogrowtextinput │ │ ├── AutoGrowTextInputModule.java │ │ └── AutoGrowTextInputPackage.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 │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── example ├── .babelrc ├── .buckconfig ├── .flowconfig ├── .gitattributes ├── .gitignore ├── .watchmanconfig ├── android │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── build_defs.bzl │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── autogrowtextinput │ │ │ │ ├── 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 │ └── settings.gradle ├── app.js ├── app.json ├── index.android.js ├── index.ios.js ├── ios │ ├── AutogrowTextinput-tvOS │ │ └── Info.plist │ ├── AutogrowTextinput-tvOSTests │ │ └── Info.plist │ ├── AutogrowTextinput.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── AutogrowTextinput-tvOS.xcscheme │ │ │ └── AutogrowTextinput.xcscheme │ ├── AutogrowTextinput.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── AutogrowTextinput │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ ├── AutogrowTextinputTests │ │ ├── AutogrowTextinputTests.m │ │ └── Info.plist │ ├── Podfile │ └── Podfile.lock ├── package-lock.json └── package.json ├── index.js ├── ios ├── AutoGrowTextInput.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── AutogrowTextInputManager.h └── AutogrowTextInputManager.m ├── package.json └── src └── AutoGrowingTextInput.js /.gitignore: -------------------------------------------------------------------------------- 1 | npm-debug.log 2 | 3 | ######################### 4 | # .gitignore file for Xcode5 5 | # 6 | # NB: if you are storing "built" products, this WILL NOT WORK, 7 | # and you should use a different .gitignore (or none at all) 8 | # This file is for SOURCE projects, where there are many extra 9 | # files that we want to exclude 10 | # 11 | # For updates, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects 12 | # and https://gist.github.com/adamgit/3786883 13 | ######################### 14 | 15 | ##### 16 | # OS X temporary files that should never be committed 17 | 18 | .DS_Store 19 | *.swp 20 | *.lock 21 | profile 22 | # cocoapods specific exclusions 23 | !Podfile.lock 24 | !Manifest.lock 25 | 26 | #### Code coverage 27 | # json file which is used by Xcode plugin called PuncoverPlugin to show code coverrage informtaion in the Xcode gutter 28 | # it is generated using Slather 29 | .gutter.json 30 | 31 | #### 32 | # Xcode temporary files that should never be committed 33 | # 34 | # NB: NIB/XIB files still exist even on Storyboard projects, so we want this... 35 | 36 | *~.nib 37 | 38 | 39 | #### 40 | # Xcode build files - 41 | # 42 | # NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "DerivedData" 43 | 44 | DerivedData/ 45 | 46 | # NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "build" 47 | 48 | build/ 49 | 50 | 51 | ##### 52 | # Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups) 53 | # 54 | # This is complicated: 55 | # 56 | # SOMETIMES you need to put this file in version control. 57 | # Apple designed it poorly - if you use "custom executables", they are 58 | # saved in this file. 59 | # 99% of projects do NOT use those, so they do NOT want to version control this file. 60 | # ..but if you're in the 1%, comment out the line "*.pbxuser" 61 | 62 | *.pbxuser 63 | *.mode1v3 64 | *.mode2v3 65 | *.perspectivev3 66 | # NB: also, whitelist the default ones, some projects need to use these 67 | !default.pbxuser 68 | !default.mode1v3 69 | !default.mode2v3 70 | !default.perspectivev3 71 | 72 | 73 | #### 74 | # Xcode 4 - semi-personal settings, often included in workspaces 75 | # 76 | # You can safely ignore the xcuserdata files - but do NOT ignore the files next to them 77 | # 78 | 79 | xcuserdata 80 | 81 | #### 82 | # XCode 4 workspaces - more detailed 83 | # 84 | # Workspaces are important! They are a core feature of Xcode - don't exclude them :) 85 | # 86 | # Workspace layout is quite spammy. For reference: 87 | # 88 | # (root)/ 89 | # (project-name).xcodeproj/ 90 | # project.pbxproj 91 | # project.xcworkspace/ 92 | # contents.xcworkspacedata 93 | # xcuserdata/ 94 | # (your name)/xcuserdatad/ 95 | # xcuserdata/ 96 | # (your name)/xcuserdatad/ 97 | # 98 | # 99 | # 100 | # Xcode 4 workspaces - SHARED 101 | # 102 | # This is UNDOCUMENTED (google: "developer.apple.com xcshareddata" - 0 results 103 | # But if you're going to kill personal workspaces, at least keep the shared ones... 104 | # 105 | # 106 | !xcshareddata 107 | 108 | #### 109 | # XCode 4 build-schemes 110 | # 111 | # PRIVATE ones are stored inside xcuserdata 112 | !xcschemes 113 | 114 | #### 115 | # Xcode 4 - Deprecated classes 116 | # 117 | # Allegedly, if you manually "deprecate" your classes, they get moved here. 118 | # 119 | # We're using source-control, so this is a "feature" that we do not want! 120 | 121 | *.moved-aside 122 | 123 | #### 124 | # Xcode 5 - Source Control files 125 | # 126 | # Xcode 5 introduced a new file type .xccheckout. This files contains VCS metadata 127 | # and should therefore not be checked into the VCS. 128 | 129 | *.xccheckout 130 | 131 | #### 132 | # Xcode 7 133 | # 134 | # Code coverage files 135 | 136 | *.gcda 137 | *.gcno 138 | 139 | #### 140 | # UNKNOWN: recommended by others, but I can't discover what these files are 141 | # 142 | # ...none. Everything is now explained.: 143 | 144 | #### 145 | # Webstorm 146 | # 147 | .idea 148 | 149 | # Intellij 150 | *.iml 151 | 152 | # Android/IntelliJ 153 | # 154 | build/ 155 | .idea 156 | .gradle 157 | local.properties 158 | android/.project 159 | android/.settings/* 160 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | example/ 2 | 3 | test/ 4 | res/generated/ 5 | 6 | .npmignore 7 | 8 | 9 | ################# 10 | # from .gitignore: 11 | ################ 12 | 13 | 14 | ############ 15 | # Node 16 | ############ 17 | # Logs 18 | logs 19 | *.log 20 | npm-debug.log* 21 | 22 | # Runtime data 23 | pids 24 | *.pid 25 | *.seed 26 | 27 | # Directory for instrumented libs generated by jscoverage/JSCover 28 | lib-cov 29 | 30 | # Coverage directory used by tools like istanbul 31 | coverage 32 | 33 | # nyc test coverage 34 | .nyc_output 35 | 36 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 37 | .grunt 38 | 39 | # node-waf configuration 40 | .lock-wscript 41 | 42 | # Compiled binary addons (http://nodejs.org/api/addons.html) 43 | build/Release 44 | 45 | # Dependency directories 46 | node_modules 47 | jspm_packages 48 | 49 | # Optional npm cache directory 50 | .npm 51 | 52 | # Optional REPL history 53 | .node_repl_history 54 | 55 | ################ 56 | # JetBrains 57 | ################ 58 | .idea 59 | 60 | ## File-based project format: 61 | *.iws 62 | 63 | ## Plugin-specific files: 64 | 65 | # IntelliJ 66 | /out/ 67 | 68 | # mpeltonen/sbt-idea plugin 69 | .idea_modules/ 70 | 71 | # JIRA plugin 72 | atlassian-ide-plugin.xml 73 | 74 | # Crashlytics plugin (for Android Studio and IntelliJ) 75 | com_crashlytics_export_strings.xml 76 | crashlytics.properties 77 | crashlytics-build.properties 78 | fabric.properties 79 | 80 | 81 | ############ 82 | # iOS 83 | ############ 84 | # Xcode 85 | # 86 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 87 | 88 | ## Build generated 89 | ios/build/ 90 | ios/DerivedData/ 91 | 92 | ## Various settings 93 | *.pbxuser 94 | !default.pbxuser 95 | *.mode1v3 96 | !default.mode1v3 97 | *.mode2v3 98 | !default.mode2v3 99 | *.perspectivev3 100 | !default.perspectivev3 101 | ios/xcuserdata/ 102 | 103 | ## Other 104 | *.moved-aside 105 | *.xcuserstate 106 | 107 | ## Obj-C/Swift specific 108 | *.hmap 109 | *.ipa 110 | *.dSYM.zip 111 | *.dSYM 112 | 113 | # CocoaPods 114 | # 115 | # We recommend against adding the Pods directory to your .gitignore. However 116 | # you should judge for yourself, the pros and cons are mentioned at: 117 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 118 | # 119 | ios/Pods/ 120 | 121 | # Carthage 122 | # 123 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 124 | # Carthage/Checkouts 125 | 126 | Carthage/Build 127 | 128 | # fastlane 129 | # 130 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 131 | # screenshots whenever they are needed. 132 | # For more information about the recommended setup visit: 133 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 134 | 135 | fastlane/report.xml 136 | fastlane/screenshots 137 | 138 | 139 | ############ 140 | # Android 141 | ############ 142 | # Built application files 143 | *.apk 144 | *.ap_ 145 | 146 | # Files for the Dalvik VM 147 | *.dex 148 | 149 | # Java class files 150 | *.class 151 | 152 | # Generated files 153 | android/bin/ 154 | android/gen/ 155 | android/out/ 156 | 157 | # Gradle files 158 | android/.gradle/ 159 | android/build/ 160 | android/*/build/ 161 | 162 | # Local configuration file (sdk path, etc) 163 | local.properties 164 | 165 | # Proguard folder generated by Eclipse 166 | android/proguard/ 167 | 168 | # Log Files 169 | *.log 170 | 171 | # Android Studio Navigation editor temp files 172 | android/.navigation/ 173 | 174 | # Android Studio captures folder 175 | android/captures/ 176 | 177 | # Intellij 178 | *.iml 179 | 180 | # Keystore files 181 | *.jks 182 | 183 | ################## 184 | # React-Native 185 | ################## 186 | # OSX 187 | # 188 | .DS_Store 189 | 190 | # Xcode 191 | # 192 | build/ 193 | *.pbxuser 194 | !default.pbxuser 195 | *.mode1v3 196 | !default.mode1v3 197 | *.mode2v3 198 | !default.mode2v3 199 | *.perspectivev3 200 | !default.perspectivev3 201 | xcuserdata 202 | *.xccheckout 203 | *.moved-aside 204 | DerivedData 205 | *.hmap 206 | *.ipa 207 | *.xcuserstate 208 | project.xcworkspace 209 | 210 | # Android/IJ 211 | # 212 | .idea 213 | android/.idea 214 | android/.gradle 215 | android/local.properties 216 | 217 | # node.js 218 | # 219 | node_modules/ 220 | npm-debug.log 221 | 222 | # BUCK 223 | buck-out/ 224 | \.buckd/ 225 | android/app/libs 226 | android/keystores/debug.keystore 227 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Wix 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-native-autogrow-textinput 2 | A helper component meant to be used as a drop-in replacement for RN TextInput to allow automatic expanding of a multi-line text input according to the number of lines. 3 | 4 | ![Demo](http://i.imgur.com/ZVhZ7r5.gif) 5 | 6 | ## Installation 7 | 8 | Install using `npm`: 9 | ``` 10 | npm i react-native-autogrow-textinput --save 11 | ``` 12 | 13 | #### Native side installation 14 | 15 | To fix the [issue](https://github.com/wix/react-native-autogrow-textinput/issues/1) with the height not being set for initial values (or with other cases where the input is not set by the user typing using the keyboard) you need to add the `libAutoGrowTextInput` to your project. After performing `npm install`, locate `AutoGrowTextInput.xcodeproj` in `YOUR_PROJECT/node_modules/react-native-autogrow-textinput/ios` and drag it to your own project, then in your target's general settings, add it to the "Linked Frameworks and Libraries". 16 | 17 | ## How To Use 18 | Import the new component: 19 | 20 | ```js 21 | import {AutoGrowingTextInput} from 'react-native-autogrow-textinput'; 22 | ``` 23 | 24 | Now use it as you would normally do with a `ScrollView` to wrap arround TextInput components: 25 | 26 | ```jsx 27 | 28 | ``` 29 | 30 | ## Example Project 31 | 32 | Check out the full example project [here](https://github.com/wix/react-native-autogrow-textinput/tree/master/example). 33 | 34 | In the example folder, perform `npm install` and then run it from the Xcode project. 35 | -------------------------------------------------------------------------------- /ReactNativeAutogrowTextinput.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 = "ReactNativeAutogrowTextinput" 7 | s.version = package['version'] 8 | s.summary = package['description'] 9 | 10 | s.authors = package['author'] 11 | s.homepage = package['homepage'] 12 | s.license = package['license'] 13 | s.platforms = { :ios => "9.0", :tvos => "9.2" } 14 | 15 | s.module_name = 'ReactNativeAutogrowTextinput' 16 | 17 | s.source = { :git => "https://github.com/wix/react-native-autogrow-textinput", :tag => "#{s.version}" } 18 | s.source_files = "./ios/**/*.{h,m}" 19 | 20 | s.dependency 'React' 21 | s.frameworks = 'UIKit' 22 | end 23 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "28.0.3" 6 | defaultConfig { 7 | minSdkVersion 16 8 | targetSdkVersion 28 9 | versionCode 1 10 | versionName "1.0" 11 | } 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 16 | } 17 | } 18 | } 19 | 20 | dependencies { 21 | implementation fileTree(dir: 'libs', include: ['*.jar']) 22 | 23 | implementation 'com.facebook.react:react-native:+' 24 | 25 | testImplementation 'junit:junit:4.12' 26 | } 27 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Sep 14 17:13:26 IDT 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 7 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /android/src/main/java/com/wix/autogrowtextinput/AutoGrowTextInputModule.java: -------------------------------------------------------------------------------- 1 | package com.wix.autogrowtextinput; 2 | 3 | import android.text.Editable; 4 | import android.text.Layout; 5 | import android.text.TextWatcher; 6 | import android.view.KeyEvent; 7 | import android.view.MotionEvent; 8 | import android.view.View; 9 | import android.widget.TextView; 10 | import android.content.Context; 11 | 12 | import com.facebook.react.ReactRootView; 13 | import com.facebook.react.bridge.ReactApplicationContext; 14 | import com.facebook.react.bridge.ReactContextBaseJavaModule; 15 | import com.facebook.react.bridge.ReactMethod; 16 | import com.facebook.react.bridge.ReadableMap; 17 | import com.facebook.react.uimanager.NativeViewHierarchyManager; 18 | import com.facebook.react.uimanager.UIBlock; 19 | import com.facebook.react.uimanager.UIManagerModule; 20 | import com.facebook.react.views.textinput.ReactEditText; 21 | import android.view.inputmethod.InputMethodManager; 22 | 23 | /** 24 | * Created by zachik on 14/09/2017. 25 | */ 26 | 27 | public class AutoGrowTextInputModule extends ReactContextBaseJavaModule { 28 | 29 | private View mScrollParent; 30 | private ReactEditText editText; 31 | private int mTopOffset = 0; 32 | private int mMaxHeight = Integer.MAX_VALUE; 33 | private boolean mHasScrollParent = false; 34 | public AutoGrowTextInputModule(ReactApplicationContext reactContext) { 35 | super(reactContext); 36 | } 37 | 38 | @Override 39 | public String getName() { 40 | return "AutoGrowTextInputManager"; 41 | } 42 | 43 | @ReactMethod 44 | public void applySettingsForInput(final Integer tag,final ReadableMap param) { 45 | 46 | mTopOffset = 0; 47 | ReactApplicationContext reactContext = this.getReactApplicationContext(); 48 | UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class); 49 | uiManager.addUIBlock(new UIBlock() { 50 | public void execute (NativeViewHierarchyManager nvhm) { 51 | editText = (ReactEditText) nvhm.resolveView(tag); 52 | if (param.hasKey("maxHeight") && !param.isNull("maxHeight")) { 53 | mMaxHeight = dpToPx(param.getDouble("maxHeight")); 54 | } 55 | editText.setBlurOnSubmit(false); 56 | editText.setOnTouchListener(new View.OnTouchListener() { 57 | @Override 58 | public boolean onTouch(View v, MotionEvent event) { 59 | 60 | v.getParent().requestDisallowInterceptTouchEvent(false); 61 | return false; 62 | } 63 | }); 64 | 65 | editText.setOnEditorActionListener(new TextView.OnEditorActionListener() { 66 | @Override 67 | public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { 68 | return false; 69 | } 70 | }); 71 | 72 | if (param.hasKey("enableScrollToCaret") && param.getBoolean("enableScrollToCaret")) { 73 | editText.addTextChangedListener(mWatcher); 74 | } 75 | 76 | } 77 | }); 78 | } 79 | 80 | private int dpToPx(double dp) { 81 | return (int) (dp * editText.getResources().getDisplayMetrics().density); 82 | } 83 | 84 | private void scrollToCaret() { 85 | if (mScrollParent == null) { 86 | 87 | mScrollParent = findScrollParent(editText); 88 | 89 | } 90 | boolean isAtMaxHeight = mScrollParent.getHeight() >= mMaxHeight; 91 | if (mHasScrollParent || isAtMaxHeight) { 92 | Integer caretY = getCaretY(); 93 | if (caretY != null) { 94 | caretY += mTopOffset - mScrollParent.getScrollY(); 95 | int offset = caretY - mScrollParent.getHeight(); 96 | if (offset > 0 || isAtMaxHeight) { 97 | offset = Math.max(offset, -mScrollParent.getScrollY()); 98 | mScrollParent.scrollBy(0, offset); 99 | } 100 | } 101 | } 102 | } 103 | 104 | private ReactRootView findReactRoot(View v) { 105 | while (v.getParent() != null) { 106 | if (v instanceof ReactRootView) { 107 | return (ReactRootView) v; 108 | } 109 | v = (View) v.getParent(); 110 | } 111 | 112 | return null; 113 | } 114 | private View findScrollParent(View v) { 115 | mTopOffset = v.getTop(); 116 | while (v.getParent() != null && v.getParent() instanceof View) { 117 | v = (View) v.getParent(); 118 | 119 | if (v.isScrollContainer()) { 120 | mHasScrollParent = true; 121 | return v; 122 | } 123 | mTopOffset += v.getTop(); 124 | } 125 | mTopOffset = 0; 126 | return editText; 127 | } 128 | private Integer getCaretY() { 129 | int pos = editText.getSelectionStart(); 130 | Layout layout = editText.getLayout(); 131 | if (layout != null) { 132 | int line = layout.getLineForOffset(pos); 133 | int baseline = layout.getLineBaseline(line); 134 | int padBottom = editText.getPaddingBottom() + dpToPx(5f); 135 | return baseline + editText.getPaddingTop() + padBottom; 136 | } else { 137 | return null; 138 | } 139 | } 140 | @ReactMethod 141 | public void performCleanupForInput(Integer tag) { 142 | mScrollParent = null; 143 | } 144 | 145 | private TextWatcher mWatcher = new TextWatcher() { 146 | @Override 147 | public void beforeTextChanged(CharSequence s, int start, int count, int after) {} 148 | 149 | @Override 150 | public void onTextChanged(CharSequence s, int start, int before, int count) {} 151 | 152 | @Override 153 | public void afterTextChanged(Editable s) { 154 | scrollToCaret(); 155 | } 156 | }; 157 | 158 | 159 | // Props to https://github.com/MattFoley for this temporary hack 160 | // https://github.com/facebook/react-native/pull/12462#issuecomment-298812731 161 | @ReactMethod 162 | public void resetKeyboardInput(final int reactTagToReset) { 163 | UIManagerModule uiManager = getReactApplicationContext().getNativeModule(UIManagerModule.class); 164 | uiManager.addUIBlock(new UIBlock() { 165 | @Override 166 | public void execute(NativeViewHierarchyManager nativeViewHierarchyManager) { 167 | InputMethodManager imm = (InputMethodManager) getReactApplicationContext().getBaseContext().getSystemService(Context.INPUT_METHOD_SERVICE); 168 | if (imm != null) { 169 | View viewToReset = nativeViewHierarchyManager.resolveView(reactTagToReset); 170 | imm.restartInput(viewToReset); 171 | } 172 | } 173 | }); 174 | } 175 | 176 | 177 | } 178 | -------------------------------------------------------------------------------- /android/src/main/java/com/wix/autogrowtextinput/AutoGrowTextInputPackage.java: -------------------------------------------------------------------------------- 1 | package com.wix.autogrowtextinput; 2 | 3 | import com.facebook.react.ReactPackage; 4 | import com.facebook.react.bridge.JavaScriptModule; 5 | import com.facebook.react.bridge.NativeModule; 6 | import com.facebook.react.bridge.ReactApplicationContext; 7 | import com.facebook.react.uimanager.ViewManager; 8 | 9 | import java.util.ArrayList; 10 | import java.util.Collections; 11 | import java.util.List; 12 | 13 | public class AutoGrowTextInputPackage implements ReactPackage { 14 | @Override 15 | public List createNativeModules(ReactApplicationContext reactContext) { 16 | List modules = new ArrayList<>(); 17 | modules.add(new AutoGrowTextInputModule(reactContext)); 18 | return modules; 19 | } 20 | 21 | // Deprecated in RN 0.47 22 | public List> createJSModules() { 23 | return Collections.emptyList(); 24 | } 25 | 26 | @Override 27 | public List createViewManagers(ReactApplicationContext reactContext) { 28 | return Collections.emptyList(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /android/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/android/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/android/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/android/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/android/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/android/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/android/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/android/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/android/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /android/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | My Application 3 | 4 | -------------------------------------------------------------------------------- /android/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /example/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["module:metro-react-native-babel-preset"] 3 | } 4 | -------------------------------------------------------------------------------- /example/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /example/.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 | .*/Libraries/react-native/ReactNative.js 16 | 17 | ; Ignore metro 18 | .*/node_modules/metro/.* 19 | 20 | [include] 21 | 22 | [libs] 23 | node_modules/react-native/Libraries/react-native/react-native-interface.js 24 | node_modules/react-native/flow/ 25 | node_modules/react-native/flow-github/ 26 | 27 | [options] 28 | emoji=true 29 | 30 | esproposal.optional_chaining=enable 31 | esproposal.nullish_coalescing=enable 32 | 33 | module.system=haste 34 | module.system.haste.use_name_reducers=true 35 | # get basename 36 | module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' 37 | # strip .js or .js.flow suffix 38 | module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' 39 | # strip .ios suffix 40 | module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' 41 | module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' 42 | module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' 43 | module.system.haste.paths.blacklist=.*/__tests__/.* 44 | module.system.haste.paths.blacklist=.*/__mocks__/.* 45 | module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.* 46 | module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.* 47 | 48 | experimental.strict_type_args=true 49 | 50 | munge_underscores=true 51 | 52 | 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' 53 | 54 | module.file_ext=.js 55 | module.file_ext=.jsx 56 | module.file_ext=.json 57 | module.file_ext=.native.js 58 | 59 | suppress_type=$FlowIssue 60 | suppress_type=$FlowFixMe 61 | suppress_type=$FlowFixMeProps 62 | suppress_type=$FlowFixMeState 63 | 64 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 65 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 66 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 67 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 68 | 69 | [version] 70 | ^0.78.0 71 | -------------------------------------------------------------------------------- /example/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | 24 | # Android/IntelliJ 25 | # 26 | build/ 27 | .idea 28 | .gradle 29 | local.properties 30 | *.iml 31 | android/.project 32 | android/.settings/* 33 | 34 | # node.js 35 | # 36 | node_modules/ 37 | npm-debug.log 38 | yarn-error.log 39 | 40 | # BUCK 41 | buck-out/ 42 | \.buckd/ 43 | *.keystore 44 | !debug.keystore 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/ 52 | 53 | */fastlane/report.xml 54 | */fastlane/Preview.html 55 | */fastlane/screenshots 56 | 57 | # Bundle artifact 58 | *.jsbundle 59 | 60 | # CocoaPods 61 | /ios/Pods/ 62 | -------------------------------------------------------------------------------- /example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /example/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.autogrowtextinput", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.autogrowtextinput", 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 | -------------------------------------------------------------------------------- /example/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 | * // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format 22 | * bundleCommand: "ram-bundle", 23 | * 24 | * // whether to bundle JS and assets in debug mode 25 | * bundleInDebug: false, 26 | * 27 | * // whether to bundle JS and assets in release mode 28 | * bundleInRelease: true, 29 | * 30 | * // whether to bundle JS and assets in another build variant (if configured). 31 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 32 | * // The configuration property can be in the following formats 33 | * // 'bundleIn${productFlavor}${buildType}' 34 | * // 'bundleIn${buildType}' 35 | * // bundleInFreeDebug: true, 36 | * // bundleInPaidRelease: true, 37 | * // bundleInBeta: true, 38 | * 39 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 40 | * // for example: to disable dev mode in the staging build type (if configured) 41 | * devDisabledInStaging: true, 42 | * // The configuration property can be in the following formats 43 | * // 'devDisabledIn${productFlavor}${buildType}' 44 | * // 'devDisabledIn${buildType}' 45 | * 46 | * // the root of your project, i.e. where "package.json" lives 47 | * root: "../../", 48 | * 49 | * // where to put the JS bundle asset in debug mode 50 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 51 | * 52 | * // where to put the JS bundle asset in release mode 53 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 54 | * 55 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 56 | * // require('./image.png')), in debug mode 57 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 58 | * 59 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 60 | * // require('./image.png')), in release mode 61 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 62 | * 63 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 64 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 65 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 66 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 67 | * // for example, you might want to remove it from here. 68 | * inputExcludes: ["android/**", "ios/**"], 69 | * 70 | * // override which node gets called and with what additional arguments 71 | * nodeExecutableAndArgs: ["node"], 72 | * 73 | * // supply additional arguments to the packager 74 | * extraPackagerArgs: [] 75 | * ] 76 | */ 77 | 78 | project.ext.react = [ 79 | entryFile: "index.js", 80 | enableHermes: false, // clean and rebuild if changing 81 | ] 82 | 83 | apply from: "../../node_modules/react-native/react.gradle" 84 | 85 | /** 86 | * Set this to true to create two separate APKs instead of one: 87 | * - An APK that only works on ARM devices 88 | * - An APK that only works on x86 devices 89 | * The advantage is the size of the APK is reduced by about 4MB. 90 | * Upload all the APKs to the Play Store and people will download 91 | * the correct one based on the CPU architecture of their device. 92 | */ 93 | def enableSeparateBuildPerCPUArchitecture = false 94 | 95 | /** 96 | * Run Proguard to shrink the Java bytecode in release builds. 97 | */ 98 | def enableProguardInReleaseBuilds = false 99 | 100 | /** 101 | * The preferred build flavor of JavaScriptCore. 102 | * 103 | * For example, to use the international variant, you can use: 104 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 105 | * 106 | * The international variant includes ICU i18n library and necessary data 107 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 108 | * give correct results when using with locales other than en-US. Note that 109 | * this variant is about 6MiB larger per architecture than default. 110 | */ 111 | def jscFlavor = 'org.webkit:android-jsc:+' 112 | 113 | /** 114 | * Whether to enable the Hermes VM. 115 | * 116 | * This should be set on project.ext.react and mirrored here. If it is not set 117 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode 118 | * and the benefits of using Hermes will therefore be sharply reduced. 119 | */ 120 | def enableHermes = project.ext.react.get("enableHermes", false); 121 | 122 | android { 123 | compileSdkVersion rootProject.ext.compileSdkVersion 124 | 125 | compileOptions { 126 | sourceCompatibility JavaVersion.VERSION_1_8 127 | targetCompatibility JavaVersion.VERSION_1_8 128 | } 129 | 130 | defaultConfig { 131 | applicationId "com.autogrowtextinput" 132 | minSdkVersion rootProject.ext.minSdkVersion 133 | targetSdkVersion rootProject.ext.targetSdkVersion 134 | versionCode 1 135 | versionName "1.0" 136 | } 137 | splits { 138 | abi { 139 | reset() 140 | enable enableSeparateBuildPerCPUArchitecture 141 | universalApk false // If true, also generate a universal APK 142 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" 143 | } 144 | } 145 | signingConfigs { 146 | debug { 147 | storeFile file('debug.keystore') 148 | storePassword 'android' 149 | keyAlias 'androiddebugkey' 150 | keyPassword 'android' 151 | } 152 | } 153 | buildTypes { 154 | debug { 155 | signingConfig signingConfigs.debug 156 | } 157 | release { 158 | // Caution! In production, you need to generate your own keystore file. 159 | // see https://facebook.github.io/react-native/docs/signed-apk-android. 160 | signingConfig signingConfigs.debug 161 | minifyEnabled enableProguardInReleaseBuilds 162 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 163 | } 164 | } 165 | // applicationVariants are e.g. debug, release 166 | applicationVariants.all { variant -> 167 | variant.outputs.each { output -> 168 | // For each separate APK per architecture, set a unique version code as described here: 169 | // https://developer.android.com/studio/build/configure-apk-splits.html 170 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] 171 | def abi = output.getFilter(OutputFile.ABI) 172 | if (abi != null) { // null for the universal-debug, universal-release variants 173 | output.versionCodeOverride = 174 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 175 | } 176 | 177 | } 178 | } 179 | } 180 | 181 | dependencies { 182 | implementation fileTree(dir: "libs", include: ["*.jar"]) 183 | implementation "com.facebook.react:react-native:+" // From node_modules 184 | 185 | if (enableHermes) { 186 | def hermesPath = "../../node_modules/hermes-engine/android/"; 187 | debugImplementation files(hermesPath + "hermes-debug.aar") 188 | releaseImplementation files(hermesPath + "hermes-release.aar") 189 | } else { 190 | implementation jscFlavor 191 | } 192 | } 193 | 194 | // Run this once to be able to run the application with BUCK 195 | // puts all compile dependencies into folder libs for BUCK to use 196 | task copyDownloadableDepsToLibs(type: Copy) { 197 | from configurations.compile 198 | into 'libs' 199 | } 200 | 201 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 202 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/example/android/app/debug.keystore -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/autogrowtextinput/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.autogrowtextinput; 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. This is used to schedule 9 | * rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "AutogrowTextinput"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/autogrowtextinput/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.autogrowtextinput; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import com.facebook.react.PackageList; 6 | import com.facebook.react.ReactApplication; 7 | import com.facebook.react.ReactNativeHost; 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.soloader.SoLoader; 10 | import java.lang.reflect.InvocationTargetException; 11 | import java.util.List; 12 | 13 | public class MainApplication extends Application implements ReactApplication { 14 | 15 | private final ReactNativeHost mReactNativeHost = 16 | new ReactNativeHost(this) { 17 | @Override 18 | public boolean getUseDeveloperSupport() { 19 | return BuildConfig.DEBUG; 20 | } 21 | 22 | @Override 23 | protected List getPackages() { 24 | @SuppressWarnings("UnnecessaryLocalVariable") 25 | List packages = new PackageList(this).getPackages(); 26 | // Packages that cannot be autolinked yet can be added manually here, for example: 27 | // packages.add(new MyReactNativePackage()); 28 | return packages; 29 | } 30 | 31 | @Override 32 | protected String getJSMainModuleName() { 33 | return "app"; 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 | initializeFlipper(this); // Remove this line if you don't want Flipper enabled 47 | } 48 | 49 | /** 50 | * Loads Flipper in React Native templates. 51 | * 52 | * @param context 53 | */ 54 | private static void initializeFlipper(Context context) { 55 | if (BuildConfig.DEBUG) { 56 | try { 57 | /* 58 | We use reflection here to pick up the class that initializes Flipper, 59 | since Flipper library is not available in release mode 60 | */ 61 | Class aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper"); 62 | aClass.getMethod("initializeFlipper", Context.class).invoke(null, context); 63 | } catch (ClassNotFoundException e) { 64 | e.printStackTrace(); 65 | } catch (NoSuchMethodException e) { 66 | e.printStackTrace(); 67 | } catch (IllegalAccessException e) { 68 | e.printStackTrace(); 69 | } catch (InvocationTargetException e) { 70 | e.printStackTrace(); 71 | } 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AutogrowTextinput 3 | 4 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /example/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 | } 10 | repositories { 11 | google() 12 | jcenter() 13 | } 14 | dependencies { 15 | classpath("com.android.tools.build:gradle:3.4.2") 16 | 17 | // NOTE: Do not place your application dependencies here; they belong 18 | // in the individual module build.gradle files 19 | } 20 | } 21 | 22 | allprojects { 23 | repositories { 24 | mavenLocal() 25 | maven { 26 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 27 | url("$rootDir/../node_modules/react-native/android") 28 | } 29 | maven { 30 | // Android JSC is installed from npm 31 | url("$rootDir/../node_modules/jsc-android/dist") 32 | } 33 | 34 | google() 35 | jcenter() 36 | maven { url 'https://jitpack.io' } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useAndroidX=true 21 | android.enableJetifier=true 22 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wix-incubator/react-native-autogrow-textinput/2bc330439b95e748e92c34bbdff5473f5dc29b88/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'AutogrowTextinput' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | -------------------------------------------------------------------------------- /example/app.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import {AppRegistry, StyleSheet, Text, View, TouchableOpacity, Platform} from 'react-native'; 3 | 4 | import {AutoGrowingTextInput} from 'react-native-autogrow-textinput'; 5 | 6 | class example extends Component { 7 | constructor(props) { 8 | super(props); 9 | this.state = {textValue: 'My initial\nText'}; 10 | } 11 | 12 | render() { 13 | return ( 14 | 15 | 16 | Auto Growing TextInput Example 17 | 18 | 19 | this._onChange(event)} 22 | style={styles.textInput} 23 | placeholder={'Your Message'} 24 | placeholderTextColor='#66737C' 25 | maxHeight={200} 26 | minHeight={45} 27 | enableScrollToCaret 28 | ref={(r) => { this._textInput = r; }} 29 | /> 30 | this._resetTextInput()}> 31 | Clear 32 | 33 | 34 | 35 | ); 36 | } 37 | 38 | _onChange(event) { 39 | this.setState({ textValue: event.nativeEvent.text || '' }); 40 | } 41 | 42 | _resetTextInput() { 43 | this._textInput.clear(); 44 | this._textInput.resetHeightToMin(); 45 | } 46 | } 47 | 48 | const IsIOS = Platform.OS === 'ios'; 49 | const styles = StyleSheet.create({ 50 | container: { 51 | flex: 1, 52 | alignItems: 'center', 53 | backgroundColor: '#76c6ff' 54 | }, 55 | textInputContainer: { 56 | flexDirection: 'row', 57 | paddingLeft: 8, 58 | paddingRight: 8 59 | }, 60 | welcome: { 61 | marginTop: 100, 62 | fontSize: 20, 63 | textAlign: 'center', 64 | margin: 10 65 | }, 66 | textInput: { 67 | paddingLeft: 10, 68 | fontSize: 17, 69 | flex: 1, 70 | backgroundColor: 'white', 71 | borderWidth: 0, 72 | borderRadius: IsIOS ? 4 : 0, 73 | }, 74 | button: { 75 | paddingLeft: 5, 76 | alignItems: 'center', 77 | justifyContent: 'center', 78 | } 79 | }); 80 | 81 | AppRegistry.registerComponent('AutogrowTextinput', () => example); 82 | -------------------------------------------------------------------------------- /example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "AutogrowTextinput", 3 | "displayName": "AutogrowTextinput" 4 | } -------------------------------------------------------------------------------- /example/index.android.js: -------------------------------------------------------------------------------- 1 | import './app' -------------------------------------------------------------------------------- /example/index.ios.js: -------------------------------------------------------------------------------- 1 | import './app' -------------------------------------------------------------------------------- /example/ios/AutogrowTextinput-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | NSAppTransportSecurity 26 | 27 | NSExceptionDomains 28 | 29 | localhost 30 | 31 | NSExceptionAllowsInsecureHTTPLoads 32 | 33 | 34 | 35 | 36 | NSLocationWhenInUseUsageDescription 37 | 38 | UILaunchStoryboardName 39 | LaunchScreen 40 | UIRequiredDeviceCapabilities 41 | 42 | armv7 43 | 44 | UISupportedInterfaceOrientations 45 | 46 | UIInterfaceOrientationPortrait 47 | UIInterfaceOrientationLandscapeLeft 48 | UIInterfaceOrientationLandscapeRight 49 | 50 | UIViewControllerBasedStatusBarAppearance 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /example/ios/AutogrowTextinput-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /example/ios/AutogrowTextinput.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 11 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; 12 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 13 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 14 | 688FCAB0C3D30D86BAE8659C /* libPods-AutogrowTextinput.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E1C1966D1A94D4DD0D784A71 /* libPods-AutogrowTextinput.a */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; 19 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 20 | 00E356F21AD99517003FC87E /* AutogrowTextinputTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AutogrowTextinputTests.m; sourceTree = ""; }; 21 | 13B07F961A680F5B00A75B9A /* AutogrowTextinput.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AutogrowTextinput.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = AutogrowTextinput/AppDelegate.h; sourceTree = ""; }; 23 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = AutogrowTextinput/AppDelegate.m; sourceTree = ""; }; 24 | 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 25 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = AutogrowTextinput/Images.xcassets; sourceTree = ""; }; 26 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = AutogrowTextinput/Info.plist; sourceTree = ""; }; 27 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = AutogrowTextinput/main.m; sourceTree = ""; }; 28 | 3E7BEED7F78981D6ACDBEE64 /* Pods-AutogrowTextinput.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AutogrowTextinput.release.xcconfig"; path = "Target Support Files/Pods-AutogrowTextinput/Pods-AutogrowTextinput.release.xcconfig"; sourceTree = ""; }; 29 | D3FBBD305EEE16B89ADCEC5E /* Pods-AutogrowTextinput.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AutogrowTextinput.debug.xcconfig"; path = "Target Support Files/Pods-AutogrowTextinput/Pods-AutogrowTextinput.debug.xcconfig"; sourceTree = ""; }; 30 | E1C1966D1A94D4DD0D784A71 /* libPods-AutogrowTextinput.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AutogrowTextinput.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; 32 | 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; }; 33 | /* End PBXFileReference section */ 34 | 35 | /* Begin PBXFrameworksBuildPhase section */ 36 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 37 | isa = PBXFrameworksBuildPhase; 38 | buildActionMask = 2147483647; 39 | files = ( 40 | 688FCAB0C3D30D86BAE8659C /* libPods-AutogrowTextinput.a in Frameworks */, 41 | ); 42 | runOnlyForDeploymentPostprocessing = 0; 43 | }; 44 | /* End PBXFrameworksBuildPhase section */ 45 | 46 | /* Begin PBXGroup section */ 47 | 00E356EF1AD99517003FC87E /* AutogrowTextinputTests */ = { 48 | isa = PBXGroup; 49 | children = ( 50 | 00E356F21AD99517003FC87E /* AutogrowTextinputTests.m */, 51 | 00E356F01AD99517003FC87E /* Supporting Files */, 52 | ); 53 | path = AutogrowTextinputTests; 54 | sourceTree = ""; 55 | }; 56 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | 00E356F11AD99517003FC87E /* Info.plist */, 60 | ); 61 | name = "Supporting Files"; 62 | sourceTree = ""; 63 | }; 64 | 13B07FAE1A68108700A75B9A /* AutogrowTextinput */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 68 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 69 | 13B07FB01A68108700A75B9A /* AppDelegate.m */, 70 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 71 | 13B07FB61A68108700A75B9A /* Info.plist */, 72 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, 73 | 13B07FB71A68108700A75B9A /* main.m */, 74 | ); 75 | name = AutogrowTextinput; 76 | sourceTree = ""; 77 | }; 78 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */, 82 | ED2971642150620600B7C4FE /* JavaScriptCore.framework */, 83 | E1C1966D1A94D4DD0D784A71 /* libPods-AutogrowTextinput.a */, 84 | ); 85 | name = Frameworks; 86 | sourceTree = ""; 87 | }; 88 | 663BF964F3E669566E29FFD9 /* Pods */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | D3FBBD305EEE16B89ADCEC5E /* Pods-AutogrowTextinput.debug.xcconfig */, 92 | 3E7BEED7F78981D6ACDBEE64 /* Pods-AutogrowTextinput.release.xcconfig */, 93 | ); 94 | path = Pods; 95 | sourceTree = ""; 96 | }; 97 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | ); 101 | name = Libraries; 102 | sourceTree = ""; 103 | }; 104 | 83CBB9F61A601CBA00E9B192 = { 105 | isa = PBXGroup; 106 | children = ( 107 | 13B07FAE1A68108700A75B9A /* AutogrowTextinput */, 108 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 109 | 00E356EF1AD99517003FC87E /* AutogrowTextinputTests */, 110 | 83CBBA001A601CBA00E9B192 /* Products */, 111 | 2D16E6871FA4F8E400B85C8A /* Frameworks */, 112 | 663BF964F3E669566E29FFD9 /* Pods */, 113 | ); 114 | indentWidth = 2; 115 | sourceTree = ""; 116 | tabWidth = 2; 117 | usesTabs = 0; 118 | }; 119 | 83CBBA001A601CBA00E9B192 /* Products */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 13B07F961A680F5B00A75B9A /* AutogrowTextinput.app */, 123 | ); 124 | name = Products; 125 | sourceTree = ""; 126 | }; 127 | /* End PBXGroup section */ 128 | 129 | /* Begin PBXNativeTarget section */ 130 | 13B07F861A680F5B00A75B9A /* AutogrowTextinput */ = { 131 | isa = PBXNativeTarget; 132 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "AutogrowTextinput" */; 133 | buildPhases = ( 134 | 0C95DA55D9CFD868757B4472 /* [CP] Check Pods Manifest.lock */, 135 | FD10A7F022414F080027D42C /* Start Packager */, 136 | 13B07F871A680F5B00A75B9A /* Sources */, 137 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 138 | 13B07F8E1A680F5B00A75B9A /* Resources */, 139 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 140 | ); 141 | buildRules = ( 142 | ); 143 | dependencies = ( 144 | ); 145 | name = AutogrowTextinput; 146 | productName = AutogrowTextinput; 147 | productReference = 13B07F961A680F5B00A75B9A /* AutogrowTextinput.app */; 148 | productType = "com.apple.product-type.application"; 149 | }; 150 | /* End PBXNativeTarget section */ 151 | 152 | /* Begin PBXProject section */ 153 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 154 | isa = PBXProject; 155 | attributes = { 156 | LastUpgradeCheck = 0940; 157 | ORGANIZATIONNAME = Facebook; 158 | }; 159 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "AutogrowTextinput" */; 160 | compatibilityVersion = "Xcode 3.2"; 161 | developmentRegion = English; 162 | hasScannedForEncodings = 0; 163 | knownRegions = ( 164 | en, 165 | Base, 166 | ); 167 | mainGroup = 83CBB9F61A601CBA00E9B192; 168 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 169 | projectDirPath = ""; 170 | projectRoot = ""; 171 | targets = ( 172 | 13B07F861A680F5B00A75B9A /* AutogrowTextinput */, 173 | ); 174 | }; 175 | /* End PBXProject section */ 176 | 177 | /* Begin PBXResourcesBuildPhase section */ 178 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 179 | isa = PBXResourcesBuildPhase; 180 | buildActionMask = 2147483647; 181 | files = ( 182 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 183 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, 184 | ); 185 | runOnlyForDeploymentPostprocessing = 0; 186 | }; 187 | /* End PBXResourcesBuildPhase section */ 188 | 189 | /* Begin PBXShellScriptBuildPhase section */ 190 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 191 | isa = PBXShellScriptBuildPhase; 192 | buildActionMask = 2147483647; 193 | files = ( 194 | ); 195 | inputPaths = ( 196 | ); 197 | name = "Bundle React Native code and images"; 198 | outputPaths = ( 199 | ); 200 | runOnlyForDeploymentPostprocessing = 0; 201 | shellPath = /bin/sh; 202 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; 203 | }; 204 | 0C95DA55D9CFD868757B4472 /* [CP] Check Pods Manifest.lock */ = { 205 | isa = PBXShellScriptBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | ); 209 | inputFileListPaths = ( 210 | ); 211 | inputPaths = ( 212 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 213 | "${PODS_ROOT}/Manifest.lock", 214 | ); 215 | name = "[CP] Check Pods Manifest.lock"; 216 | outputFileListPaths = ( 217 | ); 218 | outputPaths = ( 219 | "$(DERIVED_FILE_DIR)/Pods-AutogrowTextinput-checkManifestLockResult.txt", 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | shellPath = /bin/sh; 223 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 224 | showEnvVarsInLog = 0; 225 | }; 226 | FD10A7F022414F080027D42C /* Start Packager */ = { 227 | isa = PBXShellScriptBuildPhase; 228 | buildActionMask = 2147483647; 229 | files = ( 230 | ); 231 | inputFileListPaths = ( 232 | ); 233 | inputPaths = ( 234 | ); 235 | name = "Start Packager"; 236 | outputFileListPaths = ( 237 | ); 238 | outputPaths = ( 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | shellPath = /bin/sh; 242 | shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; 243 | showEnvVarsInLog = 0; 244 | }; 245 | /* End PBXShellScriptBuildPhase section */ 246 | 247 | /* Begin PBXSourcesBuildPhase section */ 248 | 13B07F871A680F5B00A75B9A /* Sources */ = { 249 | isa = PBXSourcesBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 253 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 254 | ); 255 | runOnlyForDeploymentPostprocessing = 0; 256 | }; 257 | /* End PBXSourcesBuildPhase section */ 258 | 259 | /* Begin PBXVariantGroup section */ 260 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { 261 | isa = PBXVariantGroup; 262 | children = ( 263 | 13B07FB21A68108700A75B9A /* Base */, 264 | ); 265 | name = LaunchScreen.xib; 266 | path = AutogrowTextinput; 267 | sourceTree = ""; 268 | }; 269 | /* End PBXVariantGroup section */ 270 | 271 | /* Begin XCBuildConfiguration section */ 272 | 13B07F941A680F5B00A75B9A /* Debug */ = { 273 | isa = XCBuildConfiguration; 274 | baseConfigurationReference = D3FBBD305EEE16B89ADCEC5E /* Pods-AutogrowTextinput.debug.xcconfig */; 275 | buildSettings = { 276 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 277 | CURRENT_PROJECT_VERSION = 1; 278 | DEAD_CODE_STRIPPING = NO; 279 | INFOPLIST_FILE = AutogrowTextinput/Info.plist; 280 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 281 | OTHER_LDFLAGS = ( 282 | "$(inherited)", 283 | "-ObjC", 284 | "-lc++", 285 | ); 286 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 287 | PRODUCT_NAME = AutogrowTextinput; 288 | VERSIONING_SYSTEM = "apple-generic"; 289 | }; 290 | name = Debug; 291 | }; 292 | 13B07F951A680F5B00A75B9A /* Release */ = { 293 | isa = XCBuildConfiguration; 294 | baseConfigurationReference = 3E7BEED7F78981D6ACDBEE64 /* Pods-AutogrowTextinput.release.xcconfig */; 295 | buildSettings = { 296 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 297 | CURRENT_PROJECT_VERSION = 1; 298 | INFOPLIST_FILE = AutogrowTextinput/Info.plist; 299 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 300 | OTHER_LDFLAGS = ( 301 | "$(inherited)", 302 | "-ObjC", 303 | "-lc++", 304 | ); 305 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 306 | PRODUCT_NAME = AutogrowTextinput; 307 | VERSIONING_SYSTEM = "apple-generic"; 308 | }; 309 | name = Release; 310 | }; 311 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 312 | isa = XCBuildConfiguration; 313 | buildSettings = { 314 | ALWAYS_SEARCH_USER_PATHS = NO; 315 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 316 | CLANG_CXX_LIBRARY = "libc++"; 317 | CLANG_ENABLE_MODULES = YES; 318 | CLANG_ENABLE_OBJC_ARC = YES; 319 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 320 | CLANG_WARN_BOOL_CONVERSION = YES; 321 | CLANG_WARN_COMMA = YES; 322 | CLANG_WARN_CONSTANT_CONVERSION = YES; 323 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 324 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 325 | CLANG_WARN_EMPTY_BODY = YES; 326 | CLANG_WARN_ENUM_CONVERSION = YES; 327 | CLANG_WARN_INFINITE_RECURSION = YES; 328 | CLANG_WARN_INT_CONVERSION = YES; 329 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 330 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 331 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 332 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 333 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 334 | CLANG_WARN_STRICT_PROTOTYPES = YES; 335 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 336 | CLANG_WARN_UNREACHABLE_CODE = YES; 337 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 338 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 339 | COPY_PHASE_STRIP = NO; 340 | ENABLE_STRICT_OBJC_MSGSEND = YES; 341 | ENABLE_TESTABILITY = YES; 342 | GCC_C_LANGUAGE_STANDARD = gnu99; 343 | GCC_DYNAMIC_NO_PIC = NO; 344 | GCC_NO_COMMON_BLOCKS = YES; 345 | GCC_OPTIMIZATION_LEVEL = 0; 346 | GCC_PREPROCESSOR_DEFINITIONS = ( 347 | "DEBUG=1", 348 | "$(inherited)", 349 | ); 350 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 351 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 352 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 353 | GCC_WARN_UNDECLARED_SELECTOR = YES; 354 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 355 | GCC_WARN_UNUSED_FUNCTION = YES; 356 | GCC_WARN_UNUSED_VARIABLE = YES; 357 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 358 | MTL_ENABLE_DEBUG_INFO = YES; 359 | ONLY_ACTIVE_ARCH = YES; 360 | SDKROOT = iphoneos; 361 | }; 362 | name = Debug; 363 | }; 364 | 83CBBA211A601CBA00E9B192 /* Release */ = { 365 | isa = XCBuildConfiguration; 366 | buildSettings = { 367 | ALWAYS_SEARCH_USER_PATHS = NO; 368 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 369 | CLANG_CXX_LIBRARY = "libc++"; 370 | CLANG_ENABLE_MODULES = YES; 371 | CLANG_ENABLE_OBJC_ARC = YES; 372 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 373 | CLANG_WARN_BOOL_CONVERSION = YES; 374 | CLANG_WARN_COMMA = YES; 375 | CLANG_WARN_CONSTANT_CONVERSION = YES; 376 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 377 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 378 | CLANG_WARN_EMPTY_BODY = YES; 379 | CLANG_WARN_ENUM_CONVERSION = YES; 380 | CLANG_WARN_INFINITE_RECURSION = YES; 381 | CLANG_WARN_INT_CONVERSION = YES; 382 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 383 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 384 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 385 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 386 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 387 | CLANG_WARN_STRICT_PROTOTYPES = YES; 388 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 389 | CLANG_WARN_UNREACHABLE_CODE = YES; 390 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 391 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 392 | COPY_PHASE_STRIP = YES; 393 | ENABLE_NS_ASSERTIONS = NO; 394 | ENABLE_STRICT_OBJC_MSGSEND = YES; 395 | GCC_C_LANGUAGE_STANDARD = gnu99; 396 | GCC_NO_COMMON_BLOCKS = YES; 397 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 398 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 399 | GCC_WARN_UNDECLARED_SELECTOR = YES; 400 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 401 | GCC_WARN_UNUSED_FUNCTION = YES; 402 | GCC_WARN_UNUSED_VARIABLE = YES; 403 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 404 | MTL_ENABLE_DEBUG_INFO = NO; 405 | SDKROOT = iphoneos; 406 | VALIDATE_PRODUCT = YES; 407 | }; 408 | name = Release; 409 | }; 410 | /* End XCBuildConfiguration section */ 411 | 412 | /* Begin XCConfigurationList section */ 413 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "AutogrowTextinput" */ = { 414 | isa = XCConfigurationList; 415 | buildConfigurations = ( 416 | 13B07F941A680F5B00A75B9A /* Debug */, 417 | 13B07F951A680F5B00A75B9A /* Release */, 418 | ); 419 | defaultConfigurationIsVisible = 0; 420 | defaultConfigurationName = Release; 421 | }; 422 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "AutogrowTextinput" */ = { 423 | isa = XCConfigurationList; 424 | buildConfigurations = ( 425 | 83CBBA201A601CBA00E9B192 /* Debug */, 426 | 83CBBA211A601CBA00E9B192 /* Release */, 427 | ); 428 | defaultConfigurationIsVisible = 0; 429 | defaultConfigurationName = Release; 430 | }; 431 | /* End XCConfigurationList section */ 432 | }; 433 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 434 | } 435 | -------------------------------------------------------------------------------- /example/ios/AutogrowTextinput.xcodeproj/xcshareddata/xcschemes/AutogrowTextinput-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 | -------------------------------------------------------------------------------- /example/ios/AutogrowTextinput.xcodeproj/xcshareddata/xcschemes/AutogrowTextinput.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 | -------------------------------------------------------------------------------- /example/ios/AutogrowTextinput.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/AutogrowTextinput.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/AutogrowTextinput/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 | -------------------------------------------------------------------------------- /example/ios/AutogrowTextinput/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:@"AutogrowTextinput" 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:@"app" fallbackResource:nil]; 37 | #else 38 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 39 | #endif 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /example/ios/AutogrowTextinput/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 | -------------------------------------------------------------------------------- /example/ios/AutogrowTextinput/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 | } -------------------------------------------------------------------------------- /example/ios/AutogrowTextinput/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/AutogrowTextinput/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | AutogrowTextinput 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 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | NSExceptionDomains 32 | 33 | localhost 34 | 35 | NSExceptionAllowsInsecureHTTPLoads 36 | 37 | 38 | 39 | 40 | NSLocationWhenInUseUsageDescription 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UIViewControllerBasedStatusBarAppearance 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /example/ios/AutogrowTextinput/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 | -------------------------------------------------------------------------------- /example/ios/AutogrowTextinputTests/AutogrowTextinputTests.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 | #import 10 | 11 | #import 12 | #import 13 | 14 | #define TIMEOUT_SECONDS 600 15 | #define TEXT_TO_LOOK_FOR @"Welcome to React" 16 | 17 | @interface AutogrowTextinputTests : XCTestCase 18 | 19 | @end 20 | 21 | @implementation AutogrowTextinputTests 22 | 23 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 24 | { 25 | if (test(view)) { 26 | return YES; 27 | } 28 | for (UIView *subview in [view subviews]) { 29 | if ([self findSubviewInView:subview matching:test]) { 30 | return YES; 31 | } 32 | } 33 | return NO; 34 | } 35 | 36 | - (void)testRendersWelcomeScreen 37 | { 38 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 39 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 40 | BOOL foundElement = NO; 41 | 42 | __block NSString *redboxError = nil; 43 | #ifdef DEBUG 44 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 45 | if (level >= RCTLogLevelError) { 46 | redboxError = message; 47 | } 48 | }); 49 | #endif 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | #ifdef DEBUG 64 | RCTSetLogFunction(RCTDefaultLogFunction); 65 | #endif 66 | 67 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 68 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 69 | } 70 | 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /example/ios/AutogrowTextinputTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '9.0' 2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | target 'AutogrowTextinput' do 5 | # Pods for AutogrowTextinput 6 | pod 'ReactNativeAutogrowTextinput', :path => '../../ReactNativeAutogrowTextinput.podspec' 7 | 8 | pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" 9 | pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" 10 | pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" 11 | pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" 12 | pod 'React', :path => '../node_modules/react-native/' 13 | pod 'React-Core', :path => '../node_modules/react-native/' 14 | pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' 15 | pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' 16 | pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' 17 | pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' 18 | pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' 19 | pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' 20 | pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' 21 | pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' 22 | pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' 23 | pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' 24 | pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' 25 | pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/' 26 | 27 | pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' 28 | pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' 29 | pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' 30 | pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' 31 | pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon" 32 | pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" 33 | pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga' 34 | 35 | pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' 36 | pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' 37 | pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' 38 | 39 | end 40 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - boost-for-react-native (1.63.0) 3 | - DoubleConversion (1.1.6) 4 | - FBLazyVector (0.61.4) 5 | - FBReactNativeSpec (0.61.4): 6 | - Folly (= 2018.10.22.00) 7 | - RCTRequired (= 0.61.4) 8 | - RCTTypeSafety (= 0.61.4) 9 | - React-Core (= 0.61.4) 10 | - React-jsi (= 0.61.4) 11 | - ReactCommon/turbomodule/core (= 0.61.4) 12 | - Folly (2018.10.22.00): 13 | - boost-for-react-native 14 | - DoubleConversion 15 | - Folly/Default (= 2018.10.22.00) 16 | - glog 17 | - Folly/Default (2018.10.22.00): 18 | - boost-for-react-native 19 | - DoubleConversion 20 | - glog 21 | - glog (0.3.5) 22 | - RCTRequired (0.61.4) 23 | - RCTTypeSafety (0.61.4): 24 | - FBLazyVector (= 0.61.4) 25 | - Folly (= 2018.10.22.00) 26 | - RCTRequired (= 0.61.4) 27 | - React-Core (= 0.61.4) 28 | - React (0.61.4): 29 | - React-Core (= 0.61.4) 30 | - React-Core/DevSupport (= 0.61.4) 31 | - React-Core/RCTWebSocket (= 0.61.4) 32 | - React-RCTActionSheet (= 0.61.4) 33 | - React-RCTAnimation (= 0.61.4) 34 | - React-RCTBlob (= 0.61.4) 35 | - React-RCTImage (= 0.61.4) 36 | - React-RCTLinking (= 0.61.4) 37 | - React-RCTNetwork (= 0.61.4) 38 | - React-RCTSettings (= 0.61.4) 39 | - React-RCTText (= 0.61.4) 40 | - React-RCTVibration (= 0.61.4) 41 | - React-Core (0.61.4): 42 | - Folly (= 2018.10.22.00) 43 | - glog 44 | - React-Core/Default (= 0.61.4) 45 | - React-cxxreact (= 0.61.4) 46 | - React-jsi (= 0.61.4) 47 | - React-jsiexecutor (= 0.61.4) 48 | - Yoga 49 | - React-Core/CoreModulesHeaders (0.61.4): 50 | - Folly (= 2018.10.22.00) 51 | - glog 52 | - React-Core/Default 53 | - React-cxxreact (= 0.61.4) 54 | - React-jsi (= 0.61.4) 55 | - React-jsiexecutor (= 0.61.4) 56 | - Yoga 57 | - React-Core/Default (0.61.4): 58 | - Folly (= 2018.10.22.00) 59 | - glog 60 | - React-cxxreact (= 0.61.4) 61 | - React-jsi (= 0.61.4) 62 | - React-jsiexecutor (= 0.61.4) 63 | - Yoga 64 | - React-Core/DevSupport (0.61.4): 65 | - Folly (= 2018.10.22.00) 66 | - glog 67 | - React-Core/Default (= 0.61.4) 68 | - React-Core/RCTWebSocket (= 0.61.4) 69 | - React-cxxreact (= 0.61.4) 70 | - React-jsi (= 0.61.4) 71 | - React-jsiexecutor (= 0.61.4) 72 | - React-jsinspector (= 0.61.4) 73 | - Yoga 74 | - React-Core/RCTActionSheetHeaders (0.61.4): 75 | - Folly (= 2018.10.22.00) 76 | - glog 77 | - React-Core/Default 78 | - React-cxxreact (= 0.61.4) 79 | - React-jsi (= 0.61.4) 80 | - React-jsiexecutor (= 0.61.4) 81 | - Yoga 82 | - React-Core/RCTAnimationHeaders (0.61.4): 83 | - Folly (= 2018.10.22.00) 84 | - glog 85 | - React-Core/Default 86 | - React-cxxreact (= 0.61.4) 87 | - React-jsi (= 0.61.4) 88 | - React-jsiexecutor (= 0.61.4) 89 | - Yoga 90 | - React-Core/RCTBlobHeaders (0.61.4): 91 | - Folly (= 2018.10.22.00) 92 | - glog 93 | - React-Core/Default 94 | - React-cxxreact (= 0.61.4) 95 | - React-jsi (= 0.61.4) 96 | - React-jsiexecutor (= 0.61.4) 97 | - Yoga 98 | - React-Core/RCTImageHeaders (0.61.4): 99 | - Folly (= 2018.10.22.00) 100 | - glog 101 | - React-Core/Default 102 | - React-cxxreact (= 0.61.4) 103 | - React-jsi (= 0.61.4) 104 | - React-jsiexecutor (= 0.61.4) 105 | - Yoga 106 | - React-Core/RCTLinkingHeaders (0.61.4): 107 | - Folly (= 2018.10.22.00) 108 | - glog 109 | - React-Core/Default 110 | - React-cxxreact (= 0.61.4) 111 | - React-jsi (= 0.61.4) 112 | - React-jsiexecutor (= 0.61.4) 113 | - Yoga 114 | - React-Core/RCTNetworkHeaders (0.61.4): 115 | - Folly (= 2018.10.22.00) 116 | - glog 117 | - React-Core/Default 118 | - React-cxxreact (= 0.61.4) 119 | - React-jsi (= 0.61.4) 120 | - React-jsiexecutor (= 0.61.4) 121 | - Yoga 122 | - React-Core/RCTSettingsHeaders (0.61.4): 123 | - Folly (= 2018.10.22.00) 124 | - glog 125 | - React-Core/Default 126 | - React-cxxreact (= 0.61.4) 127 | - React-jsi (= 0.61.4) 128 | - React-jsiexecutor (= 0.61.4) 129 | - Yoga 130 | - React-Core/RCTTextHeaders (0.61.4): 131 | - Folly (= 2018.10.22.00) 132 | - glog 133 | - React-Core/Default 134 | - React-cxxreact (= 0.61.4) 135 | - React-jsi (= 0.61.4) 136 | - React-jsiexecutor (= 0.61.4) 137 | - Yoga 138 | - React-Core/RCTVibrationHeaders (0.61.4): 139 | - Folly (= 2018.10.22.00) 140 | - glog 141 | - React-Core/Default 142 | - React-cxxreact (= 0.61.4) 143 | - React-jsi (= 0.61.4) 144 | - React-jsiexecutor (= 0.61.4) 145 | - Yoga 146 | - React-Core/RCTWebSocket (0.61.4): 147 | - Folly (= 2018.10.22.00) 148 | - glog 149 | - React-Core/Default (= 0.61.4) 150 | - React-cxxreact (= 0.61.4) 151 | - React-jsi (= 0.61.4) 152 | - React-jsiexecutor (= 0.61.4) 153 | - Yoga 154 | - React-CoreModules (0.61.4): 155 | - FBReactNativeSpec (= 0.61.4) 156 | - Folly (= 2018.10.22.00) 157 | - RCTTypeSafety (= 0.61.4) 158 | - React-Core/CoreModulesHeaders (= 0.61.4) 159 | - React-RCTImage (= 0.61.4) 160 | - ReactCommon/turbomodule/core (= 0.61.4) 161 | - React-cxxreact (0.61.4): 162 | - boost-for-react-native (= 1.63.0) 163 | - DoubleConversion 164 | - Folly (= 2018.10.22.00) 165 | - glog 166 | - React-jsinspector (= 0.61.4) 167 | - React-jsi (0.61.4): 168 | - boost-for-react-native (= 1.63.0) 169 | - DoubleConversion 170 | - Folly (= 2018.10.22.00) 171 | - glog 172 | - React-jsi/Default (= 0.61.4) 173 | - React-jsi/Default (0.61.4): 174 | - boost-for-react-native (= 1.63.0) 175 | - DoubleConversion 176 | - Folly (= 2018.10.22.00) 177 | - glog 178 | - React-jsiexecutor (0.61.4): 179 | - DoubleConversion 180 | - Folly (= 2018.10.22.00) 181 | - glog 182 | - React-cxxreact (= 0.61.4) 183 | - React-jsi (= 0.61.4) 184 | - React-jsinspector (0.61.4) 185 | - React-RCTActionSheet (0.61.4): 186 | - React-Core/RCTActionSheetHeaders (= 0.61.4) 187 | - React-RCTAnimation (0.61.4): 188 | - React-Core/RCTAnimationHeaders (= 0.61.4) 189 | - React-RCTBlob (0.61.4): 190 | - React-Core/RCTBlobHeaders (= 0.61.4) 191 | - React-Core/RCTWebSocket (= 0.61.4) 192 | - React-jsi (= 0.61.4) 193 | - React-RCTNetwork (= 0.61.4) 194 | - React-RCTImage (0.61.4): 195 | - React-Core/RCTImageHeaders (= 0.61.4) 196 | - React-RCTNetwork (= 0.61.4) 197 | - React-RCTLinking (0.61.4): 198 | - React-Core/RCTLinkingHeaders (= 0.61.4) 199 | - React-RCTNetwork (0.61.4): 200 | - React-Core/RCTNetworkHeaders (= 0.61.4) 201 | - React-RCTSettings (0.61.4): 202 | - React-Core/RCTSettingsHeaders (= 0.61.4) 203 | - React-RCTText (0.61.4): 204 | - React-Core/RCTTextHeaders (= 0.61.4) 205 | - React-RCTVibration (0.61.4): 206 | - React-Core/RCTVibrationHeaders (= 0.61.4) 207 | - ReactCommon/jscallinvoker (0.61.4): 208 | - DoubleConversion 209 | - Folly (= 2018.10.22.00) 210 | - glog 211 | - React-cxxreact (= 0.61.4) 212 | - ReactCommon/turbomodule/core (0.61.4): 213 | - DoubleConversion 214 | - Folly (= 2018.10.22.00) 215 | - glog 216 | - React-Core (= 0.61.4) 217 | - React-cxxreact (= 0.61.4) 218 | - React-jsi (= 0.61.4) 219 | - ReactCommon/jscallinvoker (= 0.61.4) 220 | - ReactNativeAutogrowTextinput (5.3.0): 221 | - React 222 | - Yoga (1.14.0) 223 | 224 | DEPENDENCIES: 225 | - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) 226 | - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) 227 | - FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`) 228 | - Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`) 229 | - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) 230 | - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`) 231 | - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`) 232 | - React (from `../node_modules/react-native/`) 233 | - React-Core (from `../node_modules/react-native/`) 234 | - React-Core/DevSupport (from `../node_modules/react-native/`) 235 | - React-Core/RCTWebSocket (from `../node_modules/react-native/`) 236 | - React-CoreModules (from `../node_modules/react-native/React/CoreModules`) 237 | - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`) 238 | - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`) 239 | - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) 240 | - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) 241 | - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) 242 | - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) 243 | - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`) 244 | - React-RCTImage (from `../node_modules/react-native/Libraries/Image`) 245 | - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`) 246 | - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`) 247 | - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`) 248 | - React-RCTText (from `../node_modules/react-native/Libraries/Text`) 249 | - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) 250 | - ReactCommon/jscallinvoker (from `../node_modules/react-native/ReactCommon`) 251 | - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) 252 | - ReactNativeAutogrowTextinput (from `../../ReactNativeAutogrowTextinput.podspec`) 253 | - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) 254 | 255 | SPEC REPOS: 256 | trunk: 257 | - boost-for-react-native 258 | 259 | EXTERNAL SOURCES: 260 | DoubleConversion: 261 | :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" 262 | FBLazyVector: 263 | :path: "../node_modules/react-native/Libraries/FBLazyVector" 264 | FBReactNativeSpec: 265 | :path: "../node_modules/react-native/Libraries/FBReactNativeSpec" 266 | Folly: 267 | :podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec" 268 | glog: 269 | :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" 270 | RCTRequired: 271 | :path: "../node_modules/react-native/Libraries/RCTRequired" 272 | RCTTypeSafety: 273 | :path: "../node_modules/react-native/Libraries/TypeSafety" 274 | React: 275 | :path: "../node_modules/react-native/" 276 | React-Core: 277 | :path: "../node_modules/react-native/" 278 | React-CoreModules: 279 | :path: "../node_modules/react-native/React/CoreModules" 280 | React-cxxreact: 281 | :path: "../node_modules/react-native/ReactCommon/cxxreact" 282 | React-jsi: 283 | :path: "../node_modules/react-native/ReactCommon/jsi" 284 | React-jsiexecutor: 285 | :path: "../node_modules/react-native/ReactCommon/jsiexecutor" 286 | React-jsinspector: 287 | :path: "../node_modules/react-native/ReactCommon/jsinspector" 288 | React-RCTActionSheet: 289 | :path: "../node_modules/react-native/Libraries/ActionSheetIOS" 290 | React-RCTAnimation: 291 | :path: "../node_modules/react-native/Libraries/NativeAnimation" 292 | React-RCTBlob: 293 | :path: "../node_modules/react-native/Libraries/Blob" 294 | React-RCTImage: 295 | :path: "../node_modules/react-native/Libraries/Image" 296 | React-RCTLinking: 297 | :path: "../node_modules/react-native/Libraries/LinkingIOS" 298 | React-RCTNetwork: 299 | :path: "../node_modules/react-native/Libraries/Network" 300 | React-RCTSettings: 301 | :path: "../node_modules/react-native/Libraries/Settings" 302 | React-RCTText: 303 | :path: "../node_modules/react-native/Libraries/Text" 304 | React-RCTVibration: 305 | :path: "../node_modules/react-native/Libraries/Vibration" 306 | ReactCommon: 307 | :path: "../node_modules/react-native/ReactCommon" 308 | ReactNativeAutogrowTextinput: 309 | :path: "../../ReactNativeAutogrowTextinput.podspec" 310 | Yoga: 311 | :path: "../node_modules/react-native/ReactCommon/yoga" 312 | 313 | SPEC CHECKSUMS: 314 | boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c 315 | DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2 316 | FBLazyVector: feb35a6b7f7b50f367be07f34012f34a79282fa3 317 | FBReactNativeSpec: 51477b84b1bf7ab6f9ef307c24e3dd675391be44 318 | Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51 319 | glog: 1f3da668190260b06b429bb211bfbee5cd790c28 320 | RCTRequired: f3b3fb6f4723e8e52facb229d0c75fdc76773849 321 | RCTTypeSafety: 2ec60de6abb1db050b56ecc4b60188026078fd10 322 | React: 10e0130b57e55a7cd8c3dee37c1261102ce295f4 323 | React-Core: 636212410772d05f3a1eb79d965df2962ca1c70b 324 | React-CoreModules: 6f70d5e41919289c582f88c9ad9923fe5c87400a 325 | React-cxxreact: ddecbe9157ec1743f52ea17bf8d95debc0d6e846 326 | React-jsi: ca921f4041505f9d5197139b2d09eeb020bb12e8 327 | React-jsiexecutor: 8dfb73b987afa9324e4009bdce62a18ce23d983c 328 | React-jsinspector: d15478d0a8ada19864aa4d1cc1c697b41b3fa92f 329 | React-RCTActionSheet: 7369b7c85f99b6299491333affd9f01f5a130c22 330 | React-RCTAnimation: d07be15b2bd1d06d89417eb0343f98ffd2b099a7 331 | React-RCTBlob: 8e0b23d95c9baa98f6b0e127e07666aaafd96c34 332 | React-RCTImage: 443050d14a66e8c2332e9c055f45689d23e15cc7 333 | React-RCTLinking: ce9a90ba155aec41be49e75ec721bbae2d48a47e 334 | React-RCTNetwork: 41fe54bacc67dd00e6e4c4d30dd98a13e4beabc8 335 | React-RCTSettings: 45e3e0a6470310b2dab2ccc6d1d73121ba3ea936 336 | React-RCTText: 21934e0a51d522abcd0a275407e80af45d6fd9ec 337 | React-RCTVibration: 0f76400ee3cec6edb9c125da49fed279340d145a 338 | ReactCommon: a6a294e7028ed67b926d29551aa9394fd989c24c 339 | ReactNativeAutogrowTextinput: 14bd6349ec4fed9231ca141ad3f1dbadf2f63e4c 340 | Yoga: ba3d99dbee6c15ea6bbe3783d1f0cb1ffb79af0f 341 | 342 | PODFILE CHECKSUM: c0a6ae5875e8262ab1db93070a2c0c03612fc531 343 | 344 | COCOAPODS: 1.8.4 345 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "AutogrowTextinput", 3 | "version": "0.0.2", 4 | "private": true, 5 | "scripts": { 6 | "android": "react-native run-android", 7 | "ios": "react-native run-ios", 8 | "start": "react-native start", 9 | "test": "jest", 10 | "lint": "eslint ." 11 | }, 12 | "dependencies": { 13 | "react": "16.9.0", 14 | "react-native": "0.61.4", 15 | "metro-react-native-babel-preset": "^0.53.1", 16 | "react-native-autogrow-textinput": "latest" 17 | }, 18 | "devDependencies": { 19 | "@babel/core": "7.7.2", 20 | "@babel/runtime": "7.7.2", 21 | "@react-native-community/eslint-config": "0.0.5", 22 | "babel-jest": "24.9.0", 23 | "eslint": "6.6.0", 24 | "jest": "24.9.0", 25 | "metro-react-native-babel-preset": "0.56.3", 26 | "react-test-renderer": "16.9.0" 27 | }, 28 | "jest": { 29 | "preset": "react-native" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import AutoGrowingTextInput from './src/AutoGrowingTextInput'; 2 | 3 | export {AutoGrowingTextInput}; 4 | -------------------------------------------------------------------------------- /ios/AutoGrowTextInput.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D81C365E1CDB66A600777FB9 /* AutogrowTextInputManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D81C365D1CDB66A600777FB9 /* AutogrowTextInputManager.m */; }; 11 | /* End PBXBuildFile section */ 12 | 13 | /* Begin PBXCopyFilesBuildPhase section */ 14 | D81C364E1CDB667F00777FB9 /* CopyFiles */ = { 15 | isa = PBXCopyFilesBuildPhase; 16 | buildActionMask = 2147483647; 17 | dstPath = "include/$(PRODUCT_NAME)"; 18 | dstSubfolderSpec = 16; 19 | files = ( 20 | ); 21 | runOnlyForDeploymentPostprocessing = 0; 22 | }; 23 | /* End PBXCopyFilesBuildPhase section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | D81C36501CDB667F00777FB9 /* libAutoGrowTextInput.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libAutoGrowTextInput.a; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | D81C365C1CDB66A600777FB9 /* AutogrowTextInputManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutogrowTextInputManager.h; sourceTree = SOURCE_ROOT; }; 28 | D81C365D1CDB66A600777FB9 /* AutogrowTextInputManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AutogrowTextInputManager.m; sourceTree = SOURCE_ROOT; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | D81C364D1CDB667F00777FB9 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | D81C36471CDB667F00777FB9 = { 43 | isa = PBXGroup; 44 | children = ( 45 | D81C36521CDB667F00777FB9 /* AutoGrowTextInput */, 46 | D81C36511CDB667F00777FB9 /* Products */, 47 | ); 48 | sourceTree = ""; 49 | }; 50 | D81C36511CDB667F00777FB9 /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | D81C36501CDB667F00777FB9 /* libAutoGrowTextInput.a */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | D81C36521CDB667F00777FB9 /* AutoGrowTextInput */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | D81C365C1CDB66A600777FB9 /* AutogrowTextInputManager.h */, 62 | D81C365D1CDB66A600777FB9 /* AutogrowTextInputManager.m */, 63 | ); 64 | path = AutoGrowTextInput; 65 | sourceTree = ""; 66 | }; 67 | /* End PBXGroup section */ 68 | 69 | /* Begin PBXNativeTarget section */ 70 | D81C364F1CDB667F00777FB9 /* AutoGrowTextInput */ = { 71 | isa = PBXNativeTarget; 72 | buildConfigurationList = D81C36591CDB667F00777FB9 /* Build configuration list for PBXNativeTarget "AutoGrowTextInput" */; 73 | buildPhases = ( 74 | D81C364C1CDB667F00777FB9 /* Sources */, 75 | D81C364D1CDB667F00777FB9 /* Frameworks */, 76 | D81C364E1CDB667F00777FB9 /* CopyFiles */, 77 | ); 78 | buildRules = ( 79 | ); 80 | dependencies = ( 81 | ); 82 | name = AutoGrowTextInput; 83 | productName = AutoGrowTextInput; 84 | productReference = D81C36501CDB667F00777FB9 /* libAutoGrowTextInput.a */; 85 | productType = "com.apple.product-type.library.static"; 86 | }; 87 | /* End PBXNativeTarget section */ 88 | 89 | /* Begin PBXProject section */ 90 | D81C36481CDB667F00777FB9 /* Project object */ = { 91 | isa = PBXProject; 92 | attributes = { 93 | LastUpgradeCheck = 0730; 94 | ORGANIZATIONNAME = wix; 95 | TargetAttributes = { 96 | D81C364F1CDB667F00777FB9 = { 97 | CreatedOnToolsVersion = 7.3; 98 | }; 99 | }; 100 | }; 101 | buildConfigurationList = D81C364B1CDB667F00777FB9 /* Build configuration list for PBXProject "AutoGrowTextInput" */; 102 | compatibilityVersion = "Xcode 3.2"; 103 | developmentRegion = English; 104 | hasScannedForEncodings = 0; 105 | knownRegions = ( 106 | en, 107 | ); 108 | mainGroup = D81C36471CDB667F00777FB9; 109 | productRefGroup = D81C36511CDB667F00777FB9 /* Products */; 110 | projectDirPath = ""; 111 | projectRoot = ""; 112 | targets = ( 113 | D81C364F1CDB667F00777FB9 /* AutoGrowTextInput */, 114 | ); 115 | }; 116 | /* End PBXProject section */ 117 | 118 | /* Begin PBXSourcesBuildPhase section */ 119 | D81C364C1CDB667F00777FB9 /* Sources */ = { 120 | isa = PBXSourcesBuildPhase; 121 | buildActionMask = 2147483647; 122 | files = ( 123 | D81C365E1CDB66A600777FB9 /* AutogrowTextInputManager.m in Sources */, 124 | ); 125 | runOnlyForDeploymentPostprocessing = 0; 126 | }; 127 | /* End PBXSourcesBuildPhase section */ 128 | 129 | /* Begin XCBuildConfiguration section */ 130 | D81C36571CDB667F00777FB9 /* Debug */ = { 131 | isa = XCBuildConfiguration; 132 | buildSettings = { 133 | ALWAYS_SEARCH_USER_PATHS = NO; 134 | CLANG_ANALYZER_NONNULL = YES; 135 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 136 | CLANG_CXX_LIBRARY = "libc++"; 137 | CLANG_ENABLE_MODULES = YES; 138 | CLANG_ENABLE_OBJC_ARC = YES; 139 | CLANG_WARN_BOOL_CONVERSION = YES; 140 | CLANG_WARN_CONSTANT_CONVERSION = YES; 141 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 142 | CLANG_WARN_EMPTY_BODY = YES; 143 | CLANG_WARN_ENUM_CONVERSION = YES; 144 | CLANG_WARN_INT_CONVERSION = YES; 145 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 146 | CLANG_WARN_UNREACHABLE_CODE = YES; 147 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 148 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 149 | COPY_PHASE_STRIP = NO; 150 | DEBUG_INFORMATION_FORMAT = dwarf; 151 | ENABLE_STRICT_OBJC_MSGSEND = YES; 152 | ENABLE_TESTABILITY = YES; 153 | GCC_C_LANGUAGE_STANDARD = gnu99; 154 | GCC_DYNAMIC_NO_PIC = NO; 155 | GCC_NO_COMMON_BLOCKS = YES; 156 | GCC_OPTIMIZATION_LEVEL = 0; 157 | GCC_PREPROCESSOR_DEFINITIONS = ( 158 | "DEBUG=1", 159 | "$(inherited)", 160 | ); 161 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 162 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 163 | GCC_WARN_UNDECLARED_SELECTOR = YES; 164 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 165 | GCC_WARN_UNUSED_FUNCTION = YES; 166 | GCC_WARN_UNUSED_VARIABLE = YES; 167 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 168 | MTL_ENABLE_DEBUG_INFO = YES; 169 | ONLY_ACTIVE_ARCH = YES; 170 | SDKROOT = iphoneos; 171 | }; 172 | name = Debug; 173 | }; 174 | D81C36581CDB667F00777FB9 /* Release */ = { 175 | isa = XCBuildConfiguration; 176 | buildSettings = { 177 | ALWAYS_SEARCH_USER_PATHS = NO; 178 | CLANG_ANALYZER_NONNULL = YES; 179 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 180 | CLANG_CXX_LIBRARY = "libc++"; 181 | CLANG_ENABLE_MODULES = YES; 182 | CLANG_ENABLE_OBJC_ARC = YES; 183 | CLANG_WARN_BOOL_CONVERSION = YES; 184 | CLANG_WARN_CONSTANT_CONVERSION = YES; 185 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 186 | CLANG_WARN_EMPTY_BODY = YES; 187 | CLANG_WARN_ENUM_CONVERSION = YES; 188 | CLANG_WARN_INT_CONVERSION = YES; 189 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 190 | CLANG_WARN_UNREACHABLE_CODE = YES; 191 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 192 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 193 | COPY_PHASE_STRIP = NO; 194 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 195 | ENABLE_NS_ASSERTIONS = NO; 196 | ENABLE_STRICT_OBJC_MSGSEND = YES; 197 | GCC_C_LANGUAGE_STANDARD = gnu99; 198 | GCC_NO_COMMON_BLOCKS = YES; 199 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 200 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 201 | GCC_WARN_UNDECLARED_SELECTOR = YES; 202 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 203 | GCC_WARN_UNUSED_FUNCTION = YES; 204 | GCC_WARN_UNUSED_VARIABLE = YES; 205 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 206 | MTL_ENABLE_DEBUG_INFO = NO; 207 | SDKROOT = iphoneos; 208 | VALIDATE_PRODUCT = YES; 209 | }; 210 | name = Release; 211 | }; 212 | D81C365A1CDB667F00777FB9 /* Debug */ = { 213 | isa = XCBuildConfiguration; 214 | buildSettings = { 215 | HEADER_SEARCH_PATHS = ( 216 | "$(inherited)", 217 | "$(SRCROOT)/../../react-native/React/**", 218 | "$(SRCROOT)/../../react-native/Libraries/Text", 219 | ); 220 | OTHER_LDFLAGS = "-ObjC"; 221 | PRODUCT_NAME = "$(TARGET_NAME)"; 222 | SKIP_INSTALL = YES; 223 | }; 224 | name = Debug; 225 | }; 226 | D81C365B1CDB667F00777FB9 /* Release */ = { 227 | isa = XCBuildConfiguration; 228 | buildSettings = { 229 | HEADER_SEARCH_PATHS = ( 230 | "$(inherited)", 231 | "$(SRCROOT)/../../react-native/React/**", 232 | "$(SRCROOT)/../../react-native/Libraries/Text", 233 | ); 234 | OTHER_LDFLAGS = "-ObjC"; 235 | PRODUCT_NAME = "$(TARGET_NAME)"; 236 | SKIP_INSTALL = YES; 237 | }; 238 | name = Release; 239 | }; 240 | /* End XCBuildConfiguration section */ 241 | 242 | /* Begin XCConfigurationList section */ 243 | D81C364B1CDB667F00777FB9 /* Build configuration list for PBXProject "AutoGrowTextInput" */ = { 244 | isa = XCConfigurationList; 245 | buildConfigurations = ( 246 | D81C36571CDB667F00777FB9 /* Debug */, 247 | D81C36581CDB667F00777FB9 /* Release */, 248 | ); 249 | defaultConfigurationIsVisible = 0; 250 | defaultConfigurationName = Release; 251 | }; 252 | D81C36591CDB667F00777FB9 /* Build configuration list for PBXNativeTarget "AutoGrowTextInput" */ = { 253 | isa = XCConfigurationList; 254 | buildConfigurations = ( 255 | D81C365A1CDB667F00777FB9 /* Debug */, 256 | D81C365B1CDB667F00777FB9 /* Release */, 257 | ); 258 | defaultConfigurationIsVisible = 0; 259 | defaultConfigurationName = Release; 260 | }; 261 | /* End XCConfigurationList section */ 262 | }; 263 | rootObject = D81C36481CDB667F00777FB9 /* Project object */; 264 | } 265 | -------------------------------------------------------------------------------- /ios/AutoGrowTextInput.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/AutogrowTextInputManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // AutogrowTextInputManager.h 3 | // example 4 | // 5 | // Created by Artal Druk on 05/05/2016. 6 | // Copyright © 2016 Wix.com. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #if __has_include() 12 | #import 13 | #else 14 | #import "RCTBridgeModule.h" 15 | #endif 16 | 17 | @interface AutoGrowTextInputManager : NSObject 18 | @end 19 | -------------------------------------------------------------------------------- /ios/AutogrowTextInputManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // AutogrowTextInputManager.m 3 | // example 4 | // 5 | // Created by Artal Druk on 05/05/2016. 6 | // Copyright © 2016 Wix.com. All rights reserved. 7 | // 8 | 9 | #import "AutogrowTextInputManager.h" 10 | 11 | #import 12 | #import 13 | 14 | #import 15 | 16 | NSUInteger const kMaxDeferedGetScrollView = 15; 17 | NSUInteger const kAdditionalOffset = 5; 18 | 19 | @interface AutoGrowTextInputManager () 20 | { 21 | NSMapTable *_inputToScrollViews; 22 | NSUInteger _deferedInitializeAccessoryViewsCount; 23 | } 24 | @end 25 | 26 | @implementation AutoGrowTextInputManager 27 | 28 | @synthesize bridge = _bridge; 29 | 30 | RCT_EXPORT_MODULE(); 31 | 32 | - (dispatch_queue_t)methodQueue 33 | { 34 | return dispatch_get_main_queue(); 35 | } 36 | 37 | #pragma mark - public API 38 | 39 | RCT_EXPORT_METHOD(applySettingsForInput:(nonnull NSNumber *)textInputReactTag settings:(NSDictionary*)settings) 40 | { 41 | UITextView *uiTextView = [self getTextViewForInput:textInputReactTag]; 42 | if (uiTextView != nil) 43 | { 44 | if([settings[@"enableScrollToCaret"] boolValue]) 45 | { 46 | _deferedInitializeAccessoryViewsCount = 0; 47 | 48 | dispatch_async(dispatch_get_main_queue(), ^{ 49 | dispatch_async(dispatch_get_main_queue(), ^{ 50 | [self getScrollViewContainerForTextView:uiTextView completion:^(UIScrollView* scrollView) 51 | { 52 | if(scrollView != nil) 53 | { 54 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onTextViewDidChangeNotification:) name:UITextViewTextDidChangeNotification object:uiTextView]; 55 | 56 | if(_inputToScrollViews == nil) 57 | { 58 | _inputToScrollViews = [NSMapTable weakToWeakObjectsMapTable]; 59 | } 60 | [_inputToScrollViews setObject:scrollView forKey:uiTextView]; 61 | } 62 | }]; 63 | }); 64 | }); 65 | } 66 | } 67 | } 68 | 69 | RCT_EXPORT_METHOD(performCleanupForInput:(nonnull NSNumber *)textInputReactTag) 70 | { 71 | UITextView *uiTextView = [self getTextViewForInput:textInputReactTag]; 72 | if (uiTextView != nil) 73 | { 74 | [[NSNotificationCenter defaultCenter] removeObserver:uiTextView]; 75 | } 76 | } 77 | 78 | #pragma mark - utility methods 79 | 80 | -(UITextView*)getTextViewForInput:(nonnull NSNumber *)textInputReactTag 81 | { 82 | UIView *_textView = [self.bridge.uiManager viewForReactTag:textInputReactTag]; 83 | if ([_textView isKindOfClass:NSClassFromString(@"RCTMultilineTextInputView")]) 84 | { 85 | return [_textView valueForKey:@"_backedTextInputView"]; 86 | } 87 | else if ([_textView isKindOfClass:NSClassFromString(@"RCTTextView")]) 88 | { 89 | return [_textView valueForKey:@"_backedTextInput"]; 90 | } 91 | return nil; 92 | } 93 | 94 | -(UIScrollView*)getScrollContainerForTextView:(UITextView*)textView 95 | { 96 | UIView *view = textView; 97 | while (view.superview != nil) 98 | { 99 | view = view.superview; 100 | if ([view isKindOfClass:[RCTScrollView class]]) 101 | break; 102 | } 103 | 104 | if ([view isKindOfClass:[RCTScrollView class]]) 105 | { 106 | RCTScrollView *rctScrollView = (RCTScrollView *)view; 107 | UIScrollView *scrollView = [rctScrollView valueForKey:@"_scrollView"]; 108 | return scrollView; 109 | } 110 | return nil; 111 | } 112 | 113 | -(void) getScrollViewContainerForTextView:(UITextView*)textView completion:(void (^ __nullable)(UIScrollView* scrollView))completion 114 | { 115 | if (_deferedInitializeAccessoryViewsCount < kMaxDeferedGetScrollView) 116 | { 117 | _deferedInitializeAccessoryViewsCount++; 118 | 119 | UIScrollView *scrollView = [self getScrollContainerForTextView:textView]; 120 | if(scrollView != nil) 121 | { 122 | completion(scrollView); 123 | } 124 | else 125 | { 126 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 127 | [self getScrollViewContainerForTextView:textView completion:completion]; 128 | }); 129 | } 130 | } 131 | else 132 | { 133 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 134 | UIScrollView *scrollView = [self getScrollContainerForTextView:textView]; 135 | completion(scrollView); 136 | }); 137 | } 138 | } 139 | 140 | -(void)onTextViewDidChangeNotification:(NSNotification *)notif 141 | { 142 | UITextView *textView = notif.object; 143 | UIScrollView *scrollView = [_inputToScrollViews objectForKey:textView]; 144 | if(scrollView != nil) 145 | { 146 | CGRect caretRect = [textView caretRectForPosition:textView.selectedTextRange.end]; 147 | if(caretRect.size.width > 0 && caretRect.size.height > 0) 148 | { 149 | CGFloat carretAdditionalSize = 0; 150 | if (caretRect.origin.x == 0) { 151 | carretAdditionalSize = caretRect.size.height; 152 | } 153 | 154 | caretRect = [scrollView convertRect:caretRect fromView:textView]; 155 | caretRect.origin.y += carretAdditionalSize; 156 | 157 | CGRect visibleRect = CGRectMake(0, scrollView.contentOffset.y, scrollView.frame.size.width, scrollView.frame.size.height - scrollView.contentInset.bottom); 158 | if (caretRect.origin.y + caretRect.size.height + kAdditionalOffset > visibleRect.size.height + visibleRect.origin.y) 159 | { 160 | BOOL caretIsAboveVisibleRect = caretRect.origin.y + caretRect.size.height < visibleRect.origin.y; 161 | CGFloat yOffset = caretIsAboveVisibleRect ? caretRect.origin.y - kAdditionalOffset : caretRect.origin.y - visibleRect.size.height + caretRect.size.height + kAdditionalOffset; 162 | [scrollView setContentOffset:CGPointMake(scrollView.contentOffset.x, yOffset) animated:NO]; 163 | } 164 | } 165 | else 166 | { 167 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 168 | [self onTextViewDidChangeNotification:notif]; 169 | }); 170 | } 171 | } 172 | } 173 | 174 | @end 175 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-autogrow-textinput", 3 | "publishConfig": { 4 | "registry": "https://registry.npmjs.org/" 5 | }, 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/wix/react-native-autogrow-textinput.git" 9 | }, 10 | "version": "5.4.0", 11 | "description": "React Native auto-growing multiline text input", 12 | "nativePackage": true, 13 | "bugs": { 14 | "url": "https://github.com/wix/react-native-autogrow-textinput/issues" 15 | }, 16 | "homepage": "https://github.com/wix/react-native-autogrow-textinput", 17 | "main": "index.js", 18 | "author": "Artal Druk ", 19 | "license": "MIT", 20 | "peerDependencies": { 21 | "react-native": ">=0.51.0", 22 | "react": ">=16.0.0" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/AutoGrowingTextInput.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import ReactNative, {TextInput, Platform, NativeModules} from 'react-native'; 3 | import PropTypes from 'prop-types'; 4 | 5 | const ANDROID_PLATFORM = (Platform.OS === 'android'); 6 | 7 | const AutoGrowTextInputManager = NativeModules.AutoGrowTextInputManager; 8 | 9 | export default class AutoGrowingTextInput extends Component { 10 | constructor(props) { 11 | super(props); 12 | this.setNativeProps = this.setNativeProps.bind(this); 13 | } 14 | 15 | componentDidMount() { 16 | if(this.shouldApplyNativeSettings()) { 17 | const reactTag = this.textInputReactTag(); 18 | if (reactTag) { 19 | AutoGrowTextInputManager.applySettingsForInput(reactTag, { 20 | enableScrollToCaret: this.props.enableScrollToCaret, 21 | maxHeight: this.props.maxHeight 22 | }); 23 | } 24 | } 25 | } 26 | 27 | componentWillUnmount() { 28 | if(this.shouldApplyNativeSettings()) { 29 | const reactTag = this.textInputReactTag(); 30 | if (reactTag) { 31 | AutoGrowTextInputManager.performCleanupForInput(reactTag); 32 | } 33 | } 34 | } 35 | 36 | shouldApplyNativeSettings() { 37 | return AutoGrowTextInputManager && (ANDROID_PLATFORM || this.props.enableScrollToCaret); 38 | } 39 | 40 | textInputReactTag() { 41 | if (this._textInput) { 42 | return ReactNative.findNodeHandle(this._textInput); 43 | } 44 | } 45 | 46 | render() { 47 | return ( 48 | { this._textInput = r; }} 53 | /> 54 | ); 55 | } 56 | 57 | setNativeProps(nativeProps = {}) { 58 | this._textInput.setNativeProps(nativeProps); 59 | } 60 | 61 | resetHeightToMin() { 62 | this.setNativeProps({text: ''}); 63 | } 64 | 65 | clear() { 66 | if (ANDROID_PLATFORM) { 67 | // fix for predictive text issues can be removed once https://github.com/facebook/react-native/pull/12462 is merged 68 | AutoGrowTextInputManager.resetKeyboardInput(ReactNative.findNodeHandle(this._textInput)) 69 | } 70 | return this._textInput.clear(); 71 | } 72 | 73 | focus() { 74 | return this._textInput.focus(); 75 | } 76 | 77 | blur() { 78 | this._textInput.blur(); 79 | } 80 | 81 | isFocused() { 82 | return this._textInput.isFocused(); 83 | } 84 | 85 | getRef() { 86 | return this._textInput; 87 | } 88 | } 89 | 90 | AutoGrowingTextInput.propTypes = { 91 | ...TextInput.propTypes, 92 | enableScrollToCaret: PropTypes.bool, 93 | }; 94 | AutoGrowingTextInput.defaultProps = { 95 | ...TextInput.defaultProps, 96 | enableScrollToCaret: false, 97 | }; 98 | --------------------------------------------------------------------------------