Skip to content

Commit

Permalink
Update defaultNewItemAlertComponent triangle position for inverted ho…
Browse files Browse the repository at this point in the history
…rizontal orientation, publish version 1.10.1.
  • Loading branch information
chubillkelvin committed May 1, 2021
1 parent 015083d commit 2e1b677
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Binary file modified demo/horizontal-inverted.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions src/component/AutoScrollFlatList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,14 @@ export class AutoScrollFlatList<T> extends React.PureComponent<Props<T>, State>

private renderDefaultNewItemAlertComponent = (newItemCount: number, translateY: Animated.Value) => {
const {inverted, horizontal, newItemAlertMessage, newItemAlertContainerStyle, newItemAlertTextStyle} = this.props;
const message = newItemAlertMessage ? newItemAlertMessage(newItemCount) : `${newItemCount} new item${newItemCount > 1 ? "s" : ""}`;
const direction = this.getTriangleDirection();
const message = newItemAlertMessage ? newItemAlertMessage(newItemCount) : `${direction === "left" ? " " : ""}${newItemCount} new item${newItemCount > 1 ? "s" : ""}`;
const position = inverted && !horizontal ? {bottom: translateY} : {top: translateY};
return (
<Animated.View style={[styles.newItemAlert, newItemAlertContainerStyle, position]}>
{direction === "left" && <Triangle size={4} direction={direction} />}
<Text style={[styles.alertMessage, newItemAlertTextStyle]}>{message}</Text>
<Triangle size={4} direction={this.getTriangleDirection()} />
{direction !== "left" && <Triangle size={4} direction={direction} />}
</Animated.View>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-autoscroll-flatlist",
"version": "1.10.0",
"version": "1.10.1",
"description": "An enhanced React Native FlatList component to provide auto-scrolling functionality",
"author": "Kelvin Chu <chubillkelvin@gmail.com> (github.com/RageBill)",
"license": "MIT",
Expand Down

0 comments on commit 2e1b677

Please sign in to comment.