Skip to content

Commit

Permalink
Add an option to disable the refresh animation for ScrollableCollecti…
Browse files Browse the repository at this point in the history
…on (#37)

* option-disabling-refresh-animation-for-scrollable-collection

* fix .gitignore rebase error
  • Loading branch information
Scrabouillmax authored Feb 8, 2021
1 parent 6a4fd6f commit 8285854
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
dist/
.jest/
.idea
2 changes: 1 addition & 1 deletion native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@birdiecare/galette-native",
"version": "1.0.4",
"version": "1.0.5",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
Expand Down
7 changes: 4 additions & 3 deletions native/src/collection/components/ScrollableCollection.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component, ReactNode } from "react";
import { RefreshControl, ScrollView, StyleProp, ViewStyle } from "react-native";
import { RefreshControl, StyleProp, ViewStyle } from "react-native";
import CollectionComponent, {
Props as CollectionComponentProps
} from "./CollectionComponent";
Expand All @@ -9,6 +9,7 @@ import Collection from "../Collection";
type Props = CollectionComponentProps & {
collection: Collection;
onRefresh: (page?: number) => void;
hideRefreshAnimation?: boolean;
header?: ReactNode;
numberOfItemsForFullPage?: StyleProp<ViewStyle>;
style?: any;
Expand All @@ -25,7 +26,7 @@ export default class ScrollableCollection extends Component<Props, {}> {
}

render() {
let { collection } = this.props;
let { collection, hideRefreshAnimation } = this.props;

return (
<React.Fragment>
Expand All @@ -34,7 +35,7 @@ export default class ScrollableCollection extends Component<Props, {}> {
style={this.props.style || { flex: 1 }}
refreshControl={
<RefreshControl
refreshing={collection.isLoading()}
refreshing={!hideRefreshAnimation && collection.isLoading()}
onRefresh={() => this.props.onRefresh(1)}
title="Loading..."
tintColor="#fff"
Expand Down

0 comments on commit 8285854

Please sign in to comment.