Skip to content

Commit

Permalink
[RNMobile] Use Flexbox for Inserter Menu tabs on mobile (#34126)
Browse files Browse the repository at this point in the history
* Use flexbox for tab positioning

* Make sure height is calculated correctly

Co-authored-by: jhnstn <jason@readysetandco.com>
  • Loading branch information
jhnstn and jhnstn authored Aug 23, 2021
1 parent 518e3c8 commit c238f43
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
5 changes: 4 additions & 1 deletion packages/block-editor/src/components/inserter/menu.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ function InserterMenu( {
>
<BottomSheetConsumer>
{ ( { listProps } ) => (
<TouchableHighlight accessible={ false }>
<TouchableHighlight
accessible={ false }
style={ { flex: 1 } }
>
{ ! showTabs || filterValue ? (
<InserterSearchResults
rootClientId={ rootClientId }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@

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

.inserter-tabs__container {
height: 100%;
width: 100%;
}

.inserter-tabs__item {
position: absolute;
flex: 1;
flex-direction: row;
}
8 changes: 1 addition & 7 deletions packages/block-editor/src/components/inserter/tabs.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,7 @@ function InserterTabs( {
>
<Animated.View style={ containerStyle }>
{ tabs.map( ( { component: TabComponent }, index ) => (
<View
key={ `tab-${ index }` }
style={ [
styles[ 'inserter-tabs__item' ],
{ left: index * wrapperWidth },
] }
>
<View key={ `tab-${ index }` }>
<TabComponent
rootClientId={ rootClientId }
onSelect={ onSelect }
Expand Down

0 comments on commit c238f43

Please sign in to comment.