[React Native] Animation Warning - Sending onAnimatedValueUpdate with no listeners registered ํ•ด๊ฒฐ

jiveloperยท2023๋…„ 11์›” 13์ผ
3

React Native

๋ชฉ๋ก ๋ณด๊ธฐ
12/14
post-thumbnail

๐Ÿ†˜ ๐Ÿ˜• ์—๋Ÿฌ๋ช…

Sending onAnimatedValueUpdate with no listeners registered



โ“ ๐Ÿง ์›์ธ

iOS์—์„œ Stack์„ ๋’ค๋กœ๊ฐ€๊ธฐ ํ•˜์—ฌ ์ด์ „ ํŽ˜์ด์ง€๋กœ ๋Œ์•„๊ฐ€๋ ค๊ณ  ํ•  ๋•Œ, mount ๋œ ํ˜„ stack์„ unmount ์‹œํ‚ฌ ๋ฆฌ์Šค๋„ˆ๋ฅผ ์ฐพ์ง€ ๋ชป ํ•จ.



๐Ÿ“Œ ๐Ÿ˜‹ ํ•ด๊ฒฐ

/node_modules/@react-navigation/stack/src/views/Stack/Card.tsx ์ˆ˜์ •

1. componentDidMount() ๋งจ ์•„๋ž˜ ์ค„์— mount ๋˜์—ˆ๋‹ค๋Š” ๋ฆฌ์Šค๋„ˆ ๋“ฑ๋กํ•˜๋Š” ์ฝ”๋“œ ์ถ”๊ฐ€

this.props.gesture.addListener(() => { return });


2. componentWillUnmount() ๋งจ ์•„๋ž˜ ์ค„์— mount๋œ ๋ฆฌ์Šค๋„ˆ๋ฅผ ์ง€์›Œ์ฃผ๋Š” ์ฝ”๋“œ ์ถ”๊ฐ€

this.props.gesture.removeAllListeners();


3. @react-navigation/stack ํŒจ์น˜ํŒจํ‚ค์ง€

์œ„์˜ ์ˆ˜์ •์‚ฌํ•ญ๋“ค์„ patch-package๋ฅผ ํ†ตํ•ด ํ”„๋กœ์ ํŠธ ๋‚ด์˜ @react-navigation/stack ์†Œ์Šค๋ฅผ ์ˆ˜์ •ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

yarn patch-package @react-navigation/stack



์ฐธ๊ณ 

https://github.com/react-navigation/react-navigation/issues/7839#issuecomment-1621988247

https://stackoverflow.com/questions/76012269/warn-sending-onanimatedvalueupdate-with-no-listeners-registered

profile
๐Ÿ‘ฉ๐Ÿปโ€๐Ÿ’ป Clean Code์™€ Refactoring์— ๊ด€์‹ฌ์ด ๋งŽ์€ ๊ฐœ๋ฐœ์ž ์ž…๋‹ˆ๋‹ค.

2๊ฐœ์˜ ๋Œ“๊ธ€

comment-user-thumbnail
2024๋…„ 8์›” 21์ผ

๋•๋ถ„์— warning ์ฒ˜๋ฆฌ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

1๊ฐœ์˜ ๋‹ต๊ธ€