-
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] [Embed block] Fix content disappearing on Android when switching light/dark mode #34207
Conversation
Size Change: 0 B Total Size: 1.04 MB ℹ️ View Unchanged
|
@@ -137,4 +140,4 @@ const EmbedPreview = ( { | |||
); | |||
}; | |||
|
|||
export default memo( EmbedPreview ); | |||
export default memo( withPreferredColorScheme( EmbedPreview ) ); |
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.
Seems like we're only using withPreferredColorScheme
to get and pass down preferredColorScheme
to SandBox
. Maybe we can instead use usePreferredColorSchemeStyle
hook in SandBox
component directly?
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.
Yeah although the usePreferredColorSchemeStyle
hook is meant to be used for picking the right style depending on the light/dark mode status. In this case, I'd rather use usePreferredColorScheme
that returns the color scheme instead 😃 .
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.
This has been addressed in this commit.
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.
Do you think it would be possible/better to use the hook directly in SandBox
and not make any changes in EmbedPreview
component?
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.
Yeah, I initially thought to add it there but since SandBox
is a generic component I wanted to leave the color scheme calculation open to the parent. However, I agree that looks cleaner to have the hook directly there.
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.
@ceyhun I applied your suggestion in this commit. I also updated the branch with the last changes from trunk
and solve conflicts, the PR is ready for another review 🙇 .
@ceyhun I've applied the suggestion from your comment, so the PR is ready for another review 🎊 . |
# Conflicts: # packages/block-library/src/embed/embed-preview.native.js # packages/components/src/sandbox/index.native.js
Additionally I added a a missing entry related to the WP embed component implementation.
@@ -10,6 +10,8 @@ For each user feature we should also add a importance categorization label to i | |||
--> | |||
|
|||
## Unreleased | |||
- [**] [Embed block] Implement WP embed preview component [#34004] |
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 added the entry for the WP embed preview component implementation because it was missing.
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.
* trunk: [RNMobile][Embed block] Add device's locale to preview content (#33858) Update AlignmentMatrixControl docs post merge. (#34662) Chore: Update caniuse package to the latest version (#34685) Chore: Move `react-native-url-polyfill` to dev dependencies (#34687) Site Editor - add basic plugin support (#34460) ESLint Plugin: Use Jest related rules only when the package is installed (#33120) Update `@wordpress/components` package's contributing guidelines (#33960) chore(release): publish Update changelog files [RNMobile] [Embed block] Fix content disappearing on Android when switching light/dark mode (#34207) Scripts: Convert legacy entry point arguments for compatibility with webpack 5 (#34264) Update justication control in `flex` layout (#34651) Block Editor: Rename experimental prop used in `BlockControls` (#34644) Fix social links deprecation (#34639)
gutenberg-mobile
PR: wordpress-mobile/gutenberg-mobile#3859Description
As it was done for the device rotation action, I'm adding to prop
key
of the SandBox component the value of the light/dark mode, this way when this device setting changes it will recreate the WebView to prevent the content from disappearing.How has this been tested?
Screenshots
N/A
Types of changes
Bug fix
Checklist:
*.native.js
files for terms that need renaming or removal).