onscroll event bubble

This commit is contained in:
NikolaBorislavovHristov 2019-08-12 19:24:48 +03:00
parent 99063753e1
commit f2eb4535af
2 changed files with 20 additions and 6 deletions

View file

@ -8,6 +8,13 @@ const App = () => {
const onPathNotMatch = React.useCallback(() => {
window.history.back();
}, []);
const onScroll = React.useCallback((event) => {
const scrollEvent = new UIEvent('scroll');
for (const prop in event.nativeEvent) {
scrollEvent[prop] = event.nativeEvent[prop];
}
window.dispatchEvent(scrollEvent);
}, []);
const services = React.useMemo(() => ({
keyboardNavigation: new KeyboardNavigation()
}), []);
@ -17,11 +24,13 @@ const App = () => {
return (
<React.StrictMode>
<ServicesProvider services={services}>
<Router
homePath={'/'}
viewsConfig={routerViewsConfig}
onPathNotMatch={onPathNotMatch}
/>
<div className={'app-content'} onScroll={onScroll}>
<Router
homePath={'/'}
viewsConfig={routerViewsConfig}
onPathNotMatch={onPathNotMatch}
/>
</div>
</ServicesProvider>
</React.StrictMode>
);

View file

@ -82,9 +82,14 @@ html {
overflow: auto;
}
.routes-container {
.app-content {
width: 100%;
height: 100%;
.routes-container {
width: 100%;
height: 100%;
}
}
::-webkit-scrollbar {