升级 react-native-elements 后按钮错误
Button errors after upgrading react-native-elements
我有一个大问题,因为我需要升级一些项目的库,但我从未使用过React native。我将 react-native-elements
表单版本 0.19 升级到 1.1,但我收到许多关于 Button
组件中不存在的属性的错误。
代码示例部分:
<Button
backgroundColor={styles.palette.transparent}
onPress={this.connectWithEmail}
title={I18n.t('CONFIRM')}
disabled={!this.state.password || !this.state.email}
disabledStyle={styles.modal.actionButtonDisabled}
underlayColor={styles.palette.transparent}
containerViewStyle={styles.modal.actionButtonContainer}
textStyle={[
styles.modal.actionButtonText,
{color: (this.state.password && this.state.email) ? styles.palette.secondary : styles.palette.textLight}
]}
/>
好的,所以我收到此按钮的错误消息,例如:
Property 'backgroundColor' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Button> & Readonly<ButtonProps> & Readonly<{ children?: ReactNode; }>'
但我发现信息,按钮的 backgroundColor 属性 在 v 1.1 中不存在,所以我用 buttonStyle
属性 以这种方式替换它:
buttonStyle={{backgroundColor: styles.palette.transparent}}
我的问题是:
如何替换其余缺少的道具,例如:underlayColor
、containerViewStyle
和 textStyle
? 我在react-native-documentation 的文档和实际注释。
containerViewStyle
== containerStyle
textStyle
== titleStyle
没有UnderlayColor
因为react-native-elements
按钮是根据TouchableNativeFeedback
'或'TouchableOpacity'
配置的。
我有一个大问题,因为我需要升级一些项目的库,但我从未使用过React native。我将 react-native-elements
表单版本 0.19 升级到 1.1,但我收到许多关于 Button
组件中不存在的属性的错误。
代码示例部分:
<Button
backgroundColor={styles.palette.transparent}
onPress={this.connectWithEmail}
title={I18n.t('CONFIRM')}
disabled={!this.state.password || !this.state.email}
disabledStyle={styles.modal.actionButtonDisabled}
underlayColor={styles.palette.transparent}
containerViewStyle={styles.modal.actionButtonContainer}
textStyle={[
styles.modal.actionButtonText,
{color: (this.state.password && this.state.email) ? styles.palette.secondary : styles.palette.textLight}
]}
/>
好的,所以我收到此按钮的错误消息,例如:
Property 'backgroundColor' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Button> & Readonly<ButtonProps> & Readonly<{ children?: ReactNode; }>'
但我发现信息,按钮的 backgroundColor 属性 在 v 1.1 中不存在,所以我用 buttonStyle
属性 以这种方式替换它:
buttonStyle={{backgroundColor: styles.palette.transparent}}
我的问题是:
如何替换其余缺少的道具,例如:underlayColor
、containerViewStyle
和 textStyle
? 我在react-native-documentation 的文档和实际注释。
containerViewStyle
== containerStyle
textStyle
== titleStyle
没有UnderlayColor
因为react-native-elements
按钮是根据TouchableNativeFeedback
'或'TouchableOpacity'
配置的。