Skip to content

Instantly share code, notes, and snippets.

View enappd's full-sized avatar

Enappd enappd

View GitHub Profile
@enappd
enappd / Home.tsx
Last active September 20, 2022 15:53
Ionic React Capacitor Push Example - Push functions
import React, { useEffect, useState } from 'react';
import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar, IonButton, IonFooter, IonList, IonCard, IonCardContent, IonItem, IonLabel, IonListHeader, IonText, IonButtons, IonMenuButton } from '@ionic/react';
import { PushNotificationSchema, PushNotifications, Token, ActionPerformed } from '@capacitor/push-notifications';
import './Home.css';
import { Toast } from "@capacitor/toast";
export default function PushNotificationsContainer() {
const nullEntry: any[] = []
const [notifications, setnotifications] = useState(nullEntry);
import React from 'react';
import { Redirect, Route } from 'react-router-dom';
import { IonApp, IonPage, IonRouterOutlet } from '@ionic/react';
import { IonReactRouter } from '@ionic/react-router';
import Home from './pages/Home';
import Login from './pages/Login';
/* Core CSS required for Ionic components to work properly */
import '@ionic/react/css/core.css';
/* Basic CSS for apps built with Ionic */
@enappd
enappd / Home.page.html
Last active June 27, 2022 19:16
TomTom Maps in Ionic Capacitor App
<ion-header [translucent]="true">
<ion-toolbar color="primary">
<ion-title>
TomTom Maps
</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<div #map id="map"></div>
@enappd
enappd / (full) HomeContainer.tsx
Last active March 29, 2022 17:35
Complete Guide - Ionic 5 Geolocation - React Capacitor - Home Container
import React, { Component } from 'react';
import HomeView from './HomeView';
import { Capacitor, Plugins, CallbackID } from "@capacitor/core";
import LocationService from './Location';
const { Geolocation, Toast } = Plugins;
class HomeContainer extends Component {
state: any;
@enappd
enappd / tab2.page.ts
Last active September 7, 2021 08:16
Ionic Capacitor Geolocation - Geocoding and Map display
import { Component, NgZone } from '@angular/core';
import { Plugins } from '@capacitor/core';
const { Geolocation, Toast } = Plugins;
import { NativeGeocoder, NativeGeocoderResult, NativeGeocoderOptions } from '@ionic-native/native-geocoder/ngx';
@Component({
selector: 'app-tab2',
templateUrl: 'tab2.page.html',
styleUrls: ['tab2.page.scss']
})
export class Tab2Page {
@enappd
enappd / Home.tsx
Last active August 14, 2021 19:39
Ionic React Capacitor Push Example - Layout
import React, { useEffect, useState } from 'react';
import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar, IonButton, IonFooter, IonList, IonCard, IonCardContent, IonItem, IonLabel, IonListHeader, IonText, IonButtons, IonMenuButton } from '@ionic/react';
export default function PushNotificationsContainer() {
const nullEntry: any[] = []
const [notifications, setnotifications] = useState(nullEntry);
return (
<IonPage id='main'>
<IonHeader>
@enappd
enappd / cap-http.page.ts
Created July 31, 2021 16:45
Ionic http calls demo - Capacitor Http
import { Component, OnInit } from '@angular/core';
import { Platform } from '@ionic/angular';
import { Http, HttpResponse } from '@capacitor-community/http';
@Component({
selector: 'app-cap-http',
templateUrl: './cap-http.page.html',
styleUrls: ['./cap-http.page.scss'],
})
export class CapHttpPage{
plt: string;
@enappd
enappd / ionic-native-adv.page.ts
Created July 31, 2021 16:35
Ionic http calls demo - Ionic Native Advanced
import { Component, OnInit } from '@angular/core';
import { Platform } from '@ionic/angular';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-ionic-native-adv',
templateUrl: './ionic-native-adv.page.html',
styleUrls: ['./ionic-native-adv.page.scss'],
})
export class IonicNativeAdvPage{
@enappd
enappd / app.module.ts
Created July 31, 2021 16:32
Ionic http calls demo - Ionic Native Advanced
import { NgModule } from '@angular/core';
import { HttpBackend, HttpXhrBackend } from '@angular/common/http';
import { NativeHttpModule, NativeHttpBackend, NativeHttpFallback } from 'ionic-native-http-connection-backend';
import { Platform } from '@ionic/angular';
@NgModule({
declarations: [],
imports: [
NativeHttpModule
],
@enappd
enappd / fetch.page.ts
Last active July 31, 2021 16:28
Ionic http calls demo - Fetch API
import { Component, OnInit } from '@angular/core';
import { Platform } from '@ionic/angular';
@Component({
selector: 'app-fetch',
templateUrl: './fetch.page.html',
styleUrls: ['./fetch.page.scss'],
})
export class FetchPage {
localhost:string = 'localhost';
plt: string;