Quantcast
Channel: Ionic Forum - Latest topics
Viewing all 71531 articles
Browse latest View live

Modal controller dismiss issues when presenting a component that presents another (nested) component

$
0
0

I’m having issue where I present a component, A, which then presents a component B. Both components have the ModalController service injected. Component B gets dismissed via this.modalController.dismiss(). This works: component B disappears on that call to dismiss(). Then, component A gets dismissed via this.modalController.dismiss() BUT this second call to dismiss() does not work - i.e. component A remains not dismissed.

I can dismiss component A if I call dismiss() on it before presenting component B, then the dismiss of component B works and they are both dismissed in that case, but this is not what I want. I want A to present B, B to dismiss, then A to dismiss - this seems not possible right now, is that right?

Has anyone else seen such an issue? Does anyone have a solution? Any help would be much appreciated!

4 posts - 2 participants

Read full topic


Opening local PDFs in Browser

$
0
0

I have a PWA that I have built using ionic 5 and am having an issue loading PDFs with the Capacitor Browser. I am using the following code to load remote PDF documents in the browser:

browserOpen(location) {
    Plugins.Browser.open({
      url: location,
      toolbarColor: "#5A5DF5",
      windowName: "_system"
    });
  }

This is working great. However, when I use the same code to load a PDF that is hosted under the same site that serves the PWA, the pdf opens full screen and has no controls for me to close the window or navigate back to the app. I end up having to close and reopen the app to resume. Does anyone have any insight as to what might be happening or how to force these “local” PDFs to open in the browser?

1 post - 1 participant

Read full topic

How to call variables for dark mode

$
0
0

Hello i want to make dark mode for my Ionic 3 Angular 5 project. I made the functions that change themes as i wanted.

My problem is that scss variables in my ionic.theme.dark scss file inside the theme folder don’t apply e.g. $background-color simple css rules apply just ok. e.g. p{font-size:40px}.

I think there is a workaround because when i just call the ionic.theme.dark in the variables.scss file without putting it in a class it works fine but when i need to call the dark mode inside the class e.g. .dark-theme{@import “./ionic.theme.dark”;} it calls only the css rules not the variables

For example

.dark-theme{
    p{
      font-size:76px
     }

     $text-color:                 #fff !default;
     $link-color:                 color($colors, primary) !default;
     $background-color:           rgba(0,0,0,0.6) !important;
     $subdued-text-color:         #666 !default;
  }

p font-size works but $background-color doesn't, same thing happens when i loose the !default in all variables Any idea why?

1 post - 1 participant

Read full topic

Null Injector Error No provider for [Object Object]

$
0
0

Hello I’m developing an Angular PWA application with Ionic for a project in school and I’m running out of time… I keep getting stuck in the same issue, and this is the 6th clean restart of my project. It’s a simple app to retrieve data from https://api.covid19api.com/ and display it.

I’ve got it all well settled and all, but I really do not understand what’s wrong with it. I’ve deleted the node_modules folder and re-ran npm install as I’ve seen some people suggested to similar issues.

I’ll leave the code here to my github. Please I really need help…


Thank you so much in advance…

Also I’ll provide the error messages I’ve got through the browser:

1 post - 1 participant

Read full topic

Developing plugins, can't impor to MainActivity.java

$
0
0

I’m having trouble with developing a plugin. I followed this page on the docs, but I must’ve missed something since it’s not working at all.

I’m not very familiar with Java or android development, please let me know if I’ve got something wrong.

I create the plugin just as explained in the guide with the same parameters:

npx @capacitor/cli plugin:generate
✏️  Creating new Capacitor plugin
? Plugin NPM name (kebab-case): my-plugin
? Plugin id (domain-style syntax. ex: com.example.plugin) com.ionicframework.myplugin
? Plugin class name (ex: AwesomePlugin) MyPlugin
? description:
? git repository:
? author:
? license: MIT
? package.json will be created, do you want to continue? (Y/n)

Then I run npm run build.

In my Capacitor app I run npm install "/home/leonardo/Desktop/Node Projects/my-plugin" to locally install my plugin and run npx cap sync:

npx cap sync
✔ Copying web assets from build to android/app/src/main/assets/public in 21.37ms
✔ Copying native bridge in 1.14ms
✔ Copying capacitor.config.json in 1.41ms
✔ copy in 43.39ms
✔ Updating Android plugins in 2.40ms
  Found 1 Capacitor plugin for android:
    my-plugin (0.0.1)
✔ update android in 25.32ms
✔ copy in 248.88μp
✔ update web in 5.94μp
Sync finished in 0.08s

In src/main/java/com/ionicframework/myplugin/MyPlugin.java the Plugin looks like this:

package com.ionicframework.myplugin;

import com.getcapacitor.JSObject;
import com.getcapacitor.NativePlugin;
import com.getcapacitor.Plugin;
import com.getcapacitor.PluginCall;
import com.getcapacitor.PluginMethod;

@NativePlugin()
public class MyPlugin extends Plugin {

    @PluginMethod()
    public void echo(PluginCall call) {
        String value = call.getString("value");

        JSObject ret = new JSObject();
        ret.put("value", value);
        call.success(ret);
    }
}

I then go to my app to make Capacitor aware of the plugin and edit src/main/java/com/ironeko/time/MainActivity.java:

package com.ironeko.time;

import android.os.Bundle;

import com.getcapacitor.BridgeActivity;
import com.getcapacitor.Plugin;

import java.util.ArrayList;

import com.ironeko.time.EchoPlugin;

public class MainActivity extends BridgeActivity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Initializes the Bridge
    this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
      // Additional plugins you've installed go here
      // Ex: add(TotallyAwesomePlugin.class);
      add(EchoPlugin.class);
    }});
  }
}

I also tried importing:

import com.ionicframework.myplugin.EchoPlugin;

Once I run my app in Android Studio however I get this error:

/home/leonardo/Desktop/Node Projects/time-management/android/app/src/main/java/com/ironeko/time/MainActivity.java:10: error: cannot find symbol
import com.ironeko.time.EchoPlugin;
                       ^
  symbol:   class EchoPlugin
  location: package com.ironeko.time

What’s happening? Shouldn’t this work?

1 post - 1 participant

Read full topic

Create Global Function and Variable?

React-scripts has unexpectedly closed (exit code 1)

$
0
0

when i run ionic serve, i get this :

react-scripts start
[react-scripts] :information_source: 「wds」: Project is running at http://192.168.43.160/
[react-scripts] :information_source: 「wds」: webpack output is served from
[react-scripts] :information_source: 「wds」: Content not from webpack is served from /home/epsilon/lab/mobile/myApp/public
[react-scripts] :information_source: 「wds」: 404s will fallback to /
[react-scripts] Starting the development server…
[react-scripts]
[react-scripts] events.js:292
[react-scripts] throw er; // Unhandled ‘error’ event
[react-scripts] ^
[react-scripts] Error: ENOSPC: System limit for number of file watchers reached, watch ‘/home/epsilon/lab/mobile/myApp/public/assets/icon’
[react-scripts] at FSWatcher.start (internal/fs/watchers.js:169:26)
[react-scripts] at Object.watch (fs.js:1415:11)
[react-scripts] at createFsWatchInstance (/home/epsilon/lab/mobile/myApp/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:38:15)
[react-scripts] at setFsWatchListener (/home/epsilon/lab/mobile/myApp/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:81:15)
[react-scripts] at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/epsilon/lab/mobile/myApp/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:233:14)
[react-scripts] at FSWatcher.NodeFsHandler._handleDir (/home/epsilon/lab/mobile/myApp/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:429:19)
[react-scripts] at FSWatcher. (/home/epsilon/lab/mobile/myApp/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:477:19)
[react-scripts] at FSWatcher. (/home/epsilon/lab/mobile/myApp/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:482:16)
[react-scripts] at FSReqCallback.oncomplete (fs.js:168:5)
[react-scripts] Emitted ‘error’ event on FSWatcher instance at:
[react-scripts] at FSWatcher._handleError (/home/epsilon/lab/mobile/myApp/node_modules/webpack-dev-server/node_modules/chokidar/index.js:260:10)
[react-scripts] at createFsWatchInstance (/home/epsilon/lab/mobile/myApp/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:40:5)
[react-scripts] at setFsWatchListener (/home/epsilon/lab/mobile/myApp/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:81:15)
[react-scripts] [… lines matching original stack trace …]
[react-scripts] at FSReqCallback.oncomplete (fs.js:168:5) {
[react-scripts] errno: -28,
[react-scripts] syscall: ‘watch’,
[react-scripts] code: ‘ENOSPC’,
[react-scripts] path: ‘/home/epsilon/lab/mobile/myApp/public/assets/icon’,
[react-scripts] filename: ‘/home/epsilon/lab/mobile/myApp/public/assets/icon’
[react-scripts] }

[ERROR] react-scripts has unexpectedly closed (exit code 1).

    The Ionic CLI will exit. Please check any output above for error details.

i’m beginner in ionic, some one can help me ?

1 post - 1 participant

Read full topic

Should ion-header go inside ion-content?

$
0
0

(topic withdrawn by author, will be automatically deleted in 24 hours unless flagged)

1 post - 1 participant

Read full topic


Ionic serve error (fresh start ionic-react app)

$
0
0

Running ionic serve after a fresh installed ionic react application

Steps to reproduce:

  1. ionic start
  2. select react
  3. ionic serve

Dependencies below

"dependencies": {
    "@capacitor/core": "2.2.0",
    "@ionic/react": "^5.0.7",
    "@ionic/react-router": "^5.0.7",
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.4.0",
    "@testing-library/user-event": "^8.0.3",
    "@types/jest": "^24.0.25",
    "@types/node": "^12.12.24",
    "@types/react": "^16.9.17",
    "@types/react-dom": "^16.9.4",
    "@types/react-router": "^5.1.4",
    "@types/react-router-dom": "^5.1.3",
    "axios": "^0.19.2",
    "ionicons": "^5.0.0",
    "react": "^16.13.0",
    "react-dom": "^16.13.0",
    "react-router": "^5.1.2",
    "react-router-dom": "^5.1.2",
    "react-scripts": "3.4.1",
    "typescript": "3.8.3"
  }

Workspace Used:

Windows 10, node version 6.12.1, ionic 6.9.1
Any steps how to solve this error?

1 post - 1 participant

Read full topic

How to add size-sm=“” sizing to ion-row in Ionic app?

$
0
0

I am trying to update the size of the below ion-row depending on the screen my Ionic app is being used on.

Here is my current code, I want to change the size of this ion-row depending on user’s screen size:

<ion-row class="rowStyle">
    <ion-icon name="mail" class="iconStyle"></ion-icon>
    <ion-input type="email"></ion-input>
</ion-row>

.rowStyle {
    background-color: white;
    padding-left: 10px;
    border-radius: 30px;
    margin-top: 10px;

    ion-icon {
        margin-top: 13px;
        margin-right: 10px;
    }
}

.iconStyle {
    color: var(--ion-color-primary);
}

I am able to change the size of an ion-col with the below code, but applying only this to the ion-row above doesn’t work:

<ion-grid>
    <ion-row>
        <ion-col size="12" size-sm="8" offset-sm="2"">Some text</ion-col>
    </ion-row>
</ion-grid>

To try get around this, I added ion-cols around the ion-icon & the ion-input, but that messes up my styling.

Can someone please tell me how I can apply this sizing to just the ion-row above?

1 post - 1 participant

Read full topic

Ionic 5 ion-tab

$
0
0

Why Ionic Docs is showing a topic about an unavailable ion-tab component.

When a new ionic 5 project is created from scratch using latest cli, and then we try to use ion-tab in a template, the IDE(WebStorm and VSCode) shows this warning “Unknown html tag” and the component it’s render as a simple div.

is this a documentation mistake or is this the expected behavior?

1 post - 1 participant

Read full topic

Can't build plugin, Capacitor.framework missing

$
0
0

Hey @mhartington, I’m following the docs and build in Xcode is failing because it can’t find Capacitor.framework. Here’s what I did:

✏️  Creating new Capacitor plugin
? Plugin NPM name (kebab-case): foobar
? Plugin id (domain-style syntax. ex: com.example.plugin) foo.bar.baz
? Plugin class name (ex: AwesomePlugin) Foo
? description: foo
? git repository: https://foobar.com
? author: foo
? license: MIT
? package.json will be created, do you want to continue? Yes


✔ Adding plugin files in 29.19ms
✔ Writing package.json in 710.05μp
✔ Installing NPM dependencies in 1.92s
✔ Building iOS project in 1.58s

By the way, the git repository prompt cannot be left empty. Seems like we should be able to.

Anway, I open the Xcode project and try to build. It fails because it can’t find Capacitor — or any other frameworks in the Frameworks group.

Please help!

@capacitor/cli 2.2.0
macOS 10.15.5
Xcode 11.5

1 post - 1 participant

Read full topic

Capacitor browser in tabs

$
0
0

Is it possible to embed capacitor browser in the app? I want three tabs containing three separate web pages.
The Capacitor Browser documentation seems to open only in a full screen window.

import { Plugins } from '@capacitor/core';

const { Browser } = Plugins;

await Browser.open({ url: 'http://capacitor.ionicframework.com/' });

1 post - 1 participant

Read full topic

Phone sometimes skip function inside loop

$
0
0

Hi, I have a POS app that works with a thermal printer. When the order is too long, I split the invoice in chunks of 300 bits. On my phone it works well 100% of the time, but when I try to use a Huawei phone (the one that is being used in the store) it skips one or several iterations of the print call in the loop.

I don’t know it if is an async/await issue, or a Bluetooth communication issue. Anyway there are the 2 functions I use for printing.

async printTicket(order: Order, sale?: Sale) {
    let ticket: any[] = await this._printer.generateReceipt(order, sale);
    let chunks: any[] = await chunk(ticket, 300);
    return new Promise((res, rej) => {
      this._printer.getDefaultPrinter().then(async printer => {
        if (printer) {
          for (let index = 0; index < chunks.length; index++) {
            await this.sendToPrinter(chunks[index], index, chunks.length, printer.address);
            await this._misc.delay(100);
          }
          res(ticket)
        } else {
          this._misc.presentSimpleAlert('Error', '', 'Impresora no seleccionada');
          rej()
        }
      }).catch(error => rej(error))
    })
  }

  async sendToPrinter(data, index, total, address) {
    return new Promise ((resolve, reject) => {
      const bt = this._printer.connectBT(address).subscribe(async _ => {
        this._misc.presentToast("Imprimiendo parte " + (index + 1) + ' de ' + total);
        await this._printer.writeData(data);
        this._printer.deviceDisconnected().then(res => {
          this._misc.presentToast("Dispositivo bluetooth desconectado");
          bt.unsubscribe()
          resolve(data);
        }).catch(err => reject(err));
      })
    }

Any help will be much appreciated.

1 post - 1 participant

Read full topic

Capacitor input file not working on Android

$
0
0

Hello everybody!

I’m trying to add an input file to my application, in the web version it does work correctly, while in the android application version it does not.

This is the input

<input type="file" accept=".png, .jpg, .jpeg" name="profilePhoto">

And the capacitor version

    "@capacitor/android": "^2.2.0",
    "@capacitor/core": "2.2.0",
    "@capacitor/ios": "^2.2.0",

I’ve seen this GitHub issue, but I’m not sure how to approach the suggested workaround.

I’ve also seen this stackoverflow question, but it has not helped me.

It is kind of a basic operation to do, so I’m sure I’m doing something wrong here.

Anyone can help me out? Thanks!

Edit: Tested also on iOs simulator and it works just fine

1 post - 1 participant

Read full topic


API call doesn't work on Android

$
0
0

(topic withdrawn by author, will be automatically deleted in 24 hours unless flagged)

1 post - 1 participant

Read full topic

Ionic 5 Tutorial: Create Offline Price Checker (Angular 9)

How to make tabs scrollable

$
0
0

HI I would like to design a scrollable tab . Kindly guide me on how to do that . Please provide with some code …

I am using following ionic configuration

“dependencies”: {
@angular/common”: “~9.1.6”,
@angular/core”: “~9.1.6”,
@angular/forms”: “~9.1.6”,
@angular/platform-browser”: “~9.1.6”,
@angular/platform-browser-dynamic”: “~9.1.6”,
@angular/router”: “~9.1.6”,
@ionic-native/core”: “^5.0.7”,
@ionic-native/splash-screen”: “^5.0.0”,
@ionic-native/status-bar”: “^5.0.0”,
@ionic/angular”: “^5.0.0”,
“cordova-android”: “^8.1.0”,
“rxjs”: “~6.5.1”,
“tslib”: “^1.10.0”,
“zone.js”: “~0.10.2”
},

1 post - 1 participant

Read full topic

Async-lock: process is not defined

$
0
0

I’m new in javascript and ionic, I got “process is not defined” when use this module, is there any solutions for this? or any other module to handle this? thanks in advance

1 post - 1 participant

Read full topic

Which software is provides best security protection for PC

$
0
0

Hi friend I am using Mcafee software which is popular product for me because this is take care of my PC and is completely secure from virus and malware protection. If you want then you can download the world’s most trusted antivirus from McAfee official website and login in a few simple steps. I am also getting live support with easily access of Mcafee Account login to solve all issues myself. Some of my friend are also create a support account on Mcafee Total Protection Login for sharing their issues or any questions on that platform.

Thanks!

1 post - 1 participant

Read full topic

Viewing all 71531 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>