-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add FloatingToolbar component * Add visible overflow to flat list wrapper * Working on Android toolbar behaviour * Use temporary solution for first item in group * Make FloatingToolbar conditional to show flag * Add check for Media&Text block
- Loading branch information
1 parent
0f8bdf5
commit 0e0b65f
Showing
5 changed files
with
116 additions
and
21 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
packages/block-editor/src/components/block-list/block-mobile-floating-toolbar.native.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { View, TouchableWithoutFeedback } from 'react-native'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import styles from './block-mobile-floating-toolbar.scss'; | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { createSlotFill } from '@wordpress/components'; | ||
|
||
const { Fill, Slot } = createSlotFill( 'FloatingToolbar' ); | ||
|
||
function FloatingToolbar( { children } ) { | ||
return ( | ||
<Fill> | ||
{ ( { innerFloatingToolbar } ) => { | ||
return ( | ||
<TouchableWithoutFeedback> | ||
<View | ||
// Issue: `FloatingToolbar` placed above the first item in group is not touchable on Android. | ||
// Temporary solution: Use `innerFloatingToolbar` to place `FloatingToolbar` over the first item in group. | ||
// TODO: `{ top: innerFloatingToolbar ? 0 : -44 }` along with `innerFloatingToolbar` should be removed once issue is fixed. | ||
style={ [ styles.floatingToolbarFill, { top: innerFloatingToolbar ? 0 : -44 } ] } | ||
>{ children } | ||
</View> | ||
</TouchableWithoutFeedback> | ||
); | ||
} } | ||
|
||
</Fill> | ||
); | ||
} | ||
|
||
FloatingToolbar.Slot = Slot; | ||
|
||
export default FloatingToolbar; |
15 changes: 15 additions & 0 deletions
15
packages/block-editor/src/components/block-list/block-mobile-floating-toolbar.native.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.floatingToolbarFill { | ||
background-color: $dark-gray-500; | ||
margin: auto; | ||
min-width: 100; | ||
max-height: $floating-toolbar-height; | ||
border-radius: 22px; | ||
flex-direction: row; | ||
z-index: 100; | ||
top: -$floating-toolbar-height; | ||
height: $floating-toolbar-height; | ||
position: absolute; | ||
align-items: center; | ||
justify-content: center; | ||
align-self: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters