-
Notifications
You must be signed in to change notification settings - Fork 985
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wrap keyboard avoiding view with safe area offset
- Loading branch information
Showing
2 changed files
with
37 additions
and
20 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
src/status_im/ui/components/keyboard_avoid_presentation.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
(ns status-im.ui.components.keyboard-avoid-presentation | ||
(:require [status-im.ui.components.react :as react] | ||
[oops.core :refer [oget]] | ||
[reagent.core :as reagent])) | ||
|
||
(defn keyboard-avoiding-view [] | ||
(let [this (reagent/current-component) | ||
props (reagent/props this) | ||
children (reagent/children this)] | ||
[react/safe-area-consumer | ||
(fn [insets] | ||
(let [vertical-offset (+ (oget insets "top") | ||
;; 10 is the margin-top for presentation modal | ||
10)] | ||
(reagent/as-element | ||
(into [react/keyboard-avoiding-view (merge props | ||
{:keyboard-vertical-offset vertical-offset})] | ||
children))))])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters