question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[patch-package fix] #2979 label covers text on iOS multiline TextInput

See original GitHub issue

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-paper@4.11.1 for the project I’m working on.

There was a PR that tried to fix the iOS multiline label covering the underlying text, unfortunately this added a bigger issue of the label covering the underlying text even if no label was present. On top of this, it used a backgroundColor that was not controllable from the component (hardcoded in react-native-paper) - which meant if someone specified their own backgroundColor the label would have a different backgroundColor.

This simple patch-package checks if a label is present, and if so renders the label container, and also matches the backgroundColor with the backgroundColor set in style prop of TextInput.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-paper/src/components/TextInput/TextInputFlat.tsx b/node_modules/react-native-paper/src/components/TextInput/TextInputFlat.tsx
index d5c9bee..8700a07 100644
--- a/node_modules/react-native-paper/src/components/TextInput/TextInputFlat.tsx
+++ b/node_modules/react-native-paper/src/components/TextInput/TextInputFlat.tsx
@@ -331,7 +331,7 @@ class TextInputFlat extends React.Component<ChildTextInputProps> {
             },
           ]}
         >
-          {!isAndroid && multiline && (
+          {!isAndroid && multiline && label && (
             // Workaround for: https://github.com/callstack/react-native-paper/issues/2799
             // Patch for a multiline TextInput with fixed height, which allow to avoid covering input label with its value.
             <View
@@ -341,7 +341,7 @@ class TextInputFlat extends React.Component<ChildTextInputProps> {
                 StyleSheet.absoluteFill,
                 dense ? styles.densePatchContainer : styles.patchContainer,
                 {
-                  backgroundColor: containerStyle.backgroundColor,
+                  backgroundColor: viewStyle.backgroundColor,
                   left: paddingLeft,
                   right: paddingRight,
                 },

This issue body was partially generated by patch-package.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
NotoriousGBGcommented, Jan 18, 2022

@lukewalczak I just upgraded to 4.11.2 but the issue persists.

1reaction
Svartocommented, Jan 13, 2022

@Insider32 @jensonjohn001 alright, I am on it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

SwiftUI Multi-line Text Fields - Use Your Loaf
In iOS 16, SwiftUI text fields can grow beyond a single line and scroll vertically when needed.
Read more >
Detecting send/submit button in a multi-line TextInput
Is there a way to detect when the user presses the enter/submit/send (depending on which keyboard layout is specified) button after entering some...
Read more >
index-5.xml - Microsoft Support
... -don-t-support-two-step-verification-5896ed9b-4263-e681-128a-a6f2979a7944 ... https://support.microsoft.com/en-gb/topic/error-message-in-excel-when-you- ...
Read more >
react-native-autogrow-textinput | Yarn - Package Manager
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...
Read more >
iOS : React Native multi line TextInput, text is centered
iOS : React Native multi line TextInput, text is centered [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] iOS : React ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found