-
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] Use default placeholder text color for native List Item #43353
[RNMobile] Use default placeholder text color for native List Item #43353
Conversation
@geriux List Item did not have a default placeholder text color defined. Looking at other native components, it looks like there are several different approaches to defining a placeholder text color. This approach first uses 0.62 opacity on the List Item text color (if there is one), which matches the web styling. If not, it falls back to |
Size Change: 0 B Total Size: 1.27 MB ℹ️ View Unchanged
|
Hey @derekblank thanks for making the changes! While testing I found another issue, when selecting a custom color for the List (from the color palette in the settings) the placeholder doesn't have an opacity: |
@geriux Good catch! I tested on standard themes as well, and when the color changes it's falling back to the $gray value as well. However, I was looking for a way to get the updated hex color value when it changes in order to fix the placeholder. So far, the only place in the code where I note that it changes is in the block's html, e.g.:
Do you know of a more direct way where this hex value can be accessed within the ListItem component? I didn't observe any changes in ExamplePlaceholderColorTest2.mov |
Hey @derekblank 👋 oh I meant the color settings for the block (not for the inline formatting): When setting a color from the block settings, it will be available in the |
@geriux Updated -- placeholder color is now using opacity on the default values, and when the style color changes. PlaceholderTextColor.mov |
…oves opacity value into a const
679d742
to
cb68742
Compare
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! Nice work!
I made a few small changes and tested it on both iOS and Android and it worked correctly.
I've updated the branch to use rnmobile/release_18.1.1
as a base so we can include it in the betafix release.
* Release script: Update react-native-editor version to 1.81.0 * Release script: Update with changes from 'npm run core preios' * Release script: Update react-native-editor version to 1.81.1 * Release script: Update with changes from 'npm run core preios' * [Mobile] - Add BlockListCompact (#43431) * Mobile - Introduce BlockListCompact - Lighter version of the default BlockList with simpler functionality for use cases like the List V2 block * Mobile - Update List V2 tests since it's not needed to fire the layout event change with the BlockListCompact component * Mobile - BlockListCompact - Add note of the component props and which block is currently using it * [RNMobile] List block v2: Fix text color inconsistencies with list items (#43244) * List block v2: use default color for preferred color scheme * Use usePreferredColorSchemeStyle hook for List Item style * Remove unneeded font-size value from list item styles * Mobile - Disable FastImage on Android (#43322) * [Mobile] - Fix dynamic React Native version (#43058) * Mobile - Fix dynamic React Native version * Mobile - Adds jvmargs setting * [RNMobile] Use default placeholder text color for native List Item (#43353) * Use default placeholder text color for native List Item * Move list item placeholder hex value to stylesheet * Resolve test failure * Add opacity to list block placeholder color styles * Update List block v2 placholder currentTextColor * Mobile - List Item - Check if currentTextColor is not undefined and moves opacity value into a const * Mobile - List Item - Add optional chaining for style.color Co-authored-by: Gerardo <gerardo.pacheco@automattic.com> * Mobile - Update CHANGELOG * Mobile - Update Podfile after resolving conflicts * Mobile - Add mock style for list item Co-authored-by: Derek Blank <derekpblank@gmail.com> Co-authored-by: Gerardo Pacheco <gerardo.pacheco@automattic.com>
* Release script: Update react-native-editor version to 1.81.0 * Release script: Update with changes from 'npm run core preios' * Release script: Update react-native-editor version to 1.81.1 * Release script: Update with changes from 'npm run core preios' * [Mobile] - Add BlockListCompact (#43431) * Mobile - Introduce BlockListCompact - Lighter version of the default BlockList with simpler functionality for use cases like the List V2 block * Mobile - Update List V2 tests since it's not needed to fire the layout event change with the BlockListCompact component * Mobile - BlockListCompact - Add note of the component props and which block is currently using it * [RNMobile] List block v2: Fix text color inconsistencies with list items (#43244) * List block v2: use default color for preferred color scheme * Use usePreferredColorSchemeStyle hook for List Item style * Remove unneeded font-size value from list item styles * Mobile - Disable FastImage on Android (#43322) * [Mobile] - Fix dynamic React Native version (#43058) * Mobile - Fix dynamic React Native version * Mobile - Adds jvmargs setting * [RNMobile] Use default placeholder text color for native List Item (#43353) * Use default placeholder text color for native List Item * Move list item placeholder hex value to stylesheet * Resolve test failure * Add opacity to list block placeholder color styles * Update List block v2 placholder currentTextColor * Mobile - List Item - Check if currentTextColor is not undefined and moves opacity value into a const * Mobile - List Item - Add optional chaining for style.color Co-authored-by: Gerardo <gerardo.pacheco@automattic.com> * Mobile - Update CHANGELOG * Release script: Update react-native-editor version to 1.81.2 * Release script: Update with changes from 'npm run core preios' * Mobile - List V2 - Prevent error when list is empty (#43861) * Mobile - Update Changelog Co-authored-by: Derek Blank <derekpblank@gmail.com> Co-authored-by: David Calhoun <438664+dcalhoun@users.noreply.github.com>
Fixes:
What?
Adds a default placeholder text color and fallback color for native List Items.
Why?
To differentiate List Item placeholder text with actual text input.
How?
If a base text color is defined, add 0.62 hex opacity to baseColor text (e.g. #FFFFFF9E) to match the user color scheme. Else, fallback to
#87a6bc
, which is the placeholder text color found elsewhere. (#)Testing Instructions
Screenshots or screencast
Example
ListItemPlaceholderText.mov