Uncontrolled multiline TextInput doesn't auto-grow
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C++
- Sterne
- 127k
- Forks
- 25.3k
- Ø Merge
- 1 T. 23 Std.
- Gemergte PRs (30 T.)
- 4
Beschreibung
Description
Uncontrolled multiline TextInput doesn't grow in size when its content spans multiple lines while typing.
Minimum reproducible code:
<View
style={{ height: 500, justifyContent: "center", padding: 20, width: 180 }}
>
<TextInput
multiline
placeholder="height increases"
defaultValue="super long text that will cause the height to span multiple lines"
enablesReturnKeyAutomatically={true}
returnKeyType="go"
style={{
borderWidth: 1,
fontSize: 13,
padding: 4,
// multilineExpandable
height: "auto",
maxHeight: 100,
}}
/>
</View>
https://github.com/user-attachments/assets/e898cc86-822d-4041-878b-b5f8ae3e3653
If the defaultValue is long enough to take multiple lines, then it does auto-grow/shrink on subsequent edits
https://github.com/user-attachments/assets/cf9ddb1b-450c-463c-9876-a0bf90274d27
Steps to reproduce
- paste the reproduction code snippet to an empty screen
- try typing into the input until the content starts wrapping
React Native Version
0.81.4
Affected Platforms
Runtime - iOS
Output of npx @react-native-community/cli info
System:
OS: macOS 26.1
CPU: (10) arm64 Apple M4
Memory: 1.16 GB / 32.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 24.8.0
path: ~/.nvm/versions/node/v24.8.0/bin/node
Yarn:
version: 4.9.2
path: ~/.n/bin/yarn
npm:
version: 11.6.0
path: ~/.nvm/versions/node/v24.8.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 25.1
- iOS 26.1
- macOS 26.1
- tvOS 26.1
- visionOS 26.1
- watchOS 26.1
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode:
version: 26.1.1/17B100
path: /usr/bin/xcodebuild
Languages:
Java:
version: javac 25
path: ~/.sdkman/candidates/java/current/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 19.1.0
wanted: "*"
react-native:
installed: 0.81.4
wanted: "*"
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Stacktrace or Logs
-
MANDATORY Reproducer
https://snack.expo.dev/@vova.sqds/uncontrolled-multiline-textinput-doesnt-auto-grow
Screenshots and Videos
No response
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit dem Ausführen des obligatorischen Expo Snack-Reproduzierers und bestätige das Verhalten des unkontrollierten mehrzeiligen TextInput unter iOS. Verfolge anschließend die Implementierung von React Native TextInput für mehrere Zeilen und dessen iOS-Pfad. Als abgeschlossen gilt die Aufgabe, wenn sich die Eingabe beim Tippen mit einem langen defaultValue vergrößert und verkleinert, maxHeight berücksichtigt wird und eine Regressionstestabdeckung vorhanden ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- react-native, typescript
- Bereich
- mobile
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 62/100