Skip to content

Commit

Permalink
fix(hippy-react-web): fix borwser does not support addRule
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleCo authored and zoomchan-cxj committed Jul 25, 2022
1 parent 6fc5871 commit 1b30755
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/hippy-react-web/src/adapters/hide-scrollbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export const shouldHideScrollBar = (isShowScrollBar: boolean) => {
if (canUseDOM) {
if (!isShowScrollBar && !window[hideScrollbarKey]) {
window[hideScrollbarKey] = true;
document.styleSheets[0].addRule(`.${HIDE_SCROLLBAR_CLASS}::-webkit-scrollbar`, 'display: none');
document.styleSheets[0].addRule(`.${HIDE_SCROLLBAR_CLASS}`, '-ms-overflow-style: none; scrollbar-width: none;');
document.styleSheets[0].insertRule(`.${HIDE_SCROLLBAR_CLASS}::-webkit-scrollbar { display: none }`, 0);
document.styleSheets[0].insertRule(`.${HIDE_SCROLLBAR_CLASS} { -ms-overflow-style: none; scrollbar-width: none; }`, 1);
}
}
};
1 change: 1 addition & 0 deletions packages/hippy-react-web/src/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { warn } from './utils';
global.Hippy = {
// @ts-ignore
Device,
on: () => {},
};
global.getTurboModule = () => {
warn('getTurboModule is unsupported');
Expand Down

0 comments on commit 1b30755

Please sign in to comment.