问题
I just installing newer react native with RNVI and i get this error when using RNVI,
BackAndroid is deprecated and has been removed from this package. Use BackHandler instead
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?
回答1:
BackAndroid is Deprecated
Don't Worry we have Backhandler instead of BackAndroid
Use "react-native-vector-icons": "^6.2.0",
Use Case : import { BackHandler } from 'react-native' componentDidMount() { BackHandler.addEventListener('hardwareBackPress', this.handleBackPress); } componentWillUnmount() { BackHandler.removeEventListener('hardwareBackPress', this.handleBackPress); } handleBackPress = () => { this.goBack(); // works best when the goBack is async return true; }
来源:https://stackoverflow.com/questions/55918055/rn-0-59-5-with-rn-vector-icons-6-4-2-throwing-backandroid-is-deprecated-and-has