You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have upgraded from version 0.1.32 to version 2.1.6, and formatString is broken.
react-native version 0.61.5
For example:
strings: {info: 'Bread will be done in {0} minutes.'}constminute=30;
Previously I could use it like strings.formatString(strings.info, minute) and it will display Bread will be done in 30 minutes..
Now it gives error TypeError: Cannot read property '0' of undefined.
After some experiments, I realised that strings.formatString(strings.info, [30]) would work.
The README did not mention that we have to enclose the string params with [] square brackets.
Anything that I have missed?
Thanks in advance.
The text was updated successfully, but these errors were encountered:
Ah, okay. I realised that the minute was undefined at first, and then only updated with a value afterwards.
Previous version will fill it with undefined for a while then update the value after it's updated.
Any ways to accommodate undefined value?
I have upgraded from version 0.1.32 to version 2.1.6, and formatString is broken.
react-native version 0.61.5
For example:
Previously I could use it like
strings.formatString(strings.info, minute)
and it will displayBread will be done in 30 minutes.
.Now it gives error
TypeError: Cannot read property '0' of undefined
.After some experiments, I realised that strings.formatString(strings.info, [30]) would work.
The README did not mention that we have to enclose the string params with [] square brackets.
Anything that I have missed?
Thanks in advance.
The text was updated successfully, but these errors were encountered: