我有一个使用expo的本地应用程序。
我想在右上角显示一个注销图标按钮。
这适用于android。但是在iOS(使用模拟器)上,按钮只是蓝色,没有图标。
这是我的标头组件:
import React from 'react';
import {AsyncStorage} from 'react-native';
import {Header, Content, Button, Text, Right, Body, Left, Icon, Title} from 'native-base';
import { PropTypes } from 'prop-types';
export default class LoggedInHeader extends React.Component {
render() {
const {title} = this.props;
return (
<Header>
<Left/>
<Body>
<Title>{title}</Title>
</Body>
<Right>
<Button onPress={this.onLogOut}>
<Icon ios='ios-log-out' android='md-log-out' />
</Button>
</Right>
</Header>
);
}
onLogOut = async () => {
await AsyncStorage.removeItem('accessToken');
this.props.navigation.navigate('Auth');
}
}
这是我的依赖项:
"dependencies": {
"@expo/vector-icons": "^9.0.0",
"axios": "^0.18.0",
"expo": "^32.0.0",
"moment": "^2.23.0",
"native-base": "^2.11.0",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
"react-navigation": "^3.0.9",
"react-redux": "^6.0.0",
"redux": "^4.0.1",
"redux-form": "^8.0.4",
"redux-thunk": "^2.3.0"
}
我在搜索时发现了this issue。它使我相信我有一个依赖项问题,因此我从本机基础2.8.0传递到了2.9.0,但没有成功。即使在2.11.0中,我也有相同的结果。
我开始绝望了。我还应该尝试什么?