Skip to content

Commit

Permalink
Revert "Merge pull request #6268 from azimgd/fix-inverted-list"
Browse files Browse the repository at this point in the history
This reverts commit 8d5a3ad, reversing
changes made to 339bb67.
  • Loading branch information
Alexander committed Nov 23, 2021
1 parent 606cacb commit c4417d0
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 14 deletions.
10 changes: 0 additions & 10 deletions build/react-native-web.sh

This file was deleted.

86 changes: 84 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"license": "MIT",
"private": true,
"scripts": {
"postinstall": "./build/react-native-web.sh",
"android": "npm run check-metro-bundler-port && react-native run-android",
"ios": "npm run check-metro-bundler-port && react-native run-ios",
"ipad": "npm run check-metro-bundler-port && react-native run-ios --simulator=\"iPad Pro (12.9-inch) (4th generation)\"",
Expand Down Expand Up @@ -98,7 +97,7 @@
"react-native-safe-area-context": "^3.1.4",
"react-native-screens": "^3.0.0",
"react-native-svg": "^12.1.0",
"react-native-web": "git+https://github.com/Expensify/react-native-web.git#bfe201af25f9bd465af203b02fc978515b96e956",
"react-native-web": "0.15.7",
"react-pdf": "^5.2.0",
"react-plaid-link": "^3.2.0",
"react-web-config": "^1.0.0",
Expand Down
25 changes: 25 additions & 0 deletions src/components/InvertedFlatList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ const propTypes = {
}).isRequired,
};

// This is adapted from https://codesandbox.io/s/react-native-dsyse
// It's a HACK alert since FlatList has inverted scrolling on web
class InvertedFlatList extends React.Component {
constructor(props) {
super(props);

this.invertedWheelEvent = this.invertedWheelEvent.bind(this);
this.list = undefined;
}

Expand All @@ -27,6 +30,28 @@ class InvertedFlatList extends React.Component {
} else {
this.props.innerRef(this.list);
}

if (this.list) {
this.list
.getScrollableNode()
.addEventListener('wheel', this.invertedWheelEvent);

this.list.setNativeProps({
style: {
transform: 'translate3d(0,0,0) scaleY(-1)',
},
});
}
}

componentWillUnmount() {
this.list.getScrollableNode()
.removeEventListener('wheel', this.invertedWheelEvent);
}

invertedWheelEvent(e) {
this.list.getScrollableNode().scrollTop -= e.deltaY;
e.preventDefault();
}

render() {
Expand Down

0 comments on commit c4417d0

Please sign in to comment.