Telegram-Mini-Apps / telegram-apps

Made from scratch TypeScript packages, examples and documentation you will surely need to start developing on Telegram Mini Apps.
https://docs.telegram-mini-apps.com/
MIT License
400 stars 80 forks source link

[Bug]: DisplayGate from "@tma.js/sdk-react"; #320

Closed gsw85 closed 1 month ago

gsw85 commented 1 month ago

Telegram Application

Telegram Desktop

Describe the Bug

The error is on DisplayGate: Attempted import error: 'DisplayGate' is not exported from '@tma.js/sdk-react' (imported as 'DisplayGate').

To Reproduce

import { SDKProvider, DisplayGate } from "@tma.js/sdk-react";

function SDKProviderError({ error }) {
  return (
    <div>
      Oops. Something went wrong.
      <blockquote>
        <code>
          {error instanceof Error
            ? error.message
            : JSON.stringify(error)}
        </code>
      </blockquote>
    </div>
  );
}

function SDKProviderLoading() {
  return <div>SDK is loading.</div>;
}

function SDKInitialState() {
  return <div>Waiting for initialization to start.</div>;
}

export function TmaSDKLoader({ children }) {
  return (
    <SDKProvider
      options={{
        async: true,
        complete: true,
      }}
    >
      <DisplayGate
        error={SDKProviderError}
        loading={SDKProviderLoading}
        initial={SDKInitialState}
      >
        {children}
      </DisplayGate>
    </SDKProvider>
  );
}

Expected Behavior

Expect to run normall and get the telegram data from user

heyqbnk commented 1 month ago

Hey. There is no such component as DisplayGate anymore. You can now see how it works in React and Next templates.

Documentation will be released soon

heyqbnk commented 1 month ago

Documentation related to this topic. Check this out! https://docs.telegram-mini-apps.com/packages/tma-js-sdk-react