@wordpress/components 25.3.0 → 25.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/build/border-control/border-control-dropdown/component.js +8 -10
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/button/index.native.js +9 -6
- package/build/button/index.native.js.map +1 -1
- package/build/color-palette/index.js +2 -2
- package/build/color-palette/index.js.map +1 -1
- package/build/focal-point-picker/index.native.js +6 -4
- package/build/focal-point-picker/index.native.js.map +1 -1
- package/build/form-token-field/styles.js +4 -2
- package/build/form-token-field/styles.js.map +1 -1
- package/build/item-group/item/hook.js +1 -1
- package/build/item-group/item/hook.js.map +1 -1
- package/build/item-group/styles.js +13 -10
- package/build/item-group/styles.js.map +1 -1
- package/build/menu-items-choice/index.js +1 -0
- package/build/menu-items-choice/index.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/bottom-sheet-navigation-context.native.js +3 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/bottom-sheet-navigation-context.native.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +50 -44
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +13 -20
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build/mobile/bottom-sheet/index.native.js +3 -1
- package/build/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build/mobile/image/index.native.js +4 -3
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/link-picker/link-picker-results.native.js +2 -1
- package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build/mobile/segmented-control/index.native.js +7 -7
- package/build/mobile/segmented-control/index.native.js.map +1 -1
- package/build/modal/index.js +14 -1
- package/build/modal/index.js.map +1 -1
- package/build/navigator/navigator-provider/component.js +18 -10
- package/build/navigator/navigator-provider/component.js.map +1 -1
- package/build/private-apis.js +4 -1
- package/build/private-apis.js.map +1 -1
- package/build/progress-bar/index.js +54 -0
- package/build/progress-bar/index.js.map +1 -0
- package/build/progress-bar/styles.js +69 -0
- package/build/progress-bar/styles.js.map +1 -0
- package/build/progress-bar/types.js +6 -0
- package/build/progress-bar/types.js.map +1 -0
- package/build/query-controls/index.js +1 -0
- package/build/query-controls/index.js.map +1 -1
- package/build/query-controls/index.native.js +1 -0
- package/build/query-controls/index.native.js.map +1 -1
- package/build/tab-panel/index.js +91 -58
- package/build/tab-panel/index.js.map +1 -1
- package/build/text-control/index.js +2 -2
- package/build/text-control/index.js.map +1 -1
- package/build/toolbar/toolbar-group/toolbar-group-container.native.js +10 -7
- package/build/toolbar/toolbar-group/toolbar-group-container.native.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +8 -10
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/button/index.native.js +8 -6
- package/build-module/button/index.native.js.map +1 -1
- package/build-module/color-palette/index.js +2 -2
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/focal-point-picker/index.native.js +6 -5
- package/build-module/focal-point-picker/index.native.js.map +1 -1
- package/build-module/form-token-field/styles.js +3 -2
- package/build-module/form-token-field/styles.js.map +1 -1
- package/build-module/item-group/item/hook.js +1 -1
- package/build-module/item-group/item/hook.js.map +1 -1
- package/build-module/item-group/styles.js +13 -11
- package/build-module/item-group/styles.js.map +1 -1
- package/build-module/menu-items-choice/index.js +1 -0
- package/build-module/menu-items-choice/index.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/bottom-sheet-navigation-context.native.js +3 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/bottom-sheet-navigation-context.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +43 -41
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +14 -20
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/index.native.js +3 -1
- package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +4 -3
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/link-picker/link-picker-results.native.js +2 -1
- package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build-module/mobile/segmented-control/index.native.js +7 -7
- package/build-module/mobile/segmented-control/index.native.js.map +1 -1
- package/build-module/modal/index.js +14 -1
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigator/navigator-provider/component.js +18 -10
- package/build-module/navigator/navigator-provider/component.js.map +1 -1
- package/build-module/private-apis.js +3 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/progress-bar/index.js +41 -0
- package/build-module/progress-bar/index.js.map +1 -0
- package/build-module/progress-bar/styles.js +61 -0
- package/build-module/progress-bar/styles.js.map +1 -0
- package/build-module/progress-bar/types.js +2 -0
- package/build-module/progress-bar/types.js.map +1 -0
- package/build-module/query-controls/index.js +1 -0
- package/build-module/query-controls/index.js.map +1 -1
- package/build-module/query-controls/index.native.js +1 -0
- package/build-module/query-controls/index.native.js.map +1 -1
- package/build-module/tab-panel/index.js +88 -59
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/text-control/index.js +2 -2
- package/build-module/text-control/index.js.map +1 -1
- package/build-module/toolbar/toolbar-group/toolbar-group-container.native.js +11 -7
- package/build-module/toolbar/toolbar-group/toolbar-group-container.native.js.map +1 -1
- package/build-style/style-rtl.css +3 -0
- package/build-style/style.css +3 -0
- package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
- package/build-types/form-token-field/styles.d.ts.map +1 -1
- package/build-types/item-group/item/hook.d.ts.map +1 -1
- package/build-types/item-group/stories/index.d.ts.map +1 -1
- package/build-types/item-group/styles.d.ts +1 -1
- package/build-types/item-group/styles.d.ts.map +1 -1
- package/build-types/menu-items-choice/index.d.ts.map +1 -1
- package/build-types/menu-items-choice/types.d.ts +5 -0
- package/build-types/menu-items-choice/types.d.ts.map +1 -1
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
- package/build-types/navigator/types.d.ts +3 -1
- package/build-types/navigator/types.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/progress-bar/index.d.ts +5 -0
- package/build-types/progress-bar/index.d.ts.map +1 -0
- package/build-types/progress-bar/stories/index.d.ts +12 -0
- package/build-types/progress-bar/stories/index.d.ts.map +1 -0
- package/build-types/progress-bar/styles.d.ts +18 -0
- package/build-types/progress-bar/styles.d.ts.map +1 -0
- package/build-types/progress-bar/test/index.d.ts +2 -0
- package/build-types/progress-bar/test/index.d.ts.map +1 -0
- package/build-types/progress-bar/types.d.ts +11 -0
- package/build-types/progress-bar/types.d.ts.map +1 -0
- package/build-types/query-controls/index.d.ts.map +1 -1
- package/build-types/tab-panel/index.d.ts.map +1 -1
- package/build-types/tab-panel/stories/index.d.ts +1 -0
- package/build-types/tab-panel/stories/index.d.ts.map +1 -1
- package/build-types/tab-panel/types.d.ts +1 -9
- package/build-types/tab-panel/types.d.ts.map +1 -1
- package/build-types/text-control/test/text-control.d.ts +2 -0
- package/build-types/text-control/test/text-control.d.ts.map +1 -0
- package/package.json +22 -22
- package/src/border-control/border-control-dropdown/component.tsx +7 -11
- package/src/border-control/test/index.js +6 -6
- package/src/button/index.native.js +9 -3
- package/src/button/style.native.scss +9 -0
- package/src/color-palette/index.tsx +2 -2
- package/src/color-palette/test/__snapshots__/index.tsx.snap +1 -1
- package/src/color-palette/test/index.tsx +1 -5
- package/src/draggable/test/index.native.js +4 -0
- package/src/focal-point-picker/index.native.js +6 -5
- package/src/form-token-field/styles.ts +2 -0
- package/src/item-group/item/hook.ts +2 -1
- package/src/item-group/stories/index.tsx +8 -3
- package/src/item-group/styles.ts +39 -28
- package/src/menu-item/README.md +7 -0
- package/src/menu-items-choice/index.tsx +1 -0
- package/src/menu-items-choice/types.ts +5 -0
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/bottom-sheet-navigation-context.native.js +1 -1
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +72 -53
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +15 -21
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +165 -119
- package/src/mobile/bottom-sheet/index.native.js +2 -0
- package/src/mobile/image/index.native.js +8 -6
- package/src/mobile/image/style.native.scss +5 -1
- package/src/mobile/link-picker/link-picker-results.native.js +1 -1
- package/src/mobile/link-settings/test/edit.native.js +37 -23
- package/src/mobile/segmented-control/index.native.js +11 -11
- package/src/modal/index.tsx +16 -0
- package/src/modal/test/index.tsx +33 -0
- package/src/navigator/navigator-provider/component.tsx +30 -23
- package/src/navigator/types.ts +4 -1
- package/src/placeholder/style.scss +5 -0
- package/src/private-apis.ts +2 -0
- package/src/progress-bar/README.md +30 -0
- package/src/progress-bar/index.tsx +45 -0
- package/src/progress-bar/stories/index.tsx +33 -0
- package/src/progress-bar/styles.ts +67 -0
- package/src/progress-bar/test/index.tsx +79 -0
- package/src/progress-bar/types.ts +11 -0
- package/src/query-controls/index.native.js +1 -0
- package/src/query-controls/index.tsx +1 -0
- package/src/tab-panel/index.tsx +121 -84
- package/src/tab-panel/stories/index.tsx +6 -0
- package/src/tab-panel/test/index.tsx +128 -109
- package/src/tab-panel/types.ts +1 -10
- package/src/text-control/index.tsx +2 -2
- package/src/text-control/test/text-control.tsx +61 -0
- package/src/toolbar/toolbar-group/style.native.scss +2 -3
- package/src/toolbar/toolbar-group/toolbar-group-container.native.js +12 -17
- package/src/tooltip/README.md +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/menu-items-choice/index.tsx"],"names":["check","MenuItem","noop","MenuItemsChoice","choices","onHover","onSelect","value","map","item","isSelected","info","shortcut","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,kBAAtB;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,cAArB;;AAGA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,eAAT,CAA0B;AACzBC,EAAAA,OAAO,GAAG,EADe;AAEzBC,EAAAA,OAAO,GAAGH,IAFe;AAGzBI,EAAAA,QAHyB;AAIzBC,EAAAA;AAJyB,CAA1B,EAK0B;AACzB,SACC,8BACGH,OAAO,CAACI,GAAR,CAAeC,IAAF,IAAY;AAC1B,UAAMC,UAAU,GAAGH,KAAK,KAAKE,IAAI,CAACF,KAAlC;AACA,WACC,cAAC,QAAD;AACC,MAAA,GAAG,EAAGE,IAAI,CAACF,KADZ;AAEC,MAAA,IAAI,EAAC,eAFN;AAGC,MAAA,IAAI,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/menu-items-choice/index.tsx"],"names":["check","MenuItem","noop","MenuItemsChoice","choices","onHover","onSelect","value","map","item","isSelected","disabled","info","shortcut","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,kBAAtB;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,cAArB;;AAGA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,eAAT,CAA0B;AACzBC,EAAAA,OAAO,GAAG,EADe;AAEzBC,EAAAA,OAAO,GAAGH,IAFe;AAGzBI,EAAAA,QAHyB;AAIzBC,EAAAA;AAJyB,CAA1B,EAK0B;AACzB,SACC,8BACGH,OAAO,CAACI,GAAR,CAAeC,IAAF,IAAY;AAC1B,UAAMC,UAAU,GAAGH,KAAK,KAAKE,IAAI,CAACF,KAAlC;AACA,WACC,cAAC,QAAD;AACC,MAAA,GAAG,EAAGE,IAAI,CAACF,KADZ;AAEC,MAAA,IAAI,EAAC,eAFN;AAGC,MAAA,QAAQ,EAAGE,IAAI,CAACE,QAHjB;AAIC,MAAA,IAAI,EAAGD,UAAU,IAAIV,KAJtB;AAKC,MAAA,IAAI,EAAGS,IAAI,CAACG,IALb;AAMC,MAAA,UAAU,EAAGF,UANd;AAOC,MAAA,QAAQ,EAAGD,IAAI,CAACI,QAPjB;AAQC,MAAA,SAAS,EAAC,8BARX;AASC,MAAA,OAAO,EAAG,MAAM;AACf,YAAK,CAAEH,UAAP,EAAoB;AACnBJ,UAAAA,QAAQ,CAAEG,IAAI,CAACF,KAAP,CAAR;AACA;AACD,OAbF;AAcC,MAAA,YAAY,EAAG,MAAMF,OAAO,CAAEI,IAAI,CAACF,KAAP,CAd7B;AAeC,MAAA,YAAY,EAAG,MAAMF,OAAO,CAAE,IAAF,CAf7B;AAgBC,oBAAaI,IAAI,CAAE,YAAF;AAhBlB,OAkBGA,IAAI,CAACK,KAlBR,CADD;AAsBA,GAxBC,CADH,CADD;AA6BA;;AAED,eAAeX,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport MenuItem from '../menu-item';\nimport type { MenuItemsChoiceProps } from './types';\n\nconst noop = () => {};\n\n/**\n * `MenuItemsChoice` functions similarly to a set of `MenuItem`s, but allows the user to select one option from a set of multiple choices.\n *\n *\n * ```jsx\n * import { MenuGroup, MenuItemsChoice } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyMenuItemsChoice = () => {\n * \tconst [ mode, setMode ] = useState( 'visual' );\n * \tconst choices = [\n * \t\t{\n * \t\t\tvalue: 'visual',\n * \t\t\tlabel: 'Visual editor',\n * \t\t},\n * \t\t{\n * \t\t\tvalue: 'text',\n * \t\t\tlabel: 'Code editor',\n * \t\t},\n * \t];\n *\n * \treturn (\n * \t\t<MenuGroup label=\"Editor\">\n * \t\t\t<MenuItemsChoice\n * \t\t\t\tchoices={ choices }\n * \t\t\t\tvalue={ mode }\n * \t\t\t\tonSelect={ ( newMode ) => setMode( newMode ) }\n * \t\t\t/>\n * \t\t</MenuGroup>\n * \t);\n * };\n * ```\n */\nfunction MenuItemsChoice( {\n\tchoices = [],\n\tonHover = noop,\n\tonSelect,\n\tvalue,\n}: MenuItemsChoiceProps ) {\n\treturn (\n\t\t<>\n\t\t\t{ choices.map( ( item ) => {\n\t\t\t\tconst isSelected = value === item.value;\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ item.value }\n\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\tdisabled={ item.disabled }\n\t\t\t\t\t\ticon={ isSelected && check }\n\t\t\t\t\t\tinfo={ item.info }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tshortcut={ item.shortcut }\n\t\t\t\t\t\tclassName=\"components-menu-items-choice\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( ! isSelected ) {\n\t\t\t\t\t\t\t\tonSelect( item.value );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonMouseEnter={ () => onHover( item.value ) }\n\t\t\t\t\t\tonMouseLeave={ () => onHover( null ) }\n\t\t\t\t\t\taria-label={ item[ 'aria-label' ] }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ item.label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport default MenuItemsChoice;\n"]}
|
|
@@ -5,7 +5,9 @@ import { createContext } from '@wordpress/element'; // Navigation context in Bot
|
|
|
5
5
|
// height of navigation container.
|
|
6
6
|
|
|
7
7
|
export const BottomSheetNavigationContext = createContext({
|
|
8
|
-
currentHeight:
|
|
8
|
+
currentHeight: {
|
|
9
|
+
value: 0
|
|
10
|
+
},
|
|
9
11
|
setHeight: () => {}
|
|
10
12
|
});
|
|
11
13
|
export const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/mobile/bottom-sheet/bottom-sheet-navigation/bottom-sheet-navigation-context.native.js"],"names":["createContext","BottomSheetNavigationContext","currentHeight","setHeight","Provider","BottomSheetNavigationProvider","Consumer","BottomSheetNavigationConsumer"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAT,QAA8B,oBAA9B,C,CAEA;AACA;;AACA,OAAO,MAAMC,4BAA4B,GAAGD,aAAa,CAAE;AAC1DE,EAAAA,aAAa,EAAE,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/mobile/bottom-sheet/bottom-sheet-navigation/bottom-sheet-navigation-context.native.js"],"names":["createContext","BottomSheetNavigationContext","currentHeight","value","setHeight","Provider","BottomSheetNavigationProvider","Consumer","BottomSheetNavigationConsumer"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAT,QAA8B,oBAA9B,C,CAEA;AACA;;AACA,OAAO,MAAMC,4BAA4B,GAAGD,aAAa,CAAE;AAC1DE,EAAAA,aAAa,EAAE;AAAEC,IAAAA,KAAK,EAAE;AAAT,GAD2C;AAE1DC,EAAAA,SAAS,EAAE,MAAM,CAAE;AAFuC,CAAF,CAAlD;AAKP,OAAO,MAAM;AACZC,EAAAA,QAAQ,EAAEC,6BADE;AAEZC,EAAAA,QAAQ,EAAEC;AAFE,IAGTP,4BAHG","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\n// Navigation context in BottomSheet is necessary for controlling the\n// height of navigation container.\nexport const BottomSheetNavigationContext = createContext( {\n\tcurrentHeight: { value: 0 },\n\tsetHeight: () => {},\n} );\n\nexport const {\n\tProvider: BottomSheetNavigationProvider,\n\tConsumer: BottomSheetNavigationConsumer,\n} = BottomSheetNavigationContext;\n"]}
|
package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js
CHANGED
|
@@ -3,21 +3,21 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { View, Easing } from 'react-native';
|
|
7
6
|
import { NavigationContainer, DefaultTheme } from '@react-navigation/native';
|
|
8
7
|
import { createStackNavigator } from '@react-navigation/stack';
|
|
8
|
+
import Animated, { Easing, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
9
9
|
/**
|
|
10
10
|
* WordPress dependencies
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import { useContext, useMemo, useCallback, Children, useRef, cloneElement } from '@wordpress/element';
|
|
14
14
|
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { performLayoutAnimation } from '../../layout-animation';
|
|
20
19
|
import { BottomSheetNavigationContext, BottomSheetNavigationProvider } from './bottom-sheet-navigation-context';
|
|
20
|
+
import { BottomSheetContext } from '../bottom-sheet-context';
|
|
21
21
|
import styles from './styles.scss';
|
|
22
22
|
const AnimationSpec = {
|
|
23
23
|
animation: 'timing',
|
|
@@ -46,48 +46,53 @@ const options = {
|
|
|
46
46
|
gestureEnabled: false,
|
|
47
47
|
cardStyleInterpolator: fadeConfig
|
|
48
48
|
};
|
|
49
|
-
const
|
|
49
|
+
const HEIGHT_ANIMATION_DURATION = 300;
|
|
50
|
+
const DEFAULT_HEIGHT = 1;
|
|
50
51
|
|
|
51
52
|
function BottomSheetNavigationContainer({
|
|
52
53
|
children,
|
|
53
54
|
animate,
|
|
54
55
|
main,
|
|
55
56
|
theme,
|
|
56
|
-
style
|
|
57
|
+
style,
|
|
58
|
+
testID
|
|
57
59
|
}) {
|
|
58
60
|
const Stack = useRef(createStackNavigator()).current;
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
+
const navigationContext = useContext(BottomSheetNavigationContext);
|
|
62
|
+
const {
|
|
63
|
+
maxHeight: sheetMaxHeight,
|
|
64
|
+
isMaxHeightSet: isSheetMaxHeightSet
|
|
65
|
+
} = useContext(BottomSheetContext);
|
|
66
|
+
const currentHeight = useSharedValue(navigationContext.currentHeight?.value || DEFAULT_HEIGHT);
|
|
61
67
|
const backgroundStyle = usePreferredColorSchemeStyle(styles.background, styles.backgroundDark);
|
|
62
|
-
|
|
63
|
-
const _theme = theme || { ...DefaultTheme,
|
|
68
|
+
const defaultTheme = useMemo(() => ({ ...DefaultTheme,
|
|
64
69
|
colors: { ...DefaultTheme.colors,
|
|
65
70
|
background: backgroundStyle.backgroundColor
|
|
66
71
|
}
|
|
67
|
-
};
|
|
72
|
+
}), [backgroundStyle.backgroundColor]);
|
|
73
|
+
|
|
74
|
+
const _theme = theme || defaultTheme;
|
|
68
75
|
|
|
69
76
|
const setHeight = useCallback(height => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
77
|
+
if (height > DEFAULT_HEIGHT && Math.round(height) !== Math.round(currentHeight.value)) {
|
|
78
|
+
// If max height is set in the bottom sheet, we clamp
|
|
79
|
+
// the new height using that value.
|
|
80
|
+
const newHeight = isSheetMaxHeightSet ? Math.min(sheetMaxHeight, height) : height;
|
|
81
|
+
const shouldAnimate = animate && currentHeight.value !== DEFAULT_HEIGHT;
|
|
76
82
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
setCurrentHeight(height);
|
|
83
|
+
if (shouldAnimate) {
|
|
84
|
+
currentHeight.value = withTiming(newHeight, {
|
|
85
|
+
duration: HEIGHT_ANIMATION_DURATION,
|
|
86
|
+
easing: Easing.out(Easing.cubic)
|
|
87
|
+
});
|
|
83
88
|
} else {
|
|
84
|
-
|
|
89
|
+
currentHeight.value = newHeight;
|
|
85
90
|
}
|
|
86
91
|
}
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
}, [animate, currentHeight, isSheetMaxHeightSet, sheetMaxHeight]);
|
|
93
|
+
const animatedStyles = useAnimatedStyle(() => ({
|
|
94
|
+
height: currentHeight.value
|
|
95
|
+
}));
|
|
91
96
|
const screens = useMemo(() => {
|
|
92
97
|
return Children.map(children, child => {
|
|
93
98
|
let screen = child;
|
|
@@ -107,15 +112,12 @@ function BottomSheetNavigationContainer({
|
|
|
107
112
|
...otherProps,
|
|
108
113
|
children: () => screen
|
|
109
114
|
});
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
113
|
-
}, [children]);
|
|
115
|
+
});
|
|
116
|
+
}, [children, main]);
|
|
114
117
|
return useMemo(() => {
|
|
115
|
-
return createElement(View, {
|
|
116
|
-
style: [style,
|
|
117
|
-
|
|
118
|
-
}]
|
|
118
|
+
return createElement(Animated.View, {
|
|
119
|
+
style: [style, animatedStyles],
|
|
120
|
+
testID: testID
|
|
119
121
|
}, createElement(BottomSheetNavigationProvider, {
|
|
120
122
|
value: {
|
|
121
123
|
setHeight,
|
|
@@ -124,13 +126,13 @@ function BottomSheetNavigationContainer({
|
|
|
124
126
|
}, main ? createElement(NavigationContainer, {
|
|
125
127
|
theme: _theme
|
|
126
128
|
}, createElement(Stack.Navigator, {
|
|
127
|
-
screenOptions: options
|
|
129
|
+
screenOptions: options,
|
|
130
|
+
detachInactiveScreens: false
|
|
128
131
|
}, screens)) : createElement(Stack.Navigator, {
|
|
129
|
-
screenOptions: options
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}, [currentHeight, _theme]);
|
|
132
|
+
screenOptions: options,
|
|
133
|
+
detachInactiveScreens: false
|
|
134
|
+
}, screens)));
|
|
135
|
+
}, [_theme, animatedStyles, currentHeight, main, screens, setHeight, style, testID]);
|
|
134
136
|
}
|
|
135
137
|
|
|
136
138
|
export default BottomSheetNavigationContainer;
|
package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js"],"names":["NavigationContainer","DefaultTheme","createStackNavigator","Animated","Easing","useAnimatedStyle","useSharedValue","withTiming","useContext","useMemo","useCallback","Children","useRef","cloneElement","usePreferredColorSchemeStyle","BottomSheetNavigationContext","BottomSheetNavigationProvider","BottomSheetContext","styles","AnimationSpec","animation","config","duration","easing","ease","fadeConfig","current","cardStyle","opacity","progress","options","transitionSpec","open","close","headerShown","gestureEnabled","cardStyleInterpolator","HEIGHT_ANIMATION_DURATION","DEFAULT_HEIGHT","BottomSheetNavigationContainer","children","animate","main","theme","style","testID","Stack","navigationContext","maxHeight","sheetMaxHeight","isMaxHeightSet","isSheetMaxHeightSet","currentHeight","value","backgroundStyle","background","backgroundDark","defaultTheme","colors","backgroundColor","_theme","setHeight","height","Math","round","newHeight","min","shouldAnimate","out","cubic","animatedStyles","screens","map","child","screen","name","otherProps","props","isNested"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,mBAAT,EAA8BC,YAA9B,QAAkD,0BAAlD;AACA,SAASC,oBAAT,QAAqC,yBAArC;AACA,OAAOC,QAAP,IACCC,MADD,EAECC,gBAFD,EAGCC,cAHD,EAICC,UAJD,QAKO,yBALP;AAOA;AACA;AACA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AAG9B,OADjB;AAEC,MAAA,qBAAqB,EAAG;AAFzB,OAIGyC,OAJH,CADD,CADK,GAUL,cAAC,KAAD,CAAO,SAAP;AACC,MAAA,aAAa,EAAGzC,OADjB;AAEC,MAAA,qBAAqB,EAAG;AAFzB,OAIGyC,OAJH,CAbF,CAJD,CADD;AA4BA,GA7Ba,EA6BX,CACFX,MADE,EAEFU,cAFE,EAGFlB,aAHE,EAIFV,IAJE,EAKF6B,OALE,EAMFV,SANE,EAOFjB,KAPE,EAQFC,MARE,CA7BW,CAAd;AAuCA;;AAED,eAAeN,8BAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { NavigationContainer, DefaultTheme } from '@react-navigation/native';\nimport { createStackNavigator } from '@react-navigation/stack';\nimport Animated, {\n\tEasing,\n\tuseAnimatedStyle,\n\tuseSharedValue,\n\twithTiming,\n} from 'react-native-reanimated';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseContext,\n\tuseMemo,\n\tuseCallback,\n\tChildren,\n\tuseRef,\n\tcloneElement,\n} from '@wordpress/element';\n\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBottomSheetNavigationContext,\n\tBottomSheetNavigationProvider,\n} from './bottom-sheet-navigation-context';\nimport { BottomSheetContext } from '../bottom-sheet-context';\n\nimport styles from './styles.scss';\n\nconst AnimationSpec = {\n\tanimation: 'timing',\n\tconfig: {\n\t\tduration: 200,\n\t\teasing: Easing.ease,\n\t},\n};\n\nconst fadeConfig = ( { current } ) => {\n\treturn {\n\t\tcardStyle: {\n\t\t\topacity: current.progress,\n\t\t},\n\t};\n};\n\nconst options = {\n\ttransitionSpec: {\n\t\topen: AnimationSpec,\n\t\tclose: AnimationSpec,\n\t},\n\theaderShown: false,\n\tgestureEnabled: false,\n\tcardStyleInterpolator: fadeConfig,\n};\n\nconst HEIGHT_ANIMATION_DURATION = 300;\nconst DEFAULT_HEIGHT = 1;\n\nfunction BottomSheetNavigationContainer( {\n\tchildren,\n\tanimate,\n\tmain,\n\ttheme,\n\tstyle,\n\ttestID,\n} ) {\n\tconst Stack = useRef( createStackNavigator() ).current;\n\tconst navigationContext = useContext( BottomSheetNavigationContext );\n\tconst { maxHeight: sheetMaxHeight, isMaxHeightSet: isSheetMaxHeightSet } =\n\t\tuseContext( BottomSheetContext );\n\tconst currentHeight = useSharedValue(\n\t\tnavigationContext.currentHeight?.value || DEFAULT_HEIGHT\n\t);\n\n\tconst backgroundStyle = usePreferredColorSchemeStyle(\n\t\tstyles.background,\n\t\tstyles.backgroundDark\n\t);\n\n\tconst defaultTheme = useMemo(\n\t\t() => ( {\n\t\t\t...DefaultTheme,\n\t\t\tcolors: {\n\t\t\t\t...DefaultTheme.colors,\n\t\t\t\tbackground: backgroundStyle.backgroundColor,\n\t\t\t},\n\t\t} ),\n\t\t[ backgroundStyle.backgroundColor ]\n\t);\n\tconst _theme = theme || defaultTheme;\n\n\tconst setHeight = useCallback(\n\t\t( height ) => {\n\t\t\tif (\n\t\t\t\theight > DEFAULT_HEIGHT &&\n\t\t\t\tMath.round( height ) !== Math.round( currentHeight.value )\n\t\t\t) {\n\t\t\t\t// If max height is set in the bottom sheet, we clamp\n\t\t\t\t// the new height using that value.\n\t\t\t\tconst newHeight = isSheetMaxHeightSet\n\t\t\t\t\t? Math.min( sheetMaxHeight, height )\n\t\t\t\t\t: height;\n\t\t\t\tconst shouldAnimate =\n\t\t\t\t\tanimate && currentHeight.value !== DEFAULT_HEIGHT;\n\n\t\t\t\tif ( shouldAnimate ) {\n\t\t\t\t\tcurrentHeight.value = withTiming( newHeight, {\n\t\t\t\t\t\tduration: HEIGHT_ANIMATION_DURATION,\n\t\t\t\t\t\teasing: Easing.out( Easing.cubic ),\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tcurrentHeight.value = newHeight;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[ animate, currentHeight, isSheetMaxHeightSet, sheetMaxHeight ]\n\t);\n\n\tconst animatedStyles = useAnimatedStyle( () => ( {\n\t\theight: currentHeight.value,\n\t} ) );\n\n\tconst screens = useMemo( () => {\n\t\treturn Children.map( children, ( child ) => {\n\t\t\tlet screen = child;\n\t\t\tconst { name, ...otherProps } = child.props;\n\t\t\tif ( ! main ) {\n\t\t\t\tscreen = cloneElement( child, {\n\t\t\t\t\t...child.props,\n\t\t\t\t\tisNested: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<Stack.Screen\n\t\t\t\t\tname={ name }\n\t\t\t\t\t{ ...otherProps }\n\t\t\t\t\tchildren={ () => screen }\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t}, [ children, main ] );\n\n\treturn useMemo( () => {\n\t\treturn (\n\t\t\t<Animated.View\n\t\t\t\tstyle={ [ style, animatedStyles ] }\n\t\t\t\ttestID={ testID }\n\t\t\t>\n\t\t\t\t<BottomSheetNavigationProvider\n\t\t\t\t\tvalue={ { setHeight, currentHeight } }\n\t\t\t\t>\n\t\t\t\t\t{ main ? (\n\t\t\t\t\t\t<NavigationContainer theme={ _theme }>\n\t\t\t\t\t\t\t<Stack.Navigator\n\t\t\t\t\t\t\t\tscreenOptions={ options }\n\t\t\t\t\t\t\t\tdetachInactiveScreens={ false }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ screens }\n\t\t\t\t\t\t\t</Stack.Navigator>\n\t\t\t\t\t\t</NavigationContainer>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Stack.Navigator\n\t\t\t\t\t\t\tscreenOptions={ options }\n\t\t\t\t\t\t\tdetachInactiveScreens={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ screens }\n\t\t\t\t\t\t</Stack.Navigator>\n\t\t\t\t\t) }\n\t\t\t\t</BottomSheetNavigationProvider>\n\t\t\t</Animated.View>\n\t\t);\n\t}, [\n\t\t_theme,\n\t\tanimatedStyles,\n\t\tcurrentHeight,\n\t\tmain,\n\t\tscreens,\n\t\tsetHeight,\n\t\tstyle,\n\t\ttestID,\n\t] );\n}\n\nexport default BottomSheetNavigationContainer;\n"]}
|
package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js
CHANGED
|
@@ -4,13 +4,12 @@ import { createElement } from "@wordpress/element";
|
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { useIsFocused, useNavigation, useFocusEffect } from '@react-navigation/native';
|
|
7
|
-
import {
|
|
7
|
+
import { ScrollView, TouchableHighlight, useWindowDimensions, View } from 'react-native';
|
|
8
8
|
/**
|
|
9
9
|
* WordPress dependencies
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { BottomSheetContext } from '@wordpress/components';
|
|
13
|
-
import { debounce } from '@wordpress/compose';
|
|
14
13
|
import { useRef, useCallback, useContext, useMemo } from '@wordpress/element';
|
|
15
14
|
/**
|
|
16
15
|
* Internal dependencies
|
|
@@ -27,9 +26,7 @@ const BottomSheetNavigationScreen = ({
|
|
|
27
26
|
name
|
|
28
27
|
}) => {
|
|
29
28
|
const navigation = useNavigation();
|
|
30
|
-
const
|
|
31
|
-
maxHeight: 0
|
|
32
|
-
});
|
|
29
|
+
const maxHeight = useRef(0);
|
|
33
30
|
const isFocused = useIsFocused();
|
|
34
31
|
const {
|
|
35
32
|
onHandleHardwareButtonPress,
|
|
@@ -38,13 +35,12 @@ const BottomSheetNavigationScreen = ({
|
|
|
38
35
|
listProps,
|
|
39
36
|
safeAreaBottomInset
|
|
40
37
|
} = useContext(BottomSheetContext);
|
|
38
|
+
const {
|
|
39
|
+
height: windowHeight
|
|
40
|
+
} = useWindowDimensions();
|
|
41
41
|
const {
|
|
42
42
|
setHeight
|
|
43
|
-
} = useContext(BottomSheetNavigationContext);
|
|
44
|
-
// see https://github.com/WordPress/gutenberg/pull/41166
|
|
45
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
-
|
|
47
|
-
const setHeightDebounce = useCallback(debounce(setHeight, 10), [setHeight]);
|
|
43
|
+
} = useContext(BottomSheetNavigationContext);
|
|
48
44
|
useFocusEffect(useCallback(() => {
|
|
49
45
|
onHandleHardwareButtonPress(() => {
|
|
50
46
|
if (navigation.canGoBack()) {
|
|
@@ -75,17 +71,15 @@ const BottomSheetNavigationScreen = ({
|
|
|
75
71
|
}, []));
|
|
76
72
|
useFocusEffect(useCallback(() => {
|
|
77
73
|
if (fullScreen) {
|
|
78
|
-
setHeight(
|
|
74
|
+
setHeight(windowHeight);
|
|
79
75
|
setIsFullScreen(true);
|
|
80
|
-
} else if (
|
|
76
|
+
} else if (maxHeight.current !== 0) {
|
|
81
77
|
setIsFullScreen(false);
|
|
82
|
-
setHeight(
|
|
78
|
+
setHeight(maxHeight.current);
|
|
83
79
|
}
|
|
84
80
|
|
|
85
|
-
return () => {};
|
|
86
|
-
|
|
87
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
88
|
-
}, [setHeight]));
|
|
81
|
+
return () => {};
|
|
82
|
+
}, [fullScreen, setHeight, setIsFullScreen, windowHeight]));
|
|
89
83
|
|
|
90
84
|
const onLayout = ({
|
|
91
85
|
nativeEvent
|
|
@@ -98,9 +92,9 @@ const BottomSheetNavigationScreen = ({
|
|
|
98
92
|
height
|
|
99
93
|
} = nativeEvent.layout;
|
|
100
94
|
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
|
|
95
|
+
if (maxHeight.current !== height && isFocused) {
|
|
96
|
+
maxHeight.current = height;
|
|
97
|
+
setHeight(height);
|
|
104
98
|
}
|
|
105
99
|
};
|
|
106
100
|
|
package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js"],"names":["useIsFocused","useNavigation","useFocusEffect","
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js"],"names":["useIsFocused","useNavigation","useFocusEffect","ScrollView","TouchableHighlight","useWindowDimensions","View","BottomSheetContext","useRef","useCallback","useContext","useMemo","BottomSheetNavigationContext","styles","BottomSheetNavigationScreen","children","fullScreen","isScrollable","isNested","name","navigation","maxHeight","isFocused","onHandleHardwareButtonPress","shouldEnableBottomSheetMaxHeight","setIsFullScreen","listProps","safeAreaBottomInset","height","windowHeight","setHeight","canGoBack","goBack","current","onLayout","nativeEvent","layout","scrollableContent","paddingBottom"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,YADD,EAECC,aAFD,EAGCC,cAHD,QAIO,0BAJP;AAKA,SACCC,UADD,EAECC,kBAFD,EAGCC,mBAHD,EAICC,IAJD,QAKO,cALP;AAOA;AACA;AACA;;AACA,SAASC,kBAAT,QAAmC,uBAAnC;AACA,SAASC,MAAT,EAAiBC,WAAjB,EAA8BC,UAA9B,EAA0CC,OAA1C,QAAyD,oBAAzD;AAEA;AACA;AACA;;AACA,SAASC,4BAAT,QAA6C,mCAA7C;AACA,OAAOC,MAAP,MAAmB,eAAnB;;AAEA,MAAMC,2BAA2B,GAAG,CAAE;AACrCC,EAAAA,QADqC;AAErCC,EAAAA,UAFqC;AAGrCC,EAAAA,YAHqC;AAIrCC,EAAAA,QAJqC;AAKrCC,EAAAA;AALqC,CAAF,KAM7B;AACN,QAAMC,UAAU,GAAGnB,aAAa,EAAhC;AACA,QAAMoB,SAAS,GAAGb,MAAM,CAAE,CAAF,CAAxB;AACA,QAAMc,SAAS,GAAGtB,YAAY,EAA9B;AACA,QAAM;AACLuB,IAAAA,2BADK;AAELC,IAAAA,gCAFK;AAGLC,IAAAA,eAHK;AAILC,IAAAA,SAJK;AAKLC,IAAAA;AALK,MAMFjB,UAAU,CAAEH,kBAAF,CANd;AAOA,QAAM;AAAEqB,IAAAA,MAAM,EAAEC;AAAV,MAA2BxB,mBAAmB,EAApD;AAEA,QAAM;AAAEyB,IAAAA;AAAF,MAAgBpB,UA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AM;AACrB,WAAOM,YAAY,IAAIC,QAAhB,GACN,cAAC,IAAD;AACC,MAAA,QAAQ,EAAGgB,QADZ;AAEC,MAAA,MAAM,EAAI,qBAAqBf,IAAM;AAFtC,OAIGJ,QAJH,CADM,GAQN,cAAC,UAAD,OAAiBW;AAAjB,OACC,cAAC,kBAAD;AAAoB,MAAA,UAAU,EAAG;AAAjC,OACC,cAAC,IAAD;AACC,MAAA,QAAQ,EAAGQ,QADZ;AAEC,MAAA,MAAM,EAAI,qBAAqBf,IAAM;AAFtC,OAIGJ,QAJH,EAKG,CAAEG,QAAF,IACD,cAAC,IAAD;AACC,MAAA,KAAK,EAAG;AACPU,QAAAA,MAAM,EACLD,mBAAmB,IACnBd,MAAM,CAACwB,iBAAP,CAAyBC;AAHnB;AADT,MANF,CADD,CADD,CARD,CADqB,CA6BrB;AACA;AACA;AACA,GAhCa,EAgCX,CACFvB,QADE,EAEFO,SAFE,EAGFK,mBAHE,EAIFD,SAJE,EAKFP,IALE,EAMFF,YANE,EAOFC,QAPE,EAQFgB,QARE,CAhCW,CAAd;AA0CA,CArHD;;AAuHA,eAAepB,2BAAf","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tuseIsFocused,\n\tuseNavigation,\n\tuseFocusEffect,\n} from '@react-navigation/native';\nimport {\n\tScrollView,\n\tTouchableHighlight,\n\tuseWindowDimensions,\n\tView,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { BottomSheetContext } from '@wordpress/components';\nimport { useRef, useCallback, useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { BottomSheetNavigationContext } from './bottom-sheet-navigation-context';\nimport styles from './styles.scss';\n\nconst BottomSheetNavigationScreen = ( {\n\tchildren,\n\tfullScreen,\n\tisScrollable,\n\tisNested,\n\tname,\n} ) => {\n\tconst navigation = useNavigation();\n\tconst maxHeight = useRef( 0 );\n\tconst isFocused = useIsFocused();\n\tconst {\n\t\tonHandleHardwareButtonPress,\n\t\tshouldEnableBottomSheetMaxHeight,\n\t\tsetIsFullScreen,\n\t\tlistProps,\n\t\tsafeAreaBottomInset,\n\t} = useContext( BottomSheetContext );\n\tconst { height: windowHeight } = useWindowDimensions();\n\n\tconst { setHeight } = useContext( BottomSheetNavigationContext );\n\n\tuseFocusEffect(\n\t\tuseCallback( () => {\n\t\t\tonHandleHardwareButtonPress( () => {\n\t\t\t\tif ( navigation.canGoBack() ) {\n\t\t\t\t\tshouldEnableBottomSheetMaxHeight( true );\n\t\t\t\t\tnavigation.goBack();\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tonHandleHardwareButtonPress( null );\n\t\t\t\treturn false;\n\t\t\t} );\n\t\t\t/**\n\t\t\t * TODO: onHandleHardwareButtonPress stores a single value, which means\n\t\t\t * future invocations from sibling screens can replace the callback for\n\t\t\t * the currently active screen. Currently, the empty dependency array\n\t\t\t * passed to useCallback here is what prevents erroneous callback\n\t\t\t * replacements, but leveraging memoization to achieve this is brittle and\n\t\t\t * explicitly discouraged in the React documentation.\n\t\t\t * https://reactjs.org/docs/hooks-reference.html#usememo\n\t\t\t *\n\t\t\t * Ideally, we refactor onHandleHardwareButtonPress to manage multiple\n\t\t\t * callbacks triggered based upon which screen is currently active.\n\t\t\t *\n\t\t\t * Related: https://github.com/WordPress/gutenberg/pull/36328#discussion_r768897546\n\t\t\t */\n\t\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, [] )\n\t);\n\n\tuseFocusEffect(\n\t\tuseCallback( () => {\n\t\t\tif ( fullScreen ) {\n\t\t\t\tsetHeight( windowHeight );\n\t\t\t\tsetIsFullScreen( true );\n\t\t\t} else if ( maxHeight.current !== 0 ) {\n\t\t\t\tsetIsFullScreen( false );\n\t\t\t\tsetHeight( maxHeight.current );\n\t\t\t}\n\t\t\treturn () => {};\n\t\t}, [ fullScreen, setHeight, setIsFullScreen, windowHeight ] )\n\t);\n\n\tconst onLayout = ( { nativeEvent } ) => {\n\t\tif ( fullScreen ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { height } = nativeEvent.layout;\n\t\tif ( maxHeight.current !== height && isFocused ) {\n\t\t\tmaxHeight.current = height;\n\t\t\tsetHeight( height );\n\t\t}\n\t};\n\n\treturn useMemo( () => {\n\t\treturn isScrollable || isNested ? (\n\t\t\t<View\n\t\t\t\tonLayout={ onLayout }\n\t\t\t\ttestID={ `navigation-screen-${ name }` }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</View>\n\t\t) : (\n\t\t\t<ScrollView { ...listProps }>\n\t\t\t\t<TouchableHighlight accessible={ false }>\n\t\t\t\t\t<View\n\t\t\t\t\t\tonLayout={ onLayout }\n\t\t\t\t\t\ttestID={ `navigation-screen-${ name }` }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t{ ! isNested && (\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\theight:\n\t\t\t\t\t\t\t\t\t\tsafeAreaBottomInset ||\n\t\t\t\t\t\t\t\t\t\tstyles.scrollableContent.paddingBottom,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</View>\n\t\t\t\t</TouchableHighlight>\n\t\t\t</ScrollView>\n\t\t);\n\t\t// Disable reason: deferring this refactor to the native team.\n\t\t// see https://github.com/WordPress/gutenberg/pull/41166\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [\n\t\tchildren,\n\t\tisFocused,\n\t\tsafeAreaBottomInset,\n\t\tlistProps,\n\t\tname,\n\t\tisScrollable,\n\t\tisNested,\n\t\tonLayout,\n\t] );\n};\n\nexport default BottomSheetNavigationScreen;\n"]}
|
|
@@ -538,7 +538,9 @@ class BottomSheet extends Component {
|
|
|
538
538
|
onHandleHardwareButtonPress: this.onHandleHardwareButtonPress,
|
|
539
539
|
listProps,
|
|
540
540
|
setIsFullScreen: this.setIsFullScreen,
|
|
541
|
-
safeAreaBottomInset
|
|
541
|
+
safeAreaBottomInset,
|
|
542
|
+
maxHeight,
|
|
543
|
+
isMaxHeightSet
|
|
542
544
|
}
|
|
543
545
|
}, hasNavigation ? createElement(Fragment, null, children) : createElement(TouchableHighlight, {
|
|
544
546
|
accessible: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/mobile/bottom-sheet/index.native.js"],"names":["Dimensions","Keyboard","LayoutAnimation","PanResponder","Platform","ScrollView","StatusBar","Text","TouchableHighlight","View","Modal","SafeArea","subscribeAndroidModalClosed","Component","withPreferredColorScheme","styles","Button","Cell","CyclePickerCell","PickerCell","SwitchCell","RangeCell","ColorCell","LinkCell","LinkSuggestionItemCell","RadioCell","NavigationScreen","NavigationContainer","KeyboardAvoidingView","BottomSheetSubSheet","NavBar","BottomSheetProvider","DEFAULT_LAYOUT_ANIMATION","Presets","easeInEaseOut","BottomSheet","constructor","arguments","onSafeAreaInsetsUpdate","bind","onScroll","isScrolling","onShouldEnableScroll","onDismiss","onShouldSetBottomSheetMaxHeight","setIsFullScreen","onDimensionsChange","onHeaderLayout","onCloseBottomSheet","onHandleClosingBottomSheet","onHardwareButtonPress","onHandleHardwareButtonPress","keyboardShow","keyboardHide","headerHeight","keyboardHeight","lastLayoutAnimation","lastLayoutAnimationFinished","state","safeAreaBottomInset","safeAreaTopInset","bounces","maxHeight","scrollEnabled","handleClosingBottomSheet","handleHardwareButtonPress","isMaxHeightSet","isFullScreen","props","e","isVisible","height","endCoordinates","performKeyboardLayoutAnimation","onSetMaxHeight","onKeyboardShow","onKeyboardHide","event","duration","easing","animationConfig","type","Types","layoutAnimation","update","create","property","Properties","opacity","delete","configureNext","performRegularLayoutAnimation","useLastLayoutAnimation","OS","componentDidMount","getSafeAreaInsetsForRootView","then","androidModalClosedSubscription","onClose","dimensionsChangeSubscription","addEventListener","keyboardShowListener","addListener","keyboardHideListener","safeAreaEventSubscription","componentWillUnmount","remove","result","safeAreaInsets","bottom","top","setState","width","get","statusBarHeight","currentHeight","maxHeightWithOpenKeyboard","Math","min","nativeEvent","layout","round","isCloseToBottom","layoutMeasurement","contentOffset","contentSize","y","isCloseToTop","value","action","getContentStyle","paddingBottom","scrollableContent","render","title","leftButton","rightButton","header","hideHeader","style","contentStyle","getStylesFromColorScheme","children","withHeaderSeparator","hasNavigation","rest","panResponder","onMoveShouldSetPanResponder","evt","gestureState","dy","backgroundStyle","background","backgroundDark","bottomSheetHeaderTitleStyle","bottomSheetHeaderTitle","bottomSheetHeaderTitleDark","listStyle","flexGrow","flexShrink","setMinHeightToMaxHeight","minHeight","listProps","disableScrollViewPanResponder","onScrollBeginDrag","onScrollEndDrag","scrollEventThrottle","contentContainerStyle","content","emptyHeader","automaticallyAdjustContentInsets","WrapperView","getHeader","bottomSheetHeader","flex","separator","showDragIndicator","allowDragIndicator","bottomModal","undefined","panHandlers","onMoveShouldSetResponder","onMoveShouldSetResponderCapture","borderColor","marginTop","backgroundFullScreen","testID","dragIndicator","shouldEnableBottomSheetScroll","shouldEnableBottomSheetMaxHeight","isBottomSheetContentScrolling","getWidth","maxWidth","ThemedBottomSheet","SubSheet"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,UADD,EAECC,QAFD,EAGCC,eAHD,EAICC,YAJD,EAKCC,QALD,EAMCC,UAND,EAOCC,SAPD,EAQCC,IARD,EASCC,kBATD,EAUCC,IAVD,QAWO,cAXP;AAYA,OAAOC,KAAP,MAAkB,oBAAlB;AACA,OAAOC,QAAP,MAAqB,wBAArB;AAEA;AACA;AACA;;AACA,SAASC,2BAAT,QAA4C,gCAA5C;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,wBAAT,QAAyC,oBAAzC;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,eAAnB;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,e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gBAAlB,GAAqCA,gBAArC;AACAuK,iBAAiB,CAACtK,mBAAlB,GAAwCA,mBAAxC;AAEA,eAAesK,iBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tDimensions,\n\tKeyboard,\n\tLayoutAnimation,\n\tPanResponder,\n\tPlatform,\n\tScrollView,\n\tStatusBar,\n\tText,\n\tTouchableHighlight,\n\tView,\n} from 'react-native';\nimport Modal from 'react-native-modal';\nimport SafeArea from 'react-native-safe-area';\n\n/**\n * WordPress dependencies\n */\nimport { subscribeAndroidModalClosed } from '@wordpress/react-native-bridge';\nimport { Component } from '@wordpress/element';\nimport { withPreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\nimport Button from './button';\nimport Cell from './cell';\nimport CyclePickerCell from './cycle-picker-cell';\nimport PickerCell from './picker-cell';\nimport SwitchCell from './switch-cell';\nimport RangeCell from './range-cell';\nimport ColorCell from './color-cell';\nimport LinkCell from './link-cell';\nimport LinkSuggestionItemCell from './link-suggestion-item-cell';\nimport RadioCell from './radio-cell';\nimport NavigationScreen from './bottom-sheet-navigation/navigation-screen';\nimport NavigationContainer from './bottom-sheet-navigation/navigation-container';\nimport KeyboardAvoidingView from './keyboard-avoiding-view';\nimport BottomSheetSubSheet from './sub-sheet';\nimport NavBar from './nav-bar';\nimport { BottomSheetProvider } from './bottom-sheet-context';\n\nconst DEFAULT_LAYOUT_ANIMATION = LayoutAnimation.Presets.easeInEaseOut;\n\nclass BottomSheet extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.onSafeAreaInsetsUpdate = this.onSafeAreaInsetsUpdate.bind( this );\n\t\tthis.onScroll = this.onScroll.bind( this );\n\t\tthis.isScrolling = this.isScrolling.bind( this );\n\t\tthis.onShouldEnableScroll = this.onShouldEnableScroll.bind( this );\n\t\tthis.onDismiss = this.onDismiss.bind( this );\n\t\tthis.onShouldSetBottomSheetMaxHeight =\n\t\t\tthis.onShouldSetBottomSheetMaxHeight.bind( this );\n\n\t\tthis.setIsFullScreen = this.setIsFullScreen.bind( this );\n\n\t\tthis.onDimensionsChange = this.onDimensionsChange.bind( this );\n\t\tthis.onHeaderLayout = this.onHeaderLayout.bind( this );\n\t\tthis.onCloseBottomSheet = this.onCloseBottomSheet.bind( this );\n\t\tthis.onHandleClosingBottomSheet =\n\t\t\tthis.onHandleClosingBottomSheet.bind( this );\n\t\tthis.onHardwareButtonPress = this.onHardwareButtonPress.bind( this );\n\t\tthis.onHandleHardwareButtonPress =\n\t\t\tthis.onHandleHardwareButtonPress.bind( this );\n\t\tthis.keyboardShow = this.keyboardShow.bind( this );\n\t\tthis.keyboardHide = this.keyboardHide.bind( this );\n\n\t\tthis.headerHeight = 0;\n\t\tthis.keyboardHeight = 0;\n\t\tthis.lastLayoutAnimation = null;\n\t\tthis.lastLayoutAnimationFinished = false;\n\n\t\tthis.state = {\n\t\t\tsafeAreaBottomInset: 0,\n\t\t\tsafeAreaTopInset: 0,\n\t\t\tbounces: false,\n\t\t\tmaxHeight: 0,\n\t\t\tscrollEnabled: true,\n\t\t\tisScrolling: false,\n\t\t\thandleClosingBottomSheet: null,\n\t\t\thandleHardwareButtonPress: null,\n\t\t\tisMaxHeightSet: true,\n\t\t\tisFullScreen: this.props.isFullScreen || false,\n\t\t};\n\t}\n\n\tkeyboardShow( e ) {\n\t\tif ( ! this.props.isVisible ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { height } = e.endCoordinates;\n\t\tthis.keyboardHeight = height;\n\t\tthis.performKeyboardLayoutAnimation( e );\n\t\tthis.onSetMaxHeight();\n\t\tthis.props.onKeyboardShow?.();\n\t}\n\n\tkeyboardHide( e ) {\n\t\tif ( ! this.props.isVisible ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.keyboardHeight = 0;\n\t\tthis.performKeyboardLayoutAnimation( e );\n\t\tthis.onSetMaxHeight();\n\t\tthis.props.onKeyboardHide?.();\n\t}\n\n\tperformKeyboardLayoutAnimation( event ) {\n\t\tconst { duration, easing } = event;\n\n\t\tif ( duration && easing ) {\n\t\t\t// This layout animation is the same as the React Native's KeyboardAvoidingView component.\n\t\t\t// Reference: https://github.com/facebook/react-native/blob/266b21baf35e052ff28120f79c06c4f6dddc51a9/Libraries/Components/Keyboard/KeyboardAvoidingView.js#L119-L128.\n\t\t\tconst animationConfig = {\n\t\t\t\t// We have to pass the duration equal to minimal accepted duration defined here: RCTLayoutAnimation.m.\n\t\t\t\tduration: duration > 10 ? duration : 10,\n\t\t\t\ttype: LayoutAnimation.Types[ easing ] || 'keyboard',\n\t\t\t};\n\t\t\tconst layoutAnimation = {\n\t\t\t\tduration: animationConfig.duration,\n\t\t\t\tupdate: animationConfig,\n\t\t\t\tcreate: {\n\t\t\t\t\t...animationConfig,\n\t\t\t\t\tproperty: LayoutAnimation.Properties.opacity,\n\t\t\t\t},\n\t\t\t\tdelete: {\n\t\t\t\t\t...animationConfig,\n\t\t\t\t\tproperty: LayoutAnimation.Properties.opacity,\n\t\t\t\t},\n\t\t\t};\n\t\t\tthis.lastLayoutAnimationFinished = false;\n\t\t\tLayoutAnimation.configureNext( layoutAnimation, () => {\n\t\t\t\tthis.lastLayoutAnimationFinished = true;\n\t\t\t} );\n\t\t\tthis.lastLayoutAnimation = layoutAnimation;\n\t\t} else {\n\t\t\t// TODO: Reinstate animations, possibly replacing `LayoutAnimation` with\n\t\t\t// more nuanced `Animated` usage or replacing our custom `BottomSheet`\n\t\t\t// with `@gorhom/bottom-sheet`. This animation was disabled to avoid a\n\t\t\t// preexisting bug: https://github.com/WordPress/gutenberg/issues/30562\n\t\t\t// this.performRegularLayoutAnimation( {\n\t\t\t// \tuseLastLayoutAnimation: false,\n\t\t\t// } );.\n\t\t}\n\t}\n\n\tperformRegularLayoutAnimation( { useLastLayoutAnimation } ) {\n\t\t// On Android, we should prevent triggering multiple layout animations at the same time because it can produce visual glitches.\n\t\tif (\n\t\t\tPlatform.OS === 'android' &&\n\t\t\tthis.lastLayoutAnimation &&\n\t\t\t! this.lastLayoutAnimationFinished\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst layoutAnimation = useLastLayoutAnimation\n\t\t\t? this.lastLayoutAnimation || DEFAULT_LAYOUT_ANIMATION\n\t\t\t: DEFAULT_LAYOUT_ANIMATION;\n\n\t\tthis.lastLayoutAnimationFinished = false;\n\t\tLayoutAnimation.configureNext( layoutAnimation, () => {\n\t\t\tthis.lastLayoutAnimationFinished = true;\n\t\t} );\n\t\tthis.lastLayoutAnimation = layoutAnimation;\n\t}\n\n\tcomponentDidMount() {\n\t\tSafeArea.getSafeAreaInsetsForRootView().then(\n\t\t\tthis.onSafeAreaInsetsUpdate\n\t\t);\n\n\t\tif ( Platform.OS === 'android' ) {\n\t\t\tthis.androidModalClosedSubscription = subscribeAndroidModalClosed(\n\t\t\t\t() => {\n\t\t\t\t\tthis.props.onClose();\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tthis.dimensionsChangeSubscription = Dimensions.addEventListener(\n\t\t\t'change',\n\t\t\tthis.onDimensionsChange\n\t\t);\n\n\t\t// 'Will' keyboard events are not available on Android.\n\t\t// Reference: https://reactnative.dev/docs/0.61/keyboard#addlistener.\n\t\tthis.keyboardShowListener = Keyboard.addListener(\n\t\t\tPlatform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow',\n\t\t\tthis.keyboardShow\n\t\t);\n\t\tthis.keyboardHideListener = Keyboard.addListener(\n\t\t\tPlatform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide',\n\t\t\tthis.keyboardHide\n\t\t);\n\n\t\tthis.safeAreaEventSubscription = SafeArea.addEventListener(\n\t\t\t'safeAreaInsetsForRootViewDidChange',\n\t\t\tthis.onSafeAreaInsetsUpdate\n\t\t);\n\t\tthis.onSetMaxHeight();\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis.dimensionsChangeSubscription.remove();\n\t\tthis.keyboardShowListener.remove();\n\t\tthis.keyboardHideListener.remove();\n\t\tif ( this.androidModalClosedSubscription ) {\n\t\t\tthis.androidModalClosedSubscription.remove();\n\t\t}\n\t\tif ( this.safeAreaEventSubscription === null ) {\n\t\t\treturn;\n\t\t}\n\t\tthis.safeAreaEventSubscription.remove();\n\t\tthis.safeAreaEventSubscription = null;\n\t}\n\n\tonSafeAreaInsetsUpdate( result ) {\n\t\tconst { safeAreaBottomInset, safeAreaTopInset } = this.state;\n\t\tif ( this.safeAreaEventSubscription === null ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { safeAreaInsets } = result;\n\t\tif (\n\t\t\tsafeAreaBottomInset !== safeAreaInsets.bottom ||\n\t\t\tsafeAreaTopInset !== safeAreaInsets.top\n\t\t) {\n\t\t\tthis.setState( {\n\t\t\t\tsafeAreaBottomInset: safeAreaInsets.bottom,\n\t\t\t\tsafeAreaTopInset: safeAreaInsets.top,\n\t\t\t} );\n\t\t}\n\t}\n\n\tonSetMaxHeight() {\n\t\tconst { height, width } = Dimensions.get( 'window' );\n\t\tconst { safeAreaBottomInset } = this.state;\n\t\tconst statusBarHeight =\n\t\t\tPlatform.OS === 'android' ? StatusBar.currentHeight : 0;\n\n\t\t// `maxHeight` when modal is opened along with a keyboard.\n\t\tconst maxHeightWithOpenKeyboard =\n\t\t\t0.95 *\n\t\t\t( Dimensions.get( 'window' ).height -\n\t\t\t\tthis.keyboardHeight -\n\t\t\t\tstatusBarHeight -\n\t\t\t\tthis.headerHeight );\n\n\t\t// In landscape orientation, set `maxHeight` to ~96% of the height.\n\t\tif ( width > height ) {\n\t\t\tthis.setState( {\n\t\t\t\tmaxHeight: Math.min(\n\t\t\t\t\t0.96 * height - this.headerHeight,\n\t\t\t\t\tmaxHeightWithOpenKeyboard\n\t\t\t\t),\n\t\t\t} );\n\t\t\t// In portrait orientation, set `maxHeight` to ~59% of the height.\n\t\t} else {\n\t\t\tthis.setState( {\n\t\t\t\tmaxHeight: Math.min(\n\t\t\t\t\theight * 0.59 - safeAreaBottomInset - this.headerHeight,\n\t\t\t\t\tmaxHeightWithOpenKeyboard\n\t\t\t\t),\n\t\t\t} );\n\t\t}\n\t}\n\n\tonDimensionsChange() {\n\t\tthis.onSetMaxHeight();\n\t\tthis.setState( { bounces: false } );\n\t}\n\n\tonHeaderLayout( { nativeEvent } ) {\n\t\tconst { height } = nativeEvent.layout;\n\t\t// The layout animation should only be triggered if the header\n\t\t// height has changed after being mounted.\n\t\tif (\n\t\t\tthis.headerHeight !== 0 &&\n\t\t\tMath.round( height ) !== Math.round( this.headerHeight )\n\t\t) {\n\t\t\tthis.performRegularLayoutAnimation( {\n\t\t\t\tuseLastLayoutAnimation: true,\n\t\t\t} );\n\t\t}\n\t\tthis.headerHeight = height;\n\t\tthis.onSetMaxHeight();\n\t}\n\n\tisCloseToBottom( { layoutMeasurement, contentOffset, contentSize } ) {\n\t\treturn (\n\t\t\tlayoutMeasurement.height + contentOffset.y >=\n\t\t\tcontentSize.height - contentOffset.y\n\t\t);\n\t}\n\n\tisCloseToTop( { contentOffset } ) {\n\t\treturn contentOffset.y < 10;\n\t}\n\n\tonScroll( { nativeEvent } ) {\n\t\tif ( this.isCloseToTop( nativeEvent ) ) {\n\t\t\tthis.setState( { bounces: false } );\n\t\t} else {\n\t\t\tthis.setState( { bounces: true } );\n\t\t}\n\t}\n\n\tonDismiss() {\n\t\tconst { onDismiss } = this.props;\n\n\t\tif ( onDismiss ) {\n\t\t\tonDismiss();\n\t\t}\n\n\t\tthis.onCloseBottomSheet();\n\t}\n\n\tonShouldEnableScroll( value ) {\n\t\tthis.setState( { scrollEnabled: value } );\n\t}\n\n\tonShouldSetBottomSheetMaxHeight( value ) {\n\t\tthis.setState( { isMaxHeightSet: value } );\n\t}\n\n\tisScrolling( value ) {\n\t\tthis.setState( { isScrolling: value } );\n\t}\n\n\tonHandleClosingBottomSheet( action ) {\n\t\tthis.setState( { handleClosingBottomSheet: action } );\n\t}\n\n\tonHandleHardwareButtonPress( action ) {\n\t\tthis.setState( { handleHardwareButtonPress: action } );\n\t}\n\n\tonCloseBottomSheet() {\n\t\tconst { onClose } = this.props;\n\t\tconst { handleClosingBottomSheet } = this.state;\n\t\tif ( handleClosingBottomSheet ) {\n\t\t\thandleClosingBottomSheet();\n\t\t\tthis.onHandleClosingBottomSheet( null );\n\t\t}\n\t\tif ( onClose ) {\n\t\t\tonClose();\n\t\t}\n\t\tthis.onShouldSetBottomSheetMaxHeight( true );\n\t}\n\n\tsetIsFullScreen( isFullScreen ) {\n\t\tif ( isFullScreen !== this.state.isFullScreen ) {\n\t\t\tif ( isFullScreen ) {\n\t\t\t\tthis.setState( { isFullScreen, isMaxHeightSet: false } );\n\t\t\t} else {\n\t\t\t\tthis.setState( { isFullScreen, isMaxHeightSet: true } );\n\t\t\t}\n\t\t}\n\t}\n\n\tonHardwareButtonPress() {\n\t\tconst { onClose } = this.props;\n\t\tconst { handleHardwareButtonPress } = this.state;\n\t\tif ( handleHardwareButtonPress && handleHardwareButtonPress() ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( onClose ) {\n\t\t\treturn onClose();\n\t\t}\n\t}\n\n\tgetContentStyle() {\n\t\tconst { safeAreaBottomInset } = this.state;\n\t\treturn {\n\t\t\tpaddingBottom:\n\t\t\t\t( safeAreaBottomInset || 0 ) +\n\t\t\t\tstyles.scrollableContent.paddingBottom,\n\t\t};\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\ttitle = '',\n\t\t\tisVisible,\n\t\t\tleftButton,\n\t\t\trightButton,\n\t\t\theader,\n\t\t\thideHeader,\n\t\t\tstyle = {},\n\t\t\tcontentStyle = {},\n\t\t\tgetStylesFromColorScheme,\n\t\t\tchildren,\n\t\t\twithHeaderSeparator = false,\n\t\t\thasNavigation,\n\t\t\tonDismiss,\n\t\t\t...rest\n\t\t} = this.props;\n\t\tconst {\n\t\t\tmaxHeight,\n\t\t\tbounces,\n\t\t\tsafeAreaBottomInset,\n\t\t\tsafeAreaTopInset,\n\t\t\tisScrolling,\n\t\t\tscrollEnabled,\n\t\t\tisMaxHeightSet,\n\t\t\tisFullScreen,\n\t\t} = this.state;\n\n\t\tconst panResponder = PanResponder.create( {\n\t\t\tonMoveShouldSetPanResponder: ( evt, gestureState ) => {\n\t\t\t\t// 'swiping-to-close' option is temporarily and partially disabled\n\t\t\t\t// on Android ( swipe / drag is still available in the top most area - near drag indicator).\n\t\t\t\tif ( Platform.OS === 'ios' ) {\n\t\t\t\t\t// Activates swipe down over child Touchables if the swipe is long enough.\n\t\t\t\t\t// With this we can adjust sensibility on the swipe vs tap gestures.\n\t\t\t\t\tif ( gestureState.dy > 3 && ! bounces ) {\n\t\t\t\t\t\tgestureState.dy = 0;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t},\n\t\t} );\n\n\t\tconst backgroundStyle = getStylesFromColorScheme(\n\t\t\tstyles.background,\n\t\t\tstyles.backgroundDark\n\t\t);\n\n\t\tconst bottomSheetHeaderTitleStyle = getStylesFromColorScheme(\n\t\t\tstyles.bottomSheetHeaderTitle,\n\t\t\tstyles.bottomSheetHeaderTitleDark\n\t\t);\n\n\t\tlet listStyle = {};\n\t\tif ( isFullScreen ) {\n\t\t\tlistStyle = { flexGrow: 1, flexShrink: 1 };\n\t\t} else if ( isMaxHeightSet ) {\n\t\t\tlistStyle = { maxHeight };\n\n\t\t\t// Allow setting a \"static\" height of the bottom sheet\n\t\t\t// by setting the min height to the max height.\n\t\t\tif ( this.props.setMinHeightToMaxHeight ) {\n\t\t\t\tlistStyle.minHeight = maxHeight;\n\t\t\t}\n\t\t}\n\n\t\tconst listProps = {\n\t\t\tdisableScrollViewPanResponder: true,\n\t\t\tbounces,\n\t\t\tonScroll: this.onScroll,\n\t\t\tonScrollBeginDrag: this.onScrollBeginDrag,\n\t\t\tonScrollEndDrag: this.onScrollEndDrag,\n\t\t\tscrollEventThrottle: 16,\n\t\t\tcontentContainerStyle: [\n\t\t\t\tstyles.content,\n\t\t\t\thideHeader && styles.emptyHeader,\n\t\t\t\tcontentStyle,\n\t\t\t\tisFullScreen && { flexGrow: 1 },\n\t\t\t],\n\t\t\tstyle: listStyle,\n\t\t\tsafeAreaBottomInset,\n\t\t\tscrollEnabled,\n\t\t\tautomaticallyAdjustContentInsets: false,\n\t\t};\n\n\t\tconst WrapperView = hasNavigation ? View : ScrollView;\n\n\t\tconst getHeader = () => (\n\t\t\t<>\n\t\t\t\t{ header || (\n\t\t\t\t\t<View style={ styles.bottomSheetHeader }>\n\t\t\t\t\t\t<View style={ styles.flex }>{ leftButton }</View>\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tstyle={ bottomSheetHeaderTitleStyle }\n\t\t\t\t\t\t\tmaxFontSizeMultiplier={ 3 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t<View style={ styles.flex }>{ rightButton }</View>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\t\t\t\t{ withHeaderSeparator && <View style={ styles.separator } /> }\n\t\t\t</>\n\t\t);\n\n\t\tconst showDragIndicator = () => {\n\t\t\t// If iOS or not fullscreen show the drag indicator.\n\t\t\tif ( Platform.OS === 'ios' || ! this.state.isFullScreen ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// Otherwise check the allowDragIndicator.\n\t\t\treturn this.props.allowDragIndicator;\n\t\t};\n\n\t\treturn (\n\t\t\t<Modal\n\t\t\t\tisVisible={ isVisible }\n\t\t\t\tstyle={ styles.bottomModal }\n\t\t\t\tanimationInTiming={ 400 }\n\t\t\t\tanimationOutTiming={ 300 }\n\t\t\t\tbackdropTransitionInTiming={ 50 }\n\t\t\t\tbackdropTransitionOutTiming={ 50 }\n\t\t\t\tbackdropOpacity={ 0.2 }\n\t\t\t\tonBackdropPress={ this.onCloseBottomSheet }\n\t\t\t\tonBackButtonPress={ this.onHardwareButtonPress }\n\t\t\t\tonSwipeComplete={ this.onCloseBottomSheet }\n\t\t\t\tonDismiss={ Platform.OS === 'ios' ? this.onDismiss : undefined }\n\t\t\t\tonModalHide={\n\t\t\t\t\tPlatform.OS === 'android' ? this.onDismiss : undefined\n\t\t\t\t}\n\t\t\t\tswipeDirection=\"down\"\n\t\t\t\tonMoveShouldSetResponder={\n\t\t\t\t\tscrollEnabled &&\n\t\t\t\t\tpanResponder.panHandlers.onMoveShouldSetResponder\n\t\t\t\t}\n\t\t\t\tonMoveShouldSetResponderCapture={\n\t\t\t\t\tscrollEnabled &&\n\t\t\t\t\tpanResponder.panHandlers.onMoveShouldSetResponderCapture\n\t\t\t\t}\n\t\t\t\tonAccessibilityEscape={ this.onCloseBottomSheet }\n\t\t\t\t{ ...rest }\n\t\t\t>\n\t\t\t\t<KeyboardAvoidingView\n\t\t\t\t\tbehavior={ Platform.OS === 'ios' && 'padding' }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t...backgroundStyle,\n\t\t\t\t\t\tborderColor: 'rgba(0, 0, 0, 0.1)',\n\t\t\t\t\t\tmarginTop:\n\t\t\t\t\t\t\tPlatform.OS === 'ios' && isFullScreen\n\t\t\t\t\t\t\t\t? safeAreaTopInset\n\t\t\t\t\t\t\t\t: 0,\n\t\t\t\t\t\tflex: isFullScreen ? 1 : undefined,\n\t\t\t\t\t\t...( Platform.OS === 'android' && isFullScreen\n\t\t\t\t\t\t\t? styles.backgroundFullScreen\n\t\t\t\t\t\t\t: {} ),\n\t\t\t\t\t\t...style,\n\t\t\t\t\t} }\n\t\t\t\t\tkeyboardVerticalOffset={ -safeAreaBottomInset }\n\t\t\t\t>\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ styles.header }\n\t\t\t\t\t\tonLayout={ this.onHeaderLayout }\n\t\t\t\t\t\ttestID={ `${ rest.testID || 'bottom-sheet' }-header` }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ showDragIndicator() && (\n\t\t\t\t\t\t\t<View style={ styles.dragIndicator } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! hideHeader && getHeader() }\n\t\t\t\t\t</View>\n\t\t\t\t\t<WrapperView\n\t\t\t\t\t\t{ ...( hasNavigation\n\t\t\t\t\t\t\t? { style: listProps.style }\n\t\t\t\t\t\t\t: listProps ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BottomSheetProvider\n\t\t\t\t\t\t\tvalue={ {\n\t\t\t\t\t\t\t\tshouldEnableBottomSheetScroll:\n\t\t\t\t\t\t\t\t\tthis.onShouldEnableScroll,\n\t\t\t\t\t\t\t\tshouldEnableBottomSheetMaxHeight:\n\t\t\t\t\t\t\t\t\tthis.onShouldSetBottomSheetMaxHeight,\n\t\t\t\t\t\t\t\tisBottomSheetContentScrolling: isScrolling,\n\t\t\t\t\t\t\t\tonHandleClosingBottomSheet:\n\t\t\t\t\t\t\t\t\tthis.onHandleClosingBottomSheet,\n\t\t\t\t\t\t\t\tonHandleHardwareButtonPress:\n\t\t\t\t\t\t\t\t\tthis.onHandleHardwareButtonPress,\n\t\t\t\t\t\t\t\tlistProps,\n\t\t\t\t\t\t\t\tsetIsFullScreen: this.setIsFullScreen,\n\t\t\t\t\t\t\t\tsafeAreaBottomInset,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ hasNavigation ? (\n\t\t\t\t\t\t\t\t<>{ children }</>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<TouchableHighlight accessible={ false }>\n\t\t\t\t\t\t\t\t\t<>{ children }</>\n\t\t\t\t\t\t\t\t</TouchableHighlight>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</BottomSheetProvider>\n\t\t\t\t\t\t{ ! hasNavigation && (\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\theight:\n\t\t\t\t\t\t\t\t\t\tsafeAreaBottomInset ||\n\t\t\t\t\t\t\t\t\t\tstyles.scrollableContent.paddingBottom,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</WrapperView>\n\t\t\t\t</KeyboardAvoidingView>\n\t\t\t</Modal>\n\t\t);\n\t}\n}\n\nfunction getWidth() {\n\treturn Math.min(\n\t\tDimensions.get( 'window' ).width,\n\t\tstyles.background.maxWidth\n\t);\n}\n\nconst ThemedBottomSheet = withPreferredColorScheme( BottomSheet );\n\nThemedBottomSheet.getWidth = getWidth;\nThemedBottomSheet.Button = Button;\nThemedBottomSheet.Cell = Cell;\nThemedBottomSheet.SubSheet = BottomSheetSubSheet;\nThemedBottomSheet.NavBar = NavBar;\nThemedBottomSheet.CyclePickerCell = CyclePickerCell;\nThemedBottomSheet.PickerCell = PickerCell;\nThemedBottomSheet.SwitchCell = SwitchCell;\nThemedBottomSheet.RangeCell = RangeCell;\nThemedBottomSheet.ColorCell = ColorCell;\nThemedBottomSheet.LinkCell = LinkCell;\nThemedBottomSheet.LinkSuggestionItemCell = LinkSuggestionItemCell;\nThemedBottomSheet.RadioCell = RadioCell;\nThemedBottomSheet.NavigationScreen = NavigationScreen;\nThemedBottomSheet.NavigationContainer = NavigationContainer;\n\nexport default ThemedBottomSheet;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/mobile/bottom-sheet/index.native.js"],"names":["Dimensions","Keyboard","LayoutAnimation","PanResponder","Platform","ScrollView","StatusBar","Text","TouchableHighlight","View","Modal","SafeArea","subscribeAndroidModalClosed","Component","withPreferredColorScheme","styles","Button","Cell","CyclePickerCell","PickerCell","SwitchCell","RangeCell","ColorCell","LinkCell","LinkSuggestionItemCell","RadioCell","NavigationScreen","NavigationContainer","KeyboardAvoidingView","BottomSheetSubSheet","NavBar","BottomSheetProvider","DEFAULT_LAYOUT_ANIMATION","Presets","easeInEaseOut","BottomSheet","constructor","arguments","onSafeAreaInsetsUpdate","bind","onScroll","isScrolling","onShouldEnableScroll","onDismiss","onShouldSetBottomSheetMaxHeight","setIsFullScreen","onDimensionsChange","onHeaderLayout","onCloseBottomSheet","onHandleClosingBottomSheet","onHardwareButtonPress","onHandleHardwareButtonPress","keyboardShow","keyboardHide","headerHeight","keyboardHeight","lastLayoutAnimation","lastLayoutAnimationFinished","state","safeAreaBottomInset","safeAreaTopInset","bounces","maxHeight","scrollEnabled","handleClosingBottomSheet","handleHardwareButtonPress","isMaxHeightSet","isFullScreen","props","e","isVisible","height","endCoordinates","performKeyboardLayoutAnimation","onSetMaxHeight","onKeyboardShow","onKeyboardHide","event","duration","easing","animationConfig","type","Types","layoutAnimation","update","create","property","Properties","opacity","delete","configureNext","performRegularLayoutAnimation","useLastLayoutAnimation","OS","componentDidMount","getSafeAreaInsetsForRootView","then","androidModalClosedSubscription","onClose","dimensionsChangeSubscription","addEventListener","keyboardShowListener","addListener","keyboardHideListener","safeAreaEventSubscription","componentWillUnmount","remove","result","safeAreaInsets","bottom","top","setState","width","get","statusBarHeight","currentHeight","maxHeightWithOpenKeyboard","Math","min","nativeEvent","layout","round","isCloseToBottom","layoutMeasurement","contentOffset","contentSize","y","isCloseToTop","value","action","getContentStyle","paddingBottom","scrollableContent","render","title","leftButton","rightButton","header","hideHeader","style","contentStyle","getStylesFromColorScheme","children","withHeaderSeparator","hasNavigation","rest","panResponder","onMoveShouldSetPanResponder","evt","gestureState","dy","backgroundStyle","background","backgroundDark","bottomSheetHeaderTitleStyle","bottomSheetHeaderTitle","bottomSheetHeaderTitleDark","listStyle","flexGrow","flexShrink","setMinHeightToMaxHeight","minHeight","listProps","disableScrollViewPanResponder","onScrollBeginDrag","onScrollEndDrag","scrollEventThrottle","contentContainerStyle","content","emptyHeader","automaticallyAdjustContentInsets","WrapperView","getHeader","bottomSheetHeader","flex","separator","showDragIndicator","allowDragIndicator","bottomModal","undefined","panHandlers","onMoveShouldSetResponder","onMoveShouldSetResponderCapture","borderColor","marginTop","backgroundFullScreen","testID","dragIndicator","shouldEnableBottomSheetScroll","shouldEnableBottomSheetMaxHeight","isBottomSheetContentScrolling","getWidth","maxWidth","ThemedBottomSheet","SubSheet"],"m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,IAAlB,GAAyBA,IAAzB;AACAgL,iBAAiB,CAACC,QAAlB,GAA6BrK,mBAA7B;AACAoK,iBAAiB,CAACnK,MAAlB,GAA2BA,MAA3B;AACAmK,iBAAiB,CAAC/K,eAAlB,GAAoCA,eAApC;AACA+K,iBAAiB,CAAC9K,UAAlB,GAA+BA,UAA/B;AACA8K,iBAAiB,CAAC7K,UAAlB,GAA+BA,UAA/B;AACA6K,iBAAiB,CAAC5K,SAAlB,GAA8BA,SAA9B;AACA4K,iBAAiB,CAAC3K,SAAlB,GAA8BA,SAA9B;AACA2K,iBAAiB,CAAC1K,QAAlB,GAA6BA,QAA7B;AACA0K,iBAAiB,CAACzK,sBAAlB,GAA2CA,sBAA3C;AACAyK,iBAAiB,CAACxK,SAAlB,GAA8BA,SAA9B;AACAwK,iBAAiB,CAACvK,gBAAlB,GAAqCA,gBAArC;AACAuK,iBAAiB,CAACtK,mBAAlB,GAAwCA,mBAAxC;AAEA,eAAesK,iBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tDimensions,\n\tKeyboard,\n\tLayoutAnimation,\n\tPanResponder,\n\tPlatform,\n\tScrollView,\n\tStatusBar,\n\tText,\n\tTouchableHighlight,\n\tView,\n} from 'react-native';\nimport Modal from 'react-native-modal';\nimport SafeArea from 'react-native-safe-area';\n\n/**\n * WordPress dependencies\n */\nimport { subscribeAndroidModalClosed } from '@wordpress/react-native-bridge';\nimport { Component } from '@wordpress/element';\nimport { withPreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\nimport Button from './button';\nimport Cell from './cell';\nimport CyclePickerCell from './cycle-picker-cell';\nimport PickerCell from './picker-cell';\nimport SwitchCell from './switch-cell';\nimport RangeCell from './range-cell';\nimport ColorCell from './color-cell';\nimport LinkCell from './link-cell';\nimport LinkSuggestionItemCell from './link-suggestion-item-cell';\nimport RadioCell from './radio-cell';\nimport NavigationScreen from './bottom-sheet-navigation/navigation-screen';\nimport NavigationContainer from './bottom-sheet-navigation/navigation-container';\nimport KeyboardAvoidingView from './keyboard-avoiding-view';\nimport BottomSheetSubSheet from './sub-sheet';\nimport NavBar from './nav-bar';\nimport { BottomSheetProvider } from './bottom-sheet-context';\n\nconst DEFAULT_LAYOUT_ANIMATION = LayoutAnimation.Presets.easeInEaseOut;\n\nclass BottomSheet extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.onSafeAreaInsetsUpdate = this.onSafeAreaInsetsUpdate.bind( this );\n\t\tthis.onScroll = this.onScroll.bind( this );\n\t\tthis.isScrolling = this.isScrolling.bind( this );\n\t\tthis.onShouldEnableScroll = this.onShouldEnableScroll.bind( this );\n\t\tthis.onDismiss = this.onDismiss.bind( this );\n\t\tthis.onShouldSetBottomSheetMaxHeight =\n\t\t\tthis.onShouldSetBottomSheetMaxHeight.bind( this );\n\n\t\tthis.setIsFullScreen = this.setIsFullScreen.bind( this );\n\n\t\tthis.onDimensionsChange = this.onDimensionsChange.bind( this );\n\t\tthis.onHeaderLayout = this.onHeaderLayout.bind( this );\n\t\tthis.onCloseBottomSheet = this.onCloseBottomSheet.bind( this );\n\t\tthis.onHandleClosingBottomSheet =\n\t\t\tthis.onHandleClosingBottomSheet.bind( this );\n\t\tthis.onHardwareButtonPress = this.onHardwareButtonPress.bind( this );\n\t\tthis.onHandleHardwareButtonPress =\n\t\t\tthis.onHandleHardwareButtonPress.bind( this );\n\t\tthis.keyboardShow = this.keyboardShow.bind( this );\n\t\tthis.keyboardHide = this.keyboardHide.bind( this );\n\n\t\tthis.headerHeight = 0;\n\t\tthis.keyboardHeight = 0;\n\t\tthis.lastLayoutAnimation = null;\n\t\tthis.lastLayoutAnimationFinished = false;\n\n\t\tthis.state = {\n\t\t\tsafeAreaBottomInset: 0,\n\t\t\tsafeAreaTopInset: 0,\n\t\t\tbounces: false,\n\t\t\tmaxHeight: 0,\n\t\t\tscrollEnabled: true,\n\t\t\tisScrolling: false,\n\t\t\thandleClosingBottomSheet: null,\n\t\t\thandleHardwareButtonPress: null,\n\t\t\tisMaxHeightSet: true,\n\t\t\tisFullScreen: this.props.isFullScreen || false,\n\t\t};\n\t}\n\n\tkeyboardShow( e ) {\n\t\tif ( ! this.props.isVisible ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { height } = e.endCoordinates;\n\t\tthis.keyboardHeight = height;\n\t\tthis.performKeyboardLayoutAnimation( e );\n\t\tthis.onSetMaxHeight();\n\t\tthis.props.onKeyboardShow?.();\n\t}\n\n\tkeyboardHide( e ) {\n\t\tif ( ! this.props.isVisible ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.keyboardHeight = 0;\n\t\tthis.performKeyboardLayoutAnimation( e );\n\t\tthis.onSetMaxHeight();\n\t\tthis.props.onKeyboardHide?.();\n\t}\n\n\tperformKeyboardLayoutAnimation( event ) {\n\t\tconst { duration, easing } = event;\n\n\t\tif ( duration && easing ) {\n\t\t\t// This layout animation is the same as the React Native's KeyboardAvoidingView component.\n\t\t\t// Reference: https://github.com/facebook/react-native/blob/266b21baf35e052ff28120f79c06c4f6dddc51a9/Libraries/Components/Keyboard/KeyboardAvoidingView.js#L119-L128.\n\t\t\tconst animationConfig = {\n\t\t\t\t// We have to pass the duration equal to minimal accepted duration defined here: RCTLayoutAnimation.m.\n\t\t\t\tduration: duration > 10 ? duration : 10,\n\t\t\t\ttype: LayoutAnimation.Types[ easing ] || 'keyboard',\n\t\t\t};\n\t\t\tconst layoutAnimation = {\n\t\t\t\tduration: animationConfig.duration,\n\t\t\t\tupdate: animationConfig,\n\t\t\t\tcreate: {\n\t\t\t\t\t...animationConfig,\n\t\t\t\t\tproperty: LayoutAnimation.Properties.opacity,\n\t\t\t\t},\n\t\t\t\tdelete: {\n\t\t\t\t\t...animationConfig,\n\t\t\t\t\tproperty: LayoutAnimation.Properties.opacity,\n\t\t\t\t},\n\t\t\t};\n\t\t\tthis.lastLayoutAnimationFinished = false;\n\t\t\tLayoutAnimation.configureNext( layoutAnimation, () => {\n\t\t\t\tthis.lastLayoutAnimationFinished = true;\n\t\t\t} );\n\t\t\tthis.lastLayoutAnimation = layoutAnimation;\n\t\t} else {\n\t\t\t// TODO: Reinstate animations, possibly replacing `LayoutAnimation` with\n\t\t\t// more nuanced `Animated` usage or replacing our custom `BottomSheet`\n\t\t\t// with `@gorhom/bottom-sheet`. This animation was disabled to avoid a\n\t\t\t// preexisting bug: https://github.com/WordPress/gutenberg/issues/30562\n\t\t\t// this.performRegularLayoutAnimation( {\n\t\t\t// \tuseLastLayoutAnimation: false,\n\t\t\t// } );.\n\t\t}\n\t}\n\n\tperformRegularLayoutAnimation( { useLastLayoutAnimation } ) {\n\t\t// On Android, we should prevent triggering multiple layout animations at the same time because it can produce visual glitches.\n\t\tif (\n\t\t\tPlatform.OS === 'android' &&\n\t\t\tthis.lastLayoutAnimation &&\n\t\t\t! this.lastLayoutAnimationFinished\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst layoutAnimation = useLastLayoutAnimation\n\t\t\t? this.lastLayoutAnimation || DEFAULT_LAYOUT_ANIMATION\n\t\t\t: DEFAULT_LAYOUT_ANIMATION;\n\n\t\tthis.lastLayoutAnimationFinished = false;\n\t\tLayoutAnimation.configureNext( layoutAnimation, () => {\n\t\t\tthis.lastLayoutAnimationFinished = true;\n\t\t} );\n\t\tthis.lastLayoutAnimation = layoutAnimation;\n\t}\n\n\tcomponentDidMount() {\n\t\tSafeArea.getSafeAreaInsetsForRootView().then(\n\t\t\tthis.onSafeAreaInsetsUpdate\n\t\t);\n\n\t\tif ( Platform.OS === 'android' ) {\n\t\t\tthis.androidModalClosedSubscription = subscribeAndroidModalClosed(\n\t\t\t\t() => {\n\t\t\t\t\tthis.props.onClose();\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tthis.dimensionsChangeSubscription = Dimensions.addEventListener(\n\t\t\t'change',\n\t\t\tthis.onDimensionsChange\n\t\t);\n\n\t\t// 'Will' keyboard events are not available on Android.\n\t\t// Reference: https://reactnative.dev/docs/0.61/keyboard#addlistener.\n\t\tthis.keyboardShowListener = Keyboard.addListener(\n\t\t\tPlatform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow',\n\t\t\tthis.keyboardShow\n\t\t);\n\t\tthis.keyboardHideListener = Keyboard.addListener(\n\t\t\tPlatform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide',\n\t\t\tthis.keyboardHide\n\t\t);\n\n\t\tthis.safeAreaEventSubscription = SafeArea.addEventListener(\n\t\t\t'safeAreaInsetsForRootViewDidChange',\n\t\t\tthis.onSafeAreaInsetsUpdate\n\t\t);\n\t\tthis.onSetMaxHeight();\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis.dimensionsChangeSubscription.remove();\n\t\tthis.keyboardShowListener.remove();\n\t\tthis.keyboardHideListener.remove();\n\t\tif ( this.androidModalClosedSubscription ) {\n\t\t\tthis.androidModalClosedSubscription.remove();\n\t\t}\n\t\tif ( this.safeAreaEventSubscription === null ) {\n\t\t\treturn;\n\t\t}\n\t\tthis.safeAreaEventSubscription.remove();\n\t\tthis.safeAreaEventSubscription = null;\n\t}\n\n\tonSafeAreaInsetsUpdate( result ) {\n\t\tconst { safeAreaBottomInset, safeAreaTopInset } = this.state;\n\t\tif ( this.safeAreaEventSubscription === null ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { safeAreaInsets } = result;\n\t\tif (\n\t\t\tsafeAreaBottomInset !== safeAreaInsets.bottom ||\n\t\t\tsafeAreaTopInset !== safeAreaInsets.top\n\t\t) {\n\t\t\tthis.setState( {\n\t\t\t\tsafeAreaBottomInset: safeAreaInsets.bottom,\n\t\t\t\tsafeAreaTopInset: safeAreaInsets.top,\n\t\t\t} );\n\t\t}\n\t}\n\n\tonSetMaxHeight() {\n\t\tconst { height, width } = Dimensions.get( 'window' );\n\t\tconst { safeAreaBottomInset } = this.state;\n\t\tconst statusBarHeight =\n\t\t\tPlatform.OS === 'android' ? StatusBar.currentHeight : 0;\n\n\t\t// `maxHeight` when modal is opened along with a keyboard.\n\t\tconst maxHeightWithOpenKeyboard =\n\t\t\t0.95 *\n\t\t\t( Dimensions.get( 'window' ).height -\n\t\t\t\tthis.keyboardHeight -\n\t\t\t\tstatusBarHeight -\n\t\t\t\tthis.headerHeight );\n\n\t\t// In landscape orientation, set `maxHeight` to ~96% of the height.\n\t\tif ( width > height ) {\n\t\t\tthis.setState( {\n\t\t\t\tmaxHeight: Math.min(\n\t\t\t\t\t0.96 * height - this.headerHeight,\n\t\t\t\t\tmaxHeightWithOpenKeyboard\n\t\t\t\t),\n\t\t\t} );\n\t\t\t// In portrait orientation, set `maxHeight` to ~59% of the height.\n\t\t} else {\n\t\t\tthis.setState( {\n\t\t\t\tmaxHeight: Math.min(\n\t\t\t\t\theight * 0.59 - safeAreaBottomInset - this.headerHeight,\n\t\t\t\t\tmaxHeightWithOpenKeyboard\n\t\t\t\t),\n\t\t\t} );\n\t\t}\n\t}\n\n\tonDimensionsChange() {\n\t\tthis.onSetMaxHeight();\n\t\tthis.setState( { bounces: false } );\n\t}\n\n\tonHeaderLayout( { nativeEvent } ) {\n\t\tconst { height } = nativeEvent.layout;\n\t\t// The layout animation should only be triggered if the header\n\t\t// height has changed after being mounted.\n\t\tif (\n\t\t\tthis.headerHeight !== 0 &&\n\t\t\tMath.round( height ) !== Math.round( this.headerHeight )\n\t\t) {\n\t\t\tthis.performRegularLayoutAnimation( {\n\t\t\t\tuseLastLayoutAnimation: true,\n\t\t\t} );\n\t\t}\n\t\tthis.headerHeight = height;\n\t\tthis.onSetMaxHeight();\n\t}\n\n\tisCloseToBottom( { layoutMeasurement, contentOffset, contentSize } ) {\n\t\treturn (\n\t\t\tlayoutMeasurement.height + contentOffset.y >=\n\t\t\tcontentSize.height - contentOffset.y\n\t\t);\n\t}\n\n\tisCloseToTop( { contentOffset } ) {\n\t\treturn contentOffset.y < 10;\n\t}\n\n\tonScroll( { nativeEvent } ) {\n\t\tif ( this.isCloseToTop( nativeEvent ) ) {\n\t\t\tthis.setState( { bounces: false } );\n\t\t} else {\n\t\t\tthis.setState( { bounces: true } );\n\t\t}\n\t}\n\n\tonDismiss() {\n\t\tconst { onDismiss } = this.props;\n\n\t\tif ( onDismiss ) {\n\t\t\tonDismiss();\n\t\t}\n\n\t\tthis.onCloseBottomSheet();\n\t}\n\n\tonShouldEnableScroll( value ) {\n\t\tthis.setState( { scrollEnabled: value } );\n\t}\n\n\tonShouldSetBottomSheetMaxHeight( value ) {\n\t\tthis.setState( { isMaxHeightSet: value } );\n\t}\n\n\tisScrolling( value ) {\n\t\tthis.setState( { isScrolling: value } );\n\t}\n\n\tonHandleClosingBottomSheet( action ) {\n\t\tthis.setState( { handleClosingBottomSheet: action } );\n\t}\n\n\tonHandleHardwareButtonPress( action ) {\n\t\tthis.setState( { handleHardwareButtonPress: action } );\n\t}\n\n\tonCloseBottomSheet() {\n\t\tconst { onClose } = this.props;\n\t\tconst { handleClosingBottomSheet } = this.state;\n\t\tif ( handleClosingBottomSheet ) {\n\t\t\thandleClosingBottomSheet();\n\t\t\tthis.onHandleClosingBottomSheet( null );\n\t\t}\n\t\tif ( onClose ) {\n\t\t\tonClose();\n\t\t}\n\t\tthis.onShouldSetBottomSheetMaxHeight( true );\n\t}\n\n\tsetIsFullScreen( isFullScreen ) {\n\t\tif ( isFullScreen !== this.state.isFullScreen ) {\n\t\t\tif ( isFullScreen ) {\n\t\t\t\tthis.setState( { isFullScreen, isMaxHeightSet: false } );\n\t\t\t} else {\n\t\t\t\tthis.setState( { isFullScreen, isMaxHeightSet: true } );\n\t\t\t}\n\t\t}\n\t}\n\n\tonHardwareButtonPress() {\n\t\tconst { onClose } = this.props;\n\t\tconst { handleHardwareButtonPress } = this.state;\n\t\tif ( handleHardwareButtonPress && handleHardwareButtonPress() ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( onClose ) {\n\t\t\treturn onClose();\n\t\t}\n\t}\n\n\tgetContentStyle() {\n\t\tconst { safeAreaBottomInset } = this.state;\n\t\treturn {\n\t\t\tpaddingBottom:\n\t\t\t\t( safeAreaBottomInset || 0 ) +\n\t\t\t\tstyles.scrollableContent.paddingBottom,\n\t\t};\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\ttitle = '',\n\t\t\tisVisible,\n\t\t\tleftButton,\n\t\t\trightButton,\n\t\t\theader,\n\t\t\thideHeader,\n\t\t\tstyle = {},\n\t\t\tcontentStyle = {},\n\t\t\tgetStylesFromColorScheme,\n\t\t\tchildren,\n\t\t\twithHeaderSeparator = false,\n\t\t\thasNavigation,\n\t\t\tonDismiss,\n\t\t\t...rest\n\t\t} = this.props;\n\t\tconst {\n\t\t\tmaxHeight,\n\t\t\tbounces,\n\t\t\tsafeAreaBottomInset,\n\t\t\tsafeAreaTopInset,\n\t\t\tisScrolling,\n\t\t\tscrollEnabled,\n\t\t\tisMaxHeightSet,\n\t\t\tisFullScreen,\n\t\t} = this.state;\n\n\t\tconst panResponder = PanResponder.create( {\n\t\t\tonMoveShouldSetPanResponder: ( evt, gestureState ) => {\n\t\t\t\t// 'swiping-to-close' option is temporarily and partially disabled\n\t\t\t\t// on Android ( swipe / drag is still available in the top most area - near drag indicator).\n\t\t\t\tif ( Platform.OS === 'ios' ) {\n\t\t\t\t\t// Activates swipe down over child Touchables if the swipe is long enough.\n\t\t\t\t\t// With this we can adjust sensibility on the swipe vs tap gestures.\n\t\t\t\t\tif ( gestureState.dy > 3 && ! bounces ) {\n\t\t\t\t\t\tgestureState.dy = 0;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t},\n\t\t} );\n\n\t\tconst backgroundStyle = getStylesFromColorScheme(\n\t\t\tstyles.background,\n\t\t\tstyles.backgroundDark\n\t\t);\n\n\t\tconst bottomSheetHeaderTitleStyle = getStylesFromColorScheme(\n\t\t\tstyles.bottomSheetHeaderTitle,\n\t\t\tstyles.bottomSheetHeaderTitleDark\n\t\t);\n\n\t\tlet listStyle = {};\n\t\tif ( isFullScreen ) {\n\t\t\tlistStyle = { flexGrow: 1, flexShrink: 1 };\n\t\t} else if ( isMaxHeightSet ) {\n\t\t\tlistStyle = { maxHeight };\n\n\t\t\t// Allow setting a \"static\" height of the bottom sheet\n\t\t\t// by setting the min height to the max height.\n\t\t\tif ( this.props.setMinHeightToMaxHeight ) {\n\t\t\t\tlistStyle.minHeight = maxHeight;\n\t\t\t}\n\t\t}\n\n\t\tconst listProps = {\n\t\t\tdisableScrollViewPanResponder: true,\n\t\t\tbounces,\n\t\t\tonScroll: this.onScroll,\n\t\t\tonScrollBeginDrag: this.onScrollBeginDrag,\n\t\t\tonScrollEndDrag: this.onScrollEndDrag,\n\t\t\tscrollEventThrottle: 16,\n\t\t\tcontentContainerStyle: [\n\t\t\t\tstyles.content,\n\t\t\t\thideHeader && styles.emptyHeader,\n\t\t\t\tcontentStyle,\n\t\t\t\tisFullScreen && { flexGrow: 1 },\n\t\t\t],\n\t\t\tstyle: listStyle,\n\t\t\tsafeAreaBottomInset,\n\t\t\tscrollEnabled,\n\t\t\tautomaticallyAdjustContentInsets: false,\n\t\t};\n\n\t\tconst WrapperView = hasNavigation ? View : ScrollView;\n\n\t\tconst getHeader = () => (\n\t\t\t<>\n\t\t\t\t{ header || (\n\t\t\t\t\t<View style={ styles.bottomSheetHeader }>\n\t\t\t\t\t\t<View style={ styles.flex }>{ leftButton }</View>\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tstyle={ bottomSheetHeaderTitleStyle }\n\t\t\t\t\t\t\tmaxFontSizeMultiplier={ 3 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t<View style={ styles.flex }>{ rightButton }</View>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\t\t\t\t{ withHeaderSeparator && <View style={ styles.separator } /> }\n\t\t\t</>\n\t\t);\n\n\t\tconst showDragIndicator = () => {\n\t\t\t// If iOS or not fullscreen show the drag indicator.\n\t\t\tif ( Platform.OS === 'ios' || ! this.state.isFullScreen ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// Otherwise check the allowDragIndicator.\n\t\t\treturn this.props.allowDragIndicator;\n\t\t};\n\n\t\treturn (\n\t\t\t<Modal\n\t\t\t\tisVisible={ isVisible }\n\t\t\t\tstyle={ styles.bottomModal }\n\t\t\t\tanimationInTiming={ 400 }\n\t\t\t\tanimationOutTiming={ 300 }\n\t\t\t\tbackdropTransitionInTiming={ 50 }\n\t\t\t\tbackdropTransitionOutTiming={ 50 }\n\t\t\t\tbackdropOpacity={ 0.2 }\n\t\t\t\tonBackdropPress={ this.onCloseBottomSheet }\n\t\t\t\tonBackButtonPress={ this.onHardwareButtonPress }\n\t\t\t\tonSwipeComplete={ this.onCloseBottomSheet }\n\t\t\t\tonDismiss={ Platform.OS === 'ios' ? this.onDismiss : undefined }\n\t\t\t\tonModalHide={\n\t\t\t\t\tPlatform.OS === 'android' ? this.onDismiss : undefined\n\t\t\t\t}\n\t\t\t\tswipeDirection=\"down\"\n\t\t\t\tonMoveShouldSetResponder={\n\t\t\t\t\tscrollEnabled &&\n\t\t\t\t\tpanResponder.panHandlers.onMoveShouldSetResponder\n\t\t\t\t}\n\t\t\t\tonMoveShouldSetResponderCapture={\n\t\t\t\t\tscrollEnabled &&\n\t\t\t\t\tpanResponder.panHandlers.onMoveShouldSetResponderCapture\n\t\t\t\t}\n\t\t\t\tonAccessibilityEscape={ this.onCloseBottomSheet }\n\t\t\t\t{ ...rest }\n\t\t\t>\n\t\t\t\t<KeyboardAvoidingView\n\t\t\t\t\tbehavior={ Platform.OS === 'ios' && 'padding' }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t...backgroundStyle,\n\t\t\t\t\t\tborderColor: 'rgba(0, 0, 0, 0.1)',\n\t\t\t\t\t\tmarginTop:\n\t\t\t\t\t\t\tPlatform.OS === 'ios' && isFullScreen\n\t\t\t\t\t\t\t\t? safeAreaTopInset\n\t\t\t\t\t\t\t\t: 0,\n\t\t\t\t\t\tflex: isFullScreen ? 1 : undefined,\n\t\t\t\t\t\t...( Platform.OS === 'android' && isFullScreen\n\t\t\t\t\t\t\t? styles.backgroundFullScreen\n\t\t\t\t\t\t\t: {} ),\n\t\t\t\t\t\t...style,\n\t\t\t\t\t} }\n\t\t\t\t\tkeyboardVerticalOffset={ -safeAreaBottomInset }\n\t\t\t\t>\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ styles.header }\n\t\t\t\t\t\tonLayout={ this.onHeaderLayout }\n\t\t\t\t\t\ttestID={ `${ rest.testID || 'bottom-sheet' }-header` }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ showDragIndicator() && (\n\t\t\t\t\t\t\t<View style={ styles.dragIndicator } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! hideHeader && getHeader() }\n\t\t\t\t\t</View>\n\t\t\t\t\t<WrapperView\n\t\t\t\t\t\t{ ...( hasNavigation\n\t\t\t\t\t\t\t? { style: listProps.style }\n\t\t\t\t\t\t\t: listProps ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BottomSheetProvider\n\t\t\t\t\t\t\tvalue={ {\n\t\t\t\t\t\t\t\tshouldEnableBottomSheetScroll:\n\t\t\t\t\t\t\t\t\tthis.onShouldEnableScroll,\n\t\t\t\t\t\t\t\tshouldEnableBottomSheetMaxHeight:\n\t\t\t\t\t\t\t\t\tthis.onShouldSetBottomSheetMaxHeight,\n\t\t\t\t\t\t\t\tisBottomSheetContentScrolling: isScrolling,\n\t\t\t\t\t\t\t\tonHandleClosingBottomSheet:\n\t\t\t\t\t\t\t\t\tthis.onHandleClosingBottomSheet,\n\t\t\t\t\t\t\t\tonHandleHardwareButtonPress:\n\t\t\t\t\t\t\t\t\tthis.onHandleHardwareButtonPress,\n\t\t\t\t\t\t\t\tlistProps,\n\t\t\t\t\t\t\t\tsetIsFullScreen: this.setIsFullScreen,\n\t\t\t\t\t\t\t\tsafeAreaBottomInset,\n\t\t\t\t\t\t\t\tmaxHeight,\n\t\t\t\t\t\t\t\tisMaxHeightSet,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ hasNavigation ? (\n\t\t\t\t\t\t\t\t<>{ children }</>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<TouchableHighlight accessible={ false }>\n\t\t\t\t\t\t\t\t\t<>{ children }</>\n\t\t\t\t\t\t\t\t</TouchableHighlight>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</BottomSheetProvider>\n\t\t\t\t\t\t{ ! hasNavigation && (\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\theight:\n\t\t\t\t\t\t\t\t\t\tsafeAreaBottomInset ||\n\t\t\t\t\t\t\t\t\t\tstyles.scrollableContent.paddingBottom,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</WrapperView>\n\t\t\t\t</KeyboardAvoidingView>\n\t\t\t</Modal>\n\t\t);\n\t}\n}\n\nfunction getWidth() {\n\treturn Math.min(\n\t\tDimensions.get( 'window' ).width,\n\t\tstyles.background.maxWidth\n\t);\n}\n\nconst ThemedBottomSheet = withPreferredColorScheme( BottomSheet );\n\nThemedBottomSheet.getWidth = getWidth;\nThemedBottomSheet.Button = Button;\nThemedBottomSheet.Cell = Cell;\nThemedBottomSheet.SubSheet = BottomSheetSubSheet;\nThemedBottomSheet.NavBar = NavBar;\nThemedBottomSheet.CyclePickerCell = CyclePickerCell;\nThemedBottomSheet.PickerCell = PickerCell;\nThemedBottomSheet.SwitchCell = SwitchCell;\nThemedBottomSheet.RangeCell = RangeCell;\nThemedBottomSheet.ColorCell = ColorCell;\nThemedBottomSheet.LinkCell = LinkCell;\nThemedBottomSheet.LinkSuggestionItemCell = LinkSuggestionItemCell;\nThemedBottomSheet.RadioCell = RadioCell;\nThemedBottomSheet.NavigationScreen = NavigationScreen;\nThemedBottomSheet.NavigationContainer = NavigationContainer;\n\nexport default ThemedBottomSheet;\n"]}
|
|
@@ -147,6 +147,9 @@ const ImageComponent = ({
|
|
|
147
147
|
}, imageHeight && {
|
|
148
148
|
height: imageHeight
|
|
149
149
|
}, shapeStyle];
|
|
150
|
+
const imageSelectedStyles = [usePreferredColorSchemeStyle(styles.imageBorder, styles.imageBorderDark), {
|
|
151
|
+
height: containerSize?.height
|
|
152
|
+
}];
|
|
150
153
|
return createElement(View, {
|
|
151
154
|
style: [styles.container, // Only set alignItems if an image exists because alignItems causes the placeholder
|
|
152
155
|
// to disappear when an aligned image can't be downloaded
|
|
@@ -164,9 +167,7 @@ const ImageComponent = ({
|
|
|
164
167
|
key: url,
|
|
165
168
|
style: imageContainerStyles
|
|
166
169
|
}, isSelected && highlightSelected && !(isUploadInProgress || isUploadFailed) && createElement(View, {
|
|
167
|
-
style:
|
|
168
|
-
height: containerSize?.height
|
|
169
|
-
}]
|
|
170
|
+
style: imageSelectedStyles
|
|
170
171
|
}), !imageData ? createElement(View, {
|
|
171
172
|
style: placeholderStyles
|
|
172
173
|
}, createElement(View, {
|