Skip to content

Commit 1e10fe3

Browse files
committed
feat : onAfterLoad
1 parent 9fa7cb9 commit 1e10fe3

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

package/CHANGE.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
## 1.3.0
22

3-
- FullpageContainer Props 추가 : ransitionDuration, 섹션간 이동 속도, type : number, default : 700
3+
### What's New?
4+
5+
- add Props in FullpageContainer : ransitionDuration, 섹션간 이동 속도, type : number, default : 700
6+
- add Props in FullpageContainer : onAfterLoad, 로딩 후 실행 이벤트, arguments : container

package/src/components/FullpageContainer.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ interface IProps {
1212
transitionDuration?: number; // Section 전환 속도
1313
onBeforeChange?: (beforeIndex: number, afterIndex: number) => void;
1414
onAfterChange?: (beforeIndex: number, afterIndex: number) => void;
15+
onAfterLoad?: (container: React.RefObject<HTMLDivElement>) => void;
1516
}
1617

1718
function FullpageContainer({
@@ -21,6 +22,7 @@ function FullpageContainer({
2122
setActiveIndex,
2223
onBeforeChange,
2324
onAfterChange,
25+
onAfterLoad,
2426
}: IProps) {
2527
const [transformY, setTransformY] = useState<number>(0);
2628
const container = useRef<HTMLDivElement>(null);
@@ -85,6 +87,12 @@ function FullpageContainer({
8587
}
8688
}, [container, isLoaded]);
8789

90+
useEffect(() => {
91+
if (isLoaded && onAfterLoad) {
92+
onAfterLoad(container);
93+
}
94+
}, [isLoaded, onAfterLoad]);
95+
8896
/**
8997
* Container 마운트에 <html> 태그에 Class를 추가하고, 언마운트에 제거합니다.
9098
*/

test/src/App.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ function App() {
2323
onAfterChange={(beforeIndex, afterIndex) => {
2424
console.log("after", beforeIndex, afterIndex);
2525
}}
26+
onAfterLoad={(container) => {
27+
console.log("afterLoad", container);
28+
}}
2629
>
2730
<FullpageSection name="first">
2831
<FirstSection />

0 commit comments

Comments
 (0)