oblador / react-native-vector-icons

Customizable Icons for React Native with support for image source and full styling.
https://oblador.github.io/react-native-vector-icons/
MIT License
17.31k stars 2.12k forks source link

Invariant Violation: Calling synchronous methods on native modules is not supported in Chrome. #1418

Closed 18601673727 closed 2 months ago

18601673727 commented 2 years ago

Strange errors like below happened while trying to integrate with react-navigation v6:

Invariant Violation: Calling synchronous methods on native modules is not supported in Chrome.
 Consider providing alternative methods to expose this method in debug mode, e.g. by exposing constants ahead-of-time.

Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
      This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.

by this implementation:

import Icon from 'react-native-vector-icons/Feather';
export default navigatorConfig = {
    headerTitleAlign: 'center',
    headerShadowVisible: false,
    headerStyle: {
        backgroundColor: '#eeeeee',
    },
    headerTintColor: '#ffffff',
    headerTitleStyle: {
        color: '#ffffff',
        alignItems: 'center',
    },
    headerBackImageSource: Icon.getImageSourceSync("arrow-left-circle", 30, "#ffffff")
};

So basically I was trying to overwrite the default instance of createNativeStackNavigator() from their end, change the default native header back button to customized one, don't know how much related to this nice lib but still want to note the solution for the future readers.

llr101 commented 2 years ago

Same error

johnf commented 2 months ago

Are you trying to use this on the web? getImageSourceSync is not supported on the web only on mobile