-
Notifications
You must be signed in to change notification settings - Fork 4.7k
[RNMobile] Add Reusable blocks to the inserter menu #28495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
178648e
bf5f8aa
463c257
0e164f5
c081f76
8efbfbb
1010667
2507e95
9cc6776
4ca23d7
b9d9cb9
d29b5c5
11c59bb
420dbb6
37ea46a
83bac66
3a5e7e5
68ccca7
cc6efdc
17ae9a4
32e66c2
71eeab7
57a0b71
ad76855
005dba9
899141f
4d3013f
a412058
a3c3ca8
a5a6beb
6aa2a11
b28f276
ed09983
f63dd63
851079f
e18274a
7456ddf
844184e
cccf2b4
1aea172
c883fd8
14ad9d6
360f5d4
1145225
fb37e84
7f64173
8e817e1
eacd5bc
8b7b5c3
fd97494
e7b2676
f2e0c79
cadfaa6
8d0f3ae
dcd4fa9
4ccd706
44c0537
575c58f
1ad3268
873e389
d1d3f12
c16c5bc
4df39cd
60e461b
2e02624
00527a5
110a513
fa4c0ec
853d45f
5d23d10
663cc8c
c93082a
2a70a38
736fab5
e35bff5
1d6e507
9c4dbfe
7eaa61c
49ea69c
8a4179c
0b1ad2f
4455515
e12c54e
f060f9c
622313d
8b4c462
fcf1ccf
76be478
24fc1f4
e25217d
958dd9d
08f4549
6153e92
8ebca15
60e020b
89a2e43
444386a
c95db83
00289fc
0ca8b43
d9f3257
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,7 @@ function InserterMenu( { | |
| insertionIndex, | ||
| } ) { | ||
| const [ filterValue, setFilterValue ] = useState( '' ); | ||
| const [ searchFocus, setSearchFocus ] = useState( false ); | ||
| const [ showTabs, setShowTabs ] = useState( true ); | ||
| // eslint-disable-next-line no-undef | ||
| const [ showSearchForm, setShowSearchForm ] = useState( __DEV__ ); | ||
| const [ tabIndex, setTabIndex ] = useState( 0 ); | ||
|
|
@@ -154,32 +154,23 @@ function InserterMenu( { | |
| [ setFilterValue ] | ||
| ); | ||
|
|
||
| const onFocusSearch = useCallback( | ||
| ( focus ) => { | ||
| LayoutAnimation.configureNext( | ||
| LayoutAnimation.Presets.easeInEaseOut | ||
| ); | ||
| setSearchFocus( focus ); | ||
| }, | ||
| [ setSearchFocus ] | ||
| ); | ||
|
|
||
| const showReusableBlocks = ! rootClientId; | ||
|
|
||
| return ( | ||
| <BottomSheet | ||
| isVisible={ true } | ||
| onClose={ onClose } | ||
| onKeyboardShow={ () => setShowTabs( false ) } | ||
| onKeyboardHide={ () => setShowTabs( true ) } | ||
|
||
| header={ | ||
| <> | ||
| { showSearchForm && ( | ||
| <InserterSearchForm | ||
| onChange={ onChangeSearch } | ||
| onFocus={ onFocusSearch } | ||
| value={ filterValue } | ||
| /> | ||
| ) } | ||
| { ! searchFocus && ! filterValue && hasReusableBlocks && ( | ||
| { showTabs && ! filterValue && hasReusableBlocks && ( | ||
| <InserterTabs.Control | ||
| onChangeTab={ setTabIndex } | ||
| showReusableBlocks={ showReusableBlocks } | ||
|
|
@@ -194,7 +185,7 @@ function InserterMenu( { | |
| <BottomSheetConsumer> | ||
| { ( { listProps } ) => ( | ||
| <TouchableHighlight accessible={ false }> | ||
| { searchFocus || filterValue ? ( | ||
| { ! showTabs || filterValue ? ( | ||
| <InserterSearchResults | ||
| rootClientId={ rootClientId } | ||
| filterValue={ filterValue } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inserter menu can be triggered by the ➕ button and within blocks like the social icons. Reusable blocks should only be shown in the first case (➕ button) so we have to check if
rootClientIdis undefined.