[英]Write Default Text on Native-Base Input
我通過將字符串傳遞給它來調用這樣的組件:
<TripsPage
startingPoint={startingPoint}
/>
現在在這個組件中,我有這個 label:
<Item fixedLabel>
<Input/>
</Item>
在前端,當我們打開這個屏幕時,它顯然是空的。 但我希望startingPoint
字符串作為默認輸入值出現在它上面。 那可能嗎?
您可以使用TextInput
。 它具有名為 value 的屬性,您可以通過它提供默認文本。 它幾乎沒有像onChangeText
這樣的事件,它會在 textInput 值發生變化時給我們事件。 有關更多詳細信息,請查看https://reactnative.dev/docs/textinput
<TextInput
style={{ height: 40, borderColor: 'gray', borderWidth: 1 }}
onChangeText={text => onChangeText(text)}
value={props.startingpoint}
/>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.