mirror of
https://github.com/zoriya/expo-vector-icons.git
synced 2026-05-31 01:25:41 +00:00
Don't call setState if unmounted before font loads
fbshipit-source-id: 2ff8070
This commit is contained in:
committed by
Exponent GitHub Bot
parent
c0d7f949a0
commit
04fe6fb39d
+8
-5
@@ -1,10 +1,8 @@
|
||||
import React from 'react';
|
||||
import { Text } from 'react-native';
|
||||
import { Font } from 'expo';
|
||||
import createIconSet
|
||||
from './vendor/react-native-vector-icons/lib/create-icon-set';
|
||||
import createIconButtonComponent
|
||||
from './vendor/react-native-vector-icons/lib/icon-button';
|
||||
import createIconSet from './vendor/react-native-vector-icons/lib/create-icon-set';
|
||||
import createIconButtonComponent from './vendor/react-native-vector-icons/lib/icon-button';
|
||||
|
||||
export default function(glyphMap, fontName, expoAssetId) {
|
||||
const expoFontName = Font.style(fontName, {
|
||||
@@ -22,12 +20,17 @@ export default function(glyphMap, fontName, expoAssetId) {
|
||||
};
|
||||
|
||||
async componentWillMount() {
|
||||
this._mounted = true;
|
||||
if (!this.state.fontIsLoaded) {
|
||||
await Font.loadAsync(font);
|
||||
this.setState({ fontIsLoaded: true });
|
||||
this._mounted && this.setState({ fontIsLoaded: true });
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this._mounted = false;
|
||||
}
|
||||
|
||||
setNativeProps(props) {
|
||||
if (this._icon) {
|
||||
this._icon.setNativeProps(props);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@expo/vector-icons",
|
||||
"version": "5.0.0",
|
||||
"version": "5.1.0",
|
||||
"description": "Built-in support for 10 popular icon fonts and the tooling to create your own Icon components from your font and glyph map. This is a wrapper around react-native-vector-icons to make it compatible with Expo.",
|
||||
"main": "index.js",
|
||||
"scripts": {},
|
||||
|
||||
Reference in New Issue
Block a user