-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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][Embed block] Fetching embed preview and loading UI #33260
Conversation
Size Change: +9 B (0%) Total Size: 1.06 MB
ℹ️ View Unchanged
|
const activityIndicatorColor = Platform.select( { | ||
ios: '#999999', // default color on iOS | ||
// ActivityIndicator is blank and does not show up unless explicit color prop is provided. | ||
// See https://github.com/facebook/react-native/pull/30057 | ||
android: PlatformColor( '?attr/colorControlActivated' ), | ||
} ); |
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.
Not for this PR but I'm thinking that it would be nice if we could have this component generic because we most likely require it in future components.
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.
That's a good idea, other places where ActivityIndicator
is used could have the same issue on Android already. I've created an issue for this: wordpress-mobile/gutenberg-mobile#3708
{ cannotEmbed ? ( | ||
<> | ||
<Text style={ labelStyle }> | ||
{ __( | ||
'Sorry, this content could not be embedded.' | ||
) } | ||
</Text> | ||
<Text | ||
style={ styles[ 'embed-empty__description' ] } | ||
> | ||
{ __( 'EDIT LINK' ) } | ||
</Text> | ||
</> | ||
) : ( | ||
<Text style={ styles[ 'embed-empty__description' ] }> | ||
{ __( 'ADD LINK' ) } | ||
</Text> | ||
) } |
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.
In an incoming PR, I will replace this part with a new component EmbedNoPreview
.
) : ( | ||
<Image | ||
style={ { | ||
flex: 1, |
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.
What do you think about moving this to a style object?
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 aspectRatio
is already dynamically generated so we'll need to pass that in from code again and only flex: 1
will be in a style object, so maybe we can skip it for now?
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.
Tested on iPhone 11 (iOS 14.2) and Samsung Galaxy S20 FE 5G (Android 10).
I tested the following cases in a free WP.com site, Atomic site, and self-hosted without Jetpack:
- An invalid URL
- A valid but unsupported embed URL (supported ones listed here)
- A valid embed URL with thumbnail
- A valid embed URL without thumbnail
All of them passed ✅ , the only thing I noticed is that the first time the preview is loaded it does a bit of flickering, see attached video capture around 0:03:
embed-block-loading-flickering.mp4
The only comment that we could tackle is this one but we might postpone it as we most likely update that part if we want to implement styles there for the alignment options, wdyt?
Thanks for the review! I agree that we can update it later if necessary 👍 I'll see if we can find a quick fix for the flickering, but otherwise I think we can leave it for later as well. |
If we address the flickering in a different then this PR LGTM 🎊 ! |
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.
LGTM 🎊 !
Description
Porting Embed block to mobile Gutenberg, here we implemented:
Gutenberg Mobile PR: wordpress-mobile/gutenberg-mobile#3704
How has this been tested?
Add an Embed block
In the bottom sheet try entering:
Try with:
Screenshots
Types of changes
New feature (non-breaking change which adds functionality)
Checklist:
*.native.js
files for terms that need renaming or removal).