Skip to content

Commit ba61c84

Browse files
committed
Some improvements in code and doc
1 parent fe0bdbd commit ba61c84

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Called when the active row was released.
4444
- **onPressRow** (function)<br />
4545
`(key) => void`<br />
4646
Called when a row was pressed.
47-
- **refreshControl** (Object)<br />
47+
- **refreshControl** (element)<br />
4848
A RefreshControl that works the same way as a ScrollView's refreshControl.
4949

5050
#### Methods

src/SortableList.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default class SortableList extends Component {
2121
sortingEnabled: PropTypes.bool,
2222
scrollEnabled: PropTypes.bool,
2323
horizontal: PropTypes.bool,
24-
refreshControl: PropTypes.object,
24+
refreshControl: PropTypes.element,
2525

2626
renderRow: PropTypes.func.isRequired,
2727

@@ -149,21 +149,18 @@ export default class SortableList extends Component {
149149
const {contentContainerStyle, horizontal, style: containerStyle} = this.props;
150150
const {contentHeight, contentWidth, scrollEnabled} = this.state;
151151
const innerContainerStyle = [styles.container];
152-
let refreshControl = this.props.refreshControl;
152+
let {refreshControl} = this.props;
153153

154154
if (horizontal) {
155155
innerContainerStyle.push({width: contentWidth});
156156
} else {
157157
innerContainerStyle.push({height: contentHeight});
158158
}
159159

160-
if(refreshControl) {
161-
refreshControl=(
162-
<RefreshControl
163-
{...this.props.refreshControl.props}
164-
enabled={scrollEnabled}
165-
/>
166-
)
160+
if (refreshControl && refreshControl.type === RefreshControl) {
161+
refreshControl = React.cloneElement(this.props.refreshControl, {
162+
enabled: scrollEnabled, // fix for Android
163+
});
167164
}
168165

169166
return (

0 commit comments

Comments
 (0)