Summary:
Fixes#979.
Previously, a Text whose width is determined automatically (as opposed to set by a container) would position the text incorrectly after an update to the text *if* the text's width did not change (i.e., when changing only digits in a font with tabular numbers).
Every time RCTShadowText's RCTMeasure runs, it sets the text container's size to be the maximum allowed size for the text. When RCTText's drawRect is called later, it relied on layoutSubviews having been called to set the text container's size back to the proper width. But if RCTMeasure returned the same dimensions as last time, then RCTText's frame wasn't reset and so layoutSubviews was never re-called. With this change, we set the textContainer's size each time we draw the text.
We could also fix this by using a different NSTextContainer instance in RCTMeasure. Not sure what the pros and cons of that are.
Closes https://github.com/facebook/react-native/pull/989
Github Author: Ben Alpert <balpert@fb.com>
Test Plan: Imported from GitHub, without a `Test Plan:` line.
Summary:
Also fix RCTShadowText export name.
Closes https://github.com/facebook/react-native/pull/857
Github Author: "Dr. Kibitz" <info@drkibitz.com>
Test Plan: Imported from GitHub, without a `Test Plan:` line.
Summary:
For a very simple view I was observing that the text background was black and had to manually be set to transparent. This ensures that text nodes have a transparent background by default.
Closes https://github.com/facebook/react-native/pull/256
Github Author: James Ide <ide@jameside.com>
Test Plan:
This example component no longer renders what looks like a black block, and instead displays legible text.
var Example = React.createClass({
render: function() {
return (
<View style={styles.container}>
<Text>hello</Text>
</View>
);
},
});
var styles = StyleSheet.create({
container: {
flex: 1,
},
};