私はをexporeと共にmonorepo設定で使用しようとしています。サブフォルダapp/
からアプリケーションを起動し、@expo/vector-icons
をインポートすると、フォントファミリが見つからないというエラーが表示されます。@ expo /ベクトルアイコンがサブフォルダから実行されているときにロードされていません
"fontFamily" 'material' is not a system font and has not been loaded
through Expo.Font.loadAsync.
私はアイコンが細かいロードメインsrc/
フォルダ内のアプリを起動した場合。
rn-cli.config.js
を設定して、他の依存関係のためにアプリケーションをコンパイルして正常に実行できるようにしました。私のプロジェクトはmonorepoのようにセットアップされているので、私はレポに複数のネイティブアプリを持つことができます。
src/
MainApp.js
package.json
app/App.js
app/app.json
app/package.json
app/rn-cli.config.js
...
私は無駄にカップルの事を試してみた:
app.json
ファイルに"assetExts": ["ttf"]
を設定するサブフォルダpackage.jsonで@expo/vector-icons
- をインストールします。 (主に新鮮
creat-react-native-app
から)
マイコード:
APP/App.js
export { default } from "../MainApp";
APP/app.json
{
"expo": {
"sdkVersion": "22.0.0",
"react": "16.0.0-beta.5"
}
}
APP/package.json
{
"private": true,
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"native": "react-native-scripts start"
},
"dependencies": {
"@expo/vector-icons": "^6.2.1",
"expo": "^22.0.0",
"react-native": "^0.49.0",
"react-native-scripts": "1.7.0"
}
}
アプリ/ RN-cli.config.js
{
"name": "react-native-app",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-native-scripts": "1.7.0"
},
"scripts": {
"native": "cd app && yarn native"
},
"dependencies": {
"@expo/vector-icons": "^6.2.1",
"expo": "^22.0.0",
"react": "16.0.0-beta.5",
"react-native": "^0.49.0"
}
}
MainApp.js
import React from "react";
import { StyleSheet, Text, View } from "react-native";
import MaterialIcons from "react-native-vector-icons/MaterialIcons";
export default class App extends React.Component {
render() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<Text>Changes you make will automatically reload.</Text>
<Text>Shake your phone to open the developer menu.</Text>
<MaterialIcons name="search" color="black" size={32} />
<MaterialIcons name="location-searching" color="black" size={32} />
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center"
}
});