使用expo react native是否不允许安装本地库?
答案 0 :(得分:0)
不,expo不会阻止您使用任何前端程序包,因为在安装native-base之后,有一种特定的方法可以安装native base。将以下代码放入主本机文件中
import React, { Component } from 'react';
import { Root } from 'native-base';
import Main from "project directory";
import * as Font from 'expo-font';
import { ActivityIndicator } from 'react-native';
export default class App extends Component {
constructor(props) {
super(props);
this.state = { loading: true };
}
async componentDidMount() {
await Font.loadAsync({
Roboto: require('native-base/Fonts/Roboto.ttf'),
Roboto_medium: require('native-base/Fonts/Roboto_medium.ttf'),
});
this.setState({ loading: false });
}
render() {
if (this.state.loading) {
return (
<Root>
<ActivityIndicator />
</Root>
);
} else {
return (
<Root>
<Main/>//Your main Javascript project file.
</Root>
);
}
}
}
答案 1 :(得分:0)
它记录在nativebase网站上。您将必须安装expo-font
并在App.js
中进行一些调整。官方文档链接为https://docs.nativebase.io/docs/GetStarted.html#Setup_with_Expo