Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Commit

Permalink
Disable popover GPU acceleration on Windows
Browse files Browse the repository at this point in the history
Related to Bootstrap bug: twbs/bootstrap#22610
  • Loading branch information
Robert Bolender committed Sep 5, 2018
1 parent d4dcba4 commit 449d512
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion components/bootstrap/base-components.jsx
@@ -1,6 +1,7 @@
/* eslint-disable import/no-default-export */
import * as _Bootstrap from 'reactstrap';
import styled from 'styled-components';
import React from 'react';
import { wrapBootstrap } from '../utils';

const inlineComponents = ['Button'];
Expand Down Expand Up @@ -49,6 +50,23 @@ const Components = Object.keys(_Bootstrap)
{},
);

function withGpuAccelerationDisabled(Popover) {
return props => (
<Popover
{...props}
modifiers={{
computeStyle: {
gpuAcceleration: !(
typeof window !== `undefined` &&
window.devicePixelRatio < 1.5 &&
/Win/.test(navigator.platform)
),
},
}}
/>
);
}

export default {
...Components,
Label: styled(_Bootstrap.Label)`
Expand All @@ -58,7 +76,7 @@ export default {
margin-bottom: 0.375rem;
}
`,
Popover: styled(_Bootstrap.Popover)`
Popover: styled(withGpuAccelerationDisabled(_Bootstrap.Popover))`
&& {
box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.12), 0 0 4px 0 rgba(0, 0, 0, 0.12);
}
Expand Down

0 comments on commit 449d512

Please sign in to comment.