Dynamically switch to rtl

Is there any way to dynamically change layout according to the users language? using webpack

There is a browser API to enable/disable stylesheets, plus you can load them on demand Webpack + react RTL? - #11 by vinithjsamuel

I made it work using that:

(async () => {
    if (window.language == 'ar') {
        await import('framework7/css/framework7.bundle.rtl.css');
        await import('../css/app.css');
    } else {
        await import('framework7/css/framework7.bundle.css');
        await import('../css/app.css');
    }
})();

only problem now is that popovers don’t attach to correct position:

any idea why that happens?