【发布时间】:2020-08-07 15:27:43
【问题描述】:
问题
我最近刚刚从一个分叉存储库中的 expo 中退出,并在尝试构建 iOS 应用程序时遇到了一个问题,无法解析我现有的图像和字体资产。
步骤
npm 安装
展会弹出
纱线 ios
预期结果
在安装 pod 并清除依赖项后运行应用程序。
我尝试注释掉导入字体的行,以查看这些文件是否存在问题,但我尝试解决的图像存在相同问题。这是我的 App.js 文件:
import React, { Component } from 'react';
import AppNavigator from './navigation/AppNavigator.js';
import AppIntroSlider from 'react-native-app-intro-slider';
import { View, Text, Image, StyleSheet } from 'react-native';
import Amplify from 'aws-amplify';
import awsmobile from './aws-exports';
Amplify.configure(awsmobile);
import { composeWithDevTools } from 'redux-devtools-extension'
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from './store/reducers/rootReducer';
import { Provider } from 'react-redux';
import { AppLoading } from 'expo';
import * as Font from 'expo-font';
// Accessing the store and associated components
// If adding additional dispatching action files, ensure they are added to the rootReducer
const store = createStore(
rootReducer,
composeWithDevTools(applyMiddleware(thunk))
);
// Fonts that need to be used in the application
const fetchFonts = () => {
return Font.loadAsync({
'euclid-triangle': require('./assets/fonts/EuclidTriangle-Regular.ttf'),
'euclid-triangle-bold': require('./assets/fonts/EuclidTriangle-Bold.ttf'),
'euclid-triangle-semibold': require('./assets/fonts/EuclidTriangle-SemiBold.ttf'),
});
};
export default class App extends Component {
constructor(props) {
super(props)
}
render() {
// Load the font if it has not been done already
if (!this.state.fontLoaded) {
return (
<AppLoading startAsync={fetchFonts}
onFinish={() => {this.setState({fontLoaded: true})
}}/>
)
}
// If the intro slider has been dismissed the main app can be shown
return (
<Provider store={store}>
<AppNavigator/>
</Provider>
)
}
}
【问题讨论】:
标签: ios reactjs xcode react-native expo