如屏幕截图所示,我遇到了 Autocomplete Kitten 元素的 UI 问题。我在文档中搜索(https://akveo.github.io/react-native-ui-kitten/docs/components/autocomplete/api#autocomplete)并尝试增加元素及其子元素的宽度,但是似乎没有任何东西允许仅增加此组件显示的建议列表的区域。有没有办法只增加那个区域而不改变原始输入元素的宽度?也许我错过了一些东西。
我希望从我想要实现的截图中可以清楚地看到
hp 和 wp 是 react-native-responsive-screen 的函数,但即使指定正常值也只会增加内部区域,而不是区域本身。
<Autocomplete
autoCapitalize="none"
onChangeText={(query) => {
...
}}
onSelect={(index) => {
...
}}
placeholder="Please select"
style={{
height: hp("5.4%"), width: wp("21.3%"),
marginTop: hp("1.2%")
}}
value={phoneCodeQuery}
>
{ codes.map((value, index) => renderPhoneCodeOption(value, index)) }
</Autocomplete>
renderPhoneCodeOption 函数输出
<AutocompleteItem
key={index}
style={{ margin: 0, padding: 0, width: wp("51.3%"), }}
title={(props) => {
const { style, ...rest } = props || {};
return (
<Text
{...rest}
style={[style, { fontWeight: "500" }]}
>
{phone.IsoCode} - {phone.English}
</Text>
);
}}
/>