2024-02-19 18:59:45 +08:00
|
|
|
import React, { useEffect, useRef } from 'react';
|
2024-06-11 03:31:30 +08:00
|
|
|
import { GenericContentItemProps } from './types';
|
2024-02-19 18:59:45 +08:00
|
|
|
|
2024-06-11 03:31:30 +08:00
|
|
|
const GenericContentItem: React.FC<GenericContentItemProps> = (props) => {
|
2024-02-19 18:59:45 +08:00
|
|
|
const {
|
|
|
|
renderFunction,
|
|
|
|
} = props;
|
|
|
|
const elementRef = useRef(null);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (elementRef.current && renderFunction) {
|
|
|
|
renderFunction(elementRef.current);
|
|
|
|
}
|
|
|
|
}, [elementRef]);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
style={{
|
|
|
|
overflow: 'hidden',
|
|
|
|
}}
|
|
|
|
ref={elementRef}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2024-06-11 03:31:30 +08:00
|
|
|
export default GenericContentItem;
|