aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.43k stars 2.13k forks source link

React Native v6 - Auth UserPool not configured #12656

Closed SwhiteMHC closed 11 months ago

SwhiteMHC commented 11 months ago

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Authentication

Amplify Categories

auth

Environment information

``` # Put output below this line System: OS: macOS 13.4 CPU: (10) arm64 Apple M2 Pro Memory: 380.97 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.8.1 - /opt/homebrew/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 10.1.0 - /opt/homebrew/bin/npm pnpm: 8.7.5 - /opt/homebrew/bin/pnpm Watchman: 2023.10.09.00 - /opt/homebrew/bin/watchman Browsers: Chrome: 119.0.6045.199 Safari: 16.5 npmPackages: @apollo/client: ^3.8.6 => 3.8.8 @apollo/client/cache: undefined () @apollo/client/core: undefined () @apollo/client/dev: undefined () @apollo/client/errors: undefined () @apollo/client/link/batch: undefined () @apollo/client/link/batch-http: undefined () @apollo/client/link/context: undefined () @apollo/client/link/core: undefined () @apollo/client/link/error: undefined () @apollo/client/link/http: undefined () @apollo/client/link/persisted-queries: undefined () @apollo/client/link/remove-typename: undefined () @apollo/client/link/retry: undefined () @apollo/client/link/schema: undefined () @apollo/client/link/subscriptions: undefined () @apollo/client/link/utils: undefined () @apollo/client/link/ws: undefined () @apollo/client/react: undefined () @apollo/client/react/components: undefined () @apollo/client/react/context: undefined () @apollo/client/react/hoc: undefined () @apollo/client/react/hooks: undefined () @apollo/client/react/parser: undefined () @apollo/client/react/ssr: undefined () @apollo/client/testing: undefined () @apollo/client/testing/core: undefined () @apollo/client/utilities: undefined () @apollo/client/utilities/globals: undefined () @aws-amplify/react-native: ^1.0.5 => 1.0.5 @aws-amplify/rtn-push-notification: ^1.2.5 => 1.2.5 @aws-amplify/ui-react-native: ^2.0.3 => 2.0.3 @babel/core: ^7.20.0 => 7.23.5 @babel/preset-env: ^7.20.0 => 7.23.5 @babel/runtime: ^7.20.0 => 7.23.5 @expo/metro-config: ^0.10.7 => 0.10.7 @expo/ngrok: ^4.1.0 => 4.1.3 @jest/globals: ^29.7.0 => 29.7.0 @managedhealth/bac-rn-module: ^1.0.1 => 1.0.1 @react-native-async-storage/async-storage: ^1.21.0 => 1.21.0 @react-native-community/netinfo: ^11.1.1 => 11.1.1 @react-native-community/slider: 4.4.2 => 4.4.2 @react-native/eslint-config: ^0.72.2 => 0.72.2 @react-native/metro-config: ^0.72.11 => 0.72.11 @react-navigation/native: ^6.1.7 => 6.1.9 @react-navigation/native-stack: ^6.9.13 => 6.9.17 @testing-library/react: ^14.0.0 => 14.1.2 @testing-library/react-hooks: ^8.0.1 => 8.0.1 @tsconfig/react-native: ^3.0.0 => 3.0.2 @types/apollo-upload-client: ^17.0.4 => 17.0.5 @types/jest: ^29.5.5 => 29.5.10 @types/react: ^18.0.24 => 18.2.39 @types/react-native-calendar-picker: ^7.0.4 => 7.0.6 @types/react-native-vector-icons: ^6.4.15 => 6.4.18 @types/react-test-renderer: ^18.0.0 => 18.0.7 HelloWorld: 0.0.1 apollo-upload-client: 17.0.0 => 17.0.0 aws-amplify: ^6.0.5 => 6.0.5 aws-amplify/adapter-core: undefined () aws-amplify/analytics: undefined () aws-amplify/analytics/kinesis: undefined () aws-amplify/analytics/kinesis-firehose: undefined () aws-amplify/analytics/personalize: undefined () aws-amplify/analytics/pinpoint: undefined () aws-amplify/api: undefined () aws-amplify/api/server: undefined () aws-amplify/auth: undefined () aws-amplify/auth/cognito: undefined () aws-amplify/auth/cognito/server: undefined () aws-amplify/auth/server: undefined () aws-amplify/datastore: undefined () aws-amplify/in-app-messaging: undefined () aws-amplify/in-app-messaging/pinpoint: undefined () aws-amplify/push-notifications: undefined () aws-amplify/push-notifications/pinpoint: undefined () aws-amplify/storage: undefined () aws-amplify/storage/s3: undefined () aws-amplify/storage/s3/server: undefined () aws-amplify/storage/server: undefined () aws-amplify/utils: undefined () babel-jest: ^29.2.1 => 29.7.0 clsx: ^2.0.0 => 2.0.0 eslint: ^8.19.0 => 8.54.0 expo: ^49.0.21 => 49.0.21 expo-dev-client: ~2.4.10 => 2.4.12 expo-file-system: ~15.4.4 => 15.4.5 expo-modules-core: ^1.5.11 => 1.5.12 graphql: ^16.8.1 => 16.8.1 (15.8.0) jest: ^29.2.1 => 29.7.0 metro-react-native-babel-preset: 0.76.8 => 0.76.8 (0.76.7) mobx: ^6.10.2 => 6.12.0 mobx-react-lite: ^4.0.4 => 4.0.5 moment: ^2.29.4 => 2.29.4 nativewind: ^2.0.11 => 2.0.11 prettier: ^2.4.1 => 2.8.8 react: 18.2.0 => 18.2.0 react-hook-form: ^7.47.0 => 7.48.2 react-native: 0.72.4 => 0.72.4 react-native-apollo-devtools-client: ^1.0.4 => 1.0.4 react-native-calendar-picker: ^7.1.4 => 7.1.4 react-native-dotenv: ^3.4.9 => 3.4.9 react-native-encrypted-storage: ^4.0.3 => 4.0.3 react-native-geolocation-service: ^5.3.1 => 5.3.1 react-native-get-random-values: ^1.10.0 => 1.10.0 react-native-keychain: ^8.1.2 => 8.1.2 react-native-maps: 1.8.0 => 1.8.0 react-native-safe-area-context: ^4.7.4 => 4.7.4 react-native-screens: ^3.25.0 => 3.27.0 react-native-url-polyfill: ^2.0.0 => 2.0.0 react-native-uuid: ^2.0.1 => 2.0.1 react-native-vector-icons: ^10.0.0 => 10.0.2 react-native-vision-camera: ^3.1.0 => 3.6.12 react-test-renderer: 18.2.0 => 18.2.0 tailwindcss: 3.3.2 => 3.3.2 typescript: 4.8.4 => 4.8.4 util: ^0.12.5 => 0.12.5 npmGlobalPackages: @aws-amplify/cli: 12.8.2 @expo/ngrok: 4.1.1 @graphql-cli/serve: 4.1.0 @nestjs/cli: 10.2.0 appium-doctor: 1.16.2 appium: 2.1.3 eas-cli: 5.2.0 graphql-cli: 4.1.0 graphql: 16.8.0 npm: 10.1.0 nx: 17.0.1 react-devtools: 4.28.0 react-native-log-ios: 1.5.0 saucectl: 0.156.0 ```

Describe the bug

Following these instructions: https://docs.amplify.aws/react-native/build-a-backend/auth/set-up-auth/, and these instructions, https://ui.docs.amplify.aws/react-native/connected-components/authenticator/configuration. I am unable to get Auth working correctly. Each time I attempt to sign in, I get Auth UserPool not configured.

Expected behavior

I am able to log in using password and username.

Reproduction steps

Standard instructions for v6 AWS-Amplify for React Native.

IMG_0007

Code Snippet

// Put your code below this line - INDEX.JS
/**
 * @format
 */

// React
import 'react-native-url-polyfill/auto';
import 'react-native-get-random-values';
import {AppRegistry} from 'react-native';

// Components
import App from './App';
import {name as appName} from './app.json';

// AWS
import {Amplify, Auth} from 'aws-amplify';
import {
  initializePushNotifications,
  onNotificationReceivedInBackground,
} from 'aws-amplify/push-notifications';

import amplifyconfig from './src/amplifyconfiguration.json';

Amplify.configure({
  Auth: {
    Cognito: {
      //  Amazon Cognito User Pool ID
      userPoolId: 'us-west-XXXXXXX',
      // OPTIONAL - Amazon Cognito Web Client ID (26-char alphanumeric string)
      userPoolClientId: 'XXXXXXXXXXX',
      // REQUIRED only for Federated Authentication - Amazon Cognito Identity Pool ID
      identityPoolId: 'us-west-2:bc760eb6-XXXX-XXXX-XXXXXXXXX',
    },
  },
});

// You can get the current config object
const currentConfig = Amplify.getConfig();

initializePushNotifications();

// Placeholder - Unnecessary for Now
const myAsyncNotificationReceivedHandler = async notification => {
  // Process Background Notification
};

onNotificationReceivedInBackground(myAsyncNotificationReceivedHandler);

AppRegistry.registerComponent(appName, () => App);
import React from 'react';
import MapView, {Marker} from 'react-native-maps';
import {StyleSheet, View} from 'react-native';

// AWS
import {Authenticator} from '@aws-amplify/ui-react-native';

function App() {
  return (
    <Authenticator.Provider>
      <Authenticator>
        <View style={styles.container}></View>
      </Authenticator>
    </Authenticator.Provider>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  map: {
    width: '100%',
    height: '100%',
  },
});

export default App;

Log output

``` // Put your logs below this line ```

aws-exports.js

/* eslint-disable */
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.

const awsmobile = {
  aws_project_region: 'us-west-2',
  aws_cognito_identity_pool_id:
    'us-west-2:bc760eb6-99fe-XXXXX-XXXX-XXXXXXXXXX,
  aws_cognito_region: 'us-west-2',
  aws_user_pools_id: 'us-west-XXXXXXX',
  aws_user_pools_web_client_id: 'XXXXXXXXXXXXX',
  oauth: {},
  aws_cognito_username_attributes: ['EMAIL'],
  aws_cognito_social_providers: [],
  aws_cognito_signup_attributes: ['EMAIL'],
  aws_cognito_mfa_configuration: 'OFF',
  aws_cognito_mfa_types: ['SMS'],
  aws_cognito_password_protection_settings: {
    passwordPolicyMinLength: 8,
    passwordPolicyCharacters: [],
  },
  aws_cognito_verification_mechanisms: ['EMAIL'],
};

export default awsmobile;

Manual configuration

Amplify.configure({
  Auth: {
    Cognito: {
      //  Amazon Cognito User Pool ID
      userPoolId: 'us-west-XXXXXXXX,
      // OPTIONAL - Amazon Cognito Web Client ID (26-char alphanumeric string)
      userPoolClientId: 'XXXXXXXXXXXXXXXX',
      // REQUIRED only for Federated Authentication - Amazon Cognito Identity Pool ID
      identityPoolId: 'us-west-2:bc760eb6-99fe-XXXX-XXXXXXXXXXXX',
    },
  },
});

Additional configuration

{
    "UserPool": {
        "Id": "us-west-2_XXXXXXXX",
        "Name": "acms67010f95_userpool_XXXXXXXXX",
        "Policies": {
            "PasswordPolicy": {
                "MinimumLength": 8,
                "RequireUppercase": false,
                "RequireLowercase": false,
                "RequireNumbers": false,
                "RequireSymbols": false,
                "TemporaryPasswordValidityDays": 7
            }
        },
        "DeletionProtection": "ACTIVE",
        "LambdaConfig": {},
        "LastModifiedDate": "2023-11-30T10:06:04.421000-08:00",
        "CreationDate": "2023-11-30T09:43:56.646000-08:00",
        "SchemaAttributes": [
            {
                "Name": "sub",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": false,
                "Required": true,
                "StringAttributeConstraints": {
                    "MinLength": "1",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "name",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "given_name",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "family_name",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "middle_name",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "nickname",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "preferred_username",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "profile",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "picture",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "website",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "email",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": true,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "email_verified",
                "AttributeDataType": "Boolean",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false
            },
            {
                "Name": "gender",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "birthdate",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "10",
                    "MaxLength": "10"
                }
            },
            {
                "Name": "zoneinfo",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "locale",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "phone_number",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "phone_number_verified",
                "AttributeDataType": "Boolean",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false
            },
            {
                "Name": "address",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "updated_at",
                "AttributeDataType": "Number",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "NumberAttributeConstraints": {
                    "MinValue": "0"
                }
            }
        ],
        "AutoVerifiedAttributes": [
            "email"
        ],
        "UsernameAttributes": [
            "email"
        ],
        "EmailVerificationMessage": "Your verification code is {####}",
        "EmailVerificationSubject": "Your verification code",
        "VerificationMessageTemplate": {
            "EmailMessage": "Your verification code is {####}",
            "EmailSubject": "Your verification code",
            "DefaultEmailOption": "CONFIRM_WITH_CODE"
        },
        "UserAttributeUpdateSettings": {
            "AttributesRequireVerificationBeforeUpdate": [
                "email"
            ]
        },
        "MfaConfiguration": "OFF",
        "EstimatedNumberOfUsers": 2,
        "EmailConfiguration": {
            "EmailSendingAccount": "COGNITO_DEFAULT"
        },
        "UserPoolTags": {},
        "AdminCreateUserConfig": {
            "AllowAdminCreateUserOnly": false,
            "UnusedAccountValidityDays": 7
        },
        "UsernameConfiguration": {
            "CaseSensitive": false
        },
        "Arn": "arn:aws:cognito-idp:us-west-2:XXXXXXXXXXXX:userpool/us-west-XXXXXXXX",
        "AccountRecoverySetting": {
            "RecoveryMechanisms": [
                {
                    "Priority": 1,
                    "Name": "verified_email"
                },
                {
                    "Priority": 2,
                    "Name": "verified_phone_number"
                }
            ]
        }
    }
}

Mobile Device

Android S< A14

Mobile Operating System

Android

Mobile Browser

N/A

Mobile Browser Version

No response

Additional information and screenshots

{
  "name": "acms",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web",
    "test": "jest --verbose",
    "eas-build-pre-install": "echo $AWS_EXPORTS | base64 --decode > ./src/aws-exports.js",
    "build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'",
    "build:android": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res",
    "postinstall": "yarn run build:ios && yarn run build:android"
  },
  "dependencies": {
    "@apollo/client": "^3.8.6",
    "@aws-amplify/react-native": "^1.0.5",
    "@aws-amplify/rtn-push-notification": "^1.2.5",
    "@aws-amplify/ui-react-native": "^2.0.3",
    "@expo/metro-config": "^0.10.7",
    "@expo/ngrok": "^4.1.0",
    "@jest/globals": "^29.7.0",
    "@managedhealth/bac-rn-module": "^1.0.1",
    "@react-native-async-storage/async-storage": "^1.21.0",
    "@react-native-community/netinfo": "^11.1.1",
    "@react-native-community/slider": "4.4.2",
    "@react-navigation/native": "^6.1.7",
    "@react-navigation/native-stack": "^6.9.13",
    "@testing-library/react": "^14.0.0",
    "@testing-library/react-hooks": "^8.0.1",
    "@types/jest": "^29.5.5",
    "@types/react-native-calendar-picker": "^7.0.4",
    "@types/react-native-vector-icons": "^6.4.15",
    "apollo-upload-client": "17.0.0",
    "aws-amplify": "^6.0.5",
    "clsx": "^2.0.0",
    "expo": "^49.0.21",
    "expo-dev-client": "~2.4.10",
    "expo-file-system": "~15.4.4",
    "expo-modules-core": "^1.5.11",
    "graphql": "^16.8.1",
    "mobx": "^6.10.2",
    "mobx-react-lite": "^4.0.4",
    "moment": "^2.29.4",
    "nativewind": "^2.0.11",
    "react": "18.2.0",
    "react-hook-form": "^7.47.0",
    "react-native": "0.72.4",
    "react-native-calendar-picker": "^7.1.4",
    "react-native-dotenv": "^3.4.9",
    "react-native-encrypted-storage": "^4.0.3",
    "react-native-geolocation-service": "^5.3.1",
    "react-native-get-random-values": "^1.10.0",
    "react-native-keychain": "^8.1.2",
    "react-native-maps": "1.8.0",
    "react-native-safe-area-context": "^4.7.4",
    "react-native-screens": "^3.25.0",
    "react-native-url-polyfill": "^2.0.0",
    "react-native-uuid": "^2.0.1",
    "react-native-vector-icons": "^10.0.0",
    "react-native-vision-camera": "^3.1.0",
    "tailwindcss": "3.3.2",
    "util": "^0.12.5"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native/eslint-config": "^0.72.2",
    "@react-native/metro-config": "^0.72.11",
    "@tsconfig/react-native": "^3.0.0",
    "@types/apollo-upload-client": "^17.0.4",
    "@types/react": "^18.0.24",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.2.1",
    "eslint": "^8.19.0",
    "jest": "^29.2.1",
    "metro-react-native-babel-preset": "0.76.8",
    "prettier": "^2.4.1",
    "react-native-apollo-devtools-client": "^1.0.4",
    "react-test-renderer": "18.2.0",
    "typescript": "4.8.4"
  },
  "engines": {
    "node": ">=16"
  },
  "private": true
}
nadetastic commented 11 months ago

Hi @SwhiteMHC thank you for opening this issue. Out of curiousity are you seeing an issue if you use the aws-amplify/auth apis directly?

import { signIn } from 'aws-amplify/auth';  // <== use this directly
import React from 'react';
import {View,Button} from 'react-native';

function App() {
  const handleSignIn = async () => {
    try {
      const result = await signIn({
        username,
        password
      })
    } catch (error) {
      console.log(error)
    }
  }
  return (
        <View style={styles.container}>
            <Button onPress={handleSignIn} title="SignIn" />
        </View>
  );
}
HuiSF commented 11 months ago

The exception "Auth UserPool not configured." is thrown when Amplify.getConfig().Auth?.Cognito doesn't return a valid configuration.

Looking at your code, you were import amplify config object from amplifyconfiguration.json file, but you were not using this object but did manual configuration, any specific reason for doing so?

You have the following code in the index.js

// You can get the current config object
const currentConfig = Amplify.getConfig();

Can you use console.log to print the currentConfig variable to inspect the object?

Also can you try the follow without the manual configuration see if there is a difference?

import amplifyconfig from './src/amplifyconfiguration.json';

Amplify.configure(amplifyconfig);
SwhiteMHC commented 11 months ago

@HuiSF My apologies, I had imported and used the configuration file initially, encountered the error, and attempted to pass a custom configuration. I get the same error when switching back. When I log the config, it is an empty object {}.

I moved the code outside of index.js and into app.js, and it is now working as expected.

index.js

// Put your code below this line - INDEX.JS
/**
 * @format
 */

// React
import 'react-native-url-polyfill/auto';
import 'react-native-get-random-values';
import {AppRegistry} from 'react-native';

// Components
import App from './App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);
import React from 'react';
import MapView, {Marker} from 'react-native-maps';
import {StyleSheet, View} from 'react-native';

// AWS
import {Authenticator} from '@aws-amplify/ui-react-native';
import * as amplifyconfig from './src/amplifyconfiguration.json';
import {Amplify} from 'aws-amplify';
Amplify.configure(amplifyconfig);

function App() {
  return (
    <Authenticator.Provider>
      <Authenticator>
        <View style={styles.container}>
          <MapView
            style={styles.map}
            region={{
              latitude: 37.78825,
              longitude: -122.4324,
              latitudeDelta: 0.0922,
              longitudeDelta: 0.0421,
            }}>
            <Marker
              key="1"
              title="1"
              description="1"
              coordinate={{
                latitude: 37.78825,
                longitude: -122.4324,
                latitudeDelta: 0.0922,
                longitudeDelta: 0.0421,
              }}
            />
          </MapView>
        </View>
      </Authenticator>
    </Authenticator.Provider>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  map: {
    width: '100%',
    height: '100%',
  },
});

export default App;

Unfortunately now my MapView is not working... Another package another problem. I think you can close this.

HuiSF commented 11 months ago

Thanks for following up @SwhiteMHC. Closing as it was a non-issue.