首页 > 解决方案 > react-native-animated 中的 useTheme 和 useDerived 钩子

问题描述

我正在研究 react-native 但我不理解这些代码块。[ Source code link][1] 在那个文件中,我没看懂这段代码

1)const { margin, normalize } = useTheme(); const BOOKW = normalize(130, 160); 为什么 BOOKW 长度受规范化限制?

2) const position = useDerivedValue(() => (index + 0.00001) * (BOOKW + margin) - scrollX.value);这个职位到底是如何运作的,我不明白吗?

PS我阅读了文档,但我有点不懂:( [1]:https ://github.com/himanchau/react-native-book-app/blob/main/src/components/Book.jsx

标签: javascriptnode.jsreact-native

解决方案


推荐阅读