feat: 自动上传组件 Co-authored-by: Junhui Chen <chenjunhui@fairclip.cn> Co-committed-by: Junhui Chen <chenjunhui@fairclip.cn>
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
import { View } from 'react-native';
|
|
import UploaderProgressBar from './progress-bar';
|
|
|
|
interface UploaderProgressProps {
|
|
imageUrl: string;
|
|
uploadedCount: number;
|
|
totalCount: number;
|
|
}
|
|
|
|
const UploaderProgress: React.FC<UploaderProgressProps> = ({ imageUrl, uploadedCount, totalCount }) => {
|
|
// This is now a 'dumb' component. It only displays the progress based on props.
|
|
// All logic for fetching and state management is handled by the parent component (MemoList).
|
|
|
|
if (totalCount === 0) {
|
|
// Don't render anything if there's no session or tasks.
|
|
// The parent component's logic (`uploadSessionStartTime && ...`) already handles this,
|
|
// but this is an extra safeguard.
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<View style={{ position: 'absolute', bottom: 0, left: 0, right: 0, backgroundColor: 'transparent' }}>
|
|
<UploaderProgressBar
|
|
imageUrl={imageUrl}
|
|
uploadedCount={uploadedCount}
|
|
totalCount={totalCount}
|
|
/>
|
|
</View>
|
|
);
|
|
};
|
|
|
|
export default React.memo(UploaderProgress); |