Skip to content
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

[RNMobile] FloatingToolbar #17399

Merged
merged 41 commits into from
Oct 3, 2019

Conversation

lukewalczak
Copy link
Member

@lukewalczak lukewalczak commented Sep 10, 2019

Description

PR is adding FloatingToolbar component without inner functionality.
gutenberg-mobile PR: wordpress-mobile/gutenberg-mobile#1362

How has this been tested?

Tested on both platforms

Screenshots

ios android

Types of changes

Added FloatingToolbar.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

etoledom and others added 13 commits August 28, 2019 10:31
* [RNMobile] Fix crash when adding separator

* Build: remove global install of latest npm since we want to use the paired node/npm version (WordPress#17134)

* Build: remove global install of latest npm since we want to use the paired node/npm version
* Also update travis to remove --latest-npm flag

* [RNMobile] Try dark mode (iOS) (WordPress#17067)

* Adding dark mode component implemented on list and list block

* Adding DarkMode handling to RichText, ToolBar and SafeArea

* Mobile: Using DarkMode as HOC

* iOS DarkMode: Modified colors on block list and block container

* iOS DarkMode: Improved Header Toolbar colors

* iOS DarkMode: Removing background from buttons

* iOS DarkMode warning and unsupported

* iOS DarkMode: MediaPlaceholder

* iOS DarkMode: BottomSheets

* iOS DarkMode: Inserter

* iOS DarkMode: DefaultBlockAppender

* iOS DarkMode: PostTite

* Update hardcoded colors with variables

* iOS DarkMode: Fix bottom-sheet cell value color

* iOS DarkMode: More - PageBreak - Add Block Here

* iOS DarkMode: Better text color

* iOS Darkmode: Code block

* iOS DarkMode: HTML View

* iOS DarkMode: Improve colors on SafeArea

* Fix toolbar not avoiding keyboard regression

* Fix native unit tests

* Fix gutenberg-mobile unit tests

* Adding RNDarkMode mocks

* RNMobile: Fix crash when viewing HTML on iOS

* [RNMobile] Remove toolbar from html view

* [RNMobile] Fix MaxListenersExceededWarning caused by dark-mode event emitter (WordPress#17186)

* Fix MaxListenersExceededWarning caused by dark-mode event emitter

* Checking for setMaxListeners trying to avoid CI error

* Adding remove listener to DarkMode HOC

* DarkMode: Binding this.onModeChanged to `this`

* DarkMode: Adding conditional needed to pass UI Tests on CI

* Fix focus title on new posts regression (WordPress#17180)

* BottomSheet: Setting DashIcon color directly when theme is default (light) (WordPress#17193)
* First working version of the MediaText component for native mobile

* Fix adding a block to an innerblock list

* Disable mediaText on production

* MediaText native: improve editor visuals

* Move BlockToolbar from BlockList to Layout

* Remove BlockEditorProvider from BlockList and add native version of EditorProvider to Editor. Plus support InsertionPoint and BlockListAppender

* Update BlockMover for native to hide if locked or if it's the only block

* Make the vertical align button work, add more styling options for toolbar buttons

* Make sure registerCoreBlocks does not break in production

* Copy docblock comment from the web version for registerCoreBlocks

* Fix focusing on the media placeholder

* Only support adding image for now

* Update usage of MediaPlaceholder in MediaContainer

* Enable autoScroll for just the out most block list

* Fix JS Unit tests

* Roll back to IconButton refactor and fix tests

* Fix BlockVerticalAlignmentToolbar buttons style on mobile

* Fix thing for web and ensure ariaPressed is always passed down

* Use AriaPressed directly to style SVG on mobile

* Update snapshots
Previously, tapping at the end of the post would insert a block
immediately after the currently selected block. In addition, this commit
is cleaning out a few unusued props in the block-list file.
* First working version of the MediaText component for native mobile

* Fix adding a block to an innerblock list

* Disable mediaText on production

* MediaText native: improve editor visuals

* Move BlockToolbar from BlockList to Layout

* Remove BlockEditorProvider from BlockList and add native version of EditorProvider to Editor. Plus support InsertionPoint and BlockListAppender

* Update BlockMover for native to hide if locked or if it's the only block

* Make the vertical align button work, add more styling options for toolbar buttons

* Make sure registerCoreBlocks does not break in production

* Copy docblock comment from the web version for registerCoreBlocks

* Fix focusing on the media placeholder

* Only support adding image for now

* Update usage of MediaPlaceholder in MediaContainer

* Enable autoScroll for just the out most block list

* Fix JS Unit tests

* Roll back to IconButton refactor and fix tests

* Fix BlockVerticalAlignmentToolbar buttons style on mobile

* Fix thing for web and ensure ariaPressed is always passed down

* Use AriaPressed directly to style SVG on mobile

* Update snapshots

* Support group block on mobile

* Extend shouldShowInsertionPoint condition to be false when group is selected

* Code refactor

* Update package-lock
* Remove the need to import `useStyle` and pass the theme prop on every instance that `withStyle` is used

* Implement dark-mode refactor on all components

* Fix broken native tests

* Fix default block appender background color on DarkMode

* DarkMode: Make `useStyle` a class function
* [RNMobile] Fix crash when adding separator

* Build: remove global install of latest npm since we want to use the paired node/npm version (WordPress#17134)

* Build: remove global install of latest npm since we want to use the paired node/npm version
* Also update travis to remove --latest-npm flag

* [RNMobile] Try dark mode (iOS) (WordPress#17067)

* Adding dark mode component implemented on list and list block

* Adding DarkMode handling to RichText, ToolBar and SafeArea

* Mobile: Using DarkMode as HOC

* iOS DarkMode: Modified colors on block list and block container

* iOS DarkMode: Improved Header Toolbar colors

* iOS DarkMode: Removing background from buttons

* iOS DarkMode warning and unsupported

* iOS DarkMode: MediaPlaceholder

* iOS DarkMode: BottomSheets

* iOS DarkMode: Inserter

* iOS DarkMode: DefaultBlockAppender

* iOS DarkMode: PostTite

* Update hardcoded colors with variables

* iOS DarkMode: Fix bottom-sheet cell value color

* iOS DarkMode: More - PageBreak - Add Block Here

* iOS DarkMode: Better text color

* iOS Darkmode: Code block

* iOS DarkMode: HTML View

* iOS DarkMode: Improve colors on SafeArea

* Fix toolbar not avoiding keyboard regression

* Fix native unit tests

* Fix gutenberg-mobile unit tests

* Adding RNDarkMode mocks

* RNMobile: Fix crash when viewing HTML on iOS

* [RNMobile] Remove toolbar from html view

* [RNMobile] Fix MaxListenersExceededWarning caused by dark-mode event emitter (WordPress#17186)

* Fix MaxListenersExceededWarning caused by dark-mode event emitter

* Checking for setMaxListeners trying to avoid CI error

* Adding remove listener to DarkMode HOC

* DarkMode: Binding this.onModeChanged to `this`

* DarkMode: Adding conditional needed to pass UI Tests on CI

* Fix focus title on new posts regression (WordPress#17180)

* BottomSheet: Setting DashIcon color directly when theme is default (light) (WordPress#17193)

* Add a preliminary version of the AutosaveMonitor for mobile that calls the "bridge" and asks the native side to save the content

* Add autosave mock function for tests

* Fix merge conflicts

* Fix lint

* Re-add autosave on mobile that was removed erroneously during import-merge from rnmobile/master

* Remove native variant of AutosaveMonitor and introduces changes at  editor store level

* Default to false for `isEditedPostAutosaveable` on mobile. There was a typo in the returing value on the previous commit.

* Make sure to consider edits to the Title when checking if auto-save is needed

* Fix lint
@koke
Copy link
Contributor

koke commented Sep 30, 2019

I was trying to understand the issues better, and while I don't have any good suggestions yet, I noticed this while using the UI inspector in Xcode, which doesn't look right:

Screen Shot 2019-09-30 at 15 58 15

@lukewalczak
Copy link
Member Author

@koke Can it be caused by a high zIndex value (100) ?

@lukewalczak lukewalczak changed the base branch from rnmobile/master to master October 1, 2019 06:43
@lukewalczak lukewalczak changed the base branch from master to rnmobile/master October 1, 2019 06:51
@lukewalczak lukewalczak changed the base branch from rnmobile/master to master October 1, 2019 08:11
@koke
Copy link
Contributor

koke commented Oct 1, 2019

@koke Can it be caused by a high zIndex value (100) ?

No, it seems FloatingToolbar is being rendered for every block:

Screen Shot 2019-10-01 at 11 34 47

@lukewalczak
Copy link
Member Author

@koke Thanks! The problem was that FloatingToolbar was rendered actually for every block, but now I've made it conditional to flag showDisplayToolbar.

Copy link
Contributor

@pinarol pinarol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the effort @lukewalczak Just dropping a few comments, aside from that I think it looks good.

About the re-occuring FloatingToobar problem @koke reported, could you open an issue? I don't think we should solve it with this PR but we should track it, there might be something wrong with slot-fill. Considering that we might want to change the FloatingToolbar designs let's not block this PR with that issue.

@@ -93,6 +96,9 @@ export class BlockList extends Component {
ListHeaderComponent={ header }
ListEmptyComponent={ this.renderDefaultBlockAppender }
ListFooterComponent={ withFooter && this.renderBlockListFooter }
getItemLayout={ ( data, index ) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this considering the current temporary fix? If we don't let's remove it to avoid having unexpected side effects

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's still needed to get working properly FloatingToolbar on Android.

return (
<View
style={ { flex: 1 } }
onAccessibilityEscape={ clearSelectedBlock }
>
{ showFloatingToolbar && <FloatingToolbar.Slot fillProps={ { innerFloatingToolbar: showFloatingToolbar } } /> }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need to change this file? considering we are rendering the first one inside the bounds. I know this is a temp fix but still I'd want to change minimum code to avoid any side effects until we find a better solution.

Copy link
Member Author

@lukewalczak lukewalczak Oct 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to simplify it to the minimum we don't need to use slot/fill, however, I've decided to keep this for the next investigations.

@mkevins
Copy link
Contributor

mkevins commented Oct 3, 2019

The temporary workaround seems to keep the floating toolbar within the bounds of the parent, so taps are not "falling through" anymore. But, the toolbar currently prevents visibility of the underlying content, which is problematic:

Is this expected behavior for this temporary iteration, or are we expecting the content to clear the toolbar?

cc: @pinarol

@pinarol
Copy link
Contributor

pinarol commented Oct 3, 2019

Is this expected behavior for this temporary iteration

Yes, this won’t go to prod as is, we’ll have another iteration. For now we are trying to unblock dependent PRs. @mkevins

@pinarol
Copy link
Contributor

pinarol commented Oct 3, 2019

@lukewalczak Could you open an issue in the gutenberg-mobile repo with the screenshot here just for us to not forget about it: #17399 (comment) ? After that it seems ready to merge to me.

Copy link
Contributor

@mkevins mkevins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving for first iteration, so other dependent PRs can move forward. 👍

@pinarol
Copy link
Contributor

pinarol commented Oct 3, 2019

@lukewalczak Could you open an issue in the gutenberg-mobile repo with the screenshot here just for us to not forget about it: #17399 (comment) ? After that it seems ready to merge to me.

Taking this back because I tried with the latest version and it is all fixed

Copy link
Contributor

@pinarol pinarol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉 We'll do separate iterations to make this better, for now let's merge for not blocking other PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change)
Projects
None yet
Development

Successfully merging this pull request may close these issues.