When i try to implement login functionality using aws-amplify library in react native. At that time we caught the following error like
AuthPiece.js:1 Uncaught TypeError: _awsAmplify.Logger is not a constructor
at ./node_modules/aws-amplify-react-native/dist/Auth/AuthPiece.js (AuthPiece.js:1:1)
at webpack_require (bootstrap:24:1)
at fn (hot module replacement:62:1)
at ./node_modules/aws-amplify-react-native/dist/Auth/Loading.js (Loading.js:1:1)
at webpack_require (bootstrap:24:1)
at fn (hot module replacement:62:1)
at ./node_modules/aws-amplify-react-native/dist/Auth/Authenticator.js (Authenticator.js:1:1)
at webpack_require (bootstrap:24:1)
at fn (hot module replacement:62:1)
at ./node_modules/aws-amplify-react-native/dist/Auth/index.js (index.js:1:1)
I would be tried following code
*** App.js file***
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Amplify } from 'aws-amplify';
import {withAuthenticator} from 'aws-amplify-react-native';
import { config } from './aws-exports';
Amplify.configure(config);
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',
},
});
*** package.json ***
{
"name": "shop-with-login",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web"
},
"dependencies": {
"@aws-amplify/ui-react-native": "^2.0.6",
"aws-amplify": "^6.0.7",
"aws-amplify-react-native": "^6.0.5",
"expo": "~49.0.15",
"expo-splash-screen": "~0.20.5",
"expo-status-bar": "~1.6.0",
"react": "18.2.0",
"react-dom": "^18.2.0",
"react-native": "0.72.6",
"react-native-web": "~0.19.6"
},
"devDependencies": {
"@babel/core": "^7.20.0"
},
"private": true
}