web-dev-qa-db-ja.com

React NativeのinputTextの下線を削除します

入力テキストの下線を削除できません

enter image description here

24
Nima

私はそれがあるべきだと思う

underlineColorAndroid="transparent"

関連する問題を参照してください https://github.com/facebook/react-native/issues/10108

43
vinayr

TextInputコンポーネントのunderlineColorAndroidプロパティを使用する

<TextInput underlineColorAndroid='transparent'
           placeholder="type here ..">
 TXT
</TextInput>
19
vijay22uk

TextFieldのプロップをフォローすることは私にとってはうまくいきます

underlineColorAndroid='rgba(0,0,0,0)' 
3
Urska

簡単な解決策を見つけました

underlineColorAndroid='#FFF'
3
Nima

underlineColorAndroid="transparent"私のために完全に働いています

<TextInput underlineColorAndroid="transparent" placeholder="Your Placeholder" />

ここでの議論を参照

1
Prafull Sharma

上記の答えに同意しますが、次の問題がランダムに発生します

https://github.com/facebook/react-native/issues/18214

NullPointerException:仮想メソッド 'Android.graphics.drawable.Drawableを呼び出そうとしないAndroid.graphics.drawable.Drawable $ ConstantState.newDrawable(Android.content.res.Resources)

だから私は他の解決策を考え出す。 style.xmlに編集ボックススタイルを追加しました

<item name="Android:background">@Android:color/transparent</item>

---------------------------完全なコード--------------------- ---------------

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="Android:windowBackground">@color/backgroundcolor</item>
        <item name="Android:editTextStyle">@style/AppEditTextStyle</item>
    </style>
    <style name="AppEditTextStyle" parent="@style/Widget.AppCompat.EditText">
        <item name="Android:background">@Android:color/transparent</item>
        <item name="Android:minHeight">40dp</item>
    </style>
1
Rajesh Nasit

underlineColorAndroid = "transparent"は私のために働いた。

/*This is an Example to Remove TextInput Underline in React Native*/
import React, { Component } from 'react';
//import react in our project
import { TextInput, View } from 'react-native';
//import all the components we will need in our project

export default class App extends Component {
  render() {
    return (
      <View
        style={{
          justifyContent: 'center',
          flex: 1,
          margin: 10,
        }}>
        <TextInput
          placeholder="https://aboutreact.com"
          placeholderTextColor="#ED2525"
          //We have to use this to remove underline
          underlineColorAndroid="transparent"
          fontSize="25"
          style={{
            textAlign: 'center',
            height: 50,
            backgroundColor: '#808080',
          }}
        />
      </View>
    );
  }
}

enter image description here

0
snehal agrawal

入力コンテナから下線を正確に削除する方法は1つしか見つかりませんでした。

<TextField
    placeholder="[email protected]" 
    InputProps={{ disableUnderline: true }}
/>
0
slavitto