10 examples of 'onresize react' in JavaScript

Every line of 'onresize react' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
18onResize() {
19 if(this.mounted) {
20 const node = ReactDOM.findDOMNode(this);
21 const parent = node.parentNode.parentNode;
22 const prev = parseInt(parent.style.height, 10);
23 const {height} = visibleArea(parent);
24
25 if(prev === height || height === 0) {
26 return;
27 }
28 if(height) {
29 node.style.height = `${height - 32}px`;
30 }
31 }
32
33}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

49};this.rbCtx = (0, _getWrapperRbCtx2.default)(props.siteConfiguration);this.rbCtx.viewportDimensions = new _ViewportDimensions2.default();this.rbCtx.siteConfiguration = props.siteConfiguration;this.muiTheme = (0, _createMUITheme2.default)(this);}componentDidMount() {this.handle_onResize(); // Will populate the data structures for dimensions with current values
50}getChildContext() {return { rbCtx: this.rbCtx };}
251onResize() {
252 super.onResize.apply(this, arguments);
253 if (this.canvas) {
254 this._heater._width = this.canvas.width;
255 this._heater._height = this.canvas.height;
256 }
257}
45};this.state = { totalWidth: 100, totalHeight: 100 };}componentDidCatch(err, err_info) {if (window && window.__rebar_error_handler__) {window.__rebar_error_handler__({ err, err_info });}}componentDidMount() {this.handle_onResize(); // Will populate the data structures for dimensions with current values
46} // This should be overridden in AppDrawer
112onResize() {
113 let s = Math.max(window.innerWidth / 1280, window.innerHeight / 720)
114 $(this.renderer.domElement).css({
115 transformOrigin: 'left top',
116 scale: [s, s],
117 translate: [(window.innerWidth - 1280 * s) / 2, (window.innerHeight - 720 * s) / 2]
118 })
119}
69onResize() {
70 if (this._stickToBottom)
71 this._scrollContainer.scrollTop = this._scrollContainer.scrollHeight - this._scrollContainer.clientHeight;
72 this.scheduleUpdate();
73 super.onResize();
74}
595resize(width: number, height: number) {
596 this._eventLayer.style.width = `${width}px`;
597 this._eventLayer.style.height = `${height}px`;
598 this.compositor.resizeCanvas(width, height);
599}
55Responsive.prototype.componentDidMount = function componentDidMount() {
56 console.warn('Responsive is deprecated. You should use ResponsiveContext.Consumer instead.');
57 window.addEventListener('resize', this.onResize);
58 this.onResize();
59};
350onResize(viewportWidth, viewportHeight, orientation) {
351 super.onResize(viewportWidth, viewportHeight, orientation);
352
353 if (this.selector)
354 this.selector.onResize(viewportWidth, viewportHeight, orientation);
355}
32componentDidMount() {
33 this.mounted = true;
34 if (typeof window !== "undefined") {
35 window.addEventListener("resize", this.onResize);
36
37 this.onResize();
38 }
39}

Related snippets