Skip to content

Commit 7abdbb1

Browse files
committed
Deprecates android TypefaceTextView in favor of core Text.
1 parent 77ee222 commit 7abdbb1

File tree

5 files changed

+9
-99
lines changed

5 files changed

+9
-99
lines changed

android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ repositories {
3030
}
3131

3232
dependencies {
33-
compile 'com.facebook.react:react-native:0.12.+'
33+
compile 'com.facebook.react:react-native:0.16.+'
3434
}

android/src/main/java/com/oblador/vectoricons/CustomTypefaceTextViewManager.java

-33
This file was deleted.

android/src/main/java/com/oblador/vectoricons/VectorIconsPackage.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ public List<Class<? extends JavaScriptModule>> createJSModules() {
3030

3131
@Override
3232
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
33-
return Arrays.<ViewManager>asList(
34-
new CustomTypefaceTextViewManager()
35-
);
33+
return Collections.emptyList();
3634
}
3735
}

lib/TypefaceTextView.js

-43
This file was deleted.

lib/create-icon-set.js

+7-19
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ var DEFAULT_BUTTON_ICON_COLOR = 'white';
3333
var DEFAULT_BUTTON_RADIUS = 5;
3434
var DEFAULT_BUTTON_BACKGROUND = IOS7_BLUE;
3535

36-
var TypefaceTextView;
37-
38-
if(Platform.OS === 'android') {
39-
TypefaceTextView = require('./TypefaceTextView');
40-
}
41-
4236
function createIconSet(glyphMap : Object, fontFamily : string, fontFile : string) : Function {
37+
var fontReference = fontFamily;
38+
// Android doesn't care about actual fontFamily name, it will only look in fonts folder.
39+
if(Platform.OS === 'android' && fontFile) {
40+
fontReference = fontFile.replace(/\.(otf|ttf)$/, '');
41+
}
42+
4343
var Icon = React.createClass({
4444
propTypes: {
4545
name: React.PropTypes.oneOf(Object.keys(glyphMap)).isRequired,
@@ -73,20 +73,8 @@ function createIconSet(glyphMap : Object, fontFamily : string, fontFile : string
7373
props.style = [styleDefaults, style];
7474
props.ref = (component) => this._root = component;
7575

76-
// For android we have to use our own subclass of the TextView since it
77-
// doesn't yet support custom fonts
78-
if(Platform.OS === 'android') {
79-
// FIXME: Temporary workaround until I can figure out how to automatically size icons
80-
styleDefaults.width = size;
81-
styleDefaults.height = size;
82-
styleDefaults.lineHeight = size;
83-
if (TypefaceTextView == null) {
84-
throw new Error("TypefaceTextView component must be available on Android");
85-
}
86-
return (<TypefaceTextView {...props} fontFile={fontFile}>{glyph}{this.props.children}</TypefaceTextView>);
87-
}
76+
styleDefaults.fontFamily = fontReference;
8877

89-
styleDefaults.fontFamily = fontFamily;
9078
return (<Text {...props}>{glyph}{this.props.children}</Text>);
9179
}
9280
});

0 commit comments

Comments
 (0)