Open iamgabrielma opened 1 year ago
Fails | |
---|---|
:no_entry_sign: | Please add a feature label to this issue. e.g. 'feature: stats' |
Generated by :no_entry_sign: dangerJS
Just had a quick look at this, seems like one way to do it is the use of the unicode marker "\u{200E}"
ref: https://stackoverflow.com/a/31744355
So e.g:
Text(minusSign + discountAmount)
Should become:
Text(minusSign + "\u{200E}" + discountAmount)
Or actually using NumberFormatter might work:
if let discountAmount = discountDetailsViewModel.finalAmountString, let discountNumber = Double(discountAmount) {
let formatter = NumberFormatter()
formatter.numberStyle = .decimal
if let formattedString = formatter.string(from: NSNumber(value: -discountNumber)) {
Text(formattedString)
.foregroundColor(Color(uiColor: .withColorStudio(.green, shade: .shade50)))
}
}
using NumberFormatter might work
That sounds good, I'd say we should rely on a NumberFormatter solution for consistency across different views/models, reusability, and easy testing.
Quick report to investigate further, we seem to display the
-
symbol, for example for discounts or refunds in the incorrect place when RTL is set as per store settings. Along with this, we display the symbol inconsistently left or right to the amount depending on the case.Some current examples: