I want to read mails with imap, by searching internet i found react-native-mailcore module which I want to use and some people on forums have recommended it. I created a new React-native expo project and tried to add https://github.com/agenthunt/react-native-mailcore , I am new to react-native but I don't know why this problem is happening.
I installed react-native-mailcore with command:
npm install react-native-mailcore
Which is installed succesfuly.
But i got the error when trying to run app:
TypeError: null is not an object (evaluating '_reactNativeMailcore.default.loginSmtp')
at node_modules\react-native\Libraries\LogBox\LogBox.js:149:8 in registerError
at node_modules\react-native\Libraries\LogBox\LogBox.js:60:8 in errorImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:34:4 in console.error
at node_modules\expo\build\environment\react-native-logs.fx.js:27:4 in error
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:104:6 in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:172:19 in handleException
at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:24:6 in handleError
at node_modules\@react-native\polyfills\error-guard.js:49:36 in ErrorUtils.reportFatalError
at node_modules\metro-runtime\src\polyfills\require.js:204:6 in guardedLoadModule
at http://192.168.1.27:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:117378:3 in global code
Here is the code driver code from github readme.:
import { StatusBar } from "expo-status-bar";
import { StyleSheet, Text, View } from "react-native";
import MailCore from "react-native-mailcore";
MailCore.loginSmtp({
hostname: "smtp.gmail.com",
port: 465,
username: "email@gmail.com",
password: "password",
})
.then((result) => {
alert(result.status);
})
.catch((error) => {
alert(error);
});
export default function App() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<StatusBar style="auto" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
});