localized-strings
localized-strings copied to clipboard
Passing undefined to 'formatString' will crash the whole application.
Hey!
Because of some changes in our backend we got an undefined for the 2nd parameter (valueForPlaceholder) of formatString
and therefore we get a TypeError: undefined is not an object (evaluating 'valuesForPlaceholders[0][matchedKey]') which crashed the whole application.
Strings.formatString(Strings.XXXX, undefined);
This will crash the react-native application.
Maybe it would be possible to add additional checks for it.
rn: 0.58.3 react-native-localization: 2.1.0 react-localization: ^1.0.13

Any fix for this ?
Hi, you can just pass an empty string instead of undefined like this:
Strings.formatString(Strings.XXXX, undefined || "");