-
Notifications
You must be signed in to change notification settings - Fork 3.2k
docs(react): show complete code context in the "Your First App" tutorial #4201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@joesphchang is attempting to deploy a commit to the Ionic Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
thetaPC
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that some method names from the Angular version and Vue version do not match even though they have the same code. For example, addNewToGallery from Angular and usePhotoGallery from Vue. Let's also sync those to match Angular as close as possible.
The same goes for the <title>. Let's match it to Angular.
Lastly, some of the content also doesn't match each other. A good example, Angular Build Your First App mentions:
`ion-header` represents the top navigation and toolbar, with "Tab 2" as the title (there are two of them due to iOS [Collapsible Large Title](https://ionicframework.com/docs/api/title#collapsible-large-titles) support). Rename both ion-title elements to:
While React states:
`IonHeader` represents the top navigation and toolbar, with "Tab 2" as the title. Let’s rename it:
brandyscarney
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All changes made to v8 should also be made to v7 please. 🙂
|
|
||
| And voilà! Your Ionic app is now running in a web browser. Most of your app can be built and tested right in the browser, greatly increasing development and testing speed. | ||
|
|
||
| ## Photo Gallery!!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove the !!! here too?
| `IonHeader` represents the top navigation and toolbar, with "Tab 2" as the title (there are two of them due to iOS [Collapsible Large Title](../api/title.md#collapsible-large-titles) support). Let’s rename both `IonTitle` elements to: | ||
|
|
||
| ```tsx | ||
| <IonTitle>Photo Gallery</IonTitle> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have the same concern here as in the Vue guide with replacing the size="large" attribute when it should remain.
| We put the visual aspects of our app into `<IonContent>`. In this case, it’s where we’ll add a button that opens the device’s camera as well as displays the image captured by the camera. Start by adding a [floating action button](../api/fab.md) (FAB) to the bottom of the page and set the camera image as the icon. | ||
|
|
||
| ```tsx | ||
| // CHANGE: Add the following import. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // CHANGE: Add the following import. | |
| // CHANGE: Add the following import |
Remove periods from comments
| // CHANGE: Add the following import. | ||
| import { camera, trash, close } from 'ionicons/icons'; | ||
| // CHANGE: Update the following import. | ||
| import { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| We’ll be creating the `takePhoto` method and the logic to use the Camera and other native features in a moment. | ||
|
|
||
| Next, open `src/App.tsx`, remove the `ellipse` icon from the import and import the `images` icon instead: | ||
| Next, open `src/views/TabsPage.vue`. Change the label to "Photos" and the `ellipse` icon to `images` for the middle tab button. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Next, open `src/views/TabsPage.vue`. Change the label to "Photos" and the `ellipse` icon to `images` for the middle tab button. | |
| Next, open `src/App.tsx`. Change the label to "Photos" and the `ellipse` icon to `images` for the middle tab button. |
Incorrect Vue reference
| <IonTabButton tab="tab2" href="/tab2"> | ||
| {/* CHANGE: Update icon. */} | ||
| <IonIcon aria-hidden="true" icon={images} /> | ||
| {/* CHANGE: Update label. */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| {/* CHANGE: Update label. */} | |
| {/* CHANGE: Update label */} |
| Since we added Capacitor to our project when it was first created, there’s only a handful of steps remaining until the Photo Gallery app is on our device! | ||
|
|
||
| :::note | ||
| Remember, you can find the complete source code for this app [here](https://github.com/ionic-team/photo-gallery-capacitor-react). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove this since it was removed in Angular?
| </IonContent> | ||
| </IonPage> | ||
| ); | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| }; | |
| }; | |
| export default Tab2; |
Add this for easy copy/paste
| return ( | ||
| <IonPage> | ||
| <IonContent> | ||
| {/* Same old code from before. */} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| {/* Same old code from before. */} | |
| <IonHeader collapse="condense"> | |
| <IonToolbar> | |
| <IonTitle size="large">Photo Gallery</IonTitle> | |
| </IonToolbar> | |
| </IonHeader> | |
| <IonGrid> | |
| <IonRow> | |
| {photos.map((photo) => ( | |
| <IonCol size="6" key={photo.filepath}> | |
| <IonImg src={photo.webviewPath} /> | |
| </IonCol> | |
| ))} | |
| </IonRow> | |
| </IonGrid> |
It's confusing to not include the code here but keep the IonFab below. I think we should show all of it.
| Save this file, then tap on a photo again and choose the “Delete” option. This time, the photo is deleted! Implemented much faster using Live Reload. 💪 | ||
| Remember that removing the photo from the `photos` array triggers the `cachePhotos` method for us automatically. | ||
|
|
||
| Tap on a photo again and choose the “Delete” option. The photo is deleted! Implemented much faster using Live Reload. 💪 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.


Resolves: #4164
Changes:
Preview