Skip to content

Commit

Permalink
DeviceList: fix iOS scroll refresh bug (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
incognitojam authored Jul 10, 2023
1 parent 8cfae84 commit 3adf4f4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/components/Dashboard/DeviceList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,13 @@ class DeviceList extends Component {
settingsModalDongleId: null,
};

this.container = React.createRef();

this.renderDevice = this.renderDevice.bind(this);
this.handleOpenedSettingsModal = this.handleOpenedSettingsModal.bind(this);
this.handleClosedSettingsModal = this.handleClosedSettingsModal.bind(this);
this.onVisible = this.onVisible.bind(this);
this.onRef = this.onRef.bind(this);
}

handleOpenedSettingsModal(dongleId, ev) {
Expand All @@ -109,6 +112,13 @@ class DeviceList extends Component {
this.setState({ settingsModalDongleId: null });
}

onRef(el) {
this.container.current = el;
if (el) {
el.addEventListener('touchstart', (ev) => ev.stopPropagation());
}
}

async onVisible() {
const { dispatch } = this.props;
if (MyCommaAuth.isAuthenticated()) {
Expand Down Expand Up @@ -194,6 +204,7 @@ class DeviceList extends Component {
<>
<VisibilityHandler onVisible={ this.onVisible } minInterval={ 10 } />
<div
ref={this.onRef}
className={`scrollstyle ${classes.deviceList}`}
style={{ height: 'calc(100vh - 64px)' }}
>
Expand Down

0 comments on commit 3adf4f4

Please sign in to comment.