类型IntrinsicClassAttributes <button>上不存在该属性

时间:2019-05-08 12:28:52

标签: react-native react-native-android

我必须承认这是我在ReactNative世界中的第一步。

我尝试升级所有npm库,如果运行build命令,则会出现很多错误,例如:

Property 'underlayColor' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Button> & Readonly<ButtonProps> & Readonly<{ children?: ReactNode; }>'.

Property 'backgroundColor' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Button> & Readonly<ButtonProps> & Readonly<{ children?: ReactNode; }>'.

Property 'textStyle' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Button> & Readonly<ButtonProps> & Readonly<{ children?: ReactNode; }>'.

这很奇怪,因为我进行了快速研究,并且上面的属性可用于element。我的问题是:是否应该添加其他库或构建元素?还是可能在最新版本的react native中为Button组件禁用了属性?

编辑 我的代码的示例部分:错误是关于缺少underlayColor

<View style={[styles.modal.footer]}>
    <Button
     buttonStyle={styles.common.buttonTransparent}
     onPress={() => requestAnimationFrame(() => this.setState({isModalVisible: false}))}
     title={I18n.t('CANCEL')}
     underlayColor={styles.palette.transparent}
     textStyle={styles.modal.actionButtonText}
     containerViewStyle={styles.modal.actionButtonContainer}
    />
    <Button
     buttonStyle={styles.common.buttonTransparent}
     onPress={this.createReport}
     title={I18n.t('CREATE')}
     underlayColor={styles.palette.transparent}
     textStyle={styles.modal.actionButtonText}
     containerViewStyle={styles.modal.actionButtonContainer}
    />
</View>

1 个答案:

答案 0 :(得分:0)

错误表明var array1 = [ { id:101, firstName: "rama" }, { id:102, firstName: "shyam" }, { id:103, firstName: "jai" } ]; var array2 = [ { sessionId:101, lastName: "singh" }, { sessionId:102, lastName: "kumar" }, { sessionId:105, lastName: "jakhar" } ]; let array3 = []; array1.forEach(item => { array2.forEach(item2 => { if(item.id === item2.sessionId){ array3.push({...item, ...item2}) } }) }) console.log(array3);textStyle对您的组件underlayColor无效。好像您从某个库中导入了按钮。请仔细检查您的图书馆文件。

还请检查您的样式,该样式应包含无效的Button