Javascript 警告:已声明,但从未读取其值
这是我的代码:'Skeleton'已声明,但其值从未读取Javascript 警告:已声明,但从未读取其值,javascript,reactjs,typescript,react-native,visual-studio-code,Javascript,Reactjs,Typescript,React Native,Visual Studio Code,这是我的代码:'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 = () => {
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.Custom
时,Skeleton
如何成为一个界面?如果您删除导入,是否会出现错误?如果是,是哪一个?如果我删除导入应用程序,则是)error@Bergi在Skeleton中,我看到了属性custom,我猜想@momo平台/组件套件
类型声明有错误,并且使用了接口
的名称空间。不幸的是,我无法在线找到他们的源代码进行确认。
export interface Skeleton extends SkeletonProps {
Line?: React.ReactElement,
Media?: React.ReactElement,
Custom?: React.ReactElement,
}