Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stuck animator fix #210

Merged
merged 5 commits into from
Jul 12, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "recyclerlistview",
"version": "1.4.0-beta.6",
"version": "1.4.0-beta.7",
"description": "The listview that you need and deserve. It was built for performance, uses cell recycling to achieve smooth scrolling.",
"main": "dist/reactnative/index.js",
"types": "dist/reactnative/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { Animated, Easing, View, Platform } from "react-native";
import { Animated, Easing, View } from "react-native";
import { BaseItemAnimator } from "../../../../core/ItemAnimator";

interface UnmountAwareView extends View {
_isUnmountedForRecyclerListView?: boolean;
_lastAnimVal?: Animated.ValueXY | null;
}

const IS_WEB = Platform.OS === "web";

/**
* Default implementation of RLV layout animations for react native. These ones are purely JS driven. Also, check out DefaultNativeItemAnimator
* for an implementation on top of LayoutAnimation. We didn't use it by default due the fact that LayoutAnimation is quite
Expand Down Expand Up @@ -36,7 +34,7 @@ export class DefaultJSItemAnimator implements BaseItemAnimator {
const viewRef = itemRef as UnmountAwareView;
const animXY = new Animated.ValueXY({ x: fromX, y: fromY });
animXY.addListener((value) => {
if (viewRef._isUnmountedForRecyclerListView) {
if (viewRef._isUnmountedForRecyclerListView || (this.shouldAnimateOnce && this._hasAnimatedOnce)) {
animXY.stopAnimation();
return;
}
Expand Down Expand Up @@ -75,7 +73,6 @@ export class DefaultJSItemAnimator implements BaseItemAnimator {
}

private _getNativePropObject(x: number, y: number): object {
const point = { left: x, top: y };
return !IS_WEB ? point : { style: point };
return { style: { left: x, top: y } };
}
}