-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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] Media & Text - Media picker buttons functionality #17537
[RNMobile] Media & Text - Media picker buttons functionality #17537
Conversation
const { mediaUrl, isSelected } = this.props; | ||
const { isUploadInProgress } = this.state; | ||
const { isUploadFailed, retryMessage } = params; | ||
const videoHeight = ( Dimensions.get( 'window' ).width / 2 ) / VIDEO_ASPECT_RATIO; |
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.
I think you can set the aspectRatio style prop directly and avoid the calculation. Otherwise, I think using the window width would be problematic because the ratio should apply to the container width, not the full window, but I haven't been able to test this because of the other issue I commented
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.
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.
Nice! I'll check aspectRatio
and also make sure it looks great on tablets as well
const ALLOWED_MEDIA_TYPES = [ MEDIA_TYPE_IMAGE, ...( Platform.OS === 'ios' ? [ MEDIA_TYPE_VIDEO ] : [] ) ]; | ||
|
||
// Default Video ratio 16:9 | ||
const VIDEO_ASPECT_RATIO = 16 / 9; |
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.
I don't love that we are hardcoding this, but I see we were already doing it in the video block. Can we move that logic to the newly extracted VideoPlayer component so we can improve it in the future?
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.
Oh yes! Will do!
packages/block-library/src/media-text/media-container.native.js
Outdated
Show resolved
Hide resolved
I think this is looking good. I had something else in mind for the aspect ratio changes, but now I realize that the video component probably isn't as smart as images and we want a fixed ratio there. I'd probably like to have in the future an API for VideoPlayer and the placeholder component that does the right thing by itself, but I think this is good for now. Let's try to wrap up #17392 first and merge that one and the lint fixes from master before I do the final testing round. 👍 |
Updated! Now all checks are green 🎉 ready to be reviewed again =) |
I noticed one thing that we don't have to fix in this PR but it's worth discussing with @iamthomasbishop. I wanted to change the media once I had uploaded it. When the block is selected, the toolbar is visible, but since there is no focus on any text component, the toolbar is at the bottom: I stared at the screen and tapped on too many things for a minute trying to edit the image/video, but I just couldn't see the toolbar at the bottom. |
@koke I think the toolbar positioning is expected, but I wouldn't expect the |
@iamthomasbishop the left part of media & text doesn't use nested blocks, it's just either one image or one video, so it's part of the parent (media-text) block. I understand that was the expected design, but I still found myself confused for a bit trying to find how to replace the image/video there |
Yea sorry, I thought from the example above that the parent (media-text) was selected. The replacing mechanism is definitely confusing, I've always disliked that icon. I think the web has recently updated that The other thing that I mentioned still applies – why do we even show the image/media replace button while the parent is selected? That's confusing to me. |
5f32e05
to
bcfd26c
Compare
I tried that myself when testing and it went full width but still had the same issue. |
…ad for iOS and Android
@koke I've just updated this PR with the fix for the issue you mentioned, I also tested this fix with your PR and it works well too 🎉 |
I feel like I had reported this before, but I can't find my comment anywhere so maybe I didn't? 😱
This is on iOS. I tested on Android and it seems fine. |
Oh wow! I haven't seen that D: I'll check it out today. Did the other issue get fixed with the latest changes? |
I think this is good to go once the red screen issue is solved. 🎉 |
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.
I think this is ready 🎉
To avoid further issues, I'll wait until wordpress-mobile/gutenberg-mobile#1410 is merged to start merging all the related PRs
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.
I've tested this on Android with the additional changes here: wordpress-mobile/gutenberg-mobile#1412 and here: wordpress-mobile/gutenberg-mobile#1400. This is looking good. Nice work @geriux ! 🎉
Can be merged after #17392
gutenberg-mobile
PR wordpress-mobile/gutenberg-mobile#1378Description
This PR adds the missing functionality for the Media & Text block wordpress-mobile/gutenberg-mobile#1313
On Android It will only support images until we can filter by more than one type at a time (images & videos) in the media picker.
Now the functionality it's the same as the
image
andvideo
blocks.How has this been tested?
Media & Text
block.Screenshots
iOS
Android
Types of changes
New feature (non-breaking change which adds functionality)
Checklist: