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.

Removing web outline in textinput

See original GitHub issue

Environment

react-native-paper: 3.0.0

Ask your Question

When using textinput with react-native-web it appears an additional line surrounding the input (I have tested it in chrome). In the flat mode, it is ok, but in the outlined, this line crosses out the label when focusing on the input as shown in the image: Captura de pantalla de 2019-10-23 12-43-47

Researching a little bit, I have found a solution that consists in adding to the input style outline: 'none'. In order not to affect the visualization in Android and IOs this line should be placed inside a Platform selection like:

Platform.select({
    web: {
        input: {
          outline: 'none',
    },
}

I have been trying to inject this style into the input but I have not found a way to do it. How can I do it?

Inserting this style line directly in the browser’s element inspector solves the problem: Captura de pantalla de 2019-10-23 12-52-56

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

7reactions
venitscommented, Oct 23, 2019

The easiest way:

In you web project add something like this to your index.css or somewhere where you handle CSS.

input {
  outline: none !important;
}

It will remove outline from all inputs on web 😃

2reactions
actuallymentorcommented, Jul 24, 2020

I ended up doing this:

import { Platform } from 'react-native'

const noGlow = `
textarea, select, input, button {
	-webkit-appearance: none;
	outline: none!important;
}
textarea:focus, select:focus, input:focus, button:focus {
	-webkit-appearance: none;
	outline: none!important;
}
`

export const injectWebCss = f => {

	// Only on web
	if ( !Platform.OS == 'web' ) return

	// Inject style
	const style = document.createElement('style')
	style.textContent = `textarea, select, input, button { outline: none!important; }`
	return document.head.append(style)

}

// 👉 And this in the App.js file
injectWebCss()
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Remove Outline around Text Input Boxes in Chrome ...
Answer: Use CSS outline property ... In Google Chrome browser form controls like <input> , <textarea> and <select> highlighted with blue outline around...
Read more >
How to Remove and Style the Border Around Text Input Boxes ...
Remove the outline and add a border style using the :focus and :active pseudo-classes with the <input> field. Also, you can remove the...
Read more >
How to remove focus border (outline) around text/input boxes ...
This border is used to show that the element is focused (i.e. you can type in the input or press the button with...
Read more >
How to remove outline around text input boxes ... - Studytonight
The CSS outline property can be used to remove the outline from the text input boxes. Use focus class with outline:none property to...
Read more >
How to remove outline around text input ... - GeeksforGeeks
Generally in the case of Google Chrome Browser, when the input field gets focus then the blue outline occurred on the border of...
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