├── .babelrc
├── .editorconfig
├── .eslintignore
├── .eslintrc
├── .flowconfig
├── .gitignore
├── .npmignore
├── .prettierrc
├── .travis.yml
├── LICENSE
├── README.md
├── package-lock.json
├── package.json
├── src
└── ResizeObserver.js
└── typings
└── react-resize-observer.d.ts
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["@babel/preset-env", {
4 | "shippedProposals": true
5 | }],
6 | "@babel/preset-react",
7 | "@babel/preset-flow"
8 | ],
9 | "plugins": [
10 | "@babel/plugin-proposal-class-properties"
11 | ]
12 | }
13 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | #
2 | # EditorConfig: http://EditorConfig.org
3 | #
4 | # This files specifies some basic editor conventions for the files in this
5 | # project. Many editors support this standard, you simply need to find a plugin
6 | # for your favorite!
7 | #
8 | # For a full list of possible values consult the reference.
9 | # https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties
10 | #
11 |
12 | # Stop searching for other .editorconfig files above this folder.
13 | root = true
14 |
15 | # Pick some sane defaults for all files.
16 | [*]
17 |
18 | # UNIX line-endings are preferred.
19 | # http://adaptivepatchwork.com/2012/03/01/mind-the-end-of-your-line/
20 | end_of_line = lf
21 |
22 | # No reason in these modern times to use anything other than UTF-8.
23 | charset = utf-8
24 |
25 | # Ensure that there's no bogus whitespace in the file.
26 | trim_trailing_whitespace = true
27 |
28 | # A little esoteric, but it's kind of a standard now.
29 | # http://stackoverflow.com/questions/729692/why-should-files-end-with-a-newline
30 | insert_final_newline = true
31 |
32 | # Pragmatism today.
33 | # http://programmers.stackexchange.com/questions/57
34 | indent_style = 2
35 |
36 | # Personal preference here. Smaller indent size means you can fit more on a line
37 | # which can be nice when there are lines with several indentations.
38 | indent_size = 2
39 |
40 | # Prefer a more conservative default line length – this allows editors with
41 | # sidebars, minimaps, etc. to show at least two documents side-by-side.
42 | # Hard wrapping by default for code is useful since many editors don't support
43 | # an elegant soft wrap; however, soft wrap is fine for things where text just
44 | # flows normally, like Markdown documents or git commit messages. Hard wrap
45 | # is also easier for line-based diffing tools to consume.
46 | # See: http://tex.stackexchange.com/questions/54140
47 | max_line_length = 80
48 |
49 | # Markdown uses trailing spaces to create line breaks.
50 | [*.md]
51 | trim_trailing_whitespace = false
52 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | /flow-typed
2 | /*.js
3 | match/**/*
4 | internal/**/*
5 | test/*.js
6 | lib/**/*
7 | node_modules
8 | /coverage
9 |
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | extends:
2 | - metalab
3 | overrides:
4 | -
5 | files: "*.spec.js"
6 | env:
7 | jest: true
8 | env:
9 | browser: true
10 |
--------------------------------------------------------------------------------
/.flowconfig:
--------------------------------------------------------------------------------
1 | [ignore]
2 | .*\.flow
3 | [include]
4 |
5 | [libs]
6 |
7 | [lints]
8 | all=error
9 |
10 | [options]
11 | emoji=true
12 | include_warnings=true
13 | suppress_comment=\\(.\\|\n\\)*\\$ExpectError
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | *.log
3 | lib
4 | coverage
5 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | examples
3 | *.log
4 | coverage
5 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | parser: flow
2 | semi: true
3 | singleQuote: true
4 | trailingComma: all
5 | bracketSpacing: false
6 | arrowParens: always
7 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: false
2 | language: node_js
3 | matrix:
4 | include:
5 | - node_js: '8'
6 | - node_js: '10'
7 |
8 | after_success:
9 | - bash <(curl -s https://codecov.io/bash)
10 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Izaak Schroeder
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # react-resize-observer
2 |
3 | Component for giving you `onResize`.
4 |
5 | 
6 | 
7 | 
8 | 
9 | 
10 |
11 | ## Overview
12 |
13 | Primarily based on [this work] by Marc J. Schmidt.
14 |
15 | ## Usage
16 |
17 | ```
18 | npm install --save react react-dom react-resize-observer
19 | ```
20 |
21 | Add `ResizeObserver` to the element whose size or position you want to measure. The only requirement is that your component must _not_ have a `position` of `static` (see [Caveats](#caveats) section.
22 |
23 | ```jsx
24 | import ResizeObserver from 'react-resize-observer';
25 |
26 | const MyComponent = () => (
27 |