我正在尝试制作搜索栏。我希望用户输入一些内容TextInput,当用户按“Enter”时我想调用我的函数。
<TextInput
//here when user press enter call function()
style={styles.searchStyle}
allowFontScaling={false}
placeholder="Search"
onChangeText={(val) => {setSearch(val)}}
/>
Run Code Online (Sandbox Code Playgroud)
我尝试过onSubmitEditing,但没有成功。