【发布时间】:2021-02-25 06:53:14
【问题描述】:
这是我的代码:'Skeleton' 已声明,但它的值从未被读取。
import React from 'react';
import {
FlatList, View, StyleSheet
} from 'react-native';
// But warning here
import { Skeleton, Colors } from '@momo-platform/component-kits';
const SkeletonLoadingChat = () => {
const data = [1, 2, 3, 4, 5, 6, 7, 8, 9];
return (
<FlatList
style={{ padding: 15 }}
data={data}
ListHeaderComponent={() => {
return (
<View style={styles.headerSkelation}>
<View style={styles.avataSkelation} />
<View style={styles.lineSkelation} />
</View>
);
}}
renderItem={({ item, index }) => {
return (
// I used Skeleton here
<Skeleton.Custom
left={<Skeleton.Media size={52} />}
style={styles.skeletionItem}
>
<Skeleton.Line style={styles.width_1_9} />
<Skeleton.Line style={styles.width_80} />
</Skeleton.Custom>
);
}}
/>
);
}
我使用了 Skeleton,但它仍然显示警告 界面骨架
export interface Skeleton extends SkeletonProps {
Line?: React.ReactElement,
Media?: React.ReactElement,
Custom?: React.ReactElement,
}
【问题讨论】:
-
Skeleton在使用值Skeleton.Custom时怎么会是一个接口? -
如果您删除导入,您会收到错误消息吗?如果有,是哪一个?
-
是的,如果我删除导入应用程序显示错误
-
@Bergi in Skeleton 我看到属性自定义
-
我的猜测是
@momo-platform/component-kits类型声明是错误的,使用interface应该是namespace。不幸的是,我无法在网上找到他们的源代码来确认。
标签: javascript reactjs typescript react-native visual-studio-code