soso-tip icon indicating copy to clipboard operation
soso-tip copied to clipboard

react transition group with lottie

Open SoYoung210 opened this issue 3 years ago โ€ข 1 comments

Desc

react-transiton group์œผ๋กœ BottomSheet๋“ฑ์„ ๋งŒ๋“ค ๋•Œ Lottie๋ฆฌ์†Œ์Šค๊ฐ€ ์•„์˜ˆ ์‚ฌ๋ผ์กŒ๋‹ค๊ฐ€ ๋‹ค์‹œ ์ƒ๊ธฐ๋Š” ๋“ฑ์˜ ์ด์Šˆ๊ฐ€ ์žˆ์„ ์ˆ˜ ์žˆ๋‹ค. lottie์˜์—ญ์— ๊ณ ์ • height๋ฅผ ์ค„๊ฒฝ์šฐ ๋ฆฌ์†Œ์Šค๊ฐ€ ์•„์˜ˆ ์‚ฌ๋ผ์ง€์ง€๋Š” ์•Š์ง€๋งŒ, ์• ๋‹ˆ๋ฉ”์ด์…˜์ด ์œ ์ง€๋œ ์ฑ„๋กœ bottom sheet๊ฐ€ ๋™์ž‘ํ•˜์ง€ ์•Š๋Š”๋‹ค.

https://github.com/reactjs/react-transition-group/blob/399f26998a5cf2449798a02c755e5808e9b39ddd/src/Transition.js#L373-L375

cloneElementํ•˜๋Š” ๊ณผ์ •์—์„œ lottie๋ฆฌ์†Œ์Šค๋ฅผ ๋น„๋™๊ธฐ๋กœ ์š”์ฒญํ•˜๊ธฐ๋•Œ๋ฌธ์— ์˜์—ญ์ด ์ค„์–ด๋“ค์—ˆ๋‹ค๊ฐ€ ๋Š˜์–ด๋‚˜๋Š”๊ฒƒ์ฒ˜๋Ÿผ ๋ณด์ผ ์ˆ˜ ์žˆ๋‹ค. bottomSheet์„ ๊ตฌํ˜„ํ•œ๋‹ค๋ฉด useSpring ๋“ฑ ๋‹ค๋ฅธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์“ฐ๊ฑฐ๋‚˜ ์ž์ฒด ๊ตฌํ˜„ํ•˜๊ณ , lottie๋Š” ๋ณ„๋„ ref๋กœ ์• ๋‹ˆ๋ฉ”์ด์…˜์„ ์ปจํŠธ๋กคํ•˜๋Š” ๊ฒƒ์ด ์ข‹๋‹ค.

 css`
    will-change: transform;
    transition: transform 500ms cubic-bezier(0.7, 0, 0.4, 1);
    transform: translate3d(0, 100%, 0);
  `,
  ({ isOpen }: ModalContainerProps) => (
    isOpen && css`
    transform: translate3d(0, 0, 0);
    `
  ),

SoYoung210 avatar Nov 30 '20 11:11 SoYoung210