mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-14 10:35:11 +00:00
components/ViewHeightSensor: remove view height sensor
This appears to no longer be necessary for correct app height on Android.
This commit is contained in:
committed by
David Lechner
parent
27b8b1e428
commit
b255a145e3
@@ -1,11 +0,0 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// Copyright (c) 2021 The Pybricks Authors
|
||||
|
||||
import { render } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import ViewHeightSensor from './ViewHeightSensor';
|
||||
|
||||
it('should set the --pb-vh variable on resize', () => {
|
||||
render(<ViewHeightSensor />);
|
||||
// REVISIT: it is not easy to test the resize event since jest-dom doesn't do layout
|
||||
});
|
||||
@@ -1,29 +0,0 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// Copyright (c) 2022 The Pybricks Authors
|
||||
|
||||
/* This is a hack for correctly sizing to view height on mobile when not running in fullscreen mode. */
|
||||
|
||||
import { ResizeSensor } from '@blueprintjs/core';
|
||||
import React from 'react';
|
||||
|
||||
/* https://css-tricks.com/the-trick-to-viewport-units-on-mobile/ */
|
||||
|
||||
function ViewHeightSensor(): JSX.Element {
|
||||
return (
|
||||
<ResizeSensor
|
||||
onResize={(e): void => {
|
||||
document.documentElement.style.setProperty(
|
||||
'--pb-vh',
|
||||
`${e[0].contentRect.height}px`,
|
||||
);
|
||||
}}
|
||||
>
|
||||
<div
|
||||
id="pb-vh"
|
||||
style={{ height: '100%', width: '100%', position: 'absolute' }}
|
||||
/>
|
||||
</ResizeSensor>
|
||||
);
|
||||
}
|
||||
|
||||
export default ViewHeightSensor;
|
||||
Reference in New Issue
Block a user