Skip to content

Commit

Permalink
1.9.3: fix event.persist is not a function error on react-native-web.
Browse files Browse the repository at this point in the history
  • Loading branch information
chubillkelvin committed Oct 5, 2020
1 parent 459d74a commit de1e6e4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
5 changes: 0 additions & 5 deletions README.md
Expand Up @@ -92,11 +92,6 @@ To do so, a simple fix would be to add
height: Dimensions.get("window").height
```
to the container style (depending on your use cases).

Q: When onScroll function is triggered, I see an error `TypeError: event.persist is not a function`, how do I fix it?

A: This is because react-native-web is not fully compatible with react-native yet. Similar issue could be found [here](https://github.com/idibidiart/react-native-responsive-grid/issues/33).
To fix, you can simply add [react-native-dom](https://github.com/vincentriemer/react-native-dom) to your dependency (see example app).

# TODOs

Expand Down
2 changes: 1 addition & 1 deletion example/expo/yarn.lock
Expand Up @@ -5800,7 +5800,7 @@ react-is@^16.12.0, react-is@^16.8.1, react-is@^16.8.4:
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==

"react-native-autoscroll-flatlist@file:../../src":
version "1.9.1"
version "1.9.2"

react-native-dom@0.5.0:
version "0.5.0"
Expand Down
5 changes: 4 additions & 1 deletion src/component/AutoScrollFlatList.tsx
Expand Up @@ -250,7 +250,10 @@ export class AutoScrollFlatList<T> extends React.PureComponent<Props<T>, State>
onScroll(event);
}
});
event.persist();
/**
* Need to check if event.persist is defined before using to account for usage in react-native-web
*/
event.persist && event.persist();
};

private renderDefaultNewItemAlertComponent = (newItemCount: number, translateY: Animated.Value) => {
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
@@ -1,6 +1,6 @@
{
"name": "react-native-autoscroll-flatlist",
"version": "1.9.2",
"version": "1.9.3",
"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 de1e6e4

Please sign in to comment.