[英]How to set focus listener on TextInput in react native
嗨,我在我的本機應用程序中使用TextInput
。 我想在單擊TextInput
打開“日期對話框”。 如果允許聽取焦點事件,我就想到了,它可能對我有用。
我對此一無所獲。 有誰知道如何在react native中設置TextInput
上的焦點偵聽器?
<TextInput
style={{
height: 40,
borderColor: "gray",
borderWidth: 1,
marginTop: 8
}}
underlineColorAndroid="transparent"
placeholder={strings.schedule_date}
onKeyPress={keyPress => console.log(keyPress)}
/>
您可以為此使用onFocus
道具。 這是在文本輸入集中時調用的回調。 您可以閱讀本文檔 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.