我测试一个组件包含一个具有Image的子组件。我在子组件中定义Image的propTypes为number
。在主要组件上,我通过了import
的图像道具。但是测试文件运行警告提供给iconBack
的类型object
的道具HeaderVideoNavigation
无效HeaderVideoNavigation
这是const HeaderVideoNavigation = props => (
<Container>
<IconContent>
<TouchableWithoutFeedback onPress={props.onPressBackIcon}>
<IconButton isDisplay source={props.iconBack} />
</TouchableWithoutFeedback>
</IconContent>
{!!props.editText && <EditText>{props.editText}</EditText>}
</Container>
)
上的代码
<Header>
<HeaderVideoNavigation
onPressBackIcon={closeModal}
iconBack={Images.iconBackWhite}
/>
</Header>
和主要组件
$files= scandir($dir);
$zip = new ZipArchive();
$tmp_file = tempnam('.','');
if ( $zip->open($tmp_file, ZipArchive::CREATE)===TRUE) {
# loop through each file
foreach($files as $file){
# download file
$download_file = file_get_contents($file);
#add it to the zip
$zip->addFromString(basename($file),$download_file);
}
# close zip
$zip->close();
# send the file to the browser as a download
header("Content-disposition: attachment; filename=$nome_dir.zip");
header("Content-length: " . filesize($tmp_file));
header('Content-type: application/zip');
readfile($tmp_file);
}
答案 0 :(得分:0)
警告基本上说iconBackWhite是一个对象,而不是其源属性的IconButton组件中期望的数字。
<IconButton isDisplay source={props.iconBack} />