-
Notifications
You must be signed in to change notification settings - Fork 25.2k
feat(android): background-size, position and repeat styles #52282
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
Changes from 1 commit
9128da3
00e2191
d65e112
34c041c
bcf8e10
46772a0
7c449aa
478dc99
a6f8253
0b8a3a3
540aa4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,26 +24,24 @@ public data class LengthPercentage( | |
| ) { | ||
| public companion object { | ||
| @JvmStatic | ||
| public fun setFromDynamic(dynamic: Dynamic): LengthPercentage? { | ||
| public fun setFromDynamic(dynamic: Dynamic, allowNegative: Boolean = false): LengthPercentage? { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did not like this change, but we need to support negative values for
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is fine.. I'll think about it a bit |
||
| return when (dynamic.type) { | ||
| ReadableType.Number -> { | ||
| val value = dynamic.asDouble() | ||
| if (value >= 0f) { | ||
| LengthPercentage(value.toFloat(), LengthPercentageType.POINT) | ||
| } else { | ||
| null | ||
| if (value < 0 && !allowNegative) { | ||
| return null | ||
| } | ||
| LengthPercentage(value.toFloat(), LengthPercentageType.POINT) | ||
| } | ||
| ReadableType.String -> { | ||
| val s = dynamic.asString() | ||
| if (s != null && s.endsWith("%")) { | ||
| try { | ||
| val value = s.substring(0, s.length - 1).toFloat() | ||
| if (value >= 0f) { | ||
| LengthPercentage(value, LengthPercentageType.PERCENT) | ||
| } else { | ||
| null | ||
| if (value < 0 && !allowNegative) { | ||
| return null | ||
| } | ||
| LengthPercentage(value, LengthPercentageType.PERCENT) | ||
| } catch (e: NumberFormatException) { | ||
| FLog.w(ReactConstants.TAG, "Invalid percentage format: $s") | ||
| null | ||
|
|
||
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.
Only enabled for new drawables as it is
trueby default now.