Skip to content

Instantly share code, notes, and snippets.

View iamshadmirza's full-sized avatar
👨‍💻
Tap Tap Tap

Shad Mirza iamshadmirza

👨‍💻
Tap Tap Tap
View GitHub Profile
@intergalacticspacehighway
intergalacticspacehighway / useKeyboardBottomInset hook
Created August 10, 2021 04:54
Hook to get keyboard height in React Native and add bottom/padding inset on a view.
import { Keyboard, Platform, KeyboardEvent } from 'react-native';
const useKeyboardBottomInset = () => {
const [bottom, setBottom] = React.useState(0);
const subscriptions = React.useRef([]);
React.useEffect(() => {
function onKeyboardChange(e) {
if (
e.startCoordinates &&