GetStream / react-native-activity-feed

Official React Native SDK for Activity Feeds
https://getstream.io/
200 stars 86 forks source link

Typescript Support #193

Open iamshouvikmitra opened 3 years ago

iamshouvikmitra commented 3 years ago

Are there any type def file available for this project?

vishalnarkhede commented 3 years ago

Hey @iamshouvikmitra not at the moment. But its on our roadmap for next quarter!!

ronaldcurtis commented 3 years ago

+1

~Also need to have this in typescript. Looking forward to it 👍~

Just noticed it's already availabe 😍 ! My bad 🙏

yumoraby commented 3 years ago

+1

~Also need to have this in typescript. Looking forward to it 👍~

Just noticed it's already availabe 😍 ! My bad 🙏

Where did you see TS support? I dont see it on GH or npmjs

ronaldcurtis commented 3 years ago

@yumoraby Sorry, my mistake, I was looking at their react package, not react-native: https://github.com/GetStream/react-activity-feed

luhart commented 3 years ago

@vishalnarkhede any updates on this?

royscheepens commented 2 years ago

@vishalnarkhede is TS support for this library currently being worked on? Or is it still on the roadmap? Would love to hear any updates on this. Thanks!

robbeman commented 2 years ago

Sorry for edit spamming.

To at least not get typescript errors you can add react-native-activity-feed.d.ts to your project, it's something.

declare module 'react-native-activity-feed' {
  import { Component } from 'react';
  import { StreamClient, StreamUser } from 'getstream';
  // Context
  export class StreamApp extends Component {}
  export class Feed extends Component {}
  export const StreamContext: React.Context<{ client: StreamClient; user: StreamUser }>;
  export const FeedContext: React.Context<unknown>;
  export const TranslationContext: React.Context<unknown>;

  export function withTranslationContext<C extends React.Component>(component: C): C;

  // Components
  export class FlatFeed extends Component {}
  export class NotificationFeed extends Component {}
  export class SinglePost extends Component {}
  export class Avatar extends Component {}
  export class FollowButton extends Component {}
  export class UrlPreview extends Component {}
  export class StatusUpdateForm extends Component {}
  export class UploadImage extends Component {}
  export class UserBar extends Component {}
  export class UserCard extends Component {}
  export class ReactionIcon extends Component {}
  export class ReactionToggleIcon extends Component {}
  export class ReactionIconBar extends Component {}
  export class CommentsContainer extends Component {}
  export class Card extends Component {}
  export class ReactionList extends Component {}
  export class SectionHeader extends Component {}
  export class CommentBox extends Component {}
  export class CommentItem extends Component {}
  export class CommentList extends Component {}
  export class LikeList extends Component {}
  export class BackButton extends Component {}
  export class Activity extends Component {}
  export class LikeButton extends Component {}
  export class NewActivitiesNotification extends Component {}
  export class IconBadge extends Component {}

  // Style
  export function updateStyle(...args: unknown[]): unknown;
  export function getStyle(...args: unknown[]): unknown;
  export function buildStylesheet(...args: unknown[]): unknown;

  // Utils
  export function humanizeTimestamp(...args: unknown[]): unknown;
  export function registerNativeHandlers(...args: unknown[]): unknown;
  export function setAndroidTranslucentStatusBar(...args: unknown[]): unknown;
}
jessepinho commented 1 year ago

Thanks @robbeman !

For future Googlers, this library is no longer being maintained (per the README), so full-fledged TypeScript support is unlikely.

david-shiko commented 9 months ago

The latest version (https://github.com/GetStream/react-native-activity-feed/issues/193#issuecomment-1063817650) was causing some warnings. Below is an updated by ChatGPT:

declare module 'react-native-activity-feed' { import { Component, ReactNode } from 'react'; import { StreamClient, StreamUser } from 'getstream';

interface StreamAppProps {
    apiKey?: string;
    appId?: string;
    token?: string;
    children?: ReactNode;
}

interface FlatFeedProps {
    Activity: (props: any) => JSX.Element;
    children?: ReactNode;
}

// Context
export class StreamApp extends Component<StreamAppProps> {}
export class Feed extends Component<FlatFeedProps> {}
export const StreamContext: React.Context<{ client: StreamClient; user: StreamUser }>;
export const FeedContext: React.Context<unknown>;
export const TranslationContext: React.Context<unknown>;

export function withTranslationContext<C extends React.Component>(component: C): C;

// Components
export class FlatFeed extends Component<FlatFeedProps> {}
export class NotificationFeed extends Component {}
export class SinglePost extends Component {}
export class Avatar extends Component {}
export class FollowButton extends Component {}
export class UrlPreview extends Component {}
export class StatusUpdateForm extends Component {}
export class UploadImage extends Component {}
export class UserBar extends Component {}
export class UserCard extends Component {}
export class ReactionIcon extends Component {}
export class ReactionToggleIcon extends Component {}
export class ReactionIconBar extends Component {}
export class CommentsContainer extends Component {}
export class Card extends Component {}
export class ReactionList extends Component {}
export class SectionHeader extends Component {}
export class CommentBox extends Component {}
export class CommentItem extends Component {}
export class CommentList extends Component {}
export class LikeList extends Component {}
export class BackButton extends Component {}
export class Activity extends Component {}
export class LikeButton extends Component {}
export class NewActivitiesNotification extends Component {}
export class IconBadge extends Component {}

// Style
export function updateStyle(...args: unknown[]): unknown;
export function getStyle(...args: unknown[]): unknown;
export function buildStylesheet(...args: unknown[]): unknown;

// Utils
export function humanizeTimestamp(...args: unknown[]): unknown;
export function registerNativeHandlers(...args: unknown[]): unknown;
export function setAndroidTranslucentStatusBar(...args: unknown[]): unknown;

}