import rnTextSize, { TSFontSpecs } from 'react-native-text-size'
.
.
.
function renderedTextSize(text: string, size: number = 14, fontFamily: string = 'moein') {
const dimension = {
width: 0,
height: 0,
};
const fontSpecs: TSFontSpecs = {
fontFamily: fontFamily,
fontSize: size,
};
rnTextSize.measure({
text, // text to measure, can include symbols
...fontSpecs, // RN font specification
}).then(result=> {
dimension.width = result.width;
dimension.height = result.height;
});
return dimension;
}
when I try to call the function, I get this error message, Cannot read property 'measure' of undefined.
why should rnTextSize be undefined when I import it from library?
here is my code:
when I try to call the function, I get this error message,
Cannot read property 'measure' of undefined
. why shouldrnTextSize
be undefined when I import it from library?