10 examples of 'resizemode in react native' in JavaScript

Every line of 'resizemode in react native' 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
39function resizeModes() {
40 "use strict";
41 var shortenNames = false;
42 $(".mode-button-label").css("width", "140px");
43
44 if (($(".mode-button-label").width() * 3) + 50 > $("#modes-container").width()) {
45 $(".mode-button-label").css("width", "115px");
46
47 if (($(".mode-button-label").width() * 3) + 50 > $("#modes-container").width()) {
48 $(".mode-button-label").css("width", "60px");
49 shortenNames = true;
50 }
51 }
52
53 if (!shortenNames) {
54 $("#one-vs-one-label").text("One vs. One");
55 $("#one-vs-all-label").text("One vs. All");
56 $("#all-vs-one-label").text("All vs. One");
57 } else {
58 $("#one-vs-one-label").text("1v1");
59 $("#one-vs-all-label").text("1vA");
60 $("#all-vs-one-label").text("Av1");
61 }
62}
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

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}
65render() {
66 const {
67 children,
68 onlyEvent,
69 component,
70 onResize,
71 widthPropName,
72 heightPropName,
73 ...props
74 } = this.props;
75 const { width, height } = this.state;
76
77 const hasCustomComponent = typeof component !== 'string';
78
79 const widthProp = [widthPropName || 'width'];
80 const heightProp = [heightPropName || 'height'];
81
82 const sizes = {
83 [widthProp]: width,
84 [heightProp]: height,
85 };
86
87 return createElement(
88 component,
89 {
90 [hasCustomComponent ? 'getRef' : 'ref']: el => { this.container = el; },
91 ...(hasCustomComponent && sizes),
92 ...props,
93 },
94 typeof children === 'function'
95 ? children({ width, height })
96 : Children.map(
97 children,
98 child =>
99 (isValidElement(child)
100 ? cloneElement(child, !onlyEvent ? sizes : null)
101 : child)
102 )
103 );
104}
5export default function Resize() {
6 const [debounce, setDebounce] = useState(60)
7 const size = useResize(debounce)
8
9 function handleChange(e) {
10 var parsed = parseInt(e.target.value)
11 if (isNaN(parsed)) {
12 setDebounce(null)
13 } else {
14 setDebounce(parsed)
15 }
16 }
17
18 return (
19 <div>
20 <h2>Resize Demo</h2>
21 <p>
22 width: {size.width}px, height: {size.height}px
23 </p>
24 FPS: <input value={debounce} onChange={handleChange} />
25 </div>
26 )
27}
19function resizeRatio(width, maxWidth, height, maxHeight) {
20 var ratio = [1];
21
22 if (width > maxWidth) {
23 ratio.push(maxWidth / width);
24 }
25 if (height > maxHeight) {
26 ratio.push(maxHeight / height);
27 }
28
29 ratio.sort();
30 return ratio[0];
31}
45render() {
46 const props = { width: this.state.width };
47 if (this.props.aspect) {
48 props.height = this.state.width / this.props.aspect;
49 }
50
51 const child = React.Children.only(this.props.children);
52 const childElement = this.state.width ? React.cloneElement(child, props) : null;
53 return (
54 <div
55 ref={c => {
56 this.container = c;
57 }}
58 style={this.props.style}
59 {...this.props}
60 >
61 {childElement}
62 </div>
63 );
64}
79export function useResize (callback) {
80 usePageLifecycle(callback, 'onResize')
81}
119function resize(mode) {
120 if (animationTimer)
121 toggleAnimation();
122
123 if (mode == "grow") {
124 width = Math.round(width * 1.2);
125 height = Math.round(height * 1.2);
126 } else if (mode == "shrink") {
127 width = Math.round(width * 0.8);
128 height = Math.round(height * 0.8);
129 }
130
131 canvas.width = width;
132 canvas.height = height;
133 pattern = new Array(width * height);
134 context.fillStyle = "rgba(0, 0, 0, 255)";
135 context.fillRect(0, 0, width, height);
136 buffer = context.getImageData(0, 0, width, height);
137
138 setUp();
139 toggleAnimation();
140}
92createEl() {
93 return super.createEl('iframe', {
94 className: 'vjs-resize-manager',
95 tabIndex: -1
96 }, {
97 'aria-hidden': 'true'
98 });
99}
9function bindResizeEvent() {
10 window.addEventListener('resize', handleScroll)
11
12 return function unbind() {
13 window.removeEventListener('resize', handleScroll)
14 }
15},

Related snippets