All Projects → Gautam-Arora24 → resize-observer-hook

Gautam-Arora24 / resize-observer-hook

Licence: MIT license
⚛️ A React Hook to monitor changes in the size of an element using native ResizeObserver API 🔍

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to resize-observer-hook

react-use-observer
Performant react hooks for WebApi Observers, useResizeObserver, useInteractionObserver, useMutationObserver
Stars: ✭ 19 (-57.78%)
Mutual labels:  hook, resize-observer
react-transition-state
Zero dependency React transition state machine.
Stars: ✭ 239 (+431.11%)
Mutual labels:  hook
Component Size
React hook for determining the size of a component
Stars: ✭ 224 (+397.78%)
Mutual labels:  hook
use-spring
Hooke's law hook
Stars: ✭ 53 (+17.78%)
Mutual labels:  hook
Funchook
Hook function calls by inserting jump instructions at runtime
Stars: ✭ 253 (+462.22%)
Mutual labels:  hook
Interface-Inspector-Hook
Interface Inspector破解
Stars: ✭ 43 (-4.44%)
Mutual labels:  hook
Use Image Color
🎨 A hook to grab a color palette from images. Render a skeleton color while your original image still loading.
Stars: ✭ 222 (+393.33%)
Mutual labels:  hook
messier
Messier is an app for tracing objective-c methods in an iOS app.
Stars: ✭ 72 (+60%)
Mutual labels:  hook
libmem
Advanced Game Hacking Library for C/C++, Rust and Python (Windows/Linux/FreeBSD) (Process/Memory Hacking) (Hooking/Detouring) (Cross Platform) (x86/x64/ARM/ARM64) (DLL/SO Injection) (Internal/External)
Stars: ✭ 336 (+646.67%)
Mutual labels:  hook
TemplePlus
ToEE hooks, extensions and fixes
Stars: ✭ 73 (+62.22%)
Mutual labels:  hook
use-callbag
👜 Use callbag as React hook.
Stars: ✭ 34 (-24.44%)
Mutual labels:  hook
use-route-as-state
Use React Router route and query string as component state
Stars: ✭ 37 (-17.78%)
Mutual labels:  hook
rdeco
响应式对象编程库,从时间和空间上解耦你的代码
Stars: ✭ 54 (+20%)
Mutual labels:  hook
Zxhookdetection
【iOS应用安全、安全攻防】hook及越狱的基本防护与检测(动态库注入检测、hook检测与防护、越狱检测、签名校验、IDA反编译分析加密协议Demo);【数据传输安全】浅谈http、https与数据加密
Stars: ✭ 241 (+435.56%)
Mutual labels:  hook
use-color-change
📈📉React hook for flashing a text when a value becomes higher or lower
Stars: ✭ 32 (-28.89%)
Mutual labels:  hook
Frida Skeleton
基于frida的安卓hook框架,提供了很多frida自身不支持的功能,将hook安卓变成简单便捷,人人都会的事情
Stars: ✭ 222 (+393.33%)
Mutual labels:  hook
react-media-hook
React Hook for Media Queries
Stars: ✭ 60 (+33.33%)
Mutual labels:  hook
Ryder
Runtime redirection of method calls for .NET Core.
Stars: ✭ 34 (-24.44%)
Mutual labels:  hook
react-use-downloader
Creates a download handler function and gives progress information
Stars: ✭ 65 (+44.44%)
Mutual labels:  hook
web
React hooks done right, for browser and SSR.
Stars: ✭ 940 (+1988.89%)
Mutual labels:  hook

resize-observer-hook

All Contributors

A hook that uses Resize Observer API to monitor changes in the size of an element.

NPM JavaScript Style Guide

Install

npm install resize-observer-hook

Usage

import React from 'react'

import useResizeObserver from 'resize-observer-hook'

const App = () => {
  const [ref, width, height] = useResizeObserver()

  return (
    <div ref={ref}>
      {width} X {height}
    </div>
  )
}

You can add multiple ResizeObserverBoxOptions to the useResizeObserver like this ->

const [ref,width,height] = useResizeObserver("borderBoxSize");

ResizeObserverBoxOptions that are supported currently in the library ->

  • borderBoxSize
  • contentBoxSize
  • contentRect

Note ⚠️ - Some options aren't supported in some broswers so if you provide any option that is not being supported in your current browser, it will automatically use contentRect to calculate height and width of the observed element.

See more details over here -> https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry

Contributing

You can help this library to grow by contributing here. Pick any issue or open one. Let us know what you are working on and ask your questions in the issues itself :)

The package is made up of 2 main folders:

  • /src contains all the resize-observer-hook code
  • /example is our create-react-app based demo website

To setup and run a local copy:

  1. Clone this repo with https://github.com/Gautam-Arora24/resize-observer-hook.git
  2. Run npm install in the root folder
  3. Run npm install in the example folder
  4. In seperate terminal window, run npm start in the root.
  5. In seperate terminal window, run npm start in the example folder.

When you're done working on your changes, submit a PR with the details and include a screenshot if you've changed anything visually.

License

MIT © Gautam-Arora24, and the contributors.

Contributors

Thanks goes to these wonderful people (emoji key):


Gautam Arora

💻

mehan

🎨

Nikhil Maske

💻

Batman09

📖

Keshav

📖

gim

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].