簡體   English   中英

TextInput中的文本在ios上的位置不正確

[英]Text in TextInput not in correct position on ios

我在一個使用flex放置在中心的View有一個textInput 問題是,當您開始在textInput編寫內容時,即使我沒有那樣設置樣式,文本也會居中...

初始光標位於正確的位置,但是一旦用戶開始鍵入,文本就會居中。

奇怪的是,這個問題僅與ios有關,而不與android有關。

我嘗試添加textAlign: left樣式,但是沒有任何作用。 我在做什么錯,該如何解決?

這是項目的鏈接https : //snack.expo.io/S1PlOqFvN

import React from 'react';
import { StyleSheet, Text, View, TextInput } from 'react-native';

export default class App extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <TextInput style={styles.textFieldStyling} placeholder="Try typing something..."></TextInput>
        <Text style={styles.textStyling}></Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: 'orange',
    alignItems: 'center',
    justifyContent: 'center',
  },
  textStyling: {
    fontSize: 50,
    textAlign: 'center',
  },
  textFieldStyling: {
      color: 'blue',
  },
});

React Native中的TextInput沒有關閉標簽

  <TextInput
      style={styles.textFieldStyling} 
      placeholder="Try typing something..."
  />

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM