Skip to content

Commit f7922a7

Browse files
author
石破天惊
authored
Merge pull request #82 from bolan9999/KeyboardShouldPersistTaps
Add props "keyboardShouldPersistTaps"
2 parents 75fdab3 + 165c59f commit f7922a7

File tree

4 files changed

+33
-5
lines changed

4 files changed

+33
-5
lines changed

README-cn.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,11 @@ onScroll | ({nativeEvent:{contentOffset:{x:number,y:number}}})=> any | | 滑动
284284
* default: ()=>null
285285
* LargeList在渲染完成或reloadData 完成后的回调,请注意,在您的视图中componentDidUpdate是不准确的,因为LargeList需要先测量头部、尾部、空视图宽高,再更新,每次更新LargeList都需要render两次
286286

287+
### keyboardShouldPersistTaps
288+
* type: enum('always', 'never', 'handled', false, true)
289+
* default: 'never'
290+
* 与ScrollView的keyboardShouldPersistTaps相同
291+
287292
## 方法
288293
### scrollTo(offset:Offset, animated:boolean=true)
289294
滑动到目标偏移Offset:{x:number,y:number},目前x值只支持0
@@ -344,6 +349,9 @@ onScroll | ({nativeEvent:{contentOffset:{x:number,y:number}}})=> any | | 滑动
344349

345350
## 更新日志
346351

352+
### 版本 1.2.6
353+
* 添加属性keyboardShouldPersistTaps
354+
347355
### 版本 1.2.5
348356
* 修复reloadData有时Section样式不正确的问题
349357

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ Notice: It is not recommended to use widthForLeftWhenSwipeOut and renderLeftWhen
278278
* default: ()=>null
279279
* Callback when LargeList render completed and reloadData completed.
280280

281+
### keyboardShouldPersistTaps
282+
* type: enum('always', 'never', 'handled', false, true)
283+
* default: 'never'
284+
* Same as keyboardShouldPersistTaps on ScrollView
285+
281286
## Method
282287
### scrollTo(offset:Offset, animated:boolean=true)
283288
Scroll to offset.
@@ -336,6 +341,9 @@ Get LargeList's footer height
336341

337342
## Update Log
338343

344+
### Version 1.2.6
345+
* Add prop "keyboardShouldPersistTaps"
346+
339347
### Version 1.2.5
340348
* Fix section error when reloadData
341349

react-native-largelist/largelist/LargeList.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,14 @@ class LargeList extends React.Component {
9696
initialOffsetY: PropTypes.number,
9797
renderItemSeparator: PropTypes.func,
9898

99-
onLargeListDidUpdate: PropTypes.func
99+
onLargeListDidUpdate: PropTypes.func,
100+
keyboardShouldPersistTaps: PropTypes.oneOf([
101+
"always",
102+
"never",
103+
"handled",
104+
false,
105+
true
106+
])
100107

101108
// onIndexPathDidAppear: PropTypes.func,
102109
// onIndexPathDidDisappear: PropTypes.func,
@@ -143,7 +150,8 @@ class LargeList extends React.Component {
143150
initialOffsetY: 0,
144151
renderItemSeparator: () =>
145152
<View style={{ height: 1, backgroundColor: "#EEE", marginLeft: 16 }} />,
146-
onLargeListDidUpdate: () => null
153+
onLargeListDidUpdate: () => null,
154+
keyboardShouldPersistTaps: "never"
147155
};
148156

149157
sections: Element[] = [];
@@ -348,6 +356,7 @@ class LargeList extends React.Component {
348356
bounces={this.props.bounces}
349357
refreshControl={refreshControl}
350358
contentContainerStyle={contentStyle}
359+
keyboardShouldPersistTaps={this.props.keyboardShouldPersistTaps}
351360
onLayout={this._onLayout.bind(this)}
352361
style={{ flex: 1 }}
353362
scrollEventThrottle={this.props.scrollEventThrottle}
@@ -399,12 +408,15 @@ class LargeList extends React.Component {
399408
}
400409

401410
_createSection(section: number, top: number, refs: LargeListSection[]) {
402-
let height = section>=0 && section< this.numberOfSections() ? this.props.heightForSection(section):0;
411+
let height =
412+
section >= 0 && section < this.numberOfSections()
413+
? this.props.heightForSection(section)
414+
: 0;
403415
return (
404416
<LargeListSection
405417
ref={reference => reference && refs.push(reference)}
406418
key={this.keyForCreating++}
407-
style={[styles.absoluteStretch, { top: top, height:height }]}
419+
style={[styles.absoluteStretch, { top: top, height: height }]}
408420
numberOfSections={this.numberOfSections}
409421
section={section}
410422
renderSection={this.props.renderSection}

react-native-largelist/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-largelist",
3-
"version": "1.2.5",
3+
"version": "1.2.6",
44
"private": false,
55
"description": "The best performance large list component which is much better than SectionList for React Native.",
66
"author": "bolan9999 <[email protected]>",

0 commit comments

Comments
 (0)