mirror of
https://github.com/zoriya/expo-vector-icons.git
synced 2025-12-06 06:36:29 +00:00
Add SSR support (see expo/vector-icons#193)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import * as Font from "expo-font";
|
||||
import React from "react";
|
||||
import { Text, } from "react-native";
|
||||
import { Text, Platform, } from "react-native";
|
||||
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_ICON_COLOR, DEFAULT_ICON_SIZE, } from "./vendor/react-native-vector-icons/lib/create-icon-set";
|
||||
@@ -35,7 +35,7 @@ export default function (glyphMap, fontName, expoAssetId, fontStyle) {
|
||||
if (__DEV__ && this.props.name && !(this.props.name in glyphMap)) {
|
||||
console.warn(`"${this.props.name}" is not a valid icon name for family "${fontName}"`);
|
||||
}
|
||||
if (!this.state.fontIsLoaded) {
|
||||
if (Platform.OS !== "web" && !this.state.fontIsLoaded) {
|
||||
return <Text />;
|
||||
}
|
||||
return (<RNVIconComponent ref={(view) => {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -8,6 +8,7 @@ import {
|
||||
OpaqueColorValue,
|
||||
TextStyle,
|
||||
ViewStyle,
|
||||
Platform,
|
||||
} from "react-native";
|
||||
|
||||
import createIconSet from "./vendor/react-native-vector-icons/lib/create-icon-set";
|
||||
@@ -150,7 +151,7 @@ export default function <G extends string, FN extends string>(
|
||||
);
|
||||
}
|
||||
|
||||
if (!this.state.fontIsLoaded) {
|
||||
if (Platform.OS !== "web" && !this.state.fontIsLoaded) {
|
||||
return <Text />;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"build": "expo build:web"
|
||||
},
|
||||
"dependencies": {
|
||||
"@expo/vector-icons": "13.0.0",
|
||||
"@expo/vector-icons": "../",
|
||||
"@react-native-community/masked-view": "0.1.10",
|
||||
"@react-navigation/native": "^5.2.4",
|
||||
"@react-navigation/stack": "^5.2.19",
|
||||
|
||||
@@ -2035,10 +2035,8 @@
|
||||
dependencies:
|
||||
cross-spawn "^6.0.5"
|
||||
|
||||
"@expo/vector-icons@13.0.0":
|
||||
"@expo/vector-icons@../":
|
||||
version "13.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@expo/vector-icons/-/vector-icons-13.0.0.tgz#e2989b85e95a82bce216f88cf8fb583ab050ec95"
|
||||
integrity sha512-TI+l71+5aSKnShYclFa14Kum+hQMZ86b95SH6tQUG3qZEmLTarvWpKwqtTwQKqvlJSJrpFiSFu3eCuZokY6zWA==
|
||||
|
||||
"@expo/vector-icons@^12.0.4":
|
||||
version "12.0.5"
|
||||
|
||||
Reference in New Issue
Block a user