Skip to content

Commit

Permalink
add ExtendedView component for surfacing ReactNode conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
calebpollman committed Jan 14, 2025
1 parent 60884f4 commit 30ced5a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions build-system-tests/templates/components/react/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { Amplify } from 'aws-amplify';
import { AccountSettings, Authenticator } from '@aws-amplify/ui-react';
import { AccountSettings, Authenticator, View } from '@aws-amplify/ui-react';
import { FaceLivenessDetector } from '@aws-amplify/ui-react-liveness';
import { StorageManager, FileUploader } from '@aws-amplify/ui-react-storage';
import { MapView, LocationSearch } from '@aws-amplify/ui-react-geo';
Expand All @@ -8,11 +9,17 @@ import '@aws-amplify/ui-react-geo/styles.css';
import awsconfig from '../../../environments/auth-with-email/src/aws-exports.js';
Amplify.configure(awsconfig);

// results in a type error if conflicting versions of `@types/react` are installed through
// `@aws-amplify/ui-react` and the consuming project
const ExtendedView = (props: { children?: React.ReactNode }) => (
<View {...props} />
);

export default function Home() {
return (
<Authenticator>
{({ signOut, user = { username: '' } }) => (
<main>
<ExtendedView>
<h1>Hello {user.username}</h1>
<button onClick={signOut}>Sign out</button>
<FaceLivenessDetector
Expand Down Expand Up @@ -55,7 +62,7 @@ export default function Home() {
>
<LocationSearch />
</MapView>
</main>
</ExtendedView>
)}
</Authenticator>
);
Expand Down

0 comments on commit 30ced5a

Please sign in to comment.