From 8ab1544972fe52a45319eb99983bc043140e4761 Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Fri, 28 Jan 2022 11:29:27 +1300 Subject: [PATCH] Only run useContext on web --- packages/block-library/src/gallery/edit.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/gallery/edit.js b/packages/block-library/src/gallery/edit.js index 13ee55cc6c786c..dbe515d769fb23 100644 --- a/packages/block-library/src/gallery/edit.js +++ b/packages/block-library/src/gallery/edit.js @@ -121,7 +121,10 @@ function GalleryEdit( props ) { }; }, [] ); - const styleElement = useContext( BlockList.__unstableElementContext ); + const styleElement = Platform.isWeb + ? // eslint-disable-next-line react-hooks/rules-of-hooks + useContext( BlockList.__unstableElementContext ) + : undefined; const innerBlockImages = useSelect( ( select ) => {