Skip to content
Merged
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@ import { useEffect } from 'react';
import { getInteractionClient } from '../lib/bridgetApi';

export const InteractivesDisableArticleSwipe = () => {
useEffect(() => {
void getInteractionClient()
const onTouchStart = () => {
getInteractionClient()
.disableArticleSwipe(true)
.catch((error) => {
log('dotcom', 'disableArticleSwipe failed:', error);
log('dotcom', 'disableArticleSwipe failed', error);
});
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if you want the article to always have the article swipe disabled? If that's the case, it might be better to not ever set this to true, what do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that's a great shout! Yes, we always want interactives to have the article swipe disabled, have removed touchend events with bd01f1c

useEffect(() => {
document.addEventListener('touchstart', onTouchStart, {
passive: true,
});

return () => {
document.removeEventListener('touchstart', onTouchStart);
};
}, []);
return null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also wondering if you tested the number of events that are being fired. I think this might cause too many events being fired and might have performance side effect. I'm not sure though, it needs testing

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't, it's tricky to get things in the emulators pre-beta, though it shouldn't fire any more than carousels or key events on live blogs should it? A blanket on/off switch would be ideal but my understanding is that's not how the Android implementation works

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will setup my android simulator now and will test this. Will let you know 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

};
Loading