【发布时间】:2021-02-02 23:57:49
【问题描述】:
我有一个像图像一样的TextInput,当文本太长时,虽然我添加了CSS textAlign: 'left',但它从右到左开始,但它不起作用。它只发生在android上,在ios上很好。有人遇到过同样的问题吗?
我的代码:
<View style={styles.myInput}>
<TextInput
numberOfLines={1}
style={styles.input}
placeholder="Tìm kiếm địa chỉ..."
value={search}
placeholderTextColor="gray"
onChangeText={(value) => setSearch(value)}
/>
<Ionicons
style={styles.inputIcon}
name="md-search"
color="gray"
size={20}
onPress={onSearch}></Ionicons>
</View>;
const styles = {
myInput: {
width: '100%',
height: 45,
top: 20,
paddingHorizontal: 20,
width: '90%',
borderColor: 'gray',
borderWidth: 1,
backgroundColor: 'white',
borderRadius: 5,
position: 'relative',
marginHorizontal: '5%',
zIndex: 1,
},
input: {
height: 40,
color: '#000',
height: '100%',
paddingRight: 30,
},
};
【问题讨论】: