-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.js
executable file
·184 lines (153 loc) · 4.57 KB
/
types.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
// @flow
import * as React from 'react';
import type { NavigationScreenProp } from 'react-navigation';
import type {
ActivityArgData,
ActivityResponse,
ActivityGroupResponse,
StreamClient,
ReactionKindMap,
UserResponse as StreamUserResponse,
ReactionRequestOptions,
ReactionResponse,
OgData as OgDataGetStream,
} from 'getstream';
import type { AppCtx, FeedCtx } from './Context';
export type NavigationScreen = NavigationScreenProp<{}>;
// Copied from react native source code
type StyleSheetInternalStyleIdentifier = number;
type StyleSheetInstance = { [string]: StyleSheetInternalStyleIdentifier };
export type StyleSheetLike = { [string]: {} } | StyleSheetInstance;
export type Style = {} | StyleSheetInternalStyleIdentifier;
export type FlowRequestTypes =
| 'get-user-info'
| 'get-feed'
| 'get-feed-next-page'
| 'get-reactions-next-page'
| 'get-notification-counts'
| 'upload-image'
| 'add-activity'
| 'delete-activity'
| 'add-reaction'
| 'delete-reaction'
| 'add-child-reaction'
| 'delete-child-reaction';
export type UploadState = 'uploading' | 'finished' | 'failed';
export type FileLike = Blob | File;
export type UploadInfo = {|
id: string,
url?: string,
state: UploadState,
|};
export type FileUpload = {|
...UploadInfo,
file: File,
|};
export type ImageUpload = {|
...UploadInfo,
file: Blob | File,
previewUri?: string,
|};
export type ErrorHandler = (
error: Error,
type: FlowRequestTypes,
details: {},
) => mixed;
type ReactComponentClass = Class<React.Component<any>>;
export type ReactComponentFunction = (
props: any,
) => ?React.Element<any> | boolean | number | string;
export type ReactElementCreator = ReactComponentClass | ReactComponentFunction;
export type RenderableButNotElement = ?(
| ReactElementCreator
| boolean
| number
| string
);
export type Renderable = RenderableButNotElement | React.Element<any>;
export type BaseActivityResponse = ActivityResponse<{}, {}>;
export type BaseActivityGroupResponse = ActivityGroupResponse<{}, {}>;
export type BaseAppCtx = AppCtx<{}>;
export type BaseFeedCtx = FeedCtx;
export type BaseClient = StreamClient<{}>;
export type BaseReaction = ReactionResponse<{}, {}>;
export type BaseReactionMap = ReactionKindMap<Object, Object>;
export type BaseUserResponse = StreamUserResponse<{}>;
export type UserData = {
name?: string,
profileImage?: string,
};
export type OgData = OgDataGetStream;
export type FileInfo = {
name: string,
url: string,
mimeType: string,
};
export type CustomActivityData = {
text?: string,
link?: boolean,
image?: string,
attachments?: {
images?: Array<string>,
og?: ?OgData,
files?: Array<FileInfo>,
},
};
export type CustomActivityArgData = ActivityArgData<{}, CustomActivityData>;
export type ActivityData = ActivityResponse<UserData, CustomActivityData>;
export type UserResponse = StreamUserResponse<UserData>;
export type ToggleReactionCallbackFunction = (
kind: string,
activity: BaseActivityResponse,
data?: {},
options?: { trackAnalytics?: boolean } & ReactionRequestOptions,
) => void | Promise<mixed>;
export type AddReactionCallbackFunction = (
kind: string,
activity: BaseActivityResponse,
data?: {},
options?: { trackAnalytics?: boolean } & ReactionRequestOptions,
) => void | Promise<mixed>;
export type RemoveReactionCallbackFunction = (
kind: string,
activity: BaseActivityResponse,
id: string,
options?: { trackAnalytics?: boolean },
) => void | Promise<mixed>;
export type ToggleChildReactionCallbackFunction = (
kind: string,
activity: BaseReaction,
data: {},
options?: { trackAnalytics?: boolean } & ReactionRequestOptions,
) => void | Promise<mixed>;
export type AddChildReactionCallbackFunction = (
kind: string,
activity: BaseReaction,
data: {},
options?: { trackAnalytics?: boolean } & ReactionRequestOptions,
) => void | Promise<mixed>;
export type RemoveChildReactionCallbackFunction = (
kind: string,
activity: BaseReaction,
id: string,
options?: { trackAnalytics?: boolean },
) => void | Promise<mixed>;
export type CommentData = {
text: string,
};
export type Comment = ReactionResponse<UserData, CommentData>;
export type NotificationActivity = ActivityResponse<UserData, {}>;
export type NotificationActivities = Array<ActivityResponse<UserData, {}>>;
export type Emoji = {
// The actual unicode emoji (e.g. 👍)
native: string,
// Colon representation (e.g. ":+1:")
colons: string,
// Colon representation (e.g. "+1")
id: string,
// Colon representation (e.g. Thumbs Up Sign)
name: string,
emoticons: Array<string>,
skin: ?number,
unified: string,
};