From 10eba54e1bfc977289d29cd619b5d8b3af853883 Mon Sep 17 00:00:00 2001 From: Paul Von Schrottky Date: Mon, 15 Feb 2021 21:38:01 -0300 Subject: [PATCH 1/3] Ignore empty width attribute in columns The editor was crashing when attempting to render a column block which contained an empty width attribute (i.e ``. The exception occurred when accessing a property of an undefined object, so adding a default object (`|| {}`) fixes this by allowing the property to be accessed. --- .../src/mobile/utils/use-unit-converter-to-mobile.native.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/src/mobile/utils/use-unit-converter-to-mobile.native.js b/packages/components/src/mobile/utils/use-unit-converter-to-mobile.native.js index cf8a77b8d0e561..fda7ff8efc9122 100644 --- a/packages/components/src/mobile/utils/use-unit-converter-to-mobile.native.js +++ b/packages/components/src/mobile/utils/use-unit-converter-to-mobile.native.js @@ -37,7 +37,7 @@ const getValueAndUnit = ( value, unit ) => { const convertUnitToMobile = ( containerSize, globalStyles, value, unit ) => { const { width, height } = containerSize; - const { valueToConvert, valueUnit } = getValueAndUnit( value, unit ); + const { valueToConvert, valueUnit } = getValueAndUnit( value, unit ) || {}; const { fontSize = 16 } = globalStyles || {}; switch ( valueUnit ) { From cde7c187e7c7626f5125ae27836628e3782bf8ed Mon Sep 17 00:00:00 2001 From: Paul Von Schrottky Date: Mon, 15 Feb 2021 22:22:57 -0300 Subject: [PATCH 2/3] Update react-native-editor changelog --- packages/react-native-editor/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-native-editor/CHANGELOG.md b/packages/react-native-editor/CHANGELOG.md index 096bb7821627b1..ed3a399481b22f 100644 --- a/packages/react-native-editor/CHANGELOG.md +++ b/packages/react-native-editor/CHANGELOG.md @@ -12,6 +12,7 @@ For each user feature we should also add a importance categorization label to i ## Unreleased * [**] Make inserter long-press options "add to beginning" and "add to end" always available. [#28610] * [**] Add support for setting Cover block focal point. [#25810] +* [*] Fix crash when Column block width attribute was empty. [#29015] ## 1.46.0 * [***] New Block: Audio [#27401, #27467, #28594] From 10a0f16a7732e28d363456c33c058b191921c8fc Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Tue, 16 Feb 2021 12:08:30 +0100 Subject: [PATCH 3/3] Add missing dependency to useSelect in columns block --- packages/block-library/src/columns/edit.native.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/columns/edit.native.js b/packages/block-library/src/columns/edit.native.js index cf9cabea944be7..59560192bf87f3 100644 --- a/packages/block-library/src/columns/edit.native.js +++ b/packages/block-library/src/columns/edit.native.js @@ -476,7 +476,7 @@ const ColumnsEdit = ( props ) => { editorSidebarOpened: isSelected && isEditorSidebarOpened(), }; }, - [ clientId ] + [ clientId, isSelected ] ); const memoizedInnerWidths = useMemo( () => {