如何创建类似 Twitter 的个人资料布局?
IT技术
javascript
android
reactjs
react-native
2021-04-16 02:08:13
1个回答
在F8 应用程序中实际上有一个很好的例子。您要查看的 3 个文件在这里:
https://github.com/fbsamples/f8app/blob/master/js/tabs/schedule/MyScheduleView.js https://github.com/fbsamples/f8app/blob/master/js/common/ListContainer.js https: //github.com/fbsamples/f8app/blob/master/js/common/PureListView.js
如果您想查看它在应用程序中的工作方式,请访问我的 F8 选项卡。
基本思想是ListContainer
通过handleScroll
函数跟踪滚动位置。它传递handleScroll
给它的所有子级,将函数重命名为onScroll
.
在PureListView
一个它需要的是onScroll
财产通过对象传播经营者{...this.props}
,并将其传递到ListView
。
这只是为了跟踪滚动。如果你仔细看看,MyScheduleView.js
你会看到它主要是如何实现的。
希望有帮助。