我在使用ant-design/react-native中 链接了font 并且 expo start也可以正常显示 但是我build:android后 字体缺消失了 我尝试把字体放进assets中加载 expo start 也是正常的 但是只要build:android后字体就会消失 sdk 33
App.js
import React from 'react';
import { Text, View, StyleSheet } from 'react-native';
import { Icon, TabBar } from '@ant-design/react-native';
import { AppLoading, Font } from 'expo';
export default class App extends React.Component {
state = {
isReady: false,
selectedTab: 'redTab',
};
renderContent(pageText) {
return (
<View style={{ flex: 1, alignItems: 'center', backgroundColor: 'white' }}>
<Text style={{ margin: 50 }}>{pageText}</Text>
</View>
);
}
onChangeTab(tabName) {
this.setState({
selectedTab: tabName,
});
}
asyncJob(){
return Promise.all([
Font.loadAsync( {
'antoutline': require('./assets/antoutline.ttf'),
'antfill': require('./assets/antfill.ttf')
}
)
]);
}
render() {
if (!this.state.isReady) {
return (
<AppLoading
startAsync={this.asyncJob}
onFinish={() => this.setState({ isReady: true })}
onError={console.warn}
/>
);
}
return (
<TabBar
unselectedTintColor="#949494"
tintColor="#33A3F4"
barTintColor="#f5f5f5"
>
<TabBar.Item
title="首页"
icon={<Icon name="home" />}
selected={this.state.selectedTab === 'blueTab'}
onPress={() => this.onChangeTab('blueTab')}
>
{this.renderContent('首页 Tab')}
</TabBar.Item>
<TabBar.Item
icon={<Icon name="appstore" />}
title="板块"
selected={this.state.selectedTab === 'redTab'}
onPress={() => this.onChangeTab('redTab')}
>
{this.renderContent('板块 Tab')}
</TabBar.Item>
<TabBar.Item
icon={<Icon name="search" />}
title="搜索"
selected={this.state.selectedTab === 'greenTab'}
onPress={() => this.onChangeTab('greenTab')}
>
{this.renderContent('搜索 Tab')}
</TabBar.Item>
<TabBar.Item
icon={<Icon name="user" />}
title="我的"
selected={this.state.selectedTab === 'yellowTab'}
onPress={() => this.onChangeTab('yellowTab')}
>
{this.renderContent('我的 Tab')}
</TabBar.Item>
</TabBar>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
app.json
{
"expo": {
"name": "jushi",
"slug": "jushi-native-app",
"privacy": "public",
"sdkVersion": "33.0.0",
"platforms": [
"ios",
"android",
"web"
],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"assets/**"
],
"ios": {
"supportsTablet": true
},
"android": {
"package": "com.gwz.jushi"
}
}
}