10 examples of 'react window open' in JavaScript

Every line of 'react window open' 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
35open () {
36 this.setState({
37 open: true
38 })
39 this.props.onOpen()
40}
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

101function open (target, { placement = 'top', title, key }) {
102 let mountNode = document.createElement('div')
103 const eleClass = classNames(`${prefixCls}-base`, placement && `${prefixCls}-${placement}`)
104 render(
105 <Popper
106 className={`${prefixCls}__popper`}
107 show
108 attachEle={target}
109 placement={placement}
110 zIndex={1070}
111 width='auto'
112 >
113 <div className={eleClass}>{title}</div>
114 </Popper>,
115 mountNode
116 )
117 tooltipInstance[key] = mountNode
118}
135value: function open() {
136 var element = _reactDom2.default.findDOMNode(this);
137 element.style.height = this.refs.wrapper.clientHeight + 'px';
138}
18renderWindow() {
19 if (this.props.window.content) {
20 return React.createElement(windows[this.props.window.content], null);
21 }
22
23 return <div />;
24}
101value: function open() {
102 // position menu element below toggle button
103 var pos = {},
104 wrapperRect = this.wrapperElRef.getBoundingClientRect(),
105 toggleRect;
106 toggleRect = this.buttonElRef.buttonElRef.getBoundingClientRect(); // menu position
107
108 switch (this.props.placement) {
109 case 'up':
110 pos.bottom = toggleRect.height + toggleRect.top - wrapperRect.top;
111 break;
112
113 case 'right':
114 pos.left = toggleRect.width;
115 pos.top = toggleRect.top - wrapperRect.top;
116 break;
117
118 case 'left':
119 pos.right = toggleRect.width;
120 pos.top = toggleRect.top - wrapperRect.top;
121 break;
122
123 default:
124 pos.top = toggleRect.top - wrapperRect.top + toggleRect.height;
125 } // menu alignment
126
127
128 if (this.props.alignment === 'bottom') {
129 pos.top = 'auto';
130 pos.bottom = toggleRect.top - wrapperRect.top;
131 }
132
133 this.setState({
134 opened: true,
135 menuPos: pos
136 });
137}
39open(e) {
40 this.pickerDirective.open(e);
41}
54static open(props = {}) {
55 return new this(props).openInWindow({title: props.title || "iframe"}).targetMorph;
56}
48componentDidMount() {
49 var popoutWindow:Window, container:HTMLElement, update:(newComponent:any) => void, close:() => void;
50
51 popoutWindow = window.open("","_blank");
52 popoutWindow.onbeforeunload = () => {
53 if (container) {
54 ReactDOM.unmountComponentAtNode(container);
55 }
56 this.windowClosing();
57 };
58 var onloadHandler = () => {
59 if (container) {
60 var existing = popoutWindow.document.getElementById(this.divId);
61 if (!existing){
62 ReactDOM.unmountComponentAtNode(container);
63 container = null;
64 } else{
65 return;
66 }
67 }
68
69 popoutWindow.document.title = this.props.title;
70 container = popoutWindow.document.createElement('div');
71 container.id = this.divId;
72 $("link, style").each(function() {
73 //Todo: find a better way to clone this link
74 var link:any = $(this).clone()[0];
75 link.setAttribute("href",window.location.origin + window.location.pathname + link.getAttribute("href"));
76 $(popoutWindow.document.head).append(link);
77 });
78 popoutWindow.document.body.appendChild(container);
79 ReactDOM.render(this.props.content, container);
80 update = newComponent => {
81 ReactDOM.render(newComponent, container);
82 };
83 close = () => popoutWindow.close();
84 };
85
86 popoutWindow.onload = onloadHandler;
87 onloadHandler();
88
89 this.setState({ update, close });
90}
33private get window() {
34 return PopupWindow.windowRef
35}
34value: function open() {
35 _get(Cart.prototype.__proto__ || Object.getPrototypeOf(Cart.prototype), 'open', this).call(this);
36}

Related snippets