Skip to content

Commit

Permalink
Only use flexbox for fullscreen inserter
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnstn committed Sep 2, 2021
1 parent 6ef8d95 commit 12274c6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
3 changes: 2 additions & 1 deletion packages/block-editor/src/components/inserter/menu.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ function InserterMenu( {
{ ( { listProps } ) => (
<TouchableHighlight
accessible={ false }
style={ styles[ 'inserter-menu__list-wrapper' ] }
style={ ! isIOS && { flex: 1 } }
>
{ ! showTabs || filterValue ? (
<InserterSearchResults
Expand All @@ -227,6 +227,7 @@ function InserterMenu( {
tabIndex={ tabIndex }
onSelect={ onSelectItem }
showReusableBlocks={ showReusableBlocks }
isFullScreen={ ! isIOS }
/>
) }
</TouchableHighlight>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
color: $blue-30;
}

.inserter-menu__list-wrapper {
flex: 1;
}

.inserter-menu__list {
padding-bottom: 20;
padding-top: 8;
Expand Down Expand Up @@ -55,12 +51,9 @@

.inserter-tabs__wrapper {
overflow: hidden;
flex: 1;
}

.inserter-tabs__container {
height: 100%;
width: 100%;
flex: 1;
flex-direction: row;
}
17 changes: 15 additions & 2 deletions packages/block-editor/src/components/inserter/tabs.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function InserterTabs( {
rootClientId,
showReusableBlocks,
tabIndex,
isFullScreen,
} ) {
const tabAnimation = useRef( new Animated.Value( 0 ) ).current;
const lastScrollEvents = useRef( [] ).current;
Expand Down Expand Up @@ -91,16 +92,28 @@ function InserterTabs( {
width: wrapperWidth * tabKeys.length,
transform: [ { translateX } ],
},
isFullScreen && { flex: 1, flexDirection: 'row' },
];

return (
<View
style={ styles[ 'inserter-tabs__wrapper' ] }
style={ [
styles[ 'inserter-tabs__wrapper' ],
isFullScreen && { flex: 1 },
] }
onLayout={ onWrapperLayout }
>
<Animated.View style={ containerStyle }>
{ tabs.map( ( { component: TabComponent }, index ) => (
<View key={ `tab-${ index }` }>
<View
key={ `tab-${ index }` }
style={
! isFullScreen && {
position: 'absolute',
left: index * wrapperWidth,
}
}
>
<TabComponent
rootClientId={ rootClientId }
onSelect={ onSelect }
Expand Down

0 comments on commit 12274c6

Please sign in to comment.