gpt4 book ai didi

react-native - react 原生 TextInput box-shadow

转载 作者:行者123 更新时间:2023-12-04 12:27:06 25 4
gpt4 key购买 nike

我想在 TextInput 上应用阴影,如下所示:
enter image description here

我正在制作这种样式,使用阴影和高度为 android:

shadowColor: colors.shadowColor,
shadowOpacity: 0.5,
shadowRadius: 3,
shadowOffset: {
height: 0,
width: 0,
},
elevation: 2,

然而,结果并不如预期。所以,我在问是否有一种方法可以在不通过 3rd 方包的情况下增强它。
enter image description here

最佳答案

我最终使用了 react-native-cardview包,效果要好得多,但是,它是如此有限,以至于我无法设置阴影颜色和其他选项。

import React, { Component } from 'react';
import {
View,
ScrollView,
TextInput,
} from 'react-native';
import CardView from 'react-native-cardview';
import styles from './styles';

export default class Signup extends Component {

render() {
return (
<View style={{ flex: 1, backgroundColor: colors.whiteColor }}>
<ScrollView contentContainerStyle={styles.signupContainer}>
<View style={styles.signupInputs}>
<CardView
style={styles.cardStyle}
cardElevation={2}
cardMaxElevation={2}
cornerRadius={5}
>
<TextInput
underlineColorAndroid="transparent"
style={[styles.signupInput, styles.commonsignupStyle]}
placeholder="Nom *"
placeholderTextColor={colors.primaryColor}
/>
</CardView>
<CardView
style={styles.cardStyle}
cardElevation={2}
cardMaxElevation={2}
cornerRadius={5}
>
<TextInput
underlineColorAndroid="transparent"
style={[styles.signupInput, styles.commonsignupStyle]}
placeholder="Prénom *"
placeholderTextColor={colors.primaryColor}
/>
</CardView>
</View>
</ScrollView>
</View>
);
}
}

enter image description here

关于react-native - react 原生 TextInput box-shadow,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53801196/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com