Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

rc-new-window

ticlo31.4kApache-2.00.1.13TypeScript support: included

popup new browser window with react

react, react-component, react-new-window, new-window

readme

rc-new-window


React New Window Component to show content in a popup browser window. Ported from react-new-window

NPM version npm download

Development

npm install
npm start

Example

online example: https://ticlo.github.io/rc-new-window/

install

rc-new-window

Usage

import React from 'react';
import ReactDOM from 'react-dom';
import NewWindow from 'rc-new-window';

ReactDOM.render((
  <NewWindow>
    Content to show in the new window
  </NewWindow>
), container);

API

props

name type default description
url String Use url instead of children content
name String Name of new window
title String title of current window Title of new window
copyStyles Boolean true Copy the styles from main window
width Number 640 Window inner width
height Number 480 Window inner height
initPopupInnerRect Function init the window client area
return {left,top,width,height}
initPopupOuterRect Function init the window position and size
return {left,top,width,height}
top Number center of current window Window position
onOpen (w: Window) => void callback when window is opened
onClose () => void callback when window is closed
onBlock () => void callback when window.open failed

License

rc-new-window is released under the Apache license version 2.0.

changelog

History


0.1.6 / 2021-02-23

  • fix es module

0.1.3 / 2020-12-18

  • fix safari window position and size issue

0.1.2 / 2020-12-13

  • add util function to map popup window to/from an element
  • add initPopupInnerRect and initPopupOuterRect

0.1.0 / 2020-12-10

  • remove features property, change to left, top, width, height
  • automatically close popup window when main window is closed