We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
I'm getting following error when try this library to calculate height of text in iOS:
'Error in measure:', { [Error: Missing required text.] framesToPop: 1, code: 'E_MISSING_TEXT', domain: 'RCTErrorDomain', userInfo: null}
My code snippet: for JS - HeightMeasurementFromText.js
HeightMeasurementFromText.js
import React, { Component } from 'react'; import { Platform } from 'react-native';
import RNTextSize, { TSFontSpecs } from 'react-native-text-size';
const fontSpecs: TSFontSpecs = { fontFamily: (Platform.OS === 'ios' ? 'Proxima Nova' : 'Proxima Nova Bold'), fontWeight: (Platform.OS === 'ios' ? 'bold' : null), fontSize: 18, }
export const nameTextHeight = async (nameText) => { const dimension = { width: 0, height: 0, }; await RNTextSize.measure({ nameText, width: 170, ...fontSpecs, }).then(result => { console.log('result - ' + JSON.stringify(result)); dimension.width = result.width; dimension.height = result.height; }).catch((err) => { console.log('Error in measure:', err); }); return dimension; };
export const nameTextHeight = async (nameText) => { const dimension = { width: 0, height: 0, };
await RNTextSize.measure({ nameText, width: 170, ...fontSpecs, }).then(result => { console.log('result - ' + JSON.stringify(result)); dimension.width = result.width; dimension.height = result.height; }).catch((err) => { console.log('Error in measure:', err); });
return dimension; };
I'm calling this in my some other JS file as:
import { nameTextHeight } from './library/helper/HeightMeasurementFromText';
let nameTextHgt = nameTextHeight(item.name.toUpperCase());
My Environment variables are:
"react": "16.8.3", "react-native": "^0.59.9", "react-native-text-size": "^4.0.0-rc.1",
What's the problem in my code and implementation of your library?
Kindly suggest. Please.
Thanks in advance.
The text was updated successfully, but these errors were encountered:
The text property is incorrectly named. You changed the text field to nameText. await RNTextSize.measure({ nameText, width: 170, ...fontSpecs, })
await RNTextSize.measure({ nameText, width: 170, ...fontSpecs, })
Update to await RNTextSize.measure({ text: nameText, width: 170, ...fontSpecs, })
await RNTextSize.measure({ text: nameText, width: 170, ...fontSpecs, })
Sorry, something went wrong.
No branches or pull requests
Hi,
I'm getting following error when try this library to calculate height of text in iOS:
'Error in measure:', { [Error: Missing required text.] framesToPop: 1, code: 'E_MISSING_TEXT', domain: 'RCTErrorDomain', userInfo: null}
My code snippet: for JS -
HeightMeasurementFromText.js
import React, { Component } from 'react'; import { Platform } from 'react-native';
import RNTextSize, { TSFontSpecs } from 'react-native-text-size';
const fontSpecs: TSFontSpecs = { fontFamily: (Platform.OS === 'ios' ? 'Proxima Nova' : 'Proxima Nova Bold'), fontWeight: (Platform.OS === 'ios' ? 'bold' : null), fontSize: 18, }
export const nameTextHeight = async (nameText) => { const dimension = { width: 0, height: 0, };
await RNTextSize.measure({ nameText, width: 170, ...fontSpecs, }).then(result => { console.log('result - ' + JSON.stringify(result)); dimension.width = result.width; dimension.height = result.height; }).catch((err) => { console.log('Error in measure:', err); });
return dimension; };
I'm calling this in my some other JS file as:
import { nameTextHeight } from './library/helper/HeightMeasurementFromText';
let nameTextHgt = nameTextHeight(item.name.toUpperCase());
My Environment variables are:
"react": "16.8.3",
"react-native": "^0.59.9",
"react-native-text-size": "^4.0.0-rc.1",
What's the problem in my code and implementation of your library?
Kindly suggest. Please.
Thanks in advance.
The text was updated successfully, but these errors were encountered: