Comments (11)
请附上代码,谢谢
from react-native-mjrefresh.
主要就是这个情况, 我FlatList部分使用的react-native-ultimate-listview, 这是截取的它的部分源码. 自定义它的下拉刷新组件, 只能通过自定义refreshControl来实现, 大佬那边有办法吗? 让其能够支持refreshControl
from react-native-mjrefresh.
/**
- Render a custom scroll component, e.g. with a differently styled
RefreshControl
.
*/
renderScrollComponent?: (props: Object) => React.Element,
const ret = React.cloneElement(
(this.props.renderScrollComponent || this._defaultRenderScrollComponent)(
scrollProps,
),
{
ref: this._captureScrollRef,
},
cells,
);
如果renderScrollComponent不为空,则刷新效果应在renderScrollComponent里实现,否则还是按照RN官方实现,即refreshControl智能为RefreshControl组件
from react-native-mjrefresh.
我的例子:
<FlatList
keyExtractor={(item)=>item}
data={this.state.data}
renderItem={({item,index}) => <Text key={index} onPress={()=>alert(111)} style={{height:100}}>{item}</Text>}
renderScrollComponent={props=><ScrollView
style={{flex:1}}
refreshControl={
<HuaWeiRefreshControl
ref={ref=>this._hw = ref}
onRefresh={this._onRefresh}
/>
}
{...props}
/>}
/>
此时的refreshControl既可以是官方RefreshControl,也可以是其他组件(须由MJRefresh包裹)
from react-native-mjrefresh.
好的. 你的意思就是只能使用renderScrollComponent, 对吗? 如果是那样的话, 我只能fork一下react-native-ultimate-listview这个库了, 🤣
from react-native-mjrefresh.
是的,你可以看一下VirtualizedList组件的源码,官方FlatList是基于VirtualizedList实现的
from react-native-mjrefresh.
好的. 谢谢.
顺便问一下, 你封装的ScrollView组件, 相对于原生ScrollView组件, 优化了那些方面呢?
from react-native-mjrefresh.
和RN官方一样,只是拓展了可以自定义下拉刷新,:smile:
from react-native-mjrefresh.
👌
我使用了你桥接的SmartRefreshLayout, 效果很好. 现在准备把IOS那边也集成一下你的MjRefresh.
问题弄清楚了, 这个issue应该可以close了.
非常感谢!
from react-native-mjrefresh.
可否加一下你的qq/微信?
from react-native-mjrefresh.
from react-native-mjrefresh.
Related Issues (20)
- 真机打包之后,无法显示下拉刷新的控件,而且各种阻塞事件 HOT 3
- 在rn 0.58.5版本中不能使用,报错如下: HOT 5
- 'React/RCTConvert.h' file not found
- 可以更新下版本吗?58.6用不了 退到57的话其他插件又有冲突 HOT 2
- iOS 12.2 报错:RCTScrollView may only contain a single subview HOT 8
- 你好,在下拉回调时,可否将lastUpdatedTime返回 HOT 4
- libRCTMJRefreshHeader.a找不到问题还是没有解决啊!! HOT 1
- 解决scrollview滑动不流畅 HOT 7
- 好像在刷新完成后,在重置动画完成前就将组建设为idle状态了
- 刷新控件和正文之间有一段空白 HOT 1
- 调用beginRefresh ,后没有,停顿触发刷新状态,直接弹回去了 HOT 1
- ListView has been removed HOT 2
- 请问继续下拉进入二楼效果有实现思路没?求帮忙 HOT 2
- RN 0.61.5 ScrollView 调用 scrollTo 方法报错: MJScrollViewManager.zoomToRect was called with 4 arguments but expects 3 arguments. HOT 8
- typescript support please?
- iOS使用报错
- Super expression must either be null or a function HOT 3
- 可以和安卓的版本一起使用吗
- ios 0.63.4 不支持 HOT 1
- 求大佬更新!!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-mjrefresh.