react-native-vector-icons: Native module cannot be null on React Native 0.59+
Description
react-native-vector-icons fails to work with React-Native 0.59.1. The following errors are thrown. iOS: Native modular cannot be null. Android: BackAndroid is deprecated and has been removed from this package. Use BackHandler instead. The library was working fine in React Native version 0.57.1 and version 0.58.6.


Environment
- iOS
- Android
Sample Code
Removing react-native-vector-icons fixes both errors.
import * as React from "react";
+ import { ViewStyle, Text } from "react-native";
- import { ViewStyle } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
interface Props {
name: string;
size: number;
color: string;
style?: ViewStyle | {};
}
export class IconWrapper extends React.PureComponent<Props> {
public render() {
const { name, size, color, style } = this.props;
+ return <Text>{name}</Text>;
return <Icon name={name} size={size} color={color} style={style} />;
}
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 6
- Comments: 17
+1
It didn’t help
Any solution?
I figured it out. You need to update your
metro.config.jsand restart your bundler.before
after