Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 8 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@
]
},
"dependencies": {
"@capacitor/action-sheet": "^8.0.0",
"@capacitor/android": "^8.0.0",
"@capacitor/action-sheet": "^8.1.1",
"@capacitor/android": "^8.2.0",
"@capacitor/app": "^8.0.0",
"@capacitor/app-launcher": "^8.0.0",
"@capacitor/browser": "^8.0.0",
"@capacitor/camera": "^8.0.0",
"@capacitor/clipboard": "^8.0.0",
"@capacitor/core": "^8.0.0",
"@capacitor/core": "^8.2.0",
"@capacitor/device": "^8.0.0",
"@capacitor/dialog": "^8.0.0",
"@capacitor/filesystem": "^8.0.0",
"@capacitor/geolocation": "^8.0.0",
"@capacitor/haptics": "^8.0.0",
"@capacitor/ios": "^8.0.0",
"@capacitor/ios": "^8.2.0",
"@capacitor/keyboard": "^8.0.0",
"@capacitor/local-notifications": "^8.0.0",
"@capacitor/motion": "^8.0.0",
Expand All @@ -52,7 +52,7 @@
"@capacitor/status-bar": "^8.0.0",
"@capacitor/text-zoom": "^8.0.0",
"@capacitor/toast": "^8.0.0",
"@ionic/pwa-elements": "^3.1.1",
"@ionic/pwa-elements": "^3.4.0",
"@ionic/react": "^7.0.0",
"@ionic/react-router": "^7.0.0",
"@types/jest": "^26.0.20",
Expand All @@ -68,7 +68,7 @@
"react-router-dom": "^5.3.4"
},
"devDependencies": {
"@capacitor/cli": "^8.0.0",
"@capacitor/cli": "^8.2.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
Expand Down
57 changes: 47 additions & 10 deletions src/pages/ActionSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,54 @@ import {
IonMenuButton,
IonTitle,
IonToolbar,
IonToggle,
IonItem,
IonLabel,
} from '@ionic/react';
import React from 'react';
import React, { useState } from 'react';
import { ActionSheet, ActionSheetButtonStyle } from '@capacitor/action-sheet';

const ActionSheetPage: React.FC = () => {
const [cancelable, setCancelable] = useState(true);

const showActions = async () => {
let promptRet = await ActionSheet.showActions({
const result = await ActionSheet.showActions({
title: 'Photo Options',
message: 'Select an option to perform',
options: [
{
title: 'Upload',
},
{
title: 'Share',
},
{ title: 'Upload' },
{ title: 'Share' },
{
title: 'Remove',
style: ActionSheetButtonStyle.Destructive,
},
],
cancelable: cancelable,
});
console.log('You selected', promptRet);

console.log('Normal sheet:', result);
alert('Normal sheet: ' + JSON.stringify(result));
};

const showActionsWithCancel = async () => {
const result = await ActionSheet.showActions({
title: 'Photo Options',
message: 'Select an option to perform',
options: [
{ title: 'Upload' },
{ title: 'Share' },
{
title: 'Cancel',
style: ActionSheetButtonStyle.Cancel,
},
],
cancelable: cancelable,
});

console.log('Cancel sheet:', result);
alert('Cancel sheet: ' + JSON.stringify(result));
};

return (
<IonPage>
<IonHeader>
Expand All @@ -41,9 +65,22 @@ const ActionSheetPage: React.FC = () => {
<IonTitle>Action Sheet</IonTitle>
</IonToolbar>
</IonHeader>

<IonContent>
<IonItem>
<IonLabel>Cancelable</IonLabel>
<IonToggle
checked={cancelable}
onIonChange={e => setCancelable(e.detail.checked)}
/>
</IonItem>

<IonButton expand="block" onClick={showActions}>
Show Actions
Show Actions (Destructive)
</IonButton>

<IonButton expand="block" onClick={showActionsWithCancel}>
Show Actions (With Cancel)
</IonButton>
</IonContent>
</IonPage>
Expand Down
3 changes: 2 additions & 1 deletion src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ const Home: React.FC = () => {
style={{
fontSize: '30px',
fontFamily: 'monospace',
}}>
}}
>
App Resolution: {dimensions.width} × {dimensions.height}
</div>
<h1>Counter</h1>
Expand Down
Loading