mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
RN: Unify Typeface Logic (Android)
Summary: Refactors how `Typeface` style and weight are applied in React Native on Android. - Unifies all style and weight normalization logic into a new `TypefaceStyle` class. - Fixes font weight support for the Fabric renderer. - De-duplicates code with `TextAttributeProps`. - Simplified normalization logic. - Fixes a rare crash due to `Typeface.sDefaultTypeface` (Android SDK) being `null`. - Adds a new example to test font weights in `TextInput`. - Adds missing `Nullsafe` and `Nullable` annotations. - Clean up a bunch of obsolete inline comments. Changelog: [Android][Fixed] - Fixed a rare crash due to `Typeface.sDefaultTypeface` (Android SDK) being `null`. [Android][Fixed] - Fixed font weight support for the Fabric renderer. [Android][Added] - Added a new example to test font weights in `TextInput`. Reviewed By: JoshuaGross Differential Revision: D29631134 fbshipit-source-id: 3f227d84253104fa828a5561b77ba7a9cbc030c4
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3e2bb331fc
commit
9d2fedc6e2
@@ -200,6 +200,38 @@ exports.examples = ([
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Font Weight',
|
||||
render: function(): React.Node {
|
||||
return (
|
||||
<View>
|
||||
<TextInput
|
||||
defaultValue="Font Weight (default)"
|
||||
style={[styles.singleLine]}
|
||||
/>
|
||||
{[
|
||||
'normal',
|
||||
'bold',
|
||||
'900',
|
||||
'800',
|
||||
'700',
|
||||
'600',
|
||||
'500',
|
||||
'400',
|
||||
'300',
|
||||
'200',
|
||||
'100',
|
||||
].map(fontWeight => (
|
||||
<TextInput
|
||||
defaultValue={`Font Weight (${fontWeight})`}
|
||||
key={fontWeight}
|
||||
style={[styles.singleLine, {fontWeight}]}
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Text input, themes and heights',
|
||||
render: function(): React.Node {
|
||||
|
||||
Reference in New Issue
Block a user