ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: InputInputEventDetail is not exported from ionic react

Open filifunk opened this issue 1 year ago • 1 comments

Prerequisites

Ionic Framework Version

v8.x

Current Behavior

The type InputInputEventDetail is not importable to be used in an onIonInput component.

Expected Behavior

We should be able to import like this:

import type { InputInputEventDetail } from '@ionic/react

That way the user should be able to use that as a type.

Steps to Reproduce

  1. Use Ionic/React and TypeScript.

  2. Use an IonInput component and then use onIonInput parameter.

  3. Use an event function. When hovering over the event it says that it is of type IonInputCustomEvent<InputInputEventDetail>.

  4. Try to type it as <InputCustomEvent<InputInputEventDetail>>. The error is Cannot find name InputInputEventDetail

  5. Try to import the type:

import type { InputInputEventDetail } from '@ionic/react'

The error will be Module '@ionic/react' has no exported member 'InputInputEventDetail'

Code Reproduction URL

https://ionic-react-first-app-5u1acp.stackblitz.io

Ionic Info

Ionic:

Ionic CLI : 7.1.1 (/usr/local/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/react 8.1.0

Capacitor:

Capacitor CLI : 6.0.0 @capacitor/android : 6.0.0 @capacitor/core : 6.0.0 @capacitor/ios : 6.0.0

Utility:

cordova-res : 0.15.4 native-run : 2.0.1

System:

NodeJS : v20.12.2 (/usr/local/bin/node) npm : 10.5.0 OS : Linux 5.14

───────────────────────────────────────────────

 Ionic CLI update available: 7.1.1 → 7.2.0
     Run npm i -g @ionic/cli to update

───────────────────────────────────────────────

Additional Information

image

filifunk avatar May 16 '24 23:05 filifunk

Thank you for the issue!

The repro URL isn't loading for me. Can you verify that the following snippet is the code that is causing you an issue?

import React from 'react';
import { IonInput } from '@ionic/react';
import type { InputInputEventDetail, IonInputCustomEvent } from '@ionic/react'

function Example() {
  return (
    <IonInput label="input" value="53703" onIonInput={(e: IonInputCustomEvent<InputInputEventDetail>) => console.log(e)}></IonInput>
  );
}
export default Example;

thetaPC avatar May 17 '24 22:05 thetaPC

I can verify that the issue exists! We'll be reviewing your PR soon!

thetaPC avatar May 31 '24 20:05 thetaPC

Thanks for the issue! This has been resolved via PR https://github.com/ionic-team/ionic-framework/pull/29512 and will be available in an upcoming release of Ionic.

thetaPC avatar May 31 '24 22:05 thetaPC

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

ionitron-bot[bot] avatar Jul 05 '24 18:07 ionitron-bot[bot]