diff --git a/package.json b/package.json
index 7e89c901bb..b328a9388c 100644
--- a/package.json
+++ b/package.json
@@ -97,8 +97,8 @@
"preact-portal": "1.1.3",
"pretty": "2.0.0",
"prop-types": "15.7.2",
- "react": "16.6.3",
- "react-dom": "16.6.3",
+ "react": "16.8.6",
+ "react-dom": "16.8.6",
"react-redux": "5.1.1",
"react-styleguidist": "7.3.11",
"react-test-renderer": "16.6.3",
@@ -134,8 +134,8 @@
"piwik-react-router": "^0.8.2",
"preact": "^8.3.1",
"preact-portal": "^1.1.3",
- "react": "^16.6.3",
- "react-dom": "^16.5.2"
+ "react": "^16.8.6",
+ "react-dom": "^16.8.6"
},
"eslintConfig": {
"extends": [
diff --git a/react/Page/Readme.md b/react/Page/Readme.md
new file mode 100644
index 0000000000..7ab4142a25
--- /dev/null
+++ b/react/Page/Readme.md
@@ -0,0 +1,13 @@
+The Page components enables to make layout that react well to keyboard appearing/disappearing.
+
+In the example below, the Button will appear at the bottom of the screen even if the PageContent
+does not takes all the space (the content grows to fill all the page). When the keyboard is
+shown, the Page real estate shrink and the Button will try to appear above the keyboard if it
+has enough space.
+
+```jsx static
+
+ Hello world !
+
+
+```
diff --git a/react/Page/index.jsx b/react/Page/index.jsx
new file mode 100644
index 0000000000..fade038113
--- /dev/null
+++ b/react/Page/index.jsx
@@ -0,0 +1,111 @@
+/**
+ * Layout components that know how to handle the keyboard.
+ *
+ * Work when the webview does not resize when the keyboard appears.
+ *
+ * https://github.com/ionic-team/cordova-plugin-ionic-keyboard
+ *
+ */
+
+import React from 'react'
+import { useKeyboardInfo } from './keyboard'
+import styles from './styles.styl'
+import withBreakpoints from '../helpers/withBreakpoints'
+
+const TOP_BAR_HEIGHT = 48
+const BOTTOM_BAR_HEIGHT = 48
+
+/**
+ * Returns the min-height CSS property for the Page
+ *
+ * The goal is for the Page to fill all the screen that is visible to the user.
+ * Since the keyboard appearing does not have any effect on the layout of the
+ * page (), we have to remove its height from the available space when it appears.
+ *
+ * Also handles fixed bars space:
+ *
+ * - topBar height is removed from the real estate available.
+ * - bottomBar height is removed from the real estate available, unless the
+ * keyboard is visible : since the bottom bar is expected to be hidden
+ * when an input is focused (to prevent iOS flickers), it does not take space
+ * when the keyboard is visible.
+ */
+const contentHeight = ({
+ topBarHeight = TOP_BAR_HEIGHT,
+ bottomBarHeight = BOTTOM_BAR_HEIGHT,
+ extraHeight = 0,
+ keyboardState,
+ keyboardHeight
+} = {}) => {
+ const removedSpace =
+ topBarHeight +
+ (keyboardState === 'showing' ? 0 : bottomBarHeight) +
+ // Surprisingly, vh changes when keyboard appears and 1 keyboard is added
+ // to the vh, this is why instead of adding 1 keyboardHeight, we add 2.
+ (keyboardState === 'showing' ? 2 * keyboardHeight : 0) +
+ extraHeight
+ return `calc(100vh ${removedSpace > 0 ? '-' : '+'} ${Math.abs(
+ removedSpace
+ )}px)`
+}
+
+/**
+ * Empty container, that has the same height as the keyboard when it is opened,
+ * used as a "cushion" upon which the PageFooter rests when the keyboard is opened.
+ */
+const KeyboardSpace = () => {
+ const { keyboardState, keyboardHeight } = useKeyboardInfo()
+ return (
+