-
Notifications
You must be signed in to change notification settings - Fork 24.7k
feat(JS): background-size, position and repeat styles #52284
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
base: main
Are you sure you want to change the base?
feat(JS): background-size, position and repeat styles #52284
Conversation
background image example example js nits beautiful multiple gradient example
|
||
const validValues = ['repeat', 'space', 'round', 'no-repeat'] as const; | ||
|
||
export default function processBackgroundRepeat( |
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 we want to do this parsing in native using the new CSSParser infra, and not rely on JS viewconfigs.
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 wanted to mention that. Is it in use already?
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 it's still gated behind a feature flag for now:
Lines 265 to 274 in c660868
inline void fromRawValue( | |
const PropsParserContext& context, | |
const RawValue& value, | |
std::vector<BoxShadow>& result) { | |
if (ReactNativeFeatureFlags::enableNativeCSSParsing()) { | |
parseUnprocessedBoxShadow(context, value, result); | |
} else { | |
parseProcessedBoxShadow(context, value, result); | |
} | |
} |
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.
Actually, just reading through some of the history there, until we complete another refactor on Android, we will still need JS parsing of these types there.
Summary:
This PR adds support for background size, position and repeat styles. It follows the CSS spec. Currently we default to
background-origin: padding-box
andbackground-clip : border-box
to match the web's behavior. We can introduce these styles later. I have split the PR intro three parts for review. This PR includes JS parsing and style propagation to native changes. I wanted to introduce one style at a time, but CSS spec is such that size, position and repeat are intertwined.Changelog:
[GENERAL][ADDED] - Background size, position and repeat styles.
Test Plan:
Merge the iOS and android PR into this, this PR includes
BackgroundImageExample
. I have also added testcases for parsing syntax in JS.Screen.Recording.2025-06-26.at.10.47.17.AM.mp4