Use the lineHeight style to change from the default line height
Have variable width
We want to measure their height using flatHeights.
This also increases accuracy for both iOS and Android by fixing tiny discrepancies.
Fix
Add handling for both Android and iOS for new FontSpecs called numberOfLines and flatHeights. This matches the <Text numberOfLines={...}> prop
Add new flatSizes function that behaves the same as flatHeights, but returns both the width and height. We use arrays (instead of objects with width and height) to reduce the amount key data passed over the React Native bridge
Testing
Created Storybook story in our app to test it on both Android and iOS:
Motivation
We have some Text components that
numberOfLines
prop to limit lineslineHeight
style to change from the default line heightWe want to measure their height using
flatHeights
.This also increases accuracy for both iOS and Android by fixing tiny discrepancies.
Fix
numberOfLines
andflatHeights
. This matches the<Text numberOfLines={...}>
propflatSizes
function that behaves the same asflatHeights
, but returns both the width and height. We use arrays (instead of objects with width and height) to reduce the amount key data passed over the React Native bridgeTesting
Created Storybook story in our app to test it on both Android and iOS: