问题描述
我刚刚安装了较新的带有 RNVI 的 react native,在使用 RNVI 时出现此错误,
BackAndroid 已弃用,并已从此软件包中删除.改用 BackHandler
但是当我删除 import FontAwesome from 'react-native-vector-icons/FontAwesome';
和 <FontAwesome name="icon_name"/>
我尝试使用 vscode 甚至在 RNVI github repo 上搜索 BackAndroid
,但我找不到任何 BackAndroid
我该如何解决这个问题?
BackAndroid is Deprecated
别担心,我们有 Backhandler 而不是 BackAndroid
使用react-native-vector-icons":^6.2.0",
用例:import { BackHandler } from 'react-native'componentDidMount() {BackHandler.addEventListener('hardwareBackPress', this.handleBackPress);}componentWillUnmount() {BackHandler.removeEventListener('hardwareBackPress', this.handleBackPress);}handleBackPress = () =>{this.goBack();//当 goBack 异步时效果最好返回真;}
I just installing newer react native with RNVI and i get this error when using RNVI,
but everything is fine when i remove import FontAwesome from 'react-native-vector-icons/FontAwesome';
and <FontAwesome name="icon_name"/>
I've tried to search BackAndroid
using vscode and even on RNVI github repo, but I can't find any BackAndroid
How can i fix this issue?
BackAndroid is Deprecated
Don't Worry we have Backhandler instead of BackAndroid
Use "react-native-vector-icons": "^6.2.0",
这篇关于RN 0.59.5 with RN-vector-icons 6.4.2 throwing BackAndroid 已弃用,并已从此包中删除.改用 BackHandler的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!