text
stringlengths 9
39.2M
| dir
stringlengths 25
226
| lang
stringclasses 163
values | created_date
timestamp[s] | updated_date
timestamp[s] | repo_name
stringclasses 751
values | repo_full_name
stringclasses 752
values | star
int64 1.01k
183k
| len_tokens
int64 1
18.5M
|
|---|---|---|---|---|---|---|---|---|
```javascript
/* @flow strict-local */
import deepFreeze from 'deep-freeze';
import fullReducer from '../../boot/reducers';
import {
getMute,
getTopicVisibilityPolicy,
isTopicVisible,
isTopicVisibleInStream,
reducer,
} from '../muteModel';
import { EVENT, EVENT_MUTED_TOPICS } from '../../actionConstants';
import * as eg from '../../__tests__/lib/exampleData';
import { makeMuteState, makeUserTopic } from './mute-testlib';
import { tryGetActiveAccountState } from '../../selectors';
import { UserTopicVisibilityPolicy } from '../../api/modelTypes';
import { EventTypes } from '../../api/eventTypes';
import * as logging from '../../utils/logging';
/* eslint jest/expect-expect: ["error", { "assertFunctionNames": ["expect", "check"] }] */
const initialState = makeMuteState([]);
describe('getters', () => {
describe('getTopicVisibilityPolicy', () => {
function check(state, expected) {
expect(getTopicVisibilityPolicy(state, eg.stream.stream_id, 'topic')).toEqual(expected);
}
test('with nothing for stream', () => {
check(makeMuteState([]), UserTopicVisibilityPolicy.None);
});
test('with nothing for topic', () => {
check(makeMuteState([[eg.stream, 'other topic']]), UserTopicVisibilityPolicy.None);
});
test('with topic muted', () => {
check(makeMuteState([[eg.stream, 'topic']]), UserTopicVisibilityPolicy.Muted);
});
test('with topic unmuted', () => {
check(
makeMuteState([[eg.stream, 'topic', UserTopicVisibilityPolicy.Unmuted]]),
UserTopicVisibilityPolicy.Unmuted,
);
});
test('with topic followed', () => {
check(
makeMuteState([[eg.stream, 'topic', UserTopicVisibilityPolicy.Followed]]),
UserTopicVisibilityPolicy.Followed,
);
});
});
describe('isTopicVisibleInStream', () => {
function check(state, expected) {
expect(isTopicVisibleInStream(eg.stream.stream_id, 'topic', state)).toEqual(expected);
}
test('with nothing for stream', () => {
check(makeMuteState([]), true);
});
test('with nothing for topic', () => {
check(makeMuteState([[eg.stream, 'other topic']]), true);
});
test('with topic muted', () => {
check(makeMuteState([[eg.stream, 'topic']]), false);
});
test('with topic unmuted', () => {
check(makeMuteState([[eg.stream, 'topic', UserTopicVisibilityPolicy.Unmuted]]), true);
});
test('with topic followed', () => {
check(makeMuteState([[eg.stream, 'topic', UserTopicVisibilityPolicy.Followed]]), true);
});
});
describe('isTopicVisible', () => {
function check(streamMuted, topicPolicy, expected) {
const subscription = { ...eg.subscription, in_home_view: !streamMuted };
const state = makeMuteState(
topicPolicy === UserTopicVisibilityPolicy.None ? [] : [[eg.stream, 'topic', topicPolicy]],
);
expect(isTopicVisible(eg.stream.stream_id, 'topic', subscription, state)).toEqual(expected);
}
test('stream unmuted, topic-policy None', () => {
check(false, UserTopicVisibilityPolicy.None, true);
});
test('stream unmuted, topic-policy Muted', () => {
check(false, UserTopicVisibilityPolicy.Muted, false);
});
test('stream unmuted, topic-policy Unmuted', () => {
check(false, UserTopicVisibilityPolicy.Unmuted, true);
});
test('stream unmuted, topic-policy Followed', () => {
check(false, UserTopicVisibilityPolicy.Followed, true);
});
test('stream muted, topic-policy None', () => {
check(true, UserTopicVisibilityPolicy.None, false);
});
test('stream muted, topic-policy Muted', () => {
check(true, UserTopicVisibilityPolicy.Muted, false);
});
test('stream muted, topic-policy Unmuted', () => {
check(true, UserTopicVisibilityPolicy.Unmuted, true);
});
test('stream muted, topic-policy Followed', () => {
check(true, UserTopicVisibilityPolicy.Followed, true);
});
});
});
describe('reducer', () => {
describe('REGISTER_COMPLETE', () => {
test('in modern user_topics format: unit test', () => {
const action = eg.mkActionRegisterComplete({
user_topics: [
makeUserTopic(eg.stream, 'topic', UserTopicVisibilityPolicy.Muted),
makeUserTopic(eg.stream, 'other topic', UserTopicVisibilityPolicy.Unmuted),
],
});
expect(reducer(initialState, action, eg.plusReduxState)).toEqual(
makeMuteState([
[eg.stream, 'topic', UserTopicVisibilityPolicy.Muted],
[eg.stream, 'other topic', UserTopicVisibilityPolicy.Unmuted],
]),
);
});
test('in modern user_topics format: end-to-end test', () => {
const action = eg.mkActionRegisterComplete({
streams: [eg.stream],
subscriptions: [eg.subscription],
user_topics: [
makeUserTopic(eg.stream, 'topic', UserTopicVisibilityPolicy.Muted),
makeUserTopic(eg.stream, 'other topic', UserTopicVisibilityPolicy.Unmuted),
],
});
const newState = tryGetActiveAccountState(fullReducer(eg.plusReduxState, action));
expect(newState).toBeTruthy();
expect(newState && getMute(newState)).toEqual(
makeMuteState([
[eg.stream, 'topic', UserTopicVisibilityPolicy.Muted],
[eg.stream, 'other topic', UserTopicVisibilityPolicy.Unmuted],
]),
);
});
test('in modern user_topics format: invalid enum values discarded', () => {
// $FlowFixMe[prop-missing]: Jest mock
logging.warn.mockReturnValue();
const action1 = eg.mkActionRegisterComplete({
user_topics: [
// $FlowIgnore[incompatible-call]: simulates a future server
makeUserTopic(eg.stream, 'topic', 42),
makeUserTopic(eg.stream, 'other topic', UserTopicVisibilityPolicy.Muted),
],
});
const action2 = eg.mkActionRegisterComplete({
user_topics: [makeUserTopic(eg.stream, 'other topic', UserTopicVisibilityPolicy.Muted)],
});
expect(reducer(initialState, action1, eg.plusReduxState)).toEqual(
reducer(initialState, action2, eg.plusReduxState),
);
});
test('in old muted_topics format: unit test', () => {
const action = eg.mkActionRegisterComplete({
muted_topics: [[eg.stream.name, 'topic']],
user_topics: undefined,
});
expect(reducer(initialState, action, eg.plusReduxState)).toEqual(
makeMuteState([[eg.stream, 'topic']]),
);
});
test('in old muted_topics format: end-to-end test', () => {
const action = eg.mkActionRegisterComplete({
streams: [eg.stream],
subscriptions: [eg.subscription],
muted_topics: [[eg.stream.name, 'topic']],
user_topics: undefined,
});
const newState = tryGetActiveAccountState(fullReducer(eg.plusReduxState, action));
expect(newState).toBeTruthy();
expect(newState && getMute(newState)).toEqual(makeMuteState([[eg.stream, 'topic']]));
});
});
describe('RESET_ACCOUNT_DATA', () => {
test('resets state to initial state', () => {
const state = makeMuteState([[eg.stream, 'some_topic']]);
expect(reducer(state, eg.action.reset_account_data, eg.plusReduxState)).toEqual(initialState);
});
});
describe('EVENT > user_topic', () => {
function mkAction(userTopic) {
return { type: EVENT, event: { id: 0, type: EventTypes.user_topic, ...userTopic } };
}
function check(state, userTopic, expected) {
expect(reducer(state, mkAction(userTopic), eg.plusReduxState)).toEqual(expected);
}
test('add with new stream', () => {
check(
initialState,
makeUserTopic(eg.stream, 'topic', UserTopicVisibilityPolicy.Muted),
makeMuteState([[eg.stream, 'topic', UserTopicVisibilityPolicy.Muted]]),
);
});
test('add in existing stream', () => {
check(
makeMuteState([[eg.stream, 'topic', UserTopicVisibilityPolicy.Muted]]),
makeUserTopic(eg.stream, 'other topic', UserTopicVisibilityPolicy.Unmuted),
makeMuteState([
[eg.stream, 'topic', UserTopicVisibilityPolicy.Muted],
[eg.stream, 'other topic', UserTopicVisibilityPolicy.Unmuted],
]),
);
});
test('change Muted -> Unmuted', () => {
check(
makeMuteState([[eg.stream, 'topic', UserTopicVisibilityPolicy.Muted]]),
makeUserTopic(eg.stream, 'topic', UserTopicVisibilityPolicy.Unmuted),
makeMuteState([[eg.stream, 'topic', UserTopicVisibilityPolicy.Unmuted]]),
);
});
test('change Unmuted -> Muted', () => {
check(
makeMuteState([[eg.stream, 'topic', UserTopicVisibilityPolicy.Unmuted]]),
makeUserTopic(eg.stream, 'topic', UserTopicVisibilityPolicy.Muted),
makeMuteState([[eg.stream, 'topic', UserTopicVisibilityPolicy.Muted]]),
);
});
test('remove, with others in stream', () => {
check(
makeMuteState([
[eg.stream, 'topic'],
[eg.stream, 'other topic'],
]),
makeUserTopic(eg.stream, 'other topic', UserTopicVisibilityPolicy.None),
makeMuteState([[eg.stream, 'topic']]),
);
});
test('remove, as last in stream', () => {
check(
makeMuteState([[eg.stream, 'topic']]),
makeUserTopic(eg.stream, 'topic', UserTopicVisibilityPolicy.None),
initialState,
);
});
test('treat invalid enum value as removing', () => {
// $FlowFixMe[prop-missing]: Jest mock
logging.warn.mockReturnValue();
check(
makeMuteState([
[eg.stream, 'topic'],
[eg.stream, 'other topic'],
]),
// $FlowIgnore[incompatible-call]: simulates a future server
makeUserTopic(eg.stream, 'topic', 999),
makeMuteState([[eg.stream, 'other topic']]),
);
});
});
describe('EVENT_MUTED_TOPICS (legacy)', () => {
const action = deepFreeze({
type: EVENT_MUTED_TOPICS,
id: -1,
muted_topics: [[eg.stream.name, 'topic']],
});
test('ignored when on a current server', () => {
expect(reducer(initialState, action, eg.plusReduxState)).toEqual(initialState);
});
test('sets the state, when on an old server lacking user_topic', () => {
const globalState = eg.reduxStatePlus({
// TODO(server-6.0): We'll drop this muted_topics event type entirely.
accounts: [{ ...eg.plusReduxState.accounts[0], zulipFeatureLevel: 133 }],
});
expect(reducer(initialState, action, globalState)).toEqual(
makeMuteState([[eg.stream, 'topic']]),
);
});
});
});
```
|
/content/code_sandbox/src/mute/__tests__/muteModel-test.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 2,532
|
```javascript
/* @flow strict-local */
import type { PerAccountAction, AccountIndependentAction, Orientation } from '../types';
import { APP_ONLINE, APP_ORIENTATION, DISMISS_SERVER_COMPAT_NOTICE } from '../actionConstants';
export const appOnline = (isOnline: boolean | null): AccountIndependentAction => ({
type: APP_ONLINE,
isOnline,
});
export const appOrientation = (orientation: Orientation): AccountIndependentAction => ({
type: APP_ORIENTATION,
orientation,
});
export const dismissCompatNotice = (): PerAccountAction => ({
type: DISMISS_SERVER_COMPAT_NOTICE,
});
```
|
/content/code_sandbox/src/session/sessionActions.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 121
|
```javascript
/* @flow strict-local */
import type { GlobalState } from '../reduxTypes';
import type { Orientation, Action } from '../types';
import { keyOfIdentity } from '../account/accountMisc';
import { getIdentity, tryGetActiveAccountState } from '../account/accountsSelectors';
import {
REHYDRATE,
DEAD_QUEUE,
RESET_ACCOUNT_DATA,
APP_ONLINE,
REGISTER_START,
REGISTER_ABORT,
REGISTER_COMPLETE,
APP_ORIENTATION,
TOGGLE_OUTBOX_SENDING,
GOT_PUSH_TOKEN,
DISMISS_SERVER_COMPAT_NOTICE,
REGISTER_PUSH_TOKEN_START,
REGISTER_PUSH_TOKEN_END,
} from '../actionConstants';
/**
* Miscellaneous non-persistent state specific to a particular account.
*
* See {@link SessionState} for discussion of what "non-persistent" means.
*/
export type PerAccountSessionState = $ReadOnly<{
/**
* The event queue ID that we're currently polling on, if any.
*
* Null when we're not polling on any event queue:
* - Between startup and registering a queue
* - After the server tells us our old queue was invalid, and before we've
* registered a new one
* - While this account is logged out
*/
eventQueueId: string | null,
/**
* Whether the /register request is in progress.
*
* This happens on startup, or on re-init following a dead event
* queue after 10 minutes of inactivity.
*/
loading: boolean,
outboxSending: boolean,
/**
* Whether `ServerCompatBanner` has been dismissed this session.
*
* We put this in the per-session state deliberately, so that users
* see the notice on every startup until the server is upgraded.
* That's a better experience than not being able to load the realm
* on mobile at all, which is what will happen soon if the user
* doesn't act on the notice.
*/
hasDismissedServerCompatNotice: boolean,
/**
* How many `api.savePushToken` requests are in progress for this account.
*/
registerPushTokenRequestsInProgress: number,
...
}>;
/**
* Miscellaneous non-persistent state independent of account.
*
* This contains data about the device and the app as a whole, independent
* of any particular Zulip server or account.
*
* See {@link SessionState} for discussion of what "non-persistent" means.
*/
export type GlobalSessionState = $ReadOnly<{
// `null` if we don't know. See the place where we set this, for what that
// means.
isOnline: boolean | null,
isHydrated: boolean,
orientation: Orientation,
/**
* Our actual device token, as most recently learned from the system.
*
* With FCM/GCM this is the "registration token"; with APNs the "device
* token".
*
* This is `null` before we've gotten a token. On Android, we may also receive
* an explicit `null` token if the device can't or won't give us a real one.
*
* See upstream docs:
* path_to_url#sample-register
* path_to_url
* path_to_url
*
* See also discussion at path_to_url
*/
pushToken: string | null,
...
}>;
/**
* Miscellaneous non-persistent state about this run of the app.
*
* These state items are stored in `session.state`, and 'session' is
* in `discardKeys` in src/boot/store.js. That means these values
* won't be persisted between sessions; on startup, they'll all be
* initialized to their default values.
*/
export type SessionState = $ReadOnly<{|
...$Exact<GlobalSessionState>,
...$Exact<PerAccountSessionState>,
|}>;
// As part of letting GlobalState freely convert to PerAccountState,
// we'll want the same for SessionState. (This is also why
// PerAccountSessionState is inexact.)
(s: SessionState): PerAccountSessionState => s; // eslint-disable-line no-unused-expressions
const initialGlobalSessionState: $Exact<GlobalSessionState> = {
// This will be `null` on startup, while we wait to hear `true` or `false`
// from the native module over the RN bridge; so, have it start as `null`.
isOnline: null,
isHydrated: false,
orientation: 'PORTRAIT',
pushToken: null,
};
/** PRIVATE; exported only for tests. */
export const initialPerAccountSessionState: $Exact<PerAccountSessionState> = {
eventQueueId: null,
loading: false,
outboxSending: false,
hasDismissedServerCompatNotice: false,
registerPushTokenRequestsInProgress: 0,
};
const initialState: SessionState = {
...initialGlobalSessionState,
...initialPerAccountSessionState,
};
export default (
state: SessionState = initialState, // eslint-disable-line default-param-last
action: Action,
globalState: GlobalState,
): SessionState => {
switch (action.type) {
case DEAD_QUEUE:
return {
...state,
loading: false,
// The server told us that the old queue ID is invalid. Forget it,
// so we don't try to use it.
eventQueueId: null,
};
case RESET_ACCOUNT_DATA:
return {
...state,
// Clear per-account session state. Importantly, stop polling on the
// account's current event queue if we had one. In the polling loop,
// after each server response, we check if we've dropped the queue
// ID from this state and break out if so.
...initialPerAccountSessionState,
};
case REHYDRATE:
return {
...state,
isHydrated: true,
};
case REGISTER_COMPLETE:
return {
...state,
loading: false,
eventQueueId: action.data.queue_id,
};
case APP_ONLINE:
return {
...state,
isOnline: action.isOnline,
};
case REGISTER_START:
return {
...state,
loading: true,
};
case REGISTER_ABORT:
return {
...state,
loading: false,
};
case APP_ORIENTATION:
return {
...state,
orientation: action.orientation,
};
case GOT_PUSH_TOKEN:
return {
...state,
pushToken: action.pushToken,
};
case REGISTER_PUSH_TOKEN_START: {
// TODO(#5006): Do for any account, not just the active one
const activeAccountState = tryGetActiveAccountState(globalState);
if (
!activeAccountState
|| keyOfIdentity(action.identity) !== keyOfIdentity(getIdentity(activeAccountState))
) {
return state;
}
return {
...state,
registerPushTokenRequestsInProgress: state.registerPushTokenRequestsInProgress + 1,
};
}
case REGISTER_PUSH_TOKEN_END: {
// TODO(#5006): Do for any account, not just the active one
const activeAccountState = tryGetActiveAccountState(globalState);
if (
!activeAccountState
|| keyOfIdentity(action.identity) !== keyOfIdentity(getIdentity(activeAccountState))
) {
return state;
}
return {
...state,
registerPushTokenRequestsInProgress: state.registerPushTokenRequestsInProgress - 1,
};
}
case TOGGLE_OUTBOX_SENDING:
return { ...state, outboxSending: action.sending };
case DISMISS_SERVER_COMPAT_NOTICE:
return {
...state,
hasDismissedServerCompatNotice: true,
};
default:
return state;
}
};
```
|
/content/code_sandbox/src/session/sessionReducer.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 1,673
|
```javascript
/* @flow strict-local */
import type { Narrow, Topic, PerAccountAction, ThunkAction, Outbox } from '../types';
import * as api from '../api';
import { INIT_TOPICS } from '../actionConstants';
import { isStreamNarrow, streamIdOfNarrow } from '../utils/narrow';
import { getAuth } from '../selectors';
import { deleteOutboxMessage } from '../outbox/outboxActions';
import { getOutbox } from '../directSelectors';
export const initTopics = (topics: $ReadOnlyArray<Topic>, streamId: number): PerAccountAction => ({
type: INIT_TOPICS,
topics,
streamId,
});
export const fetchTopics =
(streamId: number): ThunkAction<Promise<void>> =>
async (dispatch, getState) => {
const auth = getAuth(getState());
const { topics } = await api.getTopics(auth, streamId);
dispatch(initTopics(topics, streamId));
};
export const fetchTopicsForStream =
(narrow: Narrow): ThunkAction<Promise<void>> =>
async (dispatch, getState) => {
if (!isStreamNarrow(narrow)) {
return;
}
dispatch(fetchTopics(streamIdOfNarrow(narrow)));
};
export const deleteMessagesForTopic =
(streamId: number, topic: string): ThunkAction<Promise<void>> =>
async (dispatch, getState) => {
const state = getState();
const outbox = getOutbox(state);
outbox.forEach((outboxMessage: Outbox) => {
if (
outboxMessage.type === 'stream'
&& outboxMessage.stream_id === streamId
&& outboxMessage.subject === topic
) {
dispatch(deleteOutboxMessage(outboxMessage.id));
}
});
await api.deleteTopic(getAuth(state), streamId, topic);
};
```
|
/content/code_sandbox/src/topics/topicActions.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 398
|
```javascript
/* @flow strict-local */
import React from 'react';
import type { Node } from 'react';
import { FlatList } from 'react-native';
import type { Stream, TopicExtended } from '../types';
import { createStyleSheet } from '../styles';
import TopicItem from '../streams/TopicItem';
import LoadingIndicator from '../common/LoadingIndicator';
import SearchEmptyState from '../common/SearchEmptyState';
const styles = createStyleSheet({
list: {
flex: 1,
flexDirection: 'column',
},
});
type Props = $ReadOnly<{|
stream: Stream,
topics: ?$ReadOnlyArray<TopicExtended>,
onPress: (streamId: number, topic: string) => void,
|}>;
export default function TopicList(props: Props): Node {
const { stream, topics, onPress } = props;
if (!topics) {
return <LoadingIndicator size={40} />;
}
if (topics.length === 0) {
return <SearchEmptyState text="No topics found" />;
}
return (
<FlatList
keyboardShouldPersistTaps="always"
style={styles.list}
data={topics}
keyExtractor={item => item.name}
renderItem={({ item }) => (
<TopicItem
streamId={stream.stream_id}
name={item.name}
isMuted={item.isMuted}
unreadCount={item.unreadCount}
onPress={onPress}
/>
)}
/>
);
}
```
|
/content/code_sandbox/src/topics/TopicList.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 314
|
```javascript
/* @flow strict-local */
import deepFreeze from 'deep-freeze';
import {
DEAD_QUEUE,
APP_ONLINE,
REGISTER_ABORT,
APP_ORIENTATION,
GOT_PUSH_TOKEN,
TOGGLE_OUTBOX_SENDING,
DISMISS_SERVER_COMPAT_NOTICE,
REGISTER_START,
REGISTER_PUSH_TOKEN_START,
REGISTER_PUSH_TOKEN_END,
} from '../../actionConstants';
import sessionReducer, { initialPerAccountSessionState } from '../sessionReducer';
import * as eg from '../../__tests__/lib/exampleData';
import { identityOfAccount } from '../../account/accountMisc';
describe('sessionReducer', () => {
const baseState = eg.baseReduxState.session;
describe('RESET_ACCOUNT_DATA', () => {
test('resets per-account state without touching global state', () => {
const prevState = [
// per-account
eg.action.register_complete,
{ type: DISMISS_SERVER_COMPAT_NOTICE },
// global
{ type: GOT_PUSH_TOKEN, pushToken: '456' },
{ type: APP_ORIENTATION, orientation: 'LANDSCAPE' },
].reduce(
(state, action) => sessionReducer(state, action, eg.plusReduxState),
eg.baseReduxState.session,
);
expect(sessionReducer(prevState, eg.action.reset_account_data, eg.plusReduxState)).toEqual({
...prevState,
...initialPerAccountSessionState,
});
});
});
test('DEAD_QUEUE', () => {
const state = deepFreeze({ ...baseState, loading: true });
const newState = sessionReducer(state, deepFreeze({ type: DEAD_QUEUE }), eg.plusReduxState);
expect(newState).toEqual({ ...baseState, loading: false });
});
test('REGISTER_COMPLETE', () => {
const state = deepFreeze({ ...baseState, loading: true });
const action = eg.mkActionRegisterComplete({ queue_id: '100' });
const newState = sessionReducer(state, action, eg.plusReduxState);
expect(newState).toEqual({
...baseState,
loading: false,
eventQueueId: '100',
});
});
test('APP_ONLINE', () => {
const state = deepFreeze({ ...baseState, isOnline: false });
const action = deepFreeze({ type: APP_ONLINE, isOnline: true });
const newState = sessionReducer(state, action, eg.plusReduxState);
expect(newState).toEqual({ ...baseState, isOnline: true });
});
test('REGISTER_ABORT', () => {
const state = deepFreeze({ ...baseState, loading: true });
const newState = sessionReducer(
state,
deepFreeze({ type: REGISTER_ABORT, reason: 'server' }),
eg.plusReduxState,
);
expect(newState).toEqual({ ...baseState, loading: false });
});
test('REGISTER_START', () => {
const state = deepFreeze({ ...baseState, loading: false });
const newState = sessionReducer(state, deepFreeze({ type: REGISTER_START }), eg.plusReduxState);
expect(newState).toEqual({ ...baseState, loading: true });
});
test('APP_ORIENTATION', () => {
const state = deepFreeze({ ...baseState, orientation: 'PORTRAIT' });
const orientation = 'LANDSCAPE';
const action = deepFreeze({ type: APP_ORIENTATION, orientation });
expect(sessionReducer(state, action, eg.plusReduxState)).toEqual({ ...baseState, orientation });
});
test('GOT_PUSH_TOKEN', () => {
const pushToken = 'pushToken';
const action = deepFreeze({ type: GOT_PUSH_TOKEN, pushToken });
expect(sessionReducer(baseState, action, eg.plusReduxState)).toEqual({
...baseState,
pushToken,
});
});
test('REGISTER_PUSH_TOKEN_START / REGISTER_PUSH_TOKEN_END increment/decrement counter', () => {
const run = (state, type, account) =>
sessionReducer(
state,
type === 'start'
? { type: REGISTER_PUSH_TOKEN_START, identity: identityOfAccount(account) }
: { type: REGISTER_PUSH_TOKEN_END, identity: identityOfAccount(account) },
eg.plusReduxState,
);
const state1 = run(baseState, 'start', eg.selfAccount);
expect(state1.registerPushTokenRequestsInProgress).toEqual(1);
const state2 = run(state1, 'start', eg.selfAccount);
expect(state2.registerPushTokenRequestsInProgress).toEqual(2);
const state3 = run(state2, 'end', eg.selfAccount);
expect(state3.registerPushTokenRequestsInProgress).toEqual(1);
const state4 = run(state3, 'end', eg.selfAccount);
expect(state4.registerPushTokenRequestsInProgress).toEqual(0);
const state5 = run(state4, 'start', eg.makeAccount());
expect(state5).toBe(state4);
const state7 = run(state5, 'end', eg.makeAccount());
expect(state7).toBe(state5);
});
test('TOGGLE_OUTBOX_SENDING', () => {
const state = deepFreeze({ ...baseState, outboxSending: false });
expect(
sessionReducer(
state,
deepFreeze({ type: TOGGLE_OUTBOX_SENDING, sending: true }),
eg.plusReduxState,
),
).toEqual({ ...baseState, outboxSending: true });
});
test('DISMISS_SERVER_COMPAT_NOTICE', () => {
const action = deepFreeze({ type: DISMISS_SERVER_COMPAT_NOTICE });
expect(sessionReducer(baseState, action, eg.plusReduxState)).toEqual({
...baseState,
hasDismissedServerCompatNotice: true,
});
});
});
```
|
/content/code_sandbox/src/session/__tests__/sessionReducer-test.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 1,208
|
```javascript
/* @flow strict-local */
import React, { useState, useCallback, useEffect } from 'react';
import type { Node } from 'react';
import type { RouteProp } from '../react-navigation';
import type { AppNavigationProp } from '../nav/AppNavigator';
import { useSelector, useDispatch } from '../react-redux';
import Screen from '../common/Screen';
import { topicNarrow } from '../utils/narrow';
import { getTopicsForStream } from '../selectors';
import { getStreamForId } from '../subscriptions/subscriptionSelectors';
import TopicList from './TopicList';
import { fetchTopics, doNarrow } from '../actions';
type Props = $ReadOnly<{|
navigation: AppNavigationProp<'topic-list'>,
route: RouteProp<'topic-list', {| streamId: number |}>,
|}>;
export default function TopicListScreen(props: Props): Node {
const dispatch = useDispatch();
const stream = useSelector(state => getStreamForId(state, props.route.params.streamId));
const topics = useSelector(state => getTopicsForStream(state, props.route.params.streamId));
const [filter, setFilter] = useState<string>('');
const handlePress = useCallback(
(streamId: number, topic: string) => {
dispatch(doNarrow(topicNarrow(streamId, topic)));
},
[dispatch],
);
useEffect(() => {
dispatch(fetchTopics(stream.stream_id));
}, [stream, dispatch]);
const filteredTopics =
topics && topics.filter(topic => topic.name.toLowerCase().includes(filter.toLowerCase()));
return (
<Screen
title="Topics"
centerContent
search
searchPlaceholder="Search topics"
searchBarOnChange={setFilter}
scrollEnabled={false}
>
<TopicList stream={stream} topics={filteredTopics} onPress={handlePress} />
</Screen>
);
}
```
|
/content/code_sandbox/src/topics/TopicListScreen.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 386
|
```javascript
/* @flow strict-local */
import type { TopicsState, PerAccountApplicableAction } from '../types';
import {
INIT_TOPICS,
EVENT_NEW_MESSAGE,
REGISTER_COMPLETE,
RESET_ACCOUNT_DATA,
} from '../actionConstants';
import { NULL_OBJECT } from '../nullObjects';
import { replaceItemInArray } from '../utils/immutability';
const initialState: TopicsState = NULL_OBJECT;
const eventNewMessage = (state, action) => {
if (action.message.type !== 'stream') {
return state;
}
if (!state[action.message.stream_id]) {
return {
...state,
[action.message.stream_id]: [
{
max_id: action.message.id,
name: action.message.subject,
},
],
};
}
return {
...state,
[action.message.stream_id]: replaceItemInArray(
state[action.message.stream_id],
x => x.name === action.message.subject,
() => ({
max_id: action.message.id,
name: action.message.subject,
}),
),
};
};
export default (
state: TopicsState = initialState, // eslint-disable-line default-param-last
action: PerAccountApplicableAction,
): TopicsState => {
switch (action.type) {
case RESET_ACCOUNT_DATA:
return initialState;
// Reset to clear stale data; payload has no initial data for this model
case REGISTER_COMPLETE:
return initialState;
case INIT_TOPICS:
return {
...state,
[action.streamId]: action.topics,
};
case EVENT_NEW_MESSAGE:
return eventNewMessage(state, action);
default:
return state;
}
};
```
|
/content/code_sandbox/src/topics/topicsReducer.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 350
|
```javascript
/* @flow strict-local */
import { createSelector } from 'reselect';
import type { Narrow, Selector, TopicExtended, TopicsState } from '../types';
import { getTopics } from '../directSelectors';
import { getUnread, getUnreadCountForTopic } from '../unread/unreadModel';
import { NULL_ARRAY } from '../nullObjects';
import { isStreamNarrow, streamIdOfNarrow } from '../utils/narrow';
import { getMute, isTopicVisible } from '../mute/muteModel';
import { getSubscriptionsById } from '../subscriptions/subscriptionSelectors';
export const getTopicsForNarrow: Selector<$ReadOnlyArray<string>, Narrow> = createSelector(
(state, narrow) => narrow,
state => getTopics(state),
(narrow: Narrow, topics: TopicsState) => {
if (!isStreamNarrow(narrow)) {
return NULL_ARRAY;
}
const streamId = streamIdOfNarrow(narrow);
if (!topics[streamId]) {
return NULL_ARRAY;
}
return topics[streamId].map(x => x.name);
},
);
export const getTopicsForStream: Selector<?$ReadOnlyArray<TopicExtended>, number> = createSelector(
(state, streamId) => streamId,
(state, streamId) => getTopics(state)[streamId],
(state, streamId) => getSubscriptionsById(state).get(streamId),
state => getMute(state),
state => getUnread(state),
(streamId, topicList, subscription, mute, unread) => {
if (!topicList) {
return undefined;
}
return topicList.map(({ name, max_id }): TopicExtended => {
// prettier-ignore
const isMuted = subscription
? !isTopicVisible(streamId, name, subscription, mute)
// If we're looking at a stream the user isn't subscribed to, then
// they won't see unreads from it even if they somehow have
// individual topics set to unmuted. So effectively it's all muted.
: true;
const unreadCount = getUnreadCountForTopic(unread, streamId, name);
return { name, max_id, isMuted, unreadCount };
});
},
);
```
|
/content/code_sandbox/src/topics/topicSelectors.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 483
|
```javascript
/* @flow strict-local */
import deepFreeze from 'deep-freeze';
import * as eg from '../../__tests__/lib/exampleData';
import topicsReducer from '../topicsReducer';
import { INIT_TOPICS } from '../../actionConstants';
import { NULL_OBJECT } from '../../nullObjects';
describe('topicsReducer', () => {
describe('REGISTER_COMPLETE', () => {
test('resets state to initial state', () => {
const prevState = deepFreeze({ [eg.stream.stream_id]: [{ max_id: 1, name: 'some topic' }] });
const action = eg.action.register_complete;
expect(topicsReducer(prevState, action)).toEqual(eg.baseReduxState.topics);
});
});
describe('RESET_ACCOUNT_DATA', () => {
test('resets state to initial state', () => {
const prevState = deepFreeze({ [eg.stream.stream_id]: [{ max_id: 1, name: 'some topic' }] });
expect(topicsReducer(prevState, eg.action.reset_account_data)).toEqual(NULL_OBJECT);
});
});
describe('INIT_TOPICS', () => {
test('adds new topics mapped to stream id', () => {
const prevState = eg.plusReduxState.topics;
expect(
topicsReducer(
prevState,
deepFreeze({
type: INIT_TOPICS,
streamId: eg.stream.stream_id,
topics: [
{ max_id: 1, name: 'topic1' },
{ max_id: 3, name: 'topic1' },
],
}),
),
).toEqual({
[eg.stream.stream_id]: [
{ max_id: 1, name: 'topic1' },
{ max_id: 3, name: 'topic1' },
],
});
});
test('if topics for stream already exist, replace them', () => {
const prevState = deepFreeze({ [eg.stream.stream_id]: [{ max_id: 1, name: 'some topic' }] });
expect(
topicsReducer(
prevState,
deepFreeze({
type: INIT_TOPICS,
streamId: eg.stream.stream_id,
topics: [
{ max_id: 2, name: 'topic1' },
{ max_id: 3, name: 'topic1' },
],
}),
),
).toEqual({
[eg.stream.stream_id]: [
{ max_id: 2, name: 'topic1' },
{ max_id: 3, name: 'topic1' },
],
});
});
});
describe('EVENT_NEW_MESSAGE', () => {
test('if message is not in stream do not change state', () => {
const prevState = eg.plusReduxState.topics;
expect(topicsReducer(prevState, eg.mkActionEventNewMessage(eg.pmMessage()))).toBe(prevState);
});
test('if stream message and topic exists update with latest message id', () => {
const stream = eg.stream;
const topic = 'some topic';
const oldMessage = eg.streamMessage({ id: 1, stream, subject: topic });
const newMessage = eg.streamMessage({ id: 2, stream, subject: topic });
const prevState = { [stream.stream_id]: [{ max_id: oldMessage.id, name: topic }] };
expect(topicsReducer(prevState, eg.mkActionEventNewMessage(newMessage))).toEqual({
[stream.stream_id]: [{ max_id: newMessage.id, name: topic }],
});
});
test('if stream message and topic does not exist, add it', () => {
const stream = eg.stream;
const topic = 'some topic';
const message = eg.streamMessage({ stream, subject: topic });
const prevState = eg.plusReduxState.topics;
expect(topicsReducer(prevState, eg.mkActionEventNewMessage(message))).toEqual({
[stream.stream_id]: [{ max_id: message.id, name: topic }],
});
});
});
});
```
|
/content/code_sandbox/src/topics/__tests__/topicsReducer-test.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 845
|
```javascript
/* @flow strict-local */
import { getTopicsForNarrow, getTopicsForStream } from '../topicSelectors';
import { HOME_NARROW, streamNarrow } from '../../utils/narrow';
import * as eg from '../../__tests__/lib/exampleData';
import { makeMuteState } from '../../mute/__tests__/mute-testlib';
import { makeUnreadState } from '../../unread/__tests__/unread-testlib';
describe('getTopicsForNarrow', () => {
test('when no topics return an empty list', () => {
const state = eg.reduxStatePlus();
const topics = getTopicsForNarrow(state, HOME_NARROW);
expect(topics).toEqual([]);
});
test('when there are topics in the active narrow, return them as string array', () => {
const state = eg.reduxStatePlus({
topics: {
// prettier-ignore
[eg.stream.stream_id]: [{ name: 'hi', max_id: 123 }, { name: 'wow', max_id: 234 }],
},
});
const topics = getTopicsForNarrow(state, streamNarrow(eg.stream.stream_id));
expect(topics).toEqual(['hi', 'wow']);
});
});
describe('getTopicsForStream', () => {
test('when no topics loaded for given stream return undefined', () => {
const state = eg.reduxStatePlus({
topics: {},
});
const topics = getTopicsForStream(state, eg.stream.stream_id);
expect(topics).toEqual(undefined);
});
test('when topics loaded for given stream return them', () => {
const state = eg.reduxStatePlus({
topics: {
[eg.stream.stream_id]: [{ name: 'topic', max_id: 456 }],
},
});
const topics = getTopicsForStream(state, eg.stream.stream_id);
expect(topics).toEqual([{ name: 'topic', max_id: 456, isMuted: false, unreadCount: 0 }]);
});
test('Return list of topic object with isMuted, unreadCount, topic name and max id in it.', () => {
const state = eg.reduxStatePlus({
topics: {
[eg.stream.stream_id]: [
{ name: 'topic 1', max_id: 5 },
{ name: 'topic 2', max_id: 6 },
{ name: 'topic 3', max_id: 7 },
{ name: 'topic 4', max_id: 8 },
{ name: 'topic 5', max_id: 9 },
],
},
mute: makeMuteState([
[eg.stream, 'topic 1'],
[eg.stream, 'topic 3'],
[eg.otherStream, 'topic 2'],
]),
unread: makeUnreadState(eg.plusReduxState, [
eg.streamMessage({ stream: eg.stream, subject: 'topic 2', id: 1 }),
eg.streamMessage({ stream: eg.stream, subject: 'topic 2', id: 5 }),
eg.streamMessage({ stream: eg.stream, subject: 'topic 2', id: 6 }),
eg.streamMessage({ stream: eg.stream, subject: 'topic 4', id: 7 }),
eg.streamMessage({ stream: eg.stream, subject: 'topic 4', id: 8 }),
]),
});
const expected = [
{ name: 'topic 1', max_id: 5, isMuted: true, unreadCount: 0 },
{ name: 'topic 2', max_id: 6, isMuted: false, unreadCount: 3 },
{ name: 'topic 3', max_id: 7, isMuted: true, unreadCount: 0 },
{ name: 'topic 4', max_id: 8, isMuted: false, unreadCount: 2 },
{ name: 'topic 5', max_id: 9, isMuted: false, unreadCount: 0 },
];
const topics = getTopicsForStream(state, eg.stream.stream_id);
expect(topics).toEqual(expected);
});
});
```
|
/content/code_sandbox/src/topics/__tests__/topicsSelectors-test.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 891
|
```javascript
/* @flow strict-local */
import type { UserGroupsState, PerAccountApplicableAction } from '../types';
import {
REGISTER_COMPLETE,
EVENT_USER_GROUP_ADD,
EVENT_USER_GROUP_REMOVE,
EVENT_USER_GROUP_UPDATE,
EVENT_USER_GROUP_ADD_MEMBERS,
EVENT_USER_GROUP_REMOVE_MEMBERS,
RESET_ACCOUNT_DATA,
} from '../actionConstants';
import { NULL_ARRAY } from '../nullObjects';
const initialState: UserGroupsState = NULL_ARRAY;
const eventUserGroupUpdate = (state, action) =>
state.map(userGroup =>
action.group_id !== userGroup.id
? userGroup
: {
...userGroup,
...action.data,
},
);
const eventUserGroupAddMembers = (state, action) =>
state.map(userGroup =>
action.group_id !== userGroup.id
? userGroup
: {
...userGroup,
members: [...userGroup.members, ...action.user_ids],
},
);
const eventUserGroupRemoveMembers = (state, action) =>
state.map(userGroup =>
action.group_id !== userGroup.id
? userGroup
: {
...userGroup,
members: userGroup.members.filter(x => !action.user_ids.includes(x)),
},
);
export default (
state: UserGroupsState = initialState, // eslint-disable-line default-param-last
action: PerAccountApplicableAction,
): UserGroupsState => {
switch (action.type) {
case RESET_ACCOUNT_DATA:
return initialState;
case REGISTER_COMPLETE:
return action.data.realm_user_groups;
case EVENT_USER_GROUP_ADD:
return [...state, action.group];
case EVENT_USER_GROUP_REMOVE:
return state.filter(x => action.group_id !== x.id);
case EVENT_USER_GROUP_UPDATE:
return eventUserGroupUpdate(state, action);
case EVENT_USER_GROUP_ADD_MEMBERS:
return eventUserGroupAddMembers(state, action);
case EVENT_USER_GROUP_REMOVE_MEMBERS:
return eventUserGroupRemoveMembers(state, action);
default:
return state;
}
};
```
|
/content/code_sandbox/src/user-groups/userGroupsReducer.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 426
|
```javascript
/* @flow strict-local */
import React, { useCallback, useContext, useMemo } from 'react';
import type { Node } from 'react';
import { View } from 'react-native';
import { IconPeople } from '../common/Icons';
import ZulipText from '../common/ZulipText';
import Touchable from '../common/Touchable';
import { createStyleSheet, ThemeContext } from '../styles';
const componentStyles = createStyleSheet({
text: {
marginLeft: 8,
},
textEmail: {
fontSize: 10,
color: 'hsl(0, 0%, 60%)',
},
textWrapper: {
flex: 1,
},
});
type Props = $ReadOnly<{|
name: string,
description: string,
onPress: (name: string) => void,
|}>;
export default function UserGroupItem(props: Props): Node {
const { name, description, onPress } = props;
const handlePress = useCallback(() => {
onPress(name);
}, [onPress, name]);
const themeContext = useContext(ThemeContext);
const styles = useMemo(
() => ({
wrapper: {
flexDirection: 'row',
alignItems: 'center',
padding: 8,
// Minimum touch target height:
// path_to_url#layout-and-typography
minHeight: 48,
},
}),
[],
);
return (
<Touchable onPress={handlePress}>
<View style={styles.wrapper}>
<IconPeople
// Match the size of the avatar in UserItem, which also appears in
// the people autocomplete. We're counting on this icon being a
// square.
size={32}
color={themeContext.color}
/>
<View style={componentStyles.textWrapper}>
<ZulipText
style={componentStyles.text}
text={name}
numberOfLines={1}
ellipsizeMode="tail"
/>
<ZulipText
style={[componentStyles.text, componentStyles.textEmail]}
text={description}
numberOfLines={1}
ellipsizeMode="tail"
/>
</View>
</View>
</Touchable>
);
}
```
|
/content/code_sandbox/src/user-groups/UserGroupItem.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 472
|
```javascript
/* @flow strict-local */
import deepFreeze from 'deep-freeze';
import * as eg from '../../__tests__/lib/exampleData';
import {
EVENT_USER_GROUP_ADD,
EVENT_USER_GROUP_REMOVE,
EVENT_USER_GROUP_UPDATE,
EVENT_USER_GROUP_ADD_MEMBERS,
EVENT_USER_GROUP_REMOVE_MEMBERS,
} from '../../actionConstants';
import userGroupsReducer from '../userGroupsReducer';
describe('userGroupsReducer', () => {
describe('REGISTER_COMPLETE', () => {
test('when data is provided init state with it', () => {
const group = eg.makeUserGroup();
const prevState = deepFreeze(eg.plusReduxState.userGroups);
expect(
userGroupsReducer(prevState, eg.mkActionRegisterComplete({ realm_user_groups: [group] })),
).toEqual([group]);
});
});
describe('RESET_ACCOUNT_DATA', () => {
test('resets state to initial state', () => {
const prevState = deepFreeze([eg.makeUserGroup()]);
expect(userGroupsReducer(prevState, eg.action.reset_account_data)).toEqual([]);
});
});
describe('EVENT_USER_GROUP_ADD', () => {
test('adds a user group to the state', () => {
const group = eg.makeUserGroup();
const prevState = deepFreeze([]);
expect(
userGroupsReducer(
prevState,
deepFreeze({ id: 1, type: EVENT_USER_GROUP_ADD, op: 'add', group }),
),
).toEqual([group]);
});
});
describe('EVENT_USER_GROUP_REMOVE', () => {
test('if user group does not exist state does not change', () => {
const prevState = deepFreeze([]);
expect(
userGroupsReducer(
prevState,
deepFreeze({ id: 1, type: EVENT_USER_GROUP_REMOVE, op: 'remove', group_id: 1 }),
),
).toEqual([]);
});
test('adds a user group to the state', () => {
const group1 = eg.makeUserGroup();
const group2 = eg.makeUserGroup();
const prevState = deepFreeze([group1, group2]);
expect(
userGroupsReducer(
prevState,
deepFreeze({ id: 1, type: EVENT_USER_GROUP_REMOVE, op: 'remove', group_id: group1.id }),
),
).toEqual([group2]);
});
});
describe('EVENT_USER_GROUP_UPDATE', () => {
test('if user group does not exist state does not change', () => {
const prevState = deepFreeze([]);
expect(
userGroupsReducer(
prevState,
deepFreeze({
id: 1,
type: EVENT_USER_GROUP_UPDATE,
op: 'update',
group_id: 1,
data: { name: 'Some name' },
}),
),
).toEqual([]);
});
test('updates an existing user group with supplied new values', () => {
const group1 = eg.makeUserGroup();
const group2 = eg.makeUserGroup();
const prevState = deepFreeze([group1, group2]);
expect(
userGroupsReducer(
prevState,
deepFreeze({
id: 1,
type: EVENT_USER_GROUP_UPDATE,
op: 'update',
group_id: group2.id,
data: { name: 'New name' },
}),
),
).toEqual([group1, { ...group2, name: 'New name' }]);
});
});
describe('EVENT_USER_GROUP_ADD_MEMBERS', () => {
test('if user group does not exist state does not change', () => {
const prevState = deepFreeze([]);
expect(
userGroupsReducer(
prevState,
deepFreeze({
id: 1,
type: EVENT_USER_GROUP_ADD_MEMBERS,
op: 'add_members',
group_id: 1,
user_ids: [eg.makeUser().user_id, eg.makeUser().user_id, eg.makeUser().user_id],
}),
),
).toEqual([]);
});
test('updates an existing user group with supplied new members', () => {
const group = eg.makeUserGroup({ members: [eg.selfUser.user_id] });
const prevState = deepFreeze([group]);
expect(
userGroupsReducer(
prevState,
deepFreeze({
id: 1,
type: EVENT_USER_GROUP_ADD_MEMBERS,
op: 'add_members',
group_id: group.id,
user_ids: [eg.otherUser.user_id, eg.thirdUser.user_id],
}),
),
).toEqual([
{ ...group, members: [eg.selfUser.user_id, eg.otherUser.user_id, eg.thirdUser.user_id] },
]);
});
});
describe('EVENT_USER_GROUP_REMOVE_MEMBERS', () => {
test('if user group does not exist state does not change', () => {
const prevState = deepFreeze([]);
expect(
userGroupsReducer(
prevState,
deepFreeze({
id: 1,
type: EVENT_USER_GROUP_REMOVE_MEMBERS,
op: 'remove_members',
group_id: 1,
user_ids: [eg.makeUser().user_id],
}),
),
).toEqual([]);
});
test('removes members from an existing user group', () => {
const user1 = eg.makeUser();
const user2 = eg.makeUser();
const user3 = eg.makeUser();
const user4 = eg.makeUser();
const group1 = eg.makeUserGroup({
members: [user1.user_id, user2.user_id, user3.user_id, user4.user_id],
});
const group2 = eg.makeUserGroup({
members: [user1.user_id, user2.user_id, user3.user_id, user4.user_id],
});
const prevState = deepFreeze([group1, group2]);
expect(
userGroupsReducer(
prevState,
deepFreeze({
id: 1,
type: EVENT_USER_GROUP_REMOVE_MEMBERS,
op: 'remove_members',
group_id: group1.id,
user_ids: [user2.user_id, user3.user_id],
}),
),
).toEqual([{ ...group1, members: [user1.user_id, user4.user_id] }, group2]);
});
});
});
```
|
/content/code_sandbox/src/user-groups/__tests__/userGroupsReducer-test.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 1,336
|
```javascript
/* @flow strict-local */
import React, { useCallback } from 'react';
import type { Node } from 'react';
import { View } from 'react-native';
import type { EmojiType } from '../types';
import { createStyleSheet } from '../styles';
import ZulipText from '../common/ZulipText';
import Touchable from '../common/Touchable';
import Emoji from './Emoji';
const styles = createStyleSheet({
emojiRow: {
flexDirection: 'row',
padding: 8,
alignItems: 'center',
},
text: {
paddingLeft: 6,
},
});
type Props = $ReadOnly<{|
type: EmojiType,
code: string,
name: string,
onPress: ({| +type: EmojiType, +code: string, +name: string |}) => void,
|}>;
export default function EmojiRow(props: Props): Node {
const { code, name, type, onPress } = props;
const handlePress = useCallback(() => {
onPress({ type, code, name });
}, [onPress, type, code, name]);
return (
<Touchable onPress={handlePress}>
<View style={styles.emojiRow}>
<Emoji code={code} type={type} />
<ZulipText style={styles.text} text={name} />
</View>
</Touchable>
);
}
```
|
/content/code_sandbox/src/emoji/EmojiRow.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 292
|
```javascript
/* @flow strict-local */
import * as typeahead from '@zulip/shared/lib/typeahead';
import { defaultMemoize } from 'reselect';
import * as api from '../api';
import * as logging from '../utils/logging';
import type {
ThunkAction,
PerAccountAction,
ServerEmojiData,
EmojiType,
ReactionType,
EmojiForShared,
} from '../types';
import { tryParseUrl } from '../utils/url';
import { REFRESH_SERVER_EMOJI_DATA } from '../actionConstants';
import { unicodeCodeByName, override } from './codePointMap';
import zulipExtraEmojiMap from './zulipExtraEmojiMap';
import { objectEntries, objectValues } from '../flowPonyfill';
import { tryFetch } from '../message/fetchActions';
import { TimeoutError } from '../utils/async';
const refreshServerEmojiData = (data: ServerEmojiData): PerAccountAction => ({
type: REFRESH_SERVER_EMOJI_DATA,
data,
});
export const maybeRefreshServerEmojiData =
(server_emoji_data_url: string | void): ThunkAction<Promise<void>> =>
async (dispatch, getState) => {
if (server_emoji_data_url === undefined) {
// The server is too old to support this feature.
// TODO(server-6.0): Simplify away; should always be present.
return;
}
const parsedUrl = tryParseUrl(server_emoji_data_url);
if (!parsedUrl) {
logging.error('Invalid URL at server_emoji_data_url in /register response');
return;
}
let data = undefined;
try {
data = await tryFetch(() => api.fetchServerEmojiData(parsedUrl), true);
} catch (errorIllTyped) {
const e: mixed = errorIllTyped; // path_to_url
if (!(e instanceof Error)) {
logging.error('Unexpected non-error thrown from api.fetchServerEmojiData');
return;
}
if (e instanceof TimeoutError) {
// Probably not a bug in client code; no need to log. Bad Internet
// connection, probably, or the server's been giving 5xx errors,
// which server admins should track.
return;
}
// Likely client bug.
logging.error(e);
return;
}
dispatch(refreshServerEmojiData(data));
};
const getUnicodeEmojiObjects = (
serverEmojiData: ServerEmojiData | null,
): $ReadOnlyArray<EmojiForShared> => {
if (!serverEmojiData) {
return objectEntries(unicodeCodeByName).map(([name, code]) => ({
reaction_type: 'unicode_emoji',
emoji_type: 'unicode',
emoji_name: name,
emoji_code: code,
}));
}
const result = [];
for (const [code, names] of serverEmojiData.code_to_names.entries()) {
result.push(
...names.map(name => ({
reaction_type: 'unicode_emoji',
emoji_type: 'unicode',
emoji_name: name,
emoji_code: code,
})),
);
}
return result;
};
const getUnicodeEmojiObjectsMemoized = defaultMemoize(getUnicodeEmojiObjects);
/**
* Convert a Unicode emoji's `emoji_code` into the actual Unicode codepoints.
*/
// Implemented to follow the comment on emoji_code in
// path_to_url :
//
// > * For Unicode emoji, [emoji_code is] a dash-separated hex encoding of
// > the sequence of Unicode codepoints that define this emoji in the
// > Unicode specification. For examples, see "non_qualified" or
// > "unified" in the following data, with "non_qualified" taking
// > precedence when both present:
// > path_to_url
const parseUnicodeEmojiCode = (code: string): string /* force line */ =>
code
.split('-')
.map(hex => String.fromCodePoint(parseInt(hex, 16)))
.join('');
export const availableUnicodeEmojiCodes: Set<string> = new Set(objectValues(unicodeCodeByName));
const applyOverride = (code: string): string => override[code] ?? code;
/**
* From a Unicode emoji's `emoji_code`, give the actual character, like .
*
* If the character isn't found, falls back to '?'.
*/
export const displayCharacterForUnicodeEmojiCode = (
code: string,
serverEmojiData: ServerEmojiData | null,
): string => {
if (serverEmojiData?.code_to_names.has(code)) {
return parseUnicodeEmojiCode(applyOverride(code));
} else if (availableUnicodeEmojiCodes.has(code)) {
return parseUnicodeEmojiCode(applyOverride(code));
} else {
return '?';
}
};
// TODO(?): Stop having distinct `EmojiType` and `ReactionType`; confusing?
// path_to_url#discussion_r818320669
export const reactionTypeFromEmojiType = (emojiType: EmojiType, name: string): ReactionType =>
emojiType === 'image'
? zulipExtraEmojiMap[name]
? 'zulip_extra_emoji'
: 'realm_emoji'
: 'unicode_emoji';
// See comment on reactionTypeFromEmojiType, just above.
export const emojiTypeFromReactionType = (reactionType: ReactionType): EmojiType =>
reactionType === 'unicode_emoji' ? 'unicode' : 'image';
/**
* A list of emoji matching the query, in an order to offer to the user.
*
* Note that the same emoji may appear multiple times under different names.
* This allows the user to choose which name to use; the chosen name is the
* one that e.g. is shown to other users on hovering on a reaction.
*
* For example, , the Unicode emoji with code '1f5fd', has the names
* :new_york:, :statue:, and :statue_of_liberty:, and a search like "statu"
* or "" itself will return two or all three of those, respectively.
*/
export const getFilteredEmojis = (
query: string,
activeImageEmoji: $ReadOnlyArray<EmojiForShared>,
serverEmojiData: ServerEmojiData | null,
): $ReadOnlyArray<EmojiForShared> => {
const matcher = typeahead.get_emoji_matcher(query);
const allMatchingEmoji: Map<string, EmojiForShared> = new Map();
for (const emoji of getUnicodeEmojiObjectsMemoized(serverEmojiData)) {
// `matcher`'s match-literal-emoji logic doesn't do special handling for
// skin-tone modifiers or gender modifiers, since Zulip does not
// currently support those: path_to_url
// Once support is added for that, we may want to come back here and
// modify this logic, if for instance, there is a default skin-tone
// setting in the webapp that we want to also surface here. (or
// perhaps it will be best to leave it as is - that's a product
// decision that's yet to be made.) For the time being, it seems
// better to not show the user anything if they've searched for an
// emoji with a modifier than it is to show them the non-modified
// emoji, hence the very simple matching.
if (matcher(emoji)) {
allMatchingEmoji.set(emoji.emoji_name, emoji);
}
}
for (const emoji of activeImageEmoji) {
if (matcher(emoji)) {
allMatchingEmoji.set(emoji.emoji_name, emoji);
}
}
return typeahead.sort_emojis(Array.from(allMatchingEmoji.values()), query);
};
```
|
/content/code_sandbox/src/emoji/data.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 1,633
|
```javascript
/* @flow strict-local */
import { createSelector } from 'reselect';
import type { Selector, ImageEmoji, ImageEmojiById, EmojiForShared } from '../types';
import { getRawRealmEmoji } from '../directSelectors';
import { getIdentity } from '../account/accountsSelectors';
import zulipExtraEmojiMap from './zulipExtraEmojiMap';
import { objectFromEntries } from '../jsBackport';
import type { ReadWrite } from '../generics';
import { objectEntries } from '../flowPonyfill';
export const getAllImageEmojiById: Selector<ImageEmojiById> = createSelector(
getIdentity,
getRawRealmEmoji,
(identity, realmEmoji) => {
const result: ReadWrite<ImageEmojiById> = {};
objectEntries(realmEmoji).forEach(([id, emoji]) => {
result[id] = {
...emoji,
reaction_type: 'realm_emoji',
source_url: new URL(emoji.source_url, identity.realm).toString(),
};
});
objectEntries(zulipExtraEmojiMap).forEach(([id, emoji]) => {
result[id] = {
...emoji,
source_url: new URL(emoji.source_url, identity.realm).toString(),
};
});
return result;
},
);
export const getActiveImageEmojiById: Selector<ImageEmojiById> = createSelector(
getAllImageEmojiById,
emojis => {
const result: ReadWrite<ImageEmojiById> = {};
Object.keys(emojis).forEach(id => {
if (!emojis[id].deactivated) {
result[id] = emojis[id];
}
});
return result;
},
);
export const getAllImageEmojiByCode: Selector<{|
[string]: ImageEmoji,
|}> = createSelector(getAllImageEmojiById, emojis =>
objectFromEntries(Object.keys(emojis).map(id => [emojis[id].code, emojis[id]])),
);
export const getActiveImageEmoji: Selector<$ReadOnlyArray<EmojiForShared>> = createSelector(
getActiveImageEmojiById,
emojis =>
objectEntries(emojis).map(([id, emoji]) => ({
emoji_type: 'image',
reaction_type: emoji.reaction_type,
emoji_name: emoji.name,
emoji_code: emoji.code,
})),
);
```
|
/content/code_sandbox/src/emoji/emojiSelectors.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 476
|
```javascript
/* @flow strict-local */
import React, { useState, useCallback } from 'react';
import type { Node } from 'react';
import { FlatList, LogBox } from 'react-native';
import type { RouteProp } from '../react-navigation';
import type { AppNavigationProp } from '../nav/AppNavigator';
import Screen from '../common/Screen';
import EmojiRow from './EmojiRow';
import { getFilteredEmojis } from './data';
import { getActiveImageEmoji } from '../selectors';
import type { EmojiType } from '../types';
import { useSelector } from '../react-redux';
import { getRealm } from '../directSelectors';
type Props = $ReadOnly<{|
navigation: AppNavigationProp<'emoji-picker'>,
route: RouteProp<
'emoji-picker',
{|
// This param is a function, so React Nav is right to point out that
// it isn't serializable. But this is fine as long as we don't try to
// persist navigation state for this screen or set up deep linking to
// it, hence the LogBox suppression below.
//
// React Navigation doesn't offer a more sensible way to have us
// pass the emoji data to the calling screen. We could store the
// emoji data as a route param on the calling screen, or in Redux. But
// from this screen's perspective, that's basically just setting a
// global variable. Better to offer this explicit, side-effect-free
// way for the data to flow where it should, when it should.
onPressEmoji: ({| +type: EmojiType, +code: string, +name: string |}) => void,
|},
>,
|}>;
// React Navigation would give us a console warning about non-serializable
// route params. For more about the warning, see
// path_to_url#your_sha256_hashgation-state
// See comment on this param, above.
LogBox.ignoreLogs([/emoji-picker > params\.onPressEmoji \(Function\)/]);
export default function EmojiPickerScreen(props: Props): Node {
const { navigation, route } = props;
const { onPressEmoji } = route.params;
const activeImageEmoji = useSelector(getActiveImageEmoji);
const serverEmojiData = useSelector(state => getRealm(state).serverEmojiData);
const [filter, setFilter] = useState<string>('');
const handleInputChange = useCallback((text: string) => {
setFilter(text.toLowerCase());
}, []);
const handlePressEmoji = useCallback(
(...args) => {
onPressEmoji(...args);
navigation.goBack();
},
[onPressEmoji, navigation],
);
const filteredEmojis = getFilteredEmojis(filter, activeImageEmoji, serverEmojiData);
return (
<Screen search autoFocus scrollEnabled={false} searchBarOnChange={handleInputChange}>
<FlatList
keyboardShouldPersistTaps="always"
initialNumToRender={20}
data={filteredEmojis}
keyExtractor={item => item.emoji_name}
renderItem={({ item }) => (
<EmojiRow
type={item.emoji_type}
code={item.emoji_code}
name={item.emoji_name}
onPress={handlePressEmoji}
/>
)}
/>
</Screen>
);
}
```
|
/content/code_sandbox/src/emoji/EmojiPickerScreen.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 698
|
```javascript
/* @flow strict-local */
import React, { useContext, useMemo, type Node } from 'react';
import { Text } from 'react-native';
import { ThemeContext } from '../styles';
import { displayCharacterForUnicodeEmojiCode } from './data';
import { useSelector } from '../react-redux';
import { getRealm } from '../directSelectors';
type Props = $ReadOnly<{|
code: string,
size: number,
|}>;
export default function UnicodeEmoji(props: Props): Node {
const { code, size } = props;
const { color } = useContext(ThemeContext);
const serverEmojiData = useSelector(state => getRealm(state).serverEmojiData);
const style = useMemo(
() => ({
fontSize: size,
// Set `color` just to remove some transparency or darkening that's
// somehow getting applied, at least on Android, making emojis
// noticeably faded; not sure how. See a screenshot of the faded
// appearance at
// path_to_url#issuecomment-1062504604
color,
fontWeight: 'normal',
fontStyle: 'normal',
}),
[color, size],
);
return (
<Text selectable={false} allowFontScaling={false} style={style}>
{displayCharacterForUnicodeEmojiCode(code, serverEmojiData)}
</Text>
);
}
```
|
/content/code_sandbox/src/emoji/UnicodeEmoji.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 289
|
```javascript
/* @flow strict-local */
import React, { useMemo } from 'react';
import type { Node } from 'react';
import { Image } from 'react-native';
import type { EmojiType } from '../types';
import { createStyleSheet } from '../styles';
import { useSelector } from '../react-redux';
import { getAllImageEmojiByCode } from './emojiSelectors';
import UnicodeEmoji from './UnicodeEmoji';
type Props = $ReadOnly<{|
type: EmojiType,
code: string,
size?: number,
|}>;
export default function Emoji(props: Props): Node {
const { code, size = 20 } = props;
const imageEmoji = useSelector(state =>
props.type === 'image' ? getAllImageEmojiByCode(state)[props.code] : undefined,
);
const componentStyles = useMemo(
() => createStyleSheet({ image: { width: size, height: size } }),
[size],
);
if (imageEmoji) {
return <Image style={componentStyles.image} source={{ uri: imageEmoji.source_url }} />;
}
return <UnicodeEmoji code={code} size={size} />;
}
```
|
/content/code_sandbox/src/emoji/Emoji.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 239
|
```javascript
/* @flow strict-local */
import type { ImageEmoji } from '../types';
/**
* Make this to ressemble with realm emoji
* so that both emoji type can be handled in similiar way
* thus id has no meaning here
*/
const zulipExtraEmojiMap: {| [id: string]: ImageEmoji |} = {
zulip: {
reaction_type: 'zulip_extra_emoji',
deactivated: false,
code: 'zulip',
name: 'zulip',
source_url: '/static/generated/emoji/images/emoji/unicode/zulip.png',
},
};
export default zulipExtraEmojiMap;
```
|
/content/code_sandbox/src/emoji/zulipExtraEmojiMap.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 141
|
```javascript
import deepFreeze from 'deep-freeze';
import {
getActiveImageEmojiById,
getAllImageEmojiById,
getAllImageEmojiByCode,
} from '../emojiSelectors';
describe('getActiveImageEmojiById', () => {
test('filter out all deactivated emojis', () => {
const state = {
accounts: [
{
realm: new URL('path_to_url
},
],
realm: {
emoji: {
1: {
deactivated: false,
source_url: '/static/user_upload/smile.png',
},
2: {
deactivated: false,
source_url: '/static/user_upload/laugh.png',
},
3: {
deactivated: true,
source_url: '/static/user_upload/sad.png',
},
},
},
};
const expectedResult = {
1: {
reaction_type: 'realm_emoji',
deactivated: false,
source_url: 'path_to_url
},
2: {
reaction_type: 'realm_emoji',
deactivated: false,
source_url: 'path_to_url
},
zulip: {
reaction_type: 'zulip_extra_emoji',
deactivated: false,
name: 'zulip',
code: 'zulip',
source_url: 'path_to_url
},
};
expect(getActiveImageEmojiById(deepFreeze(state))).toEqual(expectedResult);
});
});
describe('getAllImageEmojiById', () => {
test('get realm emojis with absolute url', () => {
const state = {
accounts: [{ realm: new URL('path_to_url }],
realm: {
emoji: {
1: {
source_url: '/static/user_upload/smile.png',
},
2: {
source_url: 'path_to_url
},
},
},
};
const expectedResult = {
'1': {
reaction_type: 'realm_emoji',
source_url: 'path_to_url
},
'2': {
reaction_type: 'realm_emoji',
source_url: 'path_to_url
},
zulip: {
reaction_type: 'zulip_extra_emoji',
deactivated: false,
name: 'zulip',
code: 'zulip',
source_url: 'path_to_url
},
};
expect(getAllImageEmojiById(deepFreeze(state))).toEqual(expectedResult);
});
});
describe('getAllImageEmojiByCode', () => {
test('get realm emoji object with emoji names as the keys', () => {
const state = {
accounts: [{ realm: new URL('path_to_url }],
realm: {
emoji: {
1: {
code: '1',
name: 'smile',
source_url: 'path_to_url
},
2: {
code: '2',
name: 'laugh',
source_url: 'path_to_url
},
},
},
};
const expectedResult = {
1: {
reaction_type: 'realm_emoji',
code: '1',
name: 'smile',
source_url: 'path_to_url
},
2: {
reaction_type: 'realm_emoji',
code: '2',
name: 'laugh',
source_url: 'path_to_url
},
zulip: {
reaction_type: 'zulip_extra_emoji',
deactivated: false,
name: 'zulip',
code: 'zulip',
source_url: 'path_to_url
},
};
expect(getAllImageEmojiByCode(deepFreeze(state))).toEqual(expectedResult);
});
});
```
|
/content/code_sandbox/src/emoji/__tests__/emojiSelectors-test.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 800
|
```javascript
/* @flow strict-local */
import { displayCharacterForUnicodeEmojiCode, getFilteredEmojis } from '../data';
describe('displayCharacterForUnicodeEmojiCode', () => {
// Tell ESLint to recognize `check` as a helper function that runs
// assertions.
/* eslint jest/expect-expect: ["error", { "assertFunctionNames": ["expect", "check"] }] */
const check = (emojiCode, string1, string2) => {
expect(string1).toEqual(string2);
expect(displayCharacterForUnicodeEmojiCode(emojiCode, null)).toEqual(string1);
};
test('works for some single-codepoint emoji', () => {
check('1f44d', '', '\u{1f44d}');
check('1f308', '', '\u{1f308}');
});
// test_('works for some multi-codepoint emoji', () => {
// The only multi-codepoint emoji in the list are keypad emoji,
// which are special in a different way.
test('works for some overridden keypad emoji', () => {
check('0030-20e3', '0', '0\u{fe0f}\u{20e3}');
check('002a-20e3', '*', '*\u{fe0f}\u{20e3}');
check('0023-20e3', '#', '#\u{fe0f}\u{20e3}');
});
});
describe('getFilteredEmojis', () => {
const names = query => getFilteredEmojis(query, [], null).map(e => e.emoji_name);
test('empty query returns many emojis', () => {
// 1400 so that we don't have to change the test every time we change the
// emoji map, while still ensuring that enough emoji are there that we can
// be reasonably confident it's all of them.
expect(names('').length).toBeGreaterThan(1400);
});
test('non existing query returns empty list', () => {
expect(names('qwerty')).toHaveLength(0);
});
test('returns a sorted list of emojis starting with query', () => {
expect(names('go')).toEqual([
'go',
'goal',
'goat',
'goblin',
'gold',
'gold_record',
'golf',
'gondola',
'goodnight',
'gooooooooal',
'gorilla',
'got_it',
'agony',
'all_good',
'dango',
'dragon',
'dragon_face',
'easy_come_easy_go',
'heart_of_gold',
'merry_go_round',
'octagonal_sign',
'synagogue',
'virgo',
]);
});
test('matches starting at non-first word, too', () => {
expect(names('ice_cream')).toEqual(['ice_cream', 'soft_ice_cream']);
expect(names('blue_dia')).toEqual(['large_blue_diamond', 'small_blue_diamond']);
// And the prefix match comes first, even when it'd be later alphabetically:
expect(names('police_')).toEqual(['police_car', 'oncoming_police_car']);
});
describe('matches query with spaces instead of underscores', () => {
for (const query of ['big smile', 'ice cream', 'blue dia', 'police ', 'police c']) {
test(query, () => expect(names(query)).toEqual(names(query.replace(' ', '_'))));
}
});
test('returns literal emoji', () => {
expect(names('')).toEqual(['black_heart']);
});
test('returns multiple literal emoji', () => {
expect(names('')).toEqual(['+1', 'thumbs_up']);
});
test('search in realm emojis as well', () => {
const emoji = {
reaction_type: 'realm_emoji',
emoji_type: 'image',
emoji_code: '654',
emoji_name: 'qwerty',
};
expect(getFilteredEmojis('qwerty', [emoji], null)).toEqual([emoji]);
});
test('remove duplicates', () => {
expect(names('dog')).toEqual(['dog', 'dogi', 'hotdog']);
const emoji = {
reaction_type: 'realm_emoji',
emoji_type: 'image',
emoji_code: '345',
emoji_name: 'dog',
};
expect(getFilteredEmojis('dog', [emoji], null)).toEqual([
{ reaction_type: 'realm_emoji', emoji_type: 'image', emoji_code: '345', emoji_name: 'dog' },
{
reaction_type: 'unicode_emoji',
emoji_type: 'unicode',
emoji_code: '1f94b',
emoji_name: 'dogi',
},
{
reaction_type: 'unicode_emoji',
emoji_type: 'unicode',
emoji_code: '1f32d',
emoji_name: 'hotdog',
},
]);
});
test('prioritizes popular emoji', () => {
// :octopus: is prioritized, despite :octagonal_sign: coming first in
// alphabetical order.
expect(names('oct')).toEqual(['octopus', 'octagonal_sign']);
});
});
```
|
/content/code_sandbox/src/emoji/__tests__/data-test.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 1,125
|
```javascript
// flow-typed signature: 99b2d8ebd0ab4be20976dc62a3bbf54c
// flow-typed version: c6154227d1/redux_v4.x.x/flow_>=v0.89.x <=v0.103.x
declare module 'redux' {
/*
S = State
A = Action
D = Dispatch
*/
declare export type Action<T> = {
type: T,
...
}
declare export type DispatchAPI<A> = (action: A) => A;
declare export type Dispatch<A: { +type: mixed, ... }> = DispatchAPI<A>;
declare export type MiddlewareAPI<S, A, D = Dispatch<A>> = {|
dispatch: D,
getState(): S,
|};
declare export type Store<S, A, D = Dispatch<A>> = {|
// rewrite MiddlewareAPI members in order to get nicer error messages (intersections produce long messages)
dispatch: D,
getState(): S,
subscribe(listener: () => void): () => void,
replaceReducer(nextReducer: Reducer<S, A>): void,
|};
declare export type Reducer<S, -A> = (state: S | void, action: A) => S;
declare export type CombinedReducer<S, A> = (
state: ($Shape<S> & { ... }) | void,
action: A
) => S;
declare export type Middleware<S, A, D = Dispatch<A>> = (
api: MiddlewareAPI<S, A, D>
) => (next: D) => D;
declare export type StoreCreator<S, A, D = Dispatch<A>> = {|
(reducer: Reducer<S, A>, enhancer?: StoreEnhancer<S, A, D>): Store<S, A, D>,
(
reducer: Reducer<S, A>,
preloadedState: S,
enhancer?: StoreEnhancer<S, A, D>
): Store<S, A, D>,
|};
declare export type StoreEnhancer<S, A, D = Dispatch<A>> = (
next: StoreCreator<S, A, D>
) => StoreCreator<S, A, D>;
declare export function createStore<S, A, D>(
reducer: Reducer<S, A>,
enhancer?: StoreEnhancer<S, A, D>
): Store<S, A, D>;
declare export function createStore<S, A, D>(
reducer: Reducer<S, A>,
preloadedState?: S,
enhancer?: StoreEnhancer<S, A, D>
): Store<S, A, D>;
declare export function applyMiddleware<S, A, D>(
...middlewares: Array<Middleware<S, A, D>>
): StoreEnhancer<S, A, D>;
declare export type ActionCreator<A, -B> = (...args: $ReadOnlyArray<B>) => A;
declare export type ActionCreators<K, A> = {|
[key: K]: ActionCreator<A, empty>,
|};
declare export function bindActionCreators<
A,
C: ActionCreator<A, empty>,
D: DispatchAPI<A>
>(
actionCreator: C,
dispatch: D
): C;
declare export function bindActionCreators<
A,
K,
C: ActionCreators<K, A>,
D: DispatchAPI<A>
>(
actionCreators: C,
dispatch: D
): C;
declare export function combineReducers<O: { ... }, A>(
reducers: O
): CombinedReducer<$ObjMap<O, <S>(r: Reducer<S, A>) => S>, A>;
declare export var compose: $Compose;
}
```
|
/content/code_sandbox/flow-typed/redux_v4.x.x.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 801
|
```javascript
// flow-typed signature: 5ddcf688200e3506308fdcfa78ca48d9
// flow-typed version: 644a595e77/jest_v27.x.x/flow_>=v0.134.x
type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = {
(...args: TArguments): TReturn,
/**
* An object for introspecting mock calls
*/
mock: {
/**
* An array that represents all calls that have been made into this mock
* function. Each call is represented by an array of arguments that were
* passed during the call.
*/
calls: Array<TArguments>,
/**
* An array that contains all the object instances that have been
* instantiated from this mock function.
*/
instances: Array<TReturn>,
/**
* An array that contains all the object results that have been
* returned by this mock function call
*/
results: Array<{
isThrow: boolean,
value: TReturn,
...
}>,
...
},
/**
* Resets all information stored in the mockFn.mock.calls and
* mockFn.mock.instances arrays. Often this is useful when you want to clean
* up a mock's usage data between two assertions.
*/
mockClear(): void,
/**
* Resets all information stored in the mock. This is useful when you want to
* completely restore a mock back to its initial state.
*/
mockReset(): void,
/**
* Removes the mock and restores the initial implementation. This is useful
* when you want to mock functions in certain test cases and restore the
* original implementation in others. Beware that mockFn.mockRestore only
* works when mock was created with jest.spyOn. Thus you have to take care of
* restoration yourself when manually assigning jest.fn().
*/
mockRestore(): void,
/**
* Accepts a function that should be used as the implementation of the mock.
* The mock itself will still record all calls that go into and instances
* that come from itself -- the only difference is that the implementation
* will also be executed when the mock is called.
*/
mockImplementation(
fn: (...args: TArguments) => TReturn
): JestMockFn<TArguments, TReturn>,
/**
* Accepts a function that will be used as an implementation of the mock for
* one call to the mocked function. Can be chained so that multiple function
* calls produce different results.
*/
mockImplementationOnce(
fn: (...args: TArguments) => TReturn
): JestMockFn<TArguments, TReturn>,
/**
* Accepts a string to use in test result output in place of "jest.fn()" to
* indicate which mock function is being referenced.
*/
mockName(name: string): JestMockFn<TArguments, TReturn>,
/**
* Just a simple sugar function for returning `this`
*/
mockReturnThis(): void,
/**
* Accepts a value that will be returned whenever the mock function is called.
*/
mockReturnValue(value: TReturn): JestMockFn<TArguments, TReturn>,
/**
* Sugar for only returning a value once inside your mock
*/
mockReturnValueOnce(value: TReturn): JestMockFn<TArguments, TReturn>,
/**
* Sugar for jest.fn().mockImplementation(() => Promise.resolve(value))
*/
mockResolvedValue(value: TReturn): JestMockFn<TArguments, Promise<TReturn>>,
/**
* Sugar for jest.fn().mockImplementationOnce(() => Promise.resolve(value))
*/
mockResolvedValueOnce(
value: TReturn
): JestMockFn<TArguments, Promise<TReturn>>,
/**
* Sugar for jest.fn().mockImplementation(() => Promise.reject(value))
*/
mockRejectedValue(value: TReturn): JestMockFn<TArguments, Promise<any>>,
/**
* Sugar for jest.fn().mockImplementationOnce(() => Promise.reject(value))
*/
mockRejectedValueOnce(value: TReturn): JestMockFn<TArguments, Promise<any>>,
...
};
type JestAsymmetricEqualityType = {
/**
* A custom Jasmine equality tester
*/
asymmetricMatch(value: mixed): boolean,
...
};
type JestCallsType = {
allArgs(): mixed,
all(): mixed,
any(): boolean,
count(): number,
first(): mixed,
mostRecent(): mixed,
reset(): void,
...
};
type JestClockType = {
install(): void,
mockDate(date: Date): void,
tick(milliseconds?: number): void,
uninstall(): void,
...
};
type JestMatcherResult = {
message?: string | (() => string),
pass: boolean,
...
};
type JestMatcher = (
received: any,
...actual: Array<any>
) => JestMatcherResult | Promise<JestMatcherResult>;
type JestPromiseType = {
/**
* Use rejects to unwrap the reason of a rejected promise so any other
* matcher can be chained. If the promise is fulfilled the assertion fails.
*/
rejects: JestExpectType,
/**
* Use resolves to unwrap the value of a fulfilled promise so any other
* matcher can be chained. If the promise is rejected the assertion fails.
*/
resolves: JestExpectType,
...
};
/**
* Jest allows functions and classes to be used as test names in test() and
* describe()
*/
type JestTestName = string | Function;
/**
* Plugin: jest-styled-components
*/
type JestStyledComponentsMatcherValue =
| string
| JestAsymmetricEqualityType
| RegExp
| typeof undefined;
type JestStyledComponentsMatcherOptions = {
media?: string,
modifier?: string,
supports?: string,
...
};
type JestStyledComponentsMatchersType = {
toHaveStyleRule(
property: string,
value: JestStyledComponentsMatcherValue,
options?: JestStyledComponentsMatcherOptions
): void,
...
};
/**
* Plugin: jest-enzyme
*/
type EnzymeMatchersType = {
// 5.x
toBeEmpty(): void,
toBePresent(): void,
// 6.x
toBeChecked(): void,
toBeDisabled(): void,
toBeEmptyRender(): void,
toContainMatchingElement(selector: string): void,
toContainMatchingElements(n: number, selector: string): void,
toContainExactlyOneMatchingElement(selector: string): void,
toContainReact(element: React$Element<any>): void,
toExist(): void,
toHaveClassName(className: string): void,
toHaveHTML(html: string): void,
toHaveProp: ((propKey: string, propValue?: any) => void) &
((props: { ... }) => void),
toHaveRef(refName: string): void,
toHaveState: ((stateKey: string, stateValue?: any) => void) &
((state: { ... }) => void),
toHaveStyle: ((styleKey: string, styleValue?: any) => void) &
((style: { ... }) => void),
toHaveTagName(tagName: string): void,
toHaveText(text: string): void,
toHaveValue(value: any): void,
toIncludeText(text: string): void,
toMatchElement(
element: React$Element<any>,
options?: {| ignoreProps?: boolean, verbose?: boolean |}
): void,
toMatchSelector(selector: string): void,
// 7.x
toHaveDisplayName(name: string): void,
...
};
// DOM testing library extensions (jest-dom)
// path_to_url
type DomTestingLibraryType = {
/**
* @deprecated
*/
toBeInTheDOM(container?: HTMLElement): void,
// 4.x
toBeInTheDocument(): void,
toBeVisible(): void,
toBeEmpty(): void,
toBeDisabled(): void,
toBeEnabled(): void,
toBeInvalid(): void,
toBeRequired(): void,
toBeValid(): void,
toContainElement(element: HTMLElement | null): void,
toContainHTML(htmlText: string): void,
toHaveAttribute(attr: string, value?: any): void,
toHaveClass(...classNames: string[]): void,
toHaveFocus(): void,
toHaveFormValues(expectedValues: {| [name: string]: any |}): void,
toHaveStyle(css: string | {| [name: string]: any |}): void,
toHaveTextContent(
text: string | RegExp,
options?: {| normalizeWhitespace: boolean |}
): void,
toHaveValue(value?: string | string[] | number): void,
// 5.x
toHaveDisplayValue(value: string | string[]): void,
toBeChecked(): void,
toBeEmptyDOMElement(): void,
toBePartiallyChecked(): void,
toHaveDescription(text: string | RegExp): void,
...
};
// Jest JQuery Matchers: path_to_url
type JestJQueryMatchersType = {
toExist(): void,
toHaveLength(len: number): void,
toHaveId(id: string): void,
toHaveClass(className: string): void,
toHaveTag(tag: string): void,
toHaveAttr(key: string, val?: any): void,
toHaveProp(key: string, val?: any): void,
toHaveText(text: string | RegExp): void,
toHaveData(key: string, val?: any): void,
toHaveValue(val: any): void,
toHaveCss(css: {| [key: string]: any |}): void,
toBeChecked(): void,
toBeDisabled(): void,
toBeEmpty(): void,
toBeHidden(): void,
toBeSelected(): void,
toBeVisible(): void,
toBeFocused(): void,
toBeInDom(): void,
toBeMatchedBy(sel: string): void,
toHaveDescendant(sel: string): void,
toHaveDescendantWithText(sel: string, text: string | RegExp): void,
...
};
// Jest Extended Matchers: path_to_url
type JestExtendedMatchersType = {
/**
* Note: Currently unimplemented
* Passing assertion
*
* @param {String} message
*/
// pass(message: string): void;
/**
* Note: Currently unimplemented
* Failing assertion
*
* @param {String} message
*/
// fail(message: string): void;
/**
* Use .toBeEmpty when checking if a String '', Array [] or Object {} is empty.
*/
toBeEmpty(): void,
/**
* Use .toBeOneOf when checking if a value is a member of a given Array.
* @param {Array.<*>} members
*/
toBeOneOf(members: any[]): void,
/**
* Use `.toBeNil` when checking a value is `null` or `undefined`.
*/
toBeNil(): void,
/**
* Use `.toSatisfy` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean`.
* @param {Function} predicate
*/
toSatisfy(predicate: (n: any) => boolean): void,
/**
* Use `.toBeArray` when checking if a value is an `Array`.
*/
toBeArray(): void,
/**
* Use `.toBeArrayOfSize` when checking if a value is an `Array` of size x.
* @param {Number} x
*/
toBeArrayOfSize(x: number): void,
/**
* Use `.toIncludeAllMembers` when checking if an `Array` contains all of the same members of a given set.
* @param {Array.<*>} members
*/
toIncludeAllMembers(members: any[]): void,
/**
* Use `.toIncludeAnyMembers` when checking if an `Array` contains any of the members of a given set.
* @param {Array.<*>} members
*/
toIncludeAnyMembers(members: any[]): void,
/**
* Use `.toIncludeSameMembers` when checking if two arrays contain equal values, in any order.
* @param {Array.<*>} members
*/
toIncludeSameMembers(members: any[]): void,
/**
* Use `.toSatisfyAll` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean` for all values in an array.
* @param {Function} predicate
*/
toSatisfyAll(predicate: (n: any) => boolean): void,
/**
* Use `.toBeBoolean` when checking if a value is a `Boolean`.
*/
toBeBoolean(): void,
/**
* Use `.toBeTrue` when checking a value is equal (===) to `true`.
*/
toBeTrue(): void,
/**
* Use `.toBeFalse` when checking a value is equal (===) to `false`.
*/
toBeFalse(): void,
/**
* Use .toBeDate when checking if a value is a Date.
*/
toBeDate(): void,
/**
* Use `.toBeFunction` when checking if a value is a `Function`.
*/
toBeFunction(): void,
/**
* Use `.toHaveBeenCalledBefore` when checking if a `Mock` was called before another `Mock`.
*
* Note: Required Jest version >22
* Note: Your mock functions will have to be asynchronous to cause the timestamps inside of Jest to occur in a differentJS event loop, otherwise the mock timestamps will all be the same
*
* @param {Mock} mock
*/
toHaveBeenCalledBefore(mock: JestMockFn<any, any>): void,
/**
* Use `.toBeNumber` when checking if a value is a `Number`.
*/
toBeNumber(): void,
/**
* Use `.toBeNaN` when checking a value is `NaN`.
*/
toBeNaN(): void,
/**
* Use `.toBeFinite` when checking if a value is a `Number`, not `NaN` or `Infinity`.
*/
toBeFinite(): void,
/**
* Use `.toBePositive` when checking if a value is a positive `Number`.
*/
toBePositive(): void,
/**
* Use `.toBeNegative` when checking if a value is a negative `Number`.
*/
toBeNegative(): void,
/**
* Use `.toBeEven` when checking if a value is an even `Number`.
*/
toBeEven(): void,
/**
* Use `.toBeOdd` when checking if a value is an odd `Number`.
*/
toBeOdd(): void,
/**
* Use `.toBeWithin` when checking if a number is in between the given bounds of: start (inclusive) and end (exclusive).
*
* @param {Number} start
* @param {Number} end
*/
toBeWithin(start: number, end: number): void,
/**
* Use `.toBeObject` when checking if a value is an `Object`.
*/
toBeObject(): void,
/**
* Use `.toContainKey` when checking if an object contains the provided key.
*
* @param {String} key
*/
toContainKey(key: string): void,
/**
* Use `.toContainKeys` when checking if an object has all of the provided keys.
*
* @param {Array.<String>} keys
*/
toContainKeys(keys: string[]): void,
/**
* Use `.toContainAllKeys` when checking if an object only contains all of the provided keys.
*
* @param {Array.<String>} keys
*/
toContainAllKeys(keys: string[]): void,
/**
* Use `.toContainAnyKeys` when checking if an object contains at least one of the provided keys.
*
* @param {Array.<String>} keys
*/
toContainAnyKeys(keys: string[]): void,
/**
* Use `.toContainValue` when checking if an object contains the provided value.
*
* @param {*} value
*/
toContainValue(value: any): void,
/**
* Use `.toContainValues` when checking if an object contains all of the provided values.
*
* @param {Array.<*>} values
*/
toContainValues(values: any[]): void,
/**
* Use `.toContainAllValues` when checking if an object only contains all of the provided values.
*
* @param {Array.<*>} values
*/
toContainAllValues(values: any[]): void,
/**
* Use `.toContainAnyValues` when checking if an object contains at least one of the provided values.
*
* @param {Array.<*>} values
*/
toContainAnyValues(values: any[]): void,
/**
* Use `.toContainEntry` when checking if an object contains the provided entry.
*
* @param {Array.<String, String>} entry
*/
toContainEntry(entry: [string, string]): void,
/**
* Use `.toContainEntries` when checking if an object contains all of the provided entries.
*
* @param {Array.<Array.<String, String>>} entries
*/
toContainEntries(entries: [string, string][]): void,
/**
* Use `.toContainAllEntries` when checking if an object only contains all of the provided entries.
*
* @param {Array.<Array.<String, String>>} entries
*/
toContainAllEntries(entries: [string, string][]): void,
/**
* Use `.toContainAnyEntries` when checking if an object contains at least one of the provided entries.
*
* @param {Array.<Array.<String, String>>} entries
*/
toContainAnyEntries(entries: [string, string][]): void,
/**
* Use `.toBeExtensible` when checking if an object is extensible.
*/
toBeExtensible(): void,
/**
* Use `.toBeFrozen` when checking if an object is frozen.
*/
toBeFrozen(): void,
/**
* Use `.toBeSealed` when checking if an object is sealed.
*/
toBeSealed(): void,
/**
* Use `.toBeString` when checking if a value is a `String`.
*/
toBeString(): void,
/**
* Use `.toEqualCaseInsensitive` when checking if a string is equal (===) to another ignoring the casing of both strings.
*
* @param {String} string
*/
toEqualCaseInsensitive(string: string): void,
/**
* Use `.toStartWith` when checking if a `String` starts with a given `String` prefix.
*
* @param {String} prefix
*/
toStartWith(prefix: string): void,
/**
* Use `.toEndWith` when checking if a `String` ends with a given `String` suffix.
*
* @param {String} suffix
*/
toEndWith(suffix: string): void,
/**
* Use `.toInclude` when checking if a `String` includes the given `String` substring.
*
* @param {String} substring
*/
toInclude(substring: string): void,
/**
* Use `.toIncludeRepeated` when checking if a `String` includes the given `String` substring the correct number of times.
*
* @param {String} substring
* @param {Number} times
*/
toIncludeRepeated(substring: string, times: number): void,
/**
* Use `.toIncludeMultiple` when checking if a `String` includes all of the given substrings.
*
* @param {Array.<String>} substring
*/
toIncludeMultiple(substring: string[]): void,
...
};
// Diffing snapshot utility for Jest (snapshot-diff)
// path_to_url
type SnapshotDiffType = {
/**
* Compare the difference between the actual in the `expect()`
* vs the object inside `valueB` with some extra options.
*/
toMatchDiffSnapshot(
valueB: any,
options?: {|
expand?: boolean,
colors?: boolean,
contextLines?: number,
stablePatchmarks?: boolean,
aAnnotation?: string,
bAnnotation?: string,
|},
testName?: string
): void,
...
};
interface JestExpectType {
not: JestExpectType &
EnzymeMatchersType &
DomTestingLibraryType &
JestJQueryMatchersType &
JestStyledComponentsMatchersType &
JestExtendedMatchersType &
SnapshotDiffType;
/**
* If you have a mock function, you can use .lastCalledWith to test what
* arguments it was last called with.
*/
lastCalledWith(...args: Array<any>): void;
/**
* toBe just checks that a value is what you expect. It uses === to check
* strict equality.
*/
toBe(value: any): void;
/**
* Use .toBeCalledWith to ensure that a mock function was called with
* specific arguments.
*/
toBeCalledWith(...args: Array<any>): void;
/**
* Using exact equality with floating point numbers is a bad idea. Rounding
* means that intuitive things fail.
*/
toBeCloseTo(num: number, delta: any): void;
/**
* Use .toBeDefined to check that a variable is not undefined.
*/
toBeDefined(): void;
/**
* Use .toBeFalsy when you don't care what a value is, you just want to
* ensure a value is false in a boolean context.
*/
toBeFalsy(): void;
/**
* To compare floating point numbers, you can use toBeGreaterThan.
*/
toBeGreaterThan(number: number): void;
/**
* To compare floating point numbers, you can use toBeGreaterThanOrEqual.
*/
toBeGreaterThanOrEqual(number: number): void;
/**
* To compare floating point numbers, you can use toBeLessThan.
*/
toBeLessThan(number: number): void;
/**
* To compare floating point numbers, you can use toBeLessThanOrEqual.
*/
toBeLessThanOrEqual(number: number): void;
/**
* Use .toBeInstanceOf(Class) to check that an object is an instance of a
* class.
*/
toBeInstanceOf(cls: Class<*>): void;
/**
* .toBeNull() is the same as .toBe(null) but the error messages are a bit
* nicer.
*/
toBeNull(): void;
/**
* Use .toBeTruthy when you don't care what a value is, you just want to
* ensure a value is true in a boolean context.
*/
toBeTruthy(): void;
/**
* Use .toBeUndefined to check that a variable is undefined.
*/
toBeUndefined(): void;
/**
* Use .toContain when you want to check that an item is in a list. For
* testing the items in the list, this uses ===, a strict equality check.
*/
toContain(item: any): void;
/**
* Use .toContainEqual when you want to check that an item is in a list. For
* testing the items in the list, this matcher recursively checks the
* equality of all fields, rather than checking for object identity.
*/
toContainEqual(item: any): void;
/**
* Use .toEqual when you want to check that two objects have the same value.
* This matcher recursively checks the equality of all fields, rather than
* checking for object identity.
*/
toEqual(value: any): void;
/**
* Use .toHaveBeenCalled to ensure that a mock function got called.
*/
toHaveBeenCalled(): void;
toBeCalled(): void;
/**
* Use .toHaveBeenCalledTimes to ensure that a mock function got called exact
* number of times.
*/
toHaveBeenCalledTimes(number: number): void;
toBeCalledTimes(number: number): void;
/**
*
*/
toHaveBeenNthCalledWith(nthCall: number, ...args: Array<any>): void;
nthCalledWith(nthCall: number, ...args: Array<any>): void;
/**
*
*/
toHaveReturned(): void;
toReturn(): void;
/**
*
*/
toHaveReturnedTimes(number: number): void;
toReturnTimes(number: number): void;
/**
*
*/
toHaveReturnedWith(value: any): void;
toReturnWith(value: any): void;
/**
*
*/
toHaveLastReturnedWith(value: any): void;
lastReturnedWith(value: any): void;
/**
*
*/
toHaveNthReturnedWith(nthCall: number, value: any): void;
nthReturnedWith(nthCall: number, value: any): void;
/**
* Use .toHaveBeenCalledWith to ensure that a mock function was called with
* specific arguments.
*/
toHaveBeenCalledWith(...args: Array<any>): void;
toBeCalledWith(...args: Array<any>): void;
/**
* Use .toHaveBeenLastCalledWith to ensure that a mock function was last called
* with specific arguments.
*/
toHaveBeenLastCalledWith(...args: Array<any>): void;
lastCalledWith(...args: Array<any>): void;
/**
* Check that an object has a .length property and it is set to a certain
* numeric value.
*/
toHaveLength(number: number): void;
/**
*
*/
toHaveProperty(propPath: string | $ReadOnlyArray<string>, value?: any): void;
/**
* Use .toMatch to check that a string matches a regular expression or string.
*/
toMatch(regexpOrString: RegExp | string): void;
/**
* Use .toMatchObject to check that a javascript object matches a subset of the properties of an object.
*/
toMatchObject(object: Object | Array<Object>): void;
/**
* Use .toStrictEqual to check that a javascript object matches a subset of the properties of an object.
*/
toStrictEqual(value: any): void;
/**
* This ensures that an Object matches the most recent snapshot.
*/
toMatchSnapshot(propertyMatchers?: any, name?: string): void;
/**
* This ensures that an Object matches the most recent snapshot.
*/
toMatchSnapshot(name: string): void;
toMatchInlineSnapshot(snapshot?: string): void;
toMatchInlineSnapshot(propertyMatchers?: any, snapshot?: string): void;
/**
* Use .toThrow to test that a function throws when it is called.
* If you want to test that a specific error gets thrown, you can provide an
* argument to toThrow. The argument can be a string for the error message,
* a class for the error, or a regex that should match the error.
*
* Alias: .toThrowError
*/
toThrow(message?: string | Error | Class<Error> | RegExp): void;
toThrowError(message?: string | Error | Class<Error> | RegExp): void;
/**
* Use .toThrowErrorMatchingSnapshot to test that a function throws a error
* matching the most recent snapshot when it is called.
*/
toThrowErrorMatchingSnapshot(): void;
toThrowErrorMatchingInlineSnapshot(snapshot?: string): void;
}
type JestObjectType = {
/**
* Disables automatic mocking in the module loader.
*
* After this method is called, all `require()`s will return the real
* versions of each module (rather than a mocked version).
*/
disableAutomock(): JestObjectType,
/**
* An un-hoisted version of disableAutomock
*/
autoMockOff(): JestObjectType,
/**
* Enables automatic mocking in the module loader.
*/
enableAutomock(): JestObjectType,
/**
* An un-hoisted version of enableAutomock
*/
autoMockOn(): JestObjectType,
/**
* Clears the mock.calls and mock.instances properties of all mocks.
* Equivalent to calling .mockClear() on every mocked function.
*/
clearAllMocks(): JestObjectType,
/**
* Resets the state of all mocks. Equivalent to calling .mockReset() on every
* mocked function.
*/
resetAllMocks(): JestObjectType,
/**
* Restores all mocks back to their original value.
*/
restoreAllMocks(): JestObjectType,
/**
* Removes any pending timers from the timer system.
*/
clearAllTimers(): void,
/**
* Returns the number of fake timers still left to run.
*/
getTimerCount(): number,
/**
* When mocking time, `Date.now()` will also be mocked. If you for
* some reason need access to the real current time, you can invoke
* this function.
*
* > Note: This function is only available when using modern fake
* > timers implementation
*/
getRealSystemTime(): number,
/**
* Set the current system time used by fake timers. Simulates a
* user changing the system clock while your program is running. It
* affects the current time but it does not in itself cause e.g.
* timers to fire; they will fire exactly as they would have done
* without the call to `jest.setSystemTime()`.
*
* > Note: This function is only available when using modern fake
* > timers implementation
*/
setSystemTime(now?: number | Date): void,
/**
* The same as `mock` but not moved to the top of the expectation by
* babel-jest.
*/
doMock(moduleName: string, moduleFactory?: any): JestObjectType,
/**
* The same as `unmock` but not moved to the top of the expectation by
* babel-jest.
*/
dontMock(moduleName: string): JestObjectType,
/**
* Returns a new, unused mock function. Optionally takes a mock
* implementation.
*/
fn<TArguments: $ReadOnlyArray<*>, TReturn>(
implementation?: (...args: TArguments) => TReturn
): JestMockFn<TArguments, TReturn>,
/**
* Determines if the given function is a mocked function.
*/
isMockFunction(fn: Function): boolean,
/**
* Alias of `createMockFromModule`.
*/
genMockFromModule(moduleName: string): any,
/**
* Given the name of a module, use the automatic mocking system to generate a
* mocked version of the module for you.
*/
createMockFromModule(moduleName: string): any,
/**
* Mocks a module with an auto-mocked version when it is being required.
*
* The second argument can be used to specify an explicit module factory that
* is being run instead of using Jest's automocking feature.
*
* The third argument can be used to create virtual mocks -- mocks of modules
* that don't exist anywhere in the system.
*/
mock(
moduleName: string,
moduleFactory?: any,
options?: Object
): JestObjectType,
/**
* Returns the actual module instead of a mock, bypassing all checks on
* whether the module should receive a mock implementation or not.
*/
requireActual<T>(m: $Flow$ModuleRef<T> | string): T,
/**
* Returns a mock module instead of the actual module, bypassing all checks
* on whether the module should be required normally or not.
*/
requireMock(moduleName: string): any,
/**
* Resets the module registry - the cache of all required modules. This is
* useful to isolate modules where local state might conflict between tests.
*/
resetModules(): JestObjectType,
/**
* Creates a sandbox registry for the modules that are loaded inside the
* callback function. This is useful to isolate specific modules for every
* test so that local module state doesn't conflict between tests.
*/
isolateModules(fn: () => void): JestObjectType,
/**
* Exhausts the micro-task queue (usually interfaced in node via
* process.nextTick).
*/
runAllTicks(): void,
/**
* Exhausts the macro-task queue (i.e., all tasks queued by setTimeout(),
* setInterval(), and setImmediate()).
*/
runAllTimers(): void,
/**
* Exhausts all tasks queued by setImmediate().
*/
runAllImmediates(): void,
/**
* Executes only the macro task queue (i.e. all tasks queued by setTimeout()
* or setInterval() and setImmediate()).
*/
advanceTimersByTime(msToRun: number): void,
/**
* Executes only the macro-tasks that are currently pending (i.e., only the
* tasks that have been queued by setTimeout() or setInterval() up to this
* point)
*/
runOnlyPendingTimers(): void,
/**
* Explicitly supplies the mock object that the module system should return
* for the specified module. Note: It is recommended to use jest.mock()
* instead.
*/
setMock(moduleName: string, moduleExports: any): JestObjectType,
/**
* Indicates that the module system should never return a mocked version of
* the specified module from require() (e.g. that it should always return the
* real module).
*/
unmock(moduleName: string): JestObjectType,
/**
* Instructs Jest to use fake versions of the standard timer functions
* (setTimeout, setInterval, clearTimeout, clearInterval, nextTick,
* setImmediate and clearImmediate).
*/
useFakeTimers(mode?: 'modern' | 'legacy'): JestObjectType,
/**
* Instructs Jest to use the real versions of the standard timer functions.
*/
useRealTimers(): JestObjectType,
/**
* Creates a mock function similar to jest.fn but also tracks calls to
* object[methodName].
*/
spyOn(
object: Object,
methodName: string,
accessType?: 'get' | 'set'
): JestMockFn<any, any>,
/**
* Set the default timeout interval for tests and before/after hooks in milliseconds.
* Note: The default timeout interval is 5 seconds if this method is not called.
*/
setTimeout(timeout: number): JestObjectType,
...
};
type JestSpyType = { calls: JestCallsType, ... };
type JestDoneFn = {|
(error?: Error): void,
fail: (error: Error) => void,
|};
/** Runs this function after every test inside this context */
declare function afterEach(
fn: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number
): void;
/** Runs this function before every test inside this context */
declare function beforeEach(
fn: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number
): void;
/** Runs this function after all tests have finished inside this context */
declare function afterAll(
fn: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number
): void;
/** Runs this function before any tests have started inside this context */
declare function beforeAll(
fn: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number
): void;
/** A context for grouping tests together */
declare var describe: {
/**
* Creates a block that groups together several related tests in one "test suite"
*/
(name: JestTestName, fn: () => void): void,
/**
* Only run this describe block
*/
only(name: JestTestName, fn: () => void): void,
/**
* Skip running this describe block
*/
skip(name: JestTestName, fn: () => void): void,
/**
* each runs this test against array of argument arrays per each run
*
* @param {table} table of Test
*/
each(
...table: Array<Array<mixed> | mixed> | [Array<string>, string]
): (
name: JestTestName,
fn?: (...args: Array<any>) => ?Promise<mixed>,
timeout?: number
) => void,
...
};
/** An individual test unit */
declare var it: {
/**
* An individual test unit
*
* @param {JestTestName} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
(
name: JestTestName,
fn?: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number
): void,
/**
* Only run this test
*
* @param {JestTestName} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
only: {|
(
name: JestTestName,
fn?: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number
): void,
each(
...table: Array<Array<mixed> | mixed> | [Array<string>, string]
): (
name: JestTestName,
fn?: (...args: Array<any>) => ?Promise<mixed>,
timeout?: number
) => void,
|},
/**
* Skip running this test
*
* @param {JestTestName} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
skip: {|
(
name: JestTestName,
fn?: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number
): void,
each(
...table: Array<Array<mixed> | mixed> | [Array<string>, string]
): (
name: JestTestName,
fn?: (...args: Array<any>) => ?Promise<mixed>,
timeout?: number
) => void,
|},
/**
* Highlight planned tests in the summary output
*
* @param {String} Name of Test to do
*/
todo(name: string): void,
/**
* Run the test concurrently
*
* @param {JestTestName} Name of Test
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
concurrent(
name: JestTestName,
fn?: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number
): void,
/**
* each runs this test against array of argument arrays per each run
*
* @param {table} table of Test
*/
each(
...table: Array<Array<mixed> | mixed> | [Array<string>, string]
): (
name: JestTestName,
fn?: (...args: Array<any>) => ?Promise<mixed>,
timeout?: number
) => void,
...
};
declare function fit(
name: JestTestName,
fn: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number
): void;
/** An individual test unit */
declare var test: typeof it;
/** A disabled group of tests */
declare var xdescribe: typeof describe;
/** A focused group of tests */
declare var fdescribe: typeof describe;
/** A disabled individual test */
declare var xit: typeof it;
/** A disabled individual test */
declare var xtest: typeof it;
type JestPrettyFormatColors = {
comment: {
close: string,
open: string,
...
},
content: {
close: string,
open: string,
...
},
prop: {
close: string,
open: string,
...
},
tag: {
close: string,
open: string,
...
},
value: {
close: string,
open: string,
...
},
...
};
type JestPrettyFormatIndent = (string) => string;
type JestPrettyFormatRefs = Array<any>;
type JestPrettyFormatPrint = (any) => string;
type JestPrettyFormatStringOrNull = string | null;
type JestPrettyFormatOptions = {|
callToJSON: boolean,
edgeSpacing: string,
escapeRegex: boolean,
highlight: boolean,
indent: number,
maxDepth: number,
min: boolean,
plugins: JestPrettyFormatPlugins,
printFunctionName: boolean,
spacing: string,
theme: {|
comment: string,
content: string,
prop: string,
tag: string,
value: string,
|},
|};
type JestPrettyFormatPlugin = {
print: (
val: any,
serialize: JestPrettyFormatPrint,
indent: JestPrettyFormatIndent,
opts: JestPrettyFormatOptions,
colors: JestPrettyFormatColors
) => string,
test: (any) => boolean,
...
};
type JestPrettyFormatPlugins = Array<JestPrettyFormatPlugin>;
/** The expect function is used every time you want to test a value */
declare var expect: {
/** The object that you want to make assertions against */
(
value: any
): JestExpectType &
JestPromiseType &
EnzymeMatchersType &
DomTestingLibraryType &
JestJQueryMatchersType &
JestStyledComponentsMatchersType &
JestExtendedMatchersType &
SnapshotDiffType,
/** Add additional Jasmine matchers to Jest's roster */
extend(matchers: {| [name: string]: JestMatcher |}): void,
/** Add a module that formats application-specific data structures. */
addSnapshotSerializer(pluginModule: JestPrettyFormatPlugin): void,
assertions(expectedAssertions: number): void,
hasAssertions(): void,
any(value: mixed): JestAsymmetricEqualityType,
anything(): any,
arrayContaining(value: Array<mixed>): Array<mixed>,
objectContaining(value: Object): Object,
/** Matches any received string that contains the exact expected string. */
stringContaining(value: string): string,
stringMatching(value: string | RegExp): string,
not: {
arrayContaining: (value: $ReadOnlyArray<mixed>) => Array<mixed>,
objectContaining: (value: { ... }) => Object,
stringContaining: (value: string) => string,
stringMatching: (value: string | RegExp) => string,
...
},
...
};
// TODO handle return type
// path_to_url#section-Spies
declare function spyOn(value: mixed, method: string): Object;
/** Holds all functions related to manipulating test runner */
declare var jest: JestObjectType;
/**
* The global Jasmine object, this is generally not exposed as the public API,
* using features inside here could break in later versions of Jest.
*/
declare var jasmine: {
DEFAULT_TIMEOUT_INTERVAL: number,
any(value: mixed): JestAsymmetricEqualityType,
anything(): any,
arrayContaining(value: Array<mixed>): Array<mixed>,
clock(): JestClockType,
createSpy(name: string): JestSpyType,
createSpyObj(
baseName: string,
methodNames: Array<string>
): {| [methodName: string]: JestSpyType |},
objectContaining(value: Object): Object,
stringMatching(value: string): string,
...
};
```
|
/content/code_sandbox/flow-typed/jest_v27.x.x.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 9,424
|
```javascript
/* @flow strict-local */
/** Maps certain emoji to substitutes, for us to show instead. */
export const override: {| [code: string]: string |} = {
// Fix the "keypad" emoji, which are broken in Zulip's emoji database;
// use the codepoint sequences for them that appear in the Unicode spec.
// path_to_url#narrow/stream/3-backend/topic/unicode.20emojis/near/759357
'0023-20e3': '0023-fe0f-20e3', // # (:hash:)
'002a-20e3': '002a-fe0f-20e3', // * (:asterisk:)
'0030-20e3': '0030-fe0f-20e3', // 0
'0031-20e3': '0031-fe0f-20e3', // 1
'0032-20e3': '0032-fe0f-20e3', // 2
'0033-20e3': '0033-fe0f-20e3', // 3
'0034-20e3': '0034-fe0f-20e3', // 4
'0035-20e3': '0035-fe0f-20e3', // 5
'0036-20e3': '0036-fe0f-20e3', // 6
'0037-20e3': '0037-fe0f-20e3', // 7
'0038-20e3': '0038-fe0f-20e3', // 8
'0039-20e3': '0039-fe0f-20e3', // 9
// Fix the "letter" emoji. The codes in Zulip's emoji database would give
// these a text-style rather than emoji-style presentation; that's subtler
// than we want, plus when not in night mode it's actually invisible.
'1f170': '1f170-fe0f', // :a:
'1f171': '1f171-fe0f', // :b:
'1f17e': '1f17e-fe0f', // :o:
'1f17f': '1f17f-fe0f', // :p:
// (Zulip only actually offers a handful of these letter emoji.)
// :check_mark: -> :check: because the former is invisible on a light
// background, i.e. when not in night mode.
'2714': '2705',
};
/**
* Maps Zulip "emoji name" to Zulip "emoji code" for all known Unicode emoji.
*
* Many codes have multiple names. For example: as of late 2018, there were
* approximately 1600 names for 1000 codes, with about 400 codes having >=2
* names, about 100 having >=3, up to as many as 6 names for the two
* record-holders ('2620' and '1f5dd').
*
* For the format of these emoji codes, see the comment on
* Reaction.emoji_code here:
* path_to_url
*/
export const unicodeCodeByName: {| [name: string]: string |} = {
'+1': '1f44d',
'-1': '1f44e',
'100': '1f4af',
'1234': '1f522',
'8_ball': '1f3b1',
a: '1f170',
ab: '1f18e',
abc: '1f524',
abcd: '1f521',
accessible: '267f',
accommodations: '1f6cc',
acrobatics: '1f938',
action: '1f3ac',
add: '2795',
aerial_tramway: '1f6a1',
agent: '1f575',
agony: '1f616',
airplane: '2708',
airplane_arrival: '1f6ec',
airplane_departure: '1f6eb',
alarm: '1f413',
alarm_clock: '23f0',
alchemy: '2697',
alembic: '2697',
alert: '1f6a8',
alien: '1f47d',
all_good: '2705',
alphabet: '1f521',
ambulance: '1f691',
american_football: '1f3c8',
amphora: '1f3fa',
anchor: '2693',
android: '1f4f1',
angel: '1f47c',
anger: '1f4a2',
anger_bubble: '1f5ef',
angry: '1f620',
angry_cat: '1f63e',
angry_devil: '1f47f',
anguish: '1f62b',
anguished: '1f627',
ant: '1f41c',
anxious: '1f62c',
applause: '1f44f',
apple: '1f34e',
approved: '2705',
aquarius: '2652',
arabian_camel: '1f42a',
arcade: '1f579',
archery: '1f3f9',
archive: '1f5c3',
aries: '2648',
arms_open: '1f917',
arrival: '1f6ec',
art: '1f3a8',
asking_a_question: '261d',
asterisk: '002a-20e3',
astonished: '1f632',
at_work: '2692',
athletic_shoe: '1f45f',
atm: '1f3e7',
atom: '269b',
attachment: '1f4ce',
avocado: '1f951',
b: '1f171',
baa: '1f411',
baby: '1f476',
baby_bottle: '1f37c',
baby_change_station: '1f6bc',
baby_chick: '1f424',
back: '1f519',
backpack: '1f392',
bacon: '1f953',
badminton: '1f3f8',
baggage_claim: '1f6c4',
baguette: '1f956',
balance: '2696',
ball: '26f9',
balloon: '1f388',
ballot_box: '1f5f3',
ballpoint_pen: '1f58a',
bam: '1f4a2',
bamboo: '1f38d',
banana: '1f34c',
bangbang: '203c',
bank: '1f3e6',
bar_chart: '1f4ca',
barber: '1f488',
baseball: '26be',
basketball: '1f3c0',
bat: '1f987',
bath: '1f6c0',
bathtub: '1f6c1',
battery: '1f50b',
beach: '1f3d6',
beach_umbrella: '26f1',
bear: '1f43b',
bed: '1f6cf',
bedroom: '1f6cf',
bee: '1f41d',
beer: '1f37a',
beers: '1f37b',
beetle: '1f41e',
beginner: '1f530',
bell: '1f514',
bellhop_bell: '1f6ce',
bento: '1f371',
betrayed: '1f52a',
bicycle: '1f6b2',
big_frown: '2639',
big_rig: '1f69b',
big_smile: '1f604',
bike: '1f6b2',
bikini: '1f459',
billiards: '1f3b1',
biohazard: '2623',
bird: '1f426',
birthday: '1f382',
black_and_white_square: '1f533',
black_belt: '1f94b',
black_circle: '26ab',
black_flag: '1f3f4',
black_heart: '1f5a4',
black_large_square: '2b1b',
black_medium_small_square: '25fe',
black_medium_square: '25fc',
black_small_square: '25aa',
blank: '1f636',
blossom: '1f33c',
blow_a_kiss: '1f618',
blowfish: '1f421',
blue_book: '1f4d8',
blue_circle: '1f535',
blue_heart: '1f499',
blush: '1f60a',
blushing: '1f633',
boar: '1f417',
boat: '26f5',
bomb: '1f4a3',
boo: '1f47b',
book: '1f4d6',
bookmark: '1f516',
books: '1f4da',
boom: '1f4a5',
boot: '1f462',
bouquet: '1f490',
bow: '1f647',
bow_and_arrow: '1f3f9',
bowling: '1f3b3',
boxing_glove: '1f94a',
boy: '1f466',
bravery: '1f49c',
bread: '1f35e',
breakfast: '1f95e',
bride: '1f470',
bridge: '1f309',
briefcase: '1f4bc',
brightness: '1f506',
broken_heart: '1f494',
bronze: '1f949',
buddhism: '2638',
bug: '1f41b',
bulb: '1f4a1',
bull: '1f402',
bullet_train: '1f685',
bullhorn: '1f4e2',
bulls_eye: '1f3af',
bunny: '1f430',
burial: '26b0',
burrito: '1f32f',
bus: '1f68c',
bus_stop: '1f68f',
butterfly: '1f98b',
buzz: '1f41d',
cactus: '1f335',
cake: '1f370',
calendar: '1f4c5',
calf: '1f42e',
call_me: '1f919',
calling: '1f4f2',
camel: '1f42b',
camera: '1f4f7',
camping: '26fa',
campsite: '1f3d5',
cancer: '264b',
candle: '1f56f',
candy: '1f36c',
canoe: '1f6f6',
cant_talk: '1f637',
capital_abcd: '1f520',
capital_letters: '1f520',
capricorn: '2651',
car: '1f697',
card_index: '1f4c7',
carousel: '1f3a0',
carp_streamer: '1f38f',
carpenter_square: '1f4d0',
carrot: '1f955',
cartwheel: '1f938',
castle: '1f3f0',
cat: '1f408',
caterpillar: '1f41b',
caution: '26a0',
cd: '1f4bf',
celebration: '1f388',
cell_reception: '1f4f6',
chains: '26d3',
champagne: '1f37e',
chart: '1f4c8',
check: '2705',
check_mark: '2714',
checkbox: '2611',
checkered_flag: '1f3c1',
cheese: '1f9c0',
cherries: '1f352',
cherry_blossom: '1f338',
chestnut: '1f330',
chick: '1f424',
chicken: '1f414',
children_crossing: '1f6b8',
chili_pepper: '1f336',
chipmunk: '1f43f',
chocolate: '1f36b',
christianity: '271d',
church: '26ea',
cinema: '1f3a6',
circle: '2b55',
circus: '1f3aa',
city: '1f3d9',
city_sunrise: '1f307',
cl: '1f191',
clap: '1f44f',
classical_building: '1f3db',
clink: '1f942',
clipboard: '1f4cb',
clock: '1f557',
clockwise: '1f503',
closed_book: '1f4d5',
closed_mailbox: '1f4ea',
closed_umbrella: '1f302',
clothing: '1f45a',
cloud: '2601',
cloudy: '1f325',
clover: '2618',
clown: '1f921',
clubs: '2663',
cluck: '1f414',
clue: '1f5dd',
'cock-a-doodle-doo': '1f413',
cocktail: '1f378',
coffee: '2615',
coffin: '26b0',
cold_sweat: '1f630',
collision: '1f4a5',
comet: '2604',
commitment: '1f510',
commodities: '1f6e2',
composition_book: '1f4d3',
compression: '1f5dc',
computer: '1f4bb',
computer_mouse: '1f5b1',
concerned: '1f615',
conch: '1f41a',
condemned: '1f3da',
confetti: '1f38a',
confounded: '1f616',
confused: '1f615',
construction: '1f3d7',
construction_worker: '1f477',
construction_zone: '1f6a7',
control_knobs: '1f39b',
convenience_store: '1f3ea',
cookie: '1f36a',
cooking: '1f373',
cool: '1f192',
cop: '1f46e',
corn: '1f33d',
couch_and_lamp: '1f6cb',
counterclockwise: '1f504',
cow: '1f404',
cowboy: '1f920',
crab: '1f980',
crash: '1f4a5',
crayon: '1f58d',
crazy: '1f61c',
credit_card: '1f4b3',
cremation: '26b1',
crew: '1f6a3',
cricket: '1f3cf',
cricket_bat: '1f3cf',
crocodile: '1f40a',
croissant: '1f950',
cross: '271d',
cross_mark: '274c',
crossed_flags: '1f38c',
crown: '1f451',
cruise: '1f6f3',
crushed: '1f940',
cry: '1f622',
crying_cat: '1f63f',
crystal: '1f48e',
crystal_ball: '1f52e',
cucumber: '1f952',
cupid: '1f498',
curry: '1f35b',
custard: '1f36e',
customs: '1f6c3',
cute: '1f4a0',
cyclist: '1f6b4',
cyclone: '1f300',
dagger: '1f5e1',
dancer: '1f483',
dancers: '1f46f',
dancing: '1f57a',
danger: '26a0',
dango: '1f361',
dark_sunglasses: '1f576',
darts: '1f3af',
dash: '1f4a8',
date: '1f4c6',
death: '2620',
debit_card: '1f4b3',
deciduous_tree: '1f333',
decoration: '1f380',
decorative_notebook: '1f4d4',
decrease: '1f53d',
decreasing: '1f4c9',
deer: '1f98c',
denim: '1f456',
department_store: '1f3ec',
departure: '1f6eb',
derelict_house: '1f3da',
desert: '1f3dc',
desktop_computer: '1f5a5',
detective: '1f575',
devil: '1f47f',
diamond_with_a_dot: '1f4a0',
diamonds: '2666',
dice: '1f3b2',
die: '1f3b2',
digital_security: '1f50f',
dim: '1f505',
ding: '1f6ce',
direct_hit: '1f3af',
disabled: '267f',
disappointed: '1f61e',
disappointed_relieved: '1f625',
disco: '1f57a',
distraught: '1f629',
divide: '2797',
division: '2797',
dizzy: '1f635',
do_not_litter: '1f6af',
document: '1f4c4',
dog: '1f415',
dogi: '1f94b',
dollar_bills: '1f4b5',
dollars: '1f4b2',
dolls: '1f38e',
dolphin: '1f42c',
done_deal: '1f91d',
doner_kebab: '1f959',
donut: '1f369',
door: '1f6aa',
dormouse: '1f42d',
double_down: '23ec',
double_exclamation: '203c',
double_loop: '27bf',
double_up: '23eb',
doughnut: '1f369',
dove: '1f54a',
dove_of_peace: '1f54a',
down: '2b07',
down_button: '1f53d',
downvote: '1f53d',
downwards_trend: '1f4c9',
dragon: '1f409',
dragon_face: '1f432',
drama: '1f3ad',
dream: '1f4ad',
drenched: '1f327',
dress: '1f457',
drinking_water: '1f6b0',
drive_with_care: '1f6b8',
drooling: '1f924',
drop: '1f4a7',
drum: '1f941',
drumstick: '1f357',
duck: '1f986',
duel: '2694',
dungeon: '1f5dd',
dvd: '1f4c0',
'e-mail': '1f4e7',
eagle: '1f985',
ear: '1f442',
ear_of_rice: '1f33e',
earth_africa: '1f30d',
earth_americas: '1f30e',
earth_asia: '1f30f',
east: '27a1',
easy_come_easy_go: '1f4b8',
eating_utensils: '1f374',
egg: '1f95a',
eggplant: '1f346',
eight: '0038-20e3',
eight_pointed_star: '2734',
eight_spoked_asterisk: '2733',
elderly_man: '1f474',
elderly_woman: '1f475',
electric_plug: '1f50c',
elephant: '1f418',
elevated_train: '1f69d',
email: '2709',
embarrassed: '1f633',
empty_mailbox: '1f4ed',
encrypted: '1f5dd',
end: '1f51a',
engineer: '2699',
envelope: '2709',
envy: '1f49a',
euro_banknotes: '1f4b6',
evergreen_tree: '1f332',
exchange: '1f4b1',
exclamation: '2757',
exhausted: '1f625',
expecting: '1f930',
explosion: '1f4a5',
expressionless: '1f611',
eye: '1f441',
eyes: '1f440',
face_palm: '1f926',
face_with_thermometer: '1f912',
factory: '1f3ed',
fall: '1f343',
fallen_leaf: '1f342',
family: '1f46a',
fast_down: '23ec',
fast_forward: '23e9',
fast_reverse: '23ea',
fast_up: '23eb',
fax: '1f4e0',
fear: '1f628',
feet: '1f463',
fencing: '1f93a',
ferris_wheel: '1f3a1',
ferry: '26f4',
field_hockey: '1f3d1',
file: '1f4c4',
file_cabinet: '1f5c4',
file_folder: '1f4c1',
film: '1f39e',
find: '1f50d',
fingers_crossed: '1f91e',
fire: '1f525',
fire_engine: '1f692',
fire_truck: '1f692',
fireworks: '1f386',
first_place: '1f947',
fish: '1f41f',
fishing: '1f3a3',
fist: '270a',
fist_bump: '1f44a',
five: '0035-20e3',
fixing: '1f527',
flags: '1f38f',
flame: '1f525',
flan: '1f36e',
flashlight: '1f526',
fleur_de_lis: '269c',
flip_flops: '1f461',
flipper: '1f42c',
floppy_disk: '1f4be',
flower: '1f337',
flu: '1f912',
flushed: '1f633',
fog: '1f32b',
foggy: '1f301',
folder: '1f4c2',
food: '1f372',
football: '26bd',
footprints: '1f463',
fork_and_knife: '1f374',
fork_and_knife_with_plate: '1f37d',
fortune_telling: '1f52e',
forward: '21aa',
fountain: '26f2',
fountain_pen: '1f58b',
four: '0034-20e3',
four_leaf_clover: '1f340',
fox: '1f98a',
framed_picture: '1f5bc',
free: '1f193',
fries: '1f35f',
frog: '1f438',
frosty: '26c4',
frown: '1f641',
frowning: '1f626',
fuel_pump: '26fd',
full_battery: '1f50b',
full_moon: '1f315',
funeral_urn: '26b1',
furniture: '1f6cb',
future: '1f52e',
gas_pump: '26fd',
gear: '2699',
gecko: '1f98e',
geek: '1f913',
gelato: '1f368',
gem: '1f48e',
gemini: '264a',
ghost: '1f47b',
gift: '1f381',
gift_heart: '1f49d',
girl: '1f467',
glamour: '2728',
glass_of_milk: '1f95b',
glasses: '1f453',
globe: '1f310',
glowing_star: '1f31f',
go: '1f3c1',
goal: '1f945',
goat: '1f410',
goblin: '1f47a',
gold: '1f947',
gold_record: '1f4bd',
golf: '1f3cc',
gondola: '1f6a0',
goodnight: '1f31b',
gooooooooal: '1f945',
gorilla: '1f98d',
got_it: '1f44c',
graduate: '1f393',
grapes: '1f347',
grave: '26b0',
green_apple: '1f34f',
green_book: '1f4d7',
green_heart: '1f49a',
green_large_square: '1f7e9',
grey_exclamation: '2755',
grey_question: '2754',
grimacing: '1f62c',
grinning: '1f600',
grinning_face_with_smiling_eyes: '1f601',
growing: '1f4c8',
growing_heart: '1f497',
grumpy: '1f621',
gua_pi_mao: '1f472',
guard: '1f482',
guestrooms: '1f6cc',
guitar: '1f3b8',
gun: '1f52b',
gym: '1f3cb',
gymnastics: '1f938',
haircut: '1f487',
half_frown: '1f615',
halo: '1f607',
hamburger: '1f354',
hammer: '1f528',
hammer_and_pick: '2692',
hammer_and_wrench: '1f6e0',
hamster: '1f439',
hand: '270b',
handbag: '1f45c',
handball: '1f93e',
handshake: '1f91d',
handyman: '1f528',
handywoman: '1f528',
happy: '1f600',
hard_hat: '26d1',
harvest: '1f33e',
hash: '0023-20e3',
hat: '1f452',
hatching: '1f423',
hatching_chick: '1f423',
haunted: '1f47b',
hazard: '2620',
hazy: '1f32b',
head_bandage: '1f915',
heading_down: '2935',
heading_up: '2934',
headlines: '1f4f0',
headphones: '1f3a7',
hear_no_evil: '1f649',
heart: '2764',
heart_arrow: '1f498',
heart_box: '1f49f',
heart_exclamation: '2763',
heart_eyes: '1f60d',
heart_eyes_cat: '1f63b',
heart_kiss: '1f618',
heart_of_gold: '1f49b',
heart_pulse: '1f497',
heartache: '1f494',
heartbeat: '1f493',
hearts: '2665',
helicopter: '1f681',
hello: '1f44b',
helmet: '26d1',
helpless: '1f623',
herb: '1f33f',
hi: '1f44b',
hibiscus: '1f33a',
high_brightness: '1f506',
high_five: '1f590',
high_heels: '1f460',
high_speed_train: '1f684',
high_voltage: '26a1',
hinduism: '1f549',
hint: '1f5dd',
hiss: '1f40d',
hocho: '1f52a',
hole: '1f573',
hole_in_one: '26f3',
holiday_tree: '1f384',
home_phone: '1f4de',
honey: '1f36f',
honeybee: '1f41d',
horizontal_traffic_light: '1f6a5',
horn: '1f4ef',
horse: '1f40e',
horse_racing: '1f3c7',
horse_riding: '1f3c7',
hospital: '1f3e5',
hot: '1f525',
hot_pepper: '1f336',
hot_springs: '2668',
hotdog: '1f32d',
hotel: '1f3e8',
hourglass: '23f3',
hourglass_done: '231b',
house: '1f3e0',
houses: '1f3d8',
hover: '1f574',
hug: '1f917',
humpback_whale: '1f40b',
hundred: '1f4af',
hungry: '1f37d',
hurricane: '1f300',
hurt: '1f915',
hush: '1f910',
hushed: '1f62f',
ice_cream: '1f368',
ice_hockey: '1f3d2',
ice_skate: '26f8',
id: '1f194',
idea: '1f4a1',
immigration: '1f6c2',
imp: '1f47f',
in_bed: '1f6cc',
in_love: '1f60d',
inbox: '1f4e5',
inbox_zero: '1f4ed',
incorrect: '274c',
increase: '1f53c',
increasing: '1f4c8',
info: '2139',
information_desk_person: '1f481',
injection: '1f489',
injured: '1f915',
innocent: '1f607',
interrobang: '2049',
invincible: '26d1',
iphone: '1f4f1',
islam: '262a',
island: '1f3dd',
izakaya_lantern: '1f3ee',
'jack-o-lantern': '1f383',
japan: '1f5fe',
japan_post: '1f3e3',
jeans: '1f456',
jeep: '1f699',
joker: '1f0cf',
joking: '1f61c',
joy: '1f602',
joy_cat: '1f639',
joystick: '1f579',
judiasm: '2721',
juggling: '1f939',
justice: '2696',
kaaba: '1f54b',
kaching: '1f911',
kawaii: '1f4a0',
keikogi: '1f94b',
key: '1f511',
key_signing: '1f50f',
keyboard: '2328',
kick_scooter: '1f6f4',
kimono: '1f458',
king: '1f451',
kiss: '1f617',
kiss_smiling_eyes: '1f619',
kiss_with_blush: '1f61a',
kissing_cat: '1f63d',
kitten: '1f431',
kiwi: '1f95d',
knife: '1f52a',
koala: '1f428',
label: '1f3f7',
ladybug: '1f41e',
landing: '1f6ec',
landline: '1f4de',
lantern: '1f3ee',
laptop: '1f4bb',
large_blue_diamond: '1f537',
large_orange_diamond: '1f536',
laughing: '1f606',
laughter_tears: '1f602',
leaves: '1f343',
ledger: '1f4d2',
left: '2b05',
left_fist: '1f91b',
left_hook: '21a9',
left_right: '2194',
lemon: '1f34b',
leo: '264c',
leopard: '1f406',
lets_eat: '1f37d',
level_slider: '1f39a',
levitating: '1f574',
lgbtq: '1f308',
libra: '264e',
lifestyles: '1f6cb',
lift: '1f3cb',
light_bulb: '1f4a1',
light_rail: '1f688',
lightning: '1f329',
lightning_storm: '1f329',
link: '1f517',
linked: '1f587',
lion: '1f981',
lips: '1f444',
lips_are_sealed: '1f910',
lipstick: '1f484',
lipstick_kiss: '1f48b',
lit: '1f525',
live_long_and_prosper: '1f596',
living_room: '1f6cb',
lizard: '1f98e',
lock_with_key: '1f510',
locked: '1f512',
locked_bag: '1f6c5',
locker: '1f6c5',
lol: '1f606',
lollipop: '1f36d',
looking: '1f440',
loop: '27b0',
losing_money: '1f4b8',
louder: '1f50a',
loudspeaker: '1f4e2',
love: '2764',
love_hotel: '1f3e9',
love_letter: '1f48c',
love_you: '2764',
low_brightness: '1f505',
lower_left: '2199',
lower_right: '2198',
loyalty: '1f510',
lucky: '1f340',
lying: '1f925',
m: '24c2',
mad: '1f621',
magnifying_glass: '1f50d',
mahjong: '1f004',
mail: '2709',
mail_dropoff: '1f4ee',
mail_received: '1f4e8',
mail_sent: '1f4e9',
mailbox: '1f4eb',
maintenance: '1f528',
maize: '1f33d',
man: '1f468',
man_and_woman_couple: '1f46b',
man_and_woman_holding_hands: '1f46b',
mandarin: '1f34a',
mantelpiece_clock: '1f570',
map: '1f5fa',
maple_leaf: '1f341',
martial_arts: '1f94b',
mask: '1f637',
massage: '1f486',
meal: '1f37d',
meat: '1f356',
mechanical: '2699',
medal: '1f3c5',
medicine: '1f48a',
megaphone: '1f4e3',
melon: '1f348',
memo: '1f4dd',
men_couple: '1f46c',
menorah: '1f54e',
mens: '1f6b9',
meow: '1f408',
merry_go_round: '1f3a0',
meteor: '2604',
metro: '24c2',
mic: '1f3a4',
microphone: '1f3a4',
microscope: '1f52c',
middle_finger: '1f595',
mike: '1f3a4',
military_medal: '1f396',
milk: '1f95b',
milky_way: '1f30c',
mine: '26cf',
minibus: '1f690',
minidisc: '1f4bd',
minus: '2796',
mischievous: '1f61b',
mobile_phone: '1f4f1',
money: '1f4b0',
money_face: '1f911',
money_with_wings: '1f4b8',
monkey: '1f412',
monkey_face: '1f435',
monorail: '1f69d',
moon: '1f319',
moon_ceremony: '1f391',
moon_face: '1f31d',
mortar_board: '1f393',
mosque: '1f54c',
mostly_sunny: '1f324',
mother_christmas: '1f936',
mother_nature: '1f32c',
motor_bike: '1f6f5',
motor_boat: '1f6e5',
motorcycle: '1f3cd',
motorway: '1f6e3',
mount_fuji: '1f5fb',
mountain: '26f0',
mountain_biker: '1f6b5',
mountain_cableway: '1f6a0',
mountain_railway: '1f69e',
mountain_sunrise: '1f304',
mouse: '1f401',
mouth: '1f444',
movie: '1f4fd',
movie_camera: '1f3a5',
movie_theater: '1f3a6',
moving_truck: '1f69a',
moyai: '1f5ff',
mrs_claus: '1f936',
multiplication: '2716',
multiply: '2716',
muscle: '1f4aa',
mushroom: '1f344',
music: '1f3b5',
musical_keyboard: '1f3b9',
musical_notes: '1f3b6',
musical_score: '1f3bc',
mute: '1f507',
mute_notifications: '1f515',
nail_care: '1f485',
nail_polish: '1f485',
namaste: '1f64f',
name_badge: '1f4db',
naruto: '1f365',
national_park: '1f3de',
nauseated: '1f922',
nc17: '1f51e',
nerd: '1f913',
nervous: '1f62c',
neutral: '1f610',
new: '1f195',
new_baby: '1f425',
new_moon: '1f311',
new_moon_face: '1f31a',
new_york: '1f5fd',
newspaper: '1f5de',
next_track: '23ed',
ng: '1f196',
night: '1f303',
night_sky: '1f30c',
nine: '0039-20e3',
no_bicycles: '1f6b3',
no_entry: '26d4',
no_mail: '1f4ed',
no_mouth: '1f636',
no_pedestrians: '1f6b7',
no_phones: '1f4f5',
no_signal: '1f645',
no_smoking: '1f6ad',
no_sound: '1f507',
'non-potable_water': '1f6b1',
noodles: '1f35c',
nope: '1f645',
north: '2b06',
north_east: '2197',
north_west: '2196',
nose: '1f443',
not_allowed: '1f6ab',
note: '1f4dd',
notebook: '1f4d3',
notifications: '1f514',
nuclear: '2622',
number_one: '1f947',
numbers: '1f522',
nursery: '1f6bc',
nut_and_bolt: '1f529',
o: '1f17e',
ocean: '1f30a',
ocean_sunrise: '1f305',
octagonal_sign: '1f6d1',
octopus: '1f419',
oden: '1f362',
office: '1f3e2',
office_supplies: '1f587',
ogre: '1f479',
oh_no: '1f615',
oil_drum: '1f6e2',
oink: '1f416',
ok: '1f44c',
ok_signal: '1f646',
old_key: '1f5dd',
older_man: '1f474',
older_woman: '1f475',
om: '1f549',
on: '1f51b',
oncoming_automobile: '1f698',
oncoming_bus: '1f68d',
oncoming_car: '1f698',
oncoming_police_car: '1f694',
oncoming_streetcar: '1f68a',
oncoming_taxi: '1f696',
oncoming_train: '1f686',
oncoming_tram: '1f68a',
oncoming_trolley: '1f68a',
one: '0031-20e3',
onigiri: '1f359',
oops: '1f643',
open_book: '1f4d6',
open_hands: '1f450',
open_mouth: '1f62e',
ophiuchus: '26ce',
oracle: '1f52e',
orange: '1f34a',
orange_book: '1f4d9',
organize: '1f4c1',
orthodox_cross: '2626',
outbox: '1f4e4',
overcast: '2601',
owl: '1f989',
ox: '1f402',
p: '1f17f',
package: '1f4e6',
paella: '1f958',
page: '1f4c4',
pager: '1f4df',
pained: '1f627',
paintbrush: '1f58c',
painting: '1f3a8',
palette: '1f3a8',
palm: '1f590',
palm_tree: '1f334',
pancakes: '1f95e',
panda: '1f43c',
paper: '1f4c4',
paperclip: '1f4ce',
paperclip_chain: '1f587',
parking: '1f17f',
part_alternation: '303d',
partly_cloudy: '26c5',
partly_sunny: '26c5',
partly_sunny_with_rain: '1f326',
party_ball: '1f38a',
pass: '1f3ab',
passenger_ship: '1f6f3',
passport_control: '1f6c2',
pause: '23f8',
paw_prints: '1f43e',
paws: '1f43e',
peace: '262e',
peace_sign: '270c',
peach: '1f351',
peanuts: '1f95c',
pear: '1f350',
pedestrian: '1f6b6',
pen: '1f58a',
pencil: '270f',
penguin: '1f427',
pensive: '1f614',
performing_arts: '1f3ad',
persevere: '1f623',
person_frowning: '1f64d',
person_pouting: '1f64e',
person_tipping_hand: '1f481',
petrol_pump: '26fd',
phone: '260e',
phone_off: '1f4f4',
physics: '269b',
piano: '1f3b9',
pick: '26cf',
pick_me: '1f64b',
picture: '1f5bc',
pig: '1f416',
pig_nose: '1f43d',
piglet: '1f437',
pile_of_poo: '1f4a9',
pill: '1f48a',
pin: '1f4cd',
pineapple: '1f34d',
ping_pong: '1f3d3',
pirate: '2620',
pisces: '2653',
pizza: '1f355',
place_holder: '1f4d1',
place_of_worship: '1f6d0',
plant: '1f33f',
play: '25b6',
play_pause: '23ef',
play_reverse: '25c0',
playing_cards: '1f3b4',
plus: '2795',
point_down: '1f447',
point_left: '1f448',
point_of_information: '261d',
point_right: '1f449',
point_up: '1f446',
poison: '2620',
poker_face: '1f636',
police: '1f46e',
police_car: '1f693',
pony: '1f434',
poodle: '1f429',
pool: '1f3b1',
poop: '1f4a9',
popcorn: '1f37f',
post_office: '1f3e4',
potable_water: '1f6b0',
potato: '1f954',
pouch: '1f45d',
poultry: '1f357',
pound_notes: '1f4b7',
pouting_cat: '1f63e',
pow: '1f4a2',
power: '270a',
praise: '1f64c',
pray: '1f64f',
prayer_beads: '1f4ff',
pregnant: '1f930',
present: '1f381',
previous_track: '23ee',
price_tag: '1f3f7',
pride: '1f308',
prince: '1f934',
princess: '1f478',
printer: '1f5a8',
privacy: '1f50f',
prohibited: '1f6ab',
projector: '1f4fd',
protected: '1f50f',
pumpkin: '1f383',
punch: '1f44a',
puppy: '1f436',
purple_heart: '1f49c',
purse: '1f45b',
push_pin: '1f4cc',
put_litter_in_its_place: '1f6ae',
queasy: '1f922',
queen: '1f451',
question: '2753',
quiet: '1f910',
rabbit: '1f407',
race: '1f3c1',
racecar: '1f3ce',
radio: '1f4fb',
radio_button: '1f518',
radioactive: '2622',
rage: '1f621',
railway_car: '1f683',
railway_track: '1f6e4',
rainbow: '1f308',
rainy: '1f327',
raised_hand: '270b',
raised_hands: '1f64c',
raising_hand: '1f64b',
ram: '1f40f',
ramen: '1f35c',
rat: '1f400',
rated_for_violence: '1f5e1',
receipt: '1f4c3',
reception: '1f6ce',
record: '23fa',
recreational_vehicle: '1f699',
recycle: '267b',
red_book: '1f4d5',
red_circle: '1f534',
red_triangle_down: '1f53b',
red_triangle_up: '1f53a',
relaxed: '263a',
relieved: '1f60c',
reminder_ribbon: '1f397',
repeat: '1f501',
repeat_one: '1f502',
reply: '21a9',
rescue_worker: '26d1',
restroom: '1f6bb',
return: '1f504',
revolving_hearts: '1f49e',
rewind: '23ea',
rhinoceros: '1f98f',
ribbon: '1f380',
rice: '1f35a',
rice_cracker: '1f358',
rideshare: '1f695',
right: '27a1',
right_fist: '1f91c',
right_hook: '21aa',
ring: '1f48d',
road: '1f6e3',
road_trip: '1f5fa',
robot: '1f916',
rock_carving: '1f5ff',
rock_on: '1f918',
rocket: '1f680',
rofl: '1f923',
roller_coaster: '1f3a2',
rolling_eyes: '1f644',
rolling_on_the_floor_laughing: '1f923',
rolodex: '1f4c7',
rooster: '1f413',
rose: '1f339',
rosette: '1f3f5',
rotating_light: '1f6a8',
rowboat: '1f6a3',
rowing: '1f6a3',
rugby: '1f3c9',
ruler: '1f4cf',
runner: '1f3c3',
running: '1f3c3',
running_shirt: '1f3bd',
running_shoe: '1f45f',
sad: '2639',
safe: '1f510',
safety_first: '26d1',
sagittarius: '2650',
sailboat: '26f5',
sake: '1f376',
salad: '1f957',
sandal: '1f461',
santa: '1f385',
satchel: '1f392',
satellite: '1f6f0',
satellite_antenna: '1f4e1',
saxophone: '1f3b7',
say_cheese: '1f4f8',
scales: '2696',
scared: '1f628',
school: '1f3eb',
school_bus: '1f68c',
school_crossing: '1f6b8',
science: '1f52c',
scientist: '1f52c',
scissors: '2702',
scooter: '1f6f5',
scorpion: '1f982',
scorpius: '264f',
scream: '1f631',
scream_cat: '1f640',
screw: '1f529',
scroll: '1f4dc',
sculling: '1f6a3',
sealed: '1f4e9',
search: '1f50d',
seashell: '1f41a',
seat: '1f4ba',
second_place: '1f948',
secret: '1f5dd',
secure: '1f510',
see_no_evil: '1f648',
seedling: '1f331',
seeing_stars: '1f4ab',
selfie: '1f933',
semi_truck: '1f69b',
senbei: '1f358',
services: '1f6ce',
settings: '2699',
seven: '0037-20e3',
sewing_pin: '1f4cd',
shadow: '1f464',
shadows: '1f465',
shamrock: '2618',
shark: '1f988',
shaved_ice: '1f367',
shawarma: '1f959',
sheep: '1f411',
shell: '1f41a',
shield: '1f6e1',
shinto_shrine: '26e9',
ship: '1f6a2',
shiro: '1f3ef',
shirt: '1f455',
shock: '1f628',
shoe: '1f45e',
shooting_star: '1f320',
shopping_bags: '1f6cd',
shopping_cart: '1f6d2',
shopping_trolley: '1f6d2',
shout: '1f4e3',
shower: '1f6bf',
shrimp: '1f990',
shrinking: '1f4c9',
shrug: '1f937',
shuffle: '1f500',
sick: '1f912',
sign_of_the_horns: '1f918',
signal_bars: '1f4f6',
signal_strength: '1f4f6',
silence: '1f910',
silhouette: '1f464',
silhouettes: '1f465',
silver: '1f948',
siren: '1f6a8',
six: '0036-20e3',
ski: '1f3bf',
ski_lift: '1f6a1',
skier: '26f7',
skip_back: '23ee',
skip_forward: '23ed',
skull: '1f480',
skull_and_crossbones: '2620',
skyline: '1f3d9',
sleeping: '1f634',
sleepy: '1f62a',
sleuth: '1f575',
slight_frown: '1f641',
slot_machine: '1f3b0',
small_airplane: '1f6e9',
small_blue_diamond: '1f539',
small_glass: '1f943',
small_orange_diamond: '1f538',
smartphone: '1f4f1',
smile: '1f642',
smile_cat: '1f638',
smiley: '1f603',
smiley_cat: '1f63a',
smiling_devil: '1f608',
smiling_face_with_horns: '1f608',
smiling_imp: '1f608',
smirk: '1f60f',
smirk_cat: '1f63c',
smitten: '1f498',
smoking: '1f6ac',
smug: '1f60f',
smug_cat: '1f63c',
snail: '1f40c',
snake: '1f40d',
sneaker: '1f45f',
sneaky: '1f575',
sneezing: '1f927',
snowboarder: '1f3c2',
snowflake: '2744',
snowman: '2603',
snowstorm: '1f328',
snowy: '1f328',
snowy_mountain: '1f3d4',
soaked: '1f327',
sob: '1f62d',
soccer: '26bd',
soft_ice_cream: '1f366',
soft_serve: '1f366',
softer: '1f509',
solidarity: '1f38c',
soon: '1f51c',
sort: '1f5c2',
sos: '1f198',
sound: '1f50a',
soup: '1f372',
south: '2b07',
south_east: '2198',
south_west: '2199',
souvlaki: '1f959',
space_invader: '1f47e',
spades: '2660',
spaghetti: '1f35d',
sparkle: '2747',
sparkler: '1f387',
sparkles: '2728',
sparkling_heart: '1f496',
speak_no_evil: '1f64a',
speaker: '1f508',
speaking_head: '1f5e3',
spectacles: '1f453',
speech_balloon: '1f4ac',
speech_bubble: '1f5e8',
speechless: '1f636',
speedboat: '1f6a4',
spider: '1f577',
spider_web: '1f578',
spiral_notebook: '1f4d2',
spiral_notepad: '1f5d2',
spiral_shell: '1f41a',
spock: '1f596',
spooky: '1f47b',
spoon: '1f944',
sports: '26f9',
sprout: '1f331',
spy: '1f575',
squared_ok: '1f197',
squared_up: '1f199',
squid: '1f991',
stadium: '1f3df',
star: '2b50',
star_and_crescent: '262a',
star_of_david: '2721',
start: '1f3c1',
station: '1f689',
statue: '1f5fd',
statue_of_liberty: '1f5fd',
steam_locomotive: '1f682',
stew: '1f372',
stock_market: '1f4b9',
stop: '1f91a',
stop_button: '23f9',
stop_sign: '1f6d1',
stopwatch: '23f1',
straightedge: '1f4cf',
strawberry: '1f353',
streetcar: '1f68b',
stressed: '1f625',
strike: '1f3b3',
striped_pole: '1f488',
stuck_out_tongue: '1f61d',
stuck_out_tongue_wink: '1f61c',
studio_microphone: '1f399',
stuffed_flatbread: '1f959',
subtract: '2796',
suburb: '1f3e1',
subway: '1f687',
sun_and_rain: '1f326',
sun_face: '1f31e',
sunflower: '1f33b',
sunglasses: '1f60e',
sunny: '2600',
sunrise: '1f305',
sunset: '1f306',
sunshowers: '1f326',
surf: '1f3c4',
surprise: '1f62e',
surrender: '1f3f3',
sushi: '1f363',
suspension_railway: '1f69f',
swap: '2194',
swat: '1f5de',
sweat: '1f613',
sweat_drops: '1f4a6',
sweat_smile: '1f605',
sweet_potato: '1f360',
swim: '1f3ca',
swords: '2694',
symbols: '1f523',
synagogue: '1f54d',
syringe: '1f489',
table_setting: '1f37d',
table_tennis: '1f3d3',
taco: '1f32e',
tada: '1f389',
tag: '1f3f7',
take_off: '1f6eb',
taking_a_picture: '1f4f8',
tanabata_tree: '1f38b',
tangerine: '1f34a',
tap_water: '1f6b0',
taurus: '2649',
taxi: '1f695',
tea: '1f375',
tears: '1f602',
telephone: '260e',
telescope: '1f52d',
television: '1f4fa',
temperature: '1f321',
tempura: '1f364',
ten: '1f51f',
tennis: '1f3be',
tent: '26fa',
thank_you: '1f64f',
theater: '1f3ad',
thermometer: '1f321',
thinking: '1f914',
third_place: '1f949',
this: '1f446',
thought: '1f4ad',
three: '0033-20e3',
thumb_tack: '1f4cc',
thumbs_down: '1f44e',
thumbs_up: '1f44d',
thunder_and_rain: '26c8',
thunderstorm: '26c8',
ticket: '1f39f',
tie: '1f454',
tiger: '1f405',
tiger_cub: '1f42f',
time: '1f557',
time_ticking: '23f3',
timer: '23f2',
times_up: '231b',
tired: '1f614',
tm: '2122',
toast: '1f942',
toilet: '1f6bd',
tokyo_tower: '1f5fc',
tomato: '1f345',
tongue: '1f445',
tools: '1f6e0',
top: '1f51d',
top_hat: '1f3a9',
tornado: '1f32a',
tortoise: '1f422',
tower: '1f5fc',
toxic: '2620',
trackball: '1f5b2',
tractor: '1f69c',
'tractor-trailer': '1f69b',
trademark: '2122',
traffic_light: '1f6a6',
train: '1f682',
train_car: '1f683',
train_tracks: '1f6e4',
tram: '1f68b',
transport_truck: '1f69b',
trash_can: '1f5d1',
tree: '1f333',
triangular_flag: '1f6a9',
triangular_ruler: '1f4d0',
trident: '1f531',
triumph: '1f624',
trolley: '1f68e',
trophy: '1f3c6',
tropical_drink: '1f379',
tropical_fish: '1f420',
truck: '1f69b',
trumpet: '1f3ba',
tshirt: '1f455',
tulip: '1f337',
tumbling: '1f938',
turban: '1f473',
turkey: '1f983',
turtle: '1f422',
tuxedo: '1f935',
tv: '1f4fa',
two: '0032-20e3',
two_hearts: '1f495',
two_men_holding_hands: '1f46c',
two_women_holding_hands: '1f46d',
typhoon: '1f300',
ufo: '1f47d',
umbrella: '2602',
umbrella_with_rain: '2614',
umm: '1f4ac',
unamused: '1f612',
underage: '1f51e',
unicorn: '1f984',
unlocked: '1f513',
unread_mail: '1f4ec',
up: '2b06',
up_button: '1f53c',
up_down: '2195',
upper_left: '2196',
upper_right: '2197',
upside_down: '1f643',
upvote: '1f53c',
upwards_trend: '1f4c8',
vase: '1f3fa',
vertical_traffic_light: '1f6a6',
very_angry: '1f621',
vhs: '1f4fc',
vibration_mode: '1f4f3',
victory: '270c',
video_camera: '1f4f9',
video_game: '1f3ae',
video_recorder: '1f4f9',
videocassette: '1f4fc',
violin: '1f3bb',
virgo: '264d',
vise: '1f5dc',
voicemail: '27bf',
volcano: '1f30b',
volleyball: '1f3d0',
volume: '1f39a',
vs: '1f19a',
wait_one_second: '261d',
walking: '1f6b6',
warm: '1f321',
warning: '26a0',
wastebasket: '1f5d1',
watch: '231a',
water_buffalo: '1f403',
water_closet: '1f6be',
water_drop: '1f4a7',
water_polo: '1f93d',
watermelon: '1f349',
wave: '1f44b',
wavy_dash: '3030',
waxing_moon: '1f314',
wc: '1f6be',
weary: '1f629',
weary_cat: '1f640',
web: '1f578',
wedding: '1f492',
weight_lift: '1f3cb',
welcome: '1f64f',
west: '2b05',
whale: '1f433',
wheel_of_dharma: '2638',
wheelchair: '267f',
white_and_black_square: '1f532',
white_circle: '26aa',
white_flag: '1f3f3',
white_flower: '1f4ae',
white_large_square: '2b1c',
white_medium_small_square: '25fd',
white_medium_square: '25fb',
white_small_square: '25ab',
wilted_flower: '1f940',
wind: '1f343',
wind_chime: '1f390',
windy: '1f32c',
wine: '1f377',
wink: '1f609',
winner: '1f3c6',
wish: '1f320',
wish_tree: '1f38b',
wolf: '1f43a',
woman: '1f469',
women_couple: '1f46d',
womens: '1f6ba',
woof: '1f415',
work_in_progress: '1f6a7',
work_out: '1f3cb',
working_on_it: '1f6e0',
world_map: '1f5fa',
worried: '1f61f',
wrench: '1f527',
wrestling: '1f93c',
writing: '270d',
wrong: '274c',
wrong_way: '26d4',
www: '1f310',
x: '274e',
yacht: '1f6f3',
yam: '1f360',
yellow_heart: '1f49b',
yellow_large_square: '1f7e8',
yen_banknotes: '1f4b4',
yin_yang: '262f',
yum: '1f60b',
zap: '26a1',
zero: '0030-20e3',
zip_it: '1f910',
zzz: '1f4a4',
};
```
|
/content/code_sandbox/src/emoji/codePointMap.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 15,326
|
```javascript
// flow-typed signature: b80517b7c0c4c471e1e6fdbeb22ce46e
// flow-typed version: c6154227d1/prettier_v1.x.x/flow_>=v0.84.x <=v0.103.x
declare module "prettier" {
declare export type AST = { [key: string]: any, ... };
declare export type Doc = {
[key: string]: any,
...
};
declare export type FastPath<T = any> = {
stack: any[],
getName(): null | string | number | Symbol,
getValue(): T,
getNode(count?: number): null | T,
getParentNode(count?: number): null | T,
call<U>(callback: (path: FastPath<T>) => U, ...names: Array<string | number | Symbol>): U,
each(callback: (path: FastPath<T>) => void, ...names: Array<string | number | Symbol>): void,
map<U>(callback: (path: FastPath<T>, index: number) => U, ...names: Array<string | number | Symbol>): U[],
...
};
declare export type PrettierParserName =
| "babylon" // deprecated
| "babel"
| "babel-flow"
| "flow"
| "typescript"
| "postcss" // deprecated
| "css"
| "less"
| "scss"
| "json"
| "json5"
| "json-stringify"
| "graphql"
| "markdown"
| "vue"
| "html"
| "angular"
| "mdx"
| "yaml";
declare export type PrettierParser = {
[name: PrettierParserName]: (text: string, options?: { [key: string]: any, ... }) => AST,
...
};
declare export type CustomParser = (
text: string,
parsers: PrettierParser,
options: Options
) => AST;
declare export type Options = {|
printWidth?: number,
tabWidth?: number,
useTabs?: boolean,
semi?: boolean,
singleQuote?: boolean,
trailingComma?: "none" | "es5" | "all",
bracketSpacing?: boolean,
jsxBracketSameLine?: boolean,
arrowParens?: "avoid" | "always",
rangeStart?: number,
rangeEnd?: number,
parser?: PrettierParserName | CustomParser,
filepath?: string,
requirePragma?: boolean,
insertPragma?: boolean,
proseWrap?: "always" | "never" | "preserve",
plugins?: Array<string | Plugin>
|};
declare export type Plugin = {
languages: SupportLanguage,
parsers: { [parserName: string]: Parser, ... },
printers: { [astFormat: string]: Printer, ... },
options?: SupportOption[],
...
};
declare export type Parser = {
parse: (
text: string,
parsers: { [parserName: string]: Parser, ... },
options: { [key: string]: any, ... }
) => AST,
astFormat: string,
hasPragma?: (text: string) => boolean,
locStart: (node: any) => number,
locEnd: (node: any) => number,
preprocess?: (text: string, options: { [key: string]: any, ... }) => string,
...
};
declare export type Printer = {
print: (
path: FastPath<>,
options: { [key: string]: any, ... },
print: (path: FastPath<>) => Doc
) => Doc,
embed: (
path: FastPath<>,
print: (path: FastPath<>) => Doc,
textToDoc: (text: string, options: { [key: string]: any, ... }) => Doc,
options: { [key: string]: any, ... }
) => ?Doc,
insertPragma?: (text: string) => string,
massageAstNode?: (node: any, newNode: any, parent: any) => any,
hasPrettierIgnore?: (path: FastPath<>) => boolean,
canAttachComment?: (node: any) => boolean,
willPrintOwnComments?: (path: FastPath<>) => boolean,
printComments?: (path: FastPath<>, print: (path: FastPath<>) => Doc, options: { [key: string]: any, ... }, needsSemi: boolean) => Doc,
handleComments?: {
ownLine?: (commentNode: any, text: string, options: { [key: string]: any, ... }, ast: any, isLastComment: boolean) => boolean,
endOfLine?: (commentNode: any, text: string, options: { [key: string]: any, ... }, ast: any, isLastComment: boolean) => boolean,
remaining?: (commentNode: any, text: string, options: { [key: string]: any, ... }, ast: any, isLastComment: boolean) => boolean,
...
},
...
};
declare export type CursorOptions = {|
cursorOffset: number,
printWidth?: Options["printWidth"],
tabWidth?: Options["tabWidth"],
useTabs?: Options["useTabs"],
semi?: Options["semi"],
singleQuote?: Options["singleQuote"],
trailingComma?: Options["trailingComma"],
bracketSpacing?: Options["bracketSpacing"],
jsxBracketSameLine?: Options["jsxBracketSameLine"],
arrowParens?: Options["arrowParens"],
parser?: Options["parser"],
filepath?: Options["filepath"],
requirePragma?: Options["requirePragma"],
insertPragma?: Options["insertPragma"],
proseWrap?: Options["proseWrap"],
plugins?: Options["plugins"]
|};
declare export type CursorResult = {|
formatted: string,
cursorOffset: number
|};
declare export type ResolveConfigOptions = {|
useCache?: boolean,
config?: string,
editorconfig?: boolean
|};
declare export type SupportLanguage = {
name: string,
since: string,
parsers: Array<string>,
group?: string,
tmScope: string,
aceMode: string,
codemirrorMode: string,
codemirrorMimeType: string,
aliases?: Array<string>,
extensions: Array<string>,
filenames?: Array<string>,
linguistLanguageId: number,
vscodeLanguageIds: Array<string>,
...
};
declare export type SupportOption = {|
since: string,
type: "int" | "boolean" | "choice" | "path",
deprecated?: string,
redirect?: SupportOptionRedirect,
description: string,
oppositeDescription?: string,
default: SupportOptionValue,
range?: SupportOptionRange,
choices?: SupportOptionChoice
|};
declare export type SupportOptionRedirect = {|
options: string,
value: SupportOptionValue
|};
declare export type SupportOptionRange = {|
start: number,
end: number,
step: number
|};
declare export type SupportOptionChoice = {|
value: boolean | string,
description?: string,
since?: string,
deprecated?: string,
redirect?: SupportOptionValue
|};
declare export type SupportOptionValue = number | boolean | string;
declare export type SupportInfo = {|
languages: Array<SupportLanguage>,
options: Array<SupportOption>
|};
declare export type Prettier = {|
format: (source: string, options?: Options) => string,
check: (source: string, options?: Options) => boolean,
formatWithCursor: (source: string, options: CursorOptions) => CursorResult,
resolveConfig: {
(filePath: string, options?: ResolveConfigOptions): Promise<?Options>,
sync(filePath: string, options?: ResolveConfigOptions): ?Options,
...
},
clearConfigCache: () => void,
getSupportInfo: (version?: string) => SupportInfo
|};
declare export default Prettier;
}
```
|
/content/code_sandbox/flow-typed/prettier_v1.x.x.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 1,786
|
```javascript
// `flowgen --no-inexact --interface-records node_modules/expo-sqlite/build/SQLite.types.d.ts`
// from expo-sqlite 10.0.3
// with s/export type/declare export type/g, and as noted with "Zulip fix" below
declare module 'expo-sqlite/build/SQLite.types' {
/**
* Flowtype definitions for SQLite.types
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.14.1
*/
declare export type Window = {|
openDatabase?: (
name: string,
version: string,
displayName: string,
estimatedSize: number,
creationCallback?: DatabaseCallback
) => Database,
|};
declare export type DatabaseCallback = (database: Database) => void;
/**
* `Database` objects are returned by calls to `SQLite.openDatabase()`. Such an object represents a
* connection to a database on your device.
*/
declare export type Database = {|
version: string,
/**
* Execute a database transaction.
* @param callback A function representing the transaction to perform. Takes a Transaction
* (see below) as its only parameter, on which it can add SQL statements to execute.
* @param errorCallback Called if an error occurred processing this transaction. Takes a single
* parameter describing the error.
* @param successCallback Called when the transaction has completed executing on the database.
*/
transaction(
callback: SQLTransactionCallback,
errorCallback?: SQLTransactionErrorCallback,
successCallback?: () => void
): void,
readTransaction(
callback: SQLTransactionCallback,
errorCallback?: SQLTransactionErrorCallback,
successCallback?: () => void
): void,
|};
declare export type SQLTransactionCallback = (transaction: SQLTransaction) => void;
declare export type SQLTransactionErrorCallback = (error: SQLError) => void;
/**
* A `SQLTransaction` object is passed in as a parameter to the `callback` parameter for the
* `db.transaction()` method on a `Database` (see above). It allows enqueuing SQL statements to
* perform in a database transaction.
*/
declare export type SQLTransaction = {|
/**
* Enqueue a SQL statement to execute in the transaction. Authors are strongly recommended to make
* use of the `?` placeholder feature of the method to avoid against SQL injection attacks, and to
* never construct SQL statements on the fly.
* @param sqlStatement A string containing a database query to execute expressed as SQL. The string
* may contain `?` placeholders, with values to be substituted listed in the `arguments` parameter.
* @param args An array of values (numbers or strings) to substitute for `?` placeholders in the
* SQL statement.
* @param callback Called when the query is successfully completed during the transaction. Takes
* two parameters: the transaction itself, and a `ResultSet` object (see below) with the results
* of the query.
* @param errorCallback Called if an error occurred executing this particular query in the
* transaction. Takes two parameters: the transaction itself, and the error object.
*/
executeSql(
sqlStatement: string,
args?: $ReadOnlyArray<number | string>, // Zulip fix
callback?: SQLStatementCallback,
errorCallback?: SQLStatementErrorCallback
): void,
|};
declare export type SQLStatementCallback = (
transaction: SQLTransaction,
resultSet: SQLResultSet
) => void;
declare export type SQLStatementErrorCallback = (
transaction: SQLTransaction,
error: SQLError
) => boolean;
declare export type SQLResultSet = {|
/**
* The row ID of the row that the SQL statement inserted into the database, if a row was inserted.
*/
insertId?: number,
/**
* The number of rows that were changed by the SQL statement.
*/
rowsAffected: number,
rows: SQLResultSetRowList,
|};
declare export type SQLResultSetRowList = {|
/**
* The number of rows returned by the query.
*/
length: number,
/**
* Returns the row with the given `index`. If there is no such row, returns `null`.
* @param index Index of row to get.
*/
item(index: number): any,
/**
* The actual array of rows returned by the query. Can be used directly instead of
* getting rows through rows.item().
*/
_array: any[],
|};
declare export class SQLError {
static UNKNOWN_ERR: number;
static DATABASE_ERR: number;
static VERSION_ERR: number;
static TOO_LARGE_ERR: number;
static QUOTA_ERR: number;
static SYNTAX_ERR: number;
static CONSTRAINT_ERR: number;
static TIMEOUT_ERR: number;
code: number;
message: string;
}
declare export type WebSQLDatabase = {|
...$Exact<Database>,
exec(queries: Query[], readOnly: boolean, callback: SQLiteCallback): void,
|};
declare export type Query = {|
sql: string,
args: mixed[],
|};
declare export type ResultSetError = {|
error: Error,
|};
/**
* `ResultSet` objects are returned through second parameter of the `success` callback for the
* `tx.executeSql()` method on a `SQLTransaction` (see above).
*/
declare export type ResultSet = {|
/**
* The row ID of the row that the SQL statement inserted into the database, if a row was inserted.
*/
insertId?: number,
/**
* The number of rows that were changed by the SQL statement.
*/
rowsAffected: number,
rows: {|
[column: string]: any,
|}[],
|};
declare export type SQLiteCallback = (
error?: Error | null,
resultSet?: (ResultSetError | ResultSet)[]
) => void;
}
// `flowgen --no-inexact --interface-records node_modules/expo-sqlite/build/SQLite.d.ts`
// from expo-sqlite 10.0.3
// with imports fixed up
declare module 'expo-sqlite/build/SQLite' {
/**
* Flowtype definitions for SQLite
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.14.1
*/
import type { WebSQLDatabase } from "expo-sqlite/build/SQLite.types";
/**
* Open a database, creating it if it doesn't exist, and return a `Database` object. On disk,
* the database will be created under the app's [documents directory](../filesystem), i.e.
* `${FileSystem.documentDirectory}/SQLite/${name}`.
* > The `version`, `description` and `size` arguments are ignored, but are accepted by the function
* for compatibility with the WebSQL specification.
* @param name Name of the database file to open.
* @param version
* @param description
* @param size
* @param callback
* @return
*/
declare export function openDatabase(
name: string,
version?: string,
description?: string,
size?: number,
callback?: (db: WebSQLDatabase) => void
): WebSQLDatabase;
}
declare module 'expo-sqlite' {
declare export * from 'expo-sqlite/build/SQLite';
declare export * from 'expo-sqlite/build/SQLite.types';
}
```
|
/content/code_sandbox/flow-typed/expo-sqlite_vx.x.x.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 1,637
|
```javascript
/*
* Crudely @generated like so:
* $ ls static/translations/messages_*.json | LC_ALL=C sort | perl -lne '
print "\
declare module '\''../../$_'\'' {
declare export default {| [string]: string |};
}";
' >>flow-typed/translations.js
*/
declare module '../../static/translations/messages_am.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_ar.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_be.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_bg.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_bn.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_bqi.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_ca.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_cs.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_cy.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_da.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_de.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_el.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_el_GR.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_en.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_en_GB.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_eo.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_es.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_eu.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_fa.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_fi.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_fr.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_gl.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_gu.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_hi.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_hr.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_hu.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_id.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_ig.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_it.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_ja.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_ko.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_kw.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_lt.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_lv.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_ml.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_mn.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_my.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_nl.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_no.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_pa.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_pcm.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_pl.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_pt.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_pt_BR.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_pt_PT.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_ro.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_ru.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_sco.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_si.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_sk.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_sr.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_sv.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_ta.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_te.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_tl.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_tr.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_uk.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_ur.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_uz.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_vi.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_yue.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_zh-Hans.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_zh-Hant.json' {
declare export default {| [string]: string |};
}
declare module '../../static/translations/messages_zh_TW.json' {
declare export default {| [string]: string |};
}
```
|
/content/code_sandbox/flow-typed/translations.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 1,565
|
```javascript
// flow-typed signature: 350bbd47d9063ecee4c33220f3f6fa99
// flow-typed version: c6154227d1/base-64_v0.1.x/flow_>=v0.25.x <=v0.103.x
declare module 'base-64' {
declare module.exports: {|
version: string;
/**
* This function takes a byte string (the input parameter) and encodes it according to base64.
* The input data must be in the form of a string containing only characters
* in the range from U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF.
* The base64.encode() function is designed to be fully compatible
* with btoa() as described in the HTML Standard.
* see: path_to_url#dom-windowbase64-btoa
*/
encode(input: string): string;
/**
* This function takes a base64-encoded string (the input parameter) and decodes it.
* The return value is in the form of a string containing only characters in
* the range from U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF.
* The base64.decode() function is designed to be fully compatible
* with atob() as described in the HTML Standard.
* see: path_to_url#dom-windowbase64-atob
*/
decode(input: string): string;
|};
}
```
|
/content/code_sandbox/flow-typed/base-64_v0.1.x.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 337
|
```javascript
declare module 'react-native-url-polyfill/js/URL' {
import type { URLSearchParams } from 'react-native-url-polyfill/js/URLSearchParams';
// path_to_url#L3765-L3783
declare export class URL {
static createObjectURL(blob: Blob): string;
static createObjectURL(mediaSource: MediaSource): string;
static createFor(blob: Blob): string;
static revokeObjectURL(url: string): void;
constructor(url: string, base?: string | URL): void;
hash: string;
host: string;
hostname: string;
href: string;
origin: string; // readonly
password: string;
pathname: string;
port: string;
protocol: string;
search: string;
searchParams: URLSearchParams; // readonly
username: string;
}
}
declare module 'react-native-url-polyfill/js/URLSearchParams' {
// path_to_url#L1000-L1013
declare export class URLSearchParams {
@@iterator(): Iterator<[string, string]>;
constructor(
query?: string | URLSearchParams | Array<[string, string]> | {| [string]: string |},
): void;
append(name: string, value: string): void;
delete(name: string): void;
entries(): Iterator<[string, string]>;
forEach((value: string, name: string, params: URLSearchParams) => any, thisArg?: any): void;
get(name: string): null | string;
getAll(name: string): Array<string>;
has(name: string): boolean;
keys(): Iterator<string>;
set(name: string, value: string): void;
values(): Iterator<string>;
}
}
// Filename aliases
declare module 'react-native-url-polyfill/index' {
declare module.exports: $Exports<'react-native-url-polyfill'>;
}
declare module 'react-native-url-polyfill/index.js' {
declare module.exports: $Exports<'react-native-url-polyfill'>;
}
declare module 'react-native-url-polyfill/js/URL.js' {
declare module.exports: $Exports<'react-native-url-polyfill/js/URL'>;
}
declare module 'react-native-url-polyfill/js/URLSearchParams.js' {
declare module.exports: $Exports<'react-native-url-polyfill/js/URLSearchParams'>;
}
declare module 'react-native-url-polyfill' {
declare export * from 'react-native-url-polyfill/js/URL'
declare export * from 'react-native-url-polyfill/js/URLSearchParams'
}
```
|
/content/code_sandbox/flow-typed/react-native-url-polyfill_vx.x.x.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 549
|
```javascript
// flow-typed signature: c0e67f98b12ddf0a53470f9c3628dce6
// flow-typed version: 89b0d35e3a/reselect_v3.x.x/flow_>=v0.47.x <=v0.103.x
type ExtractReturnType = <Return>((...rest: any[]) => Return) => Return;
declare module "reselect" {
declare type InputSelector<-TState, TProps, TResult> =
(state: TState, props: TProps, ...rest: any[]) => TResult
declare type OutputSelector<-TState, TProps, TResult> =
& InputSelector<TState, TProps, TResult>
& {|
recomputations(): number,
resetRecomputations(): number,
resultFunc(...args: any[]): TResult,
|};
declare type SelectorCreator = {
<TState, TProps, TResult, T1>(
selector1: InputSelector<TState, TProps, T1>,
resultFunc: (arg1: T1) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1>(
selectors: [InputSelector<TState, TProps, T1>],
resultFunc: (arg1: T1) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2>(
selector1: InputSelector<TState, TProps, T1>,
selector2: InputSelector<TState, TProps, T2>,
resultFunc: (arg1: T1, arg2: T2) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2>(
selectors: [InputSelector<TState, TProps, T1>, InputSelector<TState, TProps, T2>],
resultFunc: (arg1: T1, arg2: T2) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2, T3>(
selector1: InputSelector<TState, TProps, T1>,
selector2: InputSelector<TState, TProps, T2>,
selector3: InputSelector<TState, TProps, T3>,
resultFunc: (arg1: T1, arg2: T2, arg3: T3) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2, T3>(
selectors: [
InputSelector<TState, TProps, T1>,
InputSelector<TState, TProps, T2>,
InputSelector<TState, TProps, T3>
],
resultFunc: (arg1: T1, arg2: T2, arg3: T3) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2, T3, T4>(
selector1: InputSelector<TState, TProps, T1>,
selector2: InputSelector<TState, TProps, T2>,
selector3: InputSelector<TState, TProps, T3>,
selector4: InputSelector<TState, TProps, T4>,
resultFunc: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2, T3, T4>(
selectors: [
InputSelector<TState, TProps, T1>,
InputSelector<TState, TProps, T2>,
InputSelector<TState, TProps, T3>,
InputSelector<TState, TProps, T4>
],
resultFunc: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2, T3, T4, T5>(
selector1: InputSelector<TState, TProps, T1>,
selector2: InputSelector<TState, TProps, T2>,
selector3: InputSelector<TState, TProps, T3>,
selector4: InputSelector<TState, TProps, T4>,
selector5: InputSelector<TState, TProps, T5>,
resultFunc: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2, T3, T4, T5>(
selectors: [
InputSelector<TState, TProps, T1>,
InputSelector<TState, TProps, T2>,
InputSelector<TState, TProps, T3>,
InputSelector<TState, TProps, T4>,
InputSelector<TState, TProps, T5>
],
resultFunc: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2, T3, T4, T5, T6>(
selector1: InputSelector<TState, TProps, T1>,
selector2: InputSelector<TState, TProps, T2>,
selector3: InputSelector<TState, TProps, T3>,
selector4: InputSelector<TState, TProps, T4>,
selector5: InputSelector<TState, TProps, T5>,
selector6: InputSelector<TState, TProps, T6>,
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6
) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2, T3, T4, T5, T6>(
selectors: [
InputSelector<TState, TProps, T1>,
InputSelector<TState, TProps, T2>,
InputSelector<TState, TProps, T3>,
InputSelector<TState, TProps, T4>,
InputSelector<TState, TProps, T5>,
InputSelector<TState, TProps, T6>
],
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6
) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7>(
selector1: InputSelector<TState, TProps, T1>,
selector2: InputSelector<TState, TProps, T2>,
selector3: InputSelector<TState, TProps, T3>,
selector4: InputSelector<TState, TProps, T4>,
selector5: InputSelector<TState, TProps, T5>,
selector6: InputSelector<TState, TProps, T6>,
selector7: InputSelector<TState, TProps, T7>,
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7
) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7>(
selectors: [
InputSelector<TState, TProps, T1>,
InputSelector<TState, TProps, T2>,
InputSelector<TState, TProps, T3>,
InputSelector<TState, TProps, T4>,
InputSelector<TState, TProps, T5>,
InputSelector<TState, TProps, T6>,
InputSelector<TState, TProps, T7>
],
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7
) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7, T8>(
selector1: InputSelector<TState, TProps, T1>,
selector2: InputSelector<TState, TProps, T2>,
selector3: InputSelector<TState, TProps, T3>,
selector4: InputSelector<TState, TProps, T4>,
selector5: InputSelector<TState, TProps, T5>,
selector6: InputSelector<TState, TProps, T6>,
selector7: InputSelector<TState, TProps, T7>,
selector8: InputSelector<TState, TProps, T8>,
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7,
arg8: T8
) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7, T8>(
selectors: [
InputSelector<TState, TProps, T1>,
InputSelector<TState, TProps, T2>,
InputSelector<TState, TProps, T3>,
InputSelector<TState, TProps, T4>,
InputSelector<TState, TProps, T5>,
InputSelector<TState, TProps, T6>,
InputSelector<TState, TProps, T7>,
InputSelector<TState, TProps, T8>
],
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7,
arg8: T8
) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9>(
selector1: InputSelector<TState, TProps, T1>,
selector2: InputSelector<TState, TProps, T2>,
selector3: InputSelector<TState, TProps, T3>,
selector4: InputSelector<TState, TProps, T4>,
selector5: InputSelector<TState, TProps, T5>,
selector6: InputSelector<TState, TProps, T6>,
selector7: InputSelector<TState, TProps, T7>,
selector8: InputSelector<TState, TProps, T8>,
selector9: InputSelector<TState, TProps, T9>,
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7,
arg8: T8,
arg9: T9
) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9>(
selectors: [
InputSelector<TState, TProps, T1>,
InputSelector<TState, TProps, T2>,
InputSelector<TState, TProps, T3>,
InputSelector<TState, TProps, T4>,
InputSelector<TState, TProps, T5>,
InputSelector<TState, TProps, T6>,
InputSelector<TState, TProps, T7>,
InputSelector<TState, TProps, T8>,
InputSelector<TState, TProps, T9>
],
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7,
arg8: T8,
arg9: T9
) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
selector1: InputSelector<TState, TProps, T1>,
selector2: InputSelector<TState, TProps, T2>,
selector3: InputSelector<TState, TProps, T3>,
selector4: InputSelector<TState, TProps, T4>,
selector5: InputSelector<TState, TProps, T5>,
selector6: InputSelector<TState, TProps, T6>,
selector7: InputSelector<TState, TProps, T7>,
selector8: InputSelector<TState, TProps, T8>,
selector9: InputSelector<TState, TProps, T9>,
selector10: InputSelector<TState, TProps, T10>,
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7,
arg8: T8,
arg9: T9,
arg10: T10
) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
selectors: [
InputSelector<TState, TProps, T1>,
InputSelector<TState, TProps, T2>,
InputSelector<TState, TProps, T3>,
InputSelector<TState, TProps, T4>,
InputSelector<TState, TProps, T5>,
InputSelector<TState, TProps, T6>,
InputSelector<TState, TProps, T7>,
InputSelector<TState, TProps, T8>,
InputSelector<TState, TProps, T9>,
InputSelector<TState, TProps, T10>
],
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7,
arg8: T8,
arg9: T9,
arg10: T10
) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(
selector1: InputSelector<TState, TProps, T1>,
selector2: InputSelector<TState, TProps, T2>,
selector3: InputSelector<TState, TProps, T3>,
selector4: InputSelector<TState, TProps, T4>,
selector5: InputSelector<TState, TProps, T5>,
selector6: InputSelector<TState, TProps, T6>,
selector7: InputSelector<TState, TProps, T7>,
selector8: InputSelector<TState, TProps, T8>,
selector9: InputSelector<TState, TProps, T9>,
selector10: InputSelector<TState, TProps, T10>,
selector11: InputSelector<TState, TProps, T11>,
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7,
arg8: T8,
arg9: T9,
arg10: T10,
arg11: T11
) => TResult
): OutputSelector<TState, TProps, TResult>,
<TState, TProps, TResult, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(
selectors: [
InputSelector<TState, TProps, T1>,
InputSelector<TState, TProps, T2>,
InputSelector<TState, TProps, T3>,
InputSelector<TState, TProps, T4>,
InputSelector<TState, TProps, T5>,
InputSelector<TState, TProps, T6>,
InputSelector<TState, TProps, T7>,
InputSelector<TState, TProps, T8>,
InputSelector<TState, TProps, T9>,
InputSelector<TState, TProps, T10>,
InputSelector<TState, TProps, T11>
],
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7,
arg8: T8,
arg9: T9,
arg10: T10,
arg11: T11
) => TResult
): OutputSelector<TState, TProps, TResult>,
<
TState,
TProps,
TResult,
T1,
T2,
T3,
T4,
T5,
T6,
T7,
T8,
T9,
T10,
T11,
T12
>(
selector1: InputSelector<TState, TProps, T1>,
selector2: InputSelector<TState, TProps, T2>,
selector3: InputSelector<TState, TProps, T3>,
selector4: InputSelector<TState, TProps, T4>,
selector5: InputSelector<TState, TProps, T5>,
selector6: InputSelector<TState, TProps, T6>,
selector7: InputSelector<TState, TProps, T7>,
selector8: InputSelector<TState, TProps, T8>,
selector9: InputSelector<TState, TProps, T9>,
selector10: InputSelector<TState, TProps, T10>,
selector11: InputSelector<TState, TProps, T11>,
selector12: InputSelector<TState, TProps, T12>,
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7,
arg8: T8,
arg9: T9,
arg10: T10,
arg11: T11,
arg12: T12
) => TResult
): OutputSelector<TState, TProps, TResult>,
<
TState,
TProps,
TResult,
T1,
T2,
T3,
T4,
T5,
T6,
T7,
T8,
T9,
T10,
T11,
T12
>(
selectors: [
InputSelector<TState, TProps, T1>,
InputSelector<TState, TProps, T2>,
InputSelector<TState, TProps, T3>,
InputSelector<TState, TProps, T4>,
InputSelector<TState, TProps, T5>,
InputSelector<TState, TProps, T6>,
InputSelector<TState, TProps, T7>,
InputSelector<TState, TProps, T8>,
InputSelector<TState, TProps, T9>,
InputSelector<TState, TProps, T10>,
InputSelector<TState, TProps, T11>,
InputSelector<TState, TProps, T12>
],
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7,
arg8: T8,
arg9: T9,
arg10: T10,
arg11: T11,
arg12: T12
) => TResult
): OutputSelector<TState, TProps, TResult>,
<
TState,
TProps,
TResult,
T1,
T2,
T3,
T4,
T5,
T6,
T7,
T8,
T9,
T10,
T11,
T12,
T13
>(
selector1: InputSelector<TState, TProps, T1>,
selector2: InputSelector<TState, TProps, T2>,
selector3: InputSelector<TState, TProps, T3>,
selector4: InputSelector<TState, TProps, T4>,
selector5: InputSelector<TState, TProps, T5>,
selector6: InputSelector<TState, TProps, T6>,
selector7: InputSelector<TState, TProps, T7>,
selector8: InputSelector<TState, TProps, T8>,
selector9: InputSelector<TState, TProps, T9>,
selector10: InputSelector<TState, TProps, T10>,
selector11: InputSelector<TState, TProps, T11>,
selector12: InputSelector<TState, TProps, T12>,
selector13: InputSelector<TState, TProps, T13>,
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7,
arg8: T8,
arg9: T9,
arg10: T10,
arg11: T11,
arg12: T12,
arg13: T13
) => TResult
): OutputSelector<TState, TProps, TResult>,
<
TState,
TProps,
TResult,
T1,
T2,
T3,
T4,
T5,
T6,
T7,
T8,
T9,
T10,
T11,
T12,
T13
>(
selectors: [
InputSelector<TState, TProps, T1>,
InputSelector<TState, TProps, T2>,
InputSelector<TState, TProps, T3>,
InputSelector<TState, TProps, T4>,
InputSelector<TState, TProps, T5>,
InputSelector<TState, TProps, T6>,
InputSelector<TState, TProps, T7>,
InputSelector<TState, TProps, T8>,
InputSelector<TState, TProps, T9>,
InputSelector<TState, TProps, T10>,
InputSelector<TState, TProps, T11>,
InputSelector<TState, TProps, T12>,
InputSelector<TState, TProps, T13>
],
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7,
arg8: T8,
arg9: T9,
arg10: T10,
arg11: T11,
arg12: T12,
arg13: T13
) => TResult
): OutputSelector<TState, TProps, TResult>,
<
TState,
TProps,
TResult,
T1,
T2,
T3,
T4,
T5,
T6,
T7,
T8,
T9,
T10,
T11,
T12,
T13,
T14
>(
selector1: InputSelector<TState, TProps, T1>,
selector2: InputSelector<TState, TProps, T2>,
selector3: InputSelector<TState, TProps, T3>,
selector4: InputSelector<TState, TProps, T4>,
selector5: InputSelector<TState, TProps, T5>,
selector6: InputSelector<TState, TProps, T6>,
selector7: InputSelector<TState, TProps, T7>,
selector8: InputSelector<TState, TProps, T8>,
selector9: InputSelector<TState, TProps, T9>,
selector10: InputSelector<TState, TProps, T10>,
selector11: InputSelector<TState, TProps, T11>,
selector12: InputSelector<TState, TProps, T12>,
selector13: InputSelector<TState, TProps, T13>,
selector14: InputSelector<TState, TProps, T14>,
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7,
arg8: T8,
arg9: T9,
arg10: T10,
arg11: T11,
arg12: T12,
arg13: T13,
arg14: T14
) => TResult
): OutputSelector<TState, TProps, TResult>,
<
TState,
TProps,
TResult,
T1,
T2,
T3,
T4,
T5,
T6,
T7,
T8,
T9,
T10,
T11,
T12,
T13,
T14
>(
selectors: [
InputSelector<TState, TProps, T1>,
InputSelector<TState, TProps, T2>,
InputSelector<TState, TProps, T3>,
InputSelector<TState, TProps, T4>,
InputSelector<TState, TProps, T5>,
InputSelector<TState, TProps, T6>,
InputSelector<TState, TProps, T7>,
InputSelector<TState, TProps, T8>,
InputSelector<TState, TProps, T9>,
InputSelector<TState, TProps, T10>,
InputSelector<TState, TProps, T11>,
InputSelector<TState, TProps, T12>,
InputSelector<TState, TProps, T13>,
InputSelector<TState, TProps, T14>
],
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7,
arg8: T8,
arg9: T9,
arg10: T10,
arg11: T11,
arg12: T12,
arg13: T13,
arg14: T14
) => TResult
): OutputSelector<TState, TProps, TResult>,
<
TState,
TProps,
TResult,
T1,
T2,
T3,
T4,
T5,
T6,
T7,
T8,
T9,
T10,
T11,
T12,
T13,
T14,
T15
>(
selector1: InputSelector<TState, TProps, T1>,
selector2: InputSelector<TState, TProps, T2>,
selector3: InputSelector<TState, TProps, T3>,
selector4: InputSelector<TState, TProps, T4>,
selector5: InputSelector<TState, TProps, T5>,
selector6: InputSelector<TState, TProps, T6>,
selector7: InputSelector<TState, TProps, T7>,
selector8: InputSelector<TState, TProps, T8>,
selector9: InputSelector<TState, TProps, T9>,
selector10: InputSelector<TState, TProps, T10>,
selector11: InputSelector<TState, TProps, T11>,
selector12: InputSelector<TState, TProps, T12>,
selector13: InputSelector<TState, TProps, T13>,
selector14: InputSelector<TState, TProps, T14>,
selector15: InputSelector<TState, TProps, T15>,
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7,
arg8: T8,
arg9: T9,
arg10: T10,
arg11: T11,
arg12: T12,
arg13: T13,
arg14: T14,
arg15: T15
) => TResult
): OutputSelector<TState, TProps, TResult>,
<
TState,
TProps,
TResult,
T1,
T2,
T3,
T4,
T5,
T6,
T7,
T8,
T9,
T10,
T11,
T12,
T13,
T14,
T15
>(
selectors: [
InputSelector<TState, TProps, T1>,
InputSelector<TState, TProps, T2>,
InputSelector<TState, TProps, T3>,
InputSelector<TState, TProps, T4>,
InputSelector<TState, TProps, T5>,
InputSelector<TState, TProps, T6>,
InputSelector<TState, TProps, T7>,
InputSelector<TState, TProps, T8>,
InputSelector<TState, TProps, T9>,
InputSelector<TState, TProps, T10>,
InputSelector<TState, TProps, T11>,
InputSelector<TState, TProps, T12>,
InputSelector<TState, TProps, T13>,
InputSelector<TState, TProps, T14>,
InputSelector<TState, TProps, T15>
],
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7,
arg8: T8,
arg9: T9,
arg10: T10,
arg11: T11,
arg12: T12,
arg13: T13,
arg14: T14,
arg15: T15
) => TResult
): OutputSelector<TState, TProps, TResult>,
<
TState,
TProps,
TResult,
T1,
T2,
T3,
T4,
T5,
T6,
T7,
T8,
T9,
T10,
T11,
T12,
T13,
T14,
T15,
T16
>(
selector1: InputSelector<TState, TProps, T1>,
selector2: InputSelector<TState, TProps, T2>,
selector3: InputSelector<TState, TProps, T3>,
selector4: InputSelector<TState, TProps, T4>,
selector5: InputSelector<TState, TProps, T5>,
selector6: InputSelector<TState, TProps, T6>,
selector7: InputSelector<TState, TProps, T7>,
selector8: InputSelector<TState, TProps, T8>,
selector9: InputSelector<TState, TProps, T9>,
selector10: InputSelector<TState, TProps, T10>,
selector11: InputSelector<TState, TProps, T11>,
selector12: InputSelector<TState, TProps, T12>,
selector13: InputSelector<TState, TProps, T13>,
selector14: InputSelector<TState, TProps, T14>,
selector15: InputSelector<TState, TProps, T15>,
selector16: InputSelector<TState, TProps, T16>,
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7,
arg8: T8,
arg9: T9,
arg10: T10,
arg11: T11,
arg12: T12,
arg13: T13,
arg14: T14,
arg15: T15,
arg16: T16
) => TResult
): OutputSelector<TState, TProps, TResult>,
<
TState,
TProps,
TResult,
T1,
T2,
T3,
T4,
T5,
T6,
T7,
T8,
T9,
T10,
T11,
T12,
T13,
T14,
T15,
T16
>(
selectors: [
InputSelector<TState, TProps, T1>,
InputSelector<TState, TProps, T2>,
InputSelector<TState, TProps, T3>,
InputSelector<TState, TProps, T4>,
InputSelector<TState, TProps, T5>,
InputSelector<TState, TProps, T6>,
InputSelector<TState, TProps, T7>,
InputSelector<TState, TProps, T8>,
InputSelector<TState, TProps, T9>,
InputSelector<TState, TProps, T10>,
InputSelector<TState, TProps, T11>,
InputSelector<TState, TProps, T12>,
InputSelector<TState, TProps, T13>,
InputSelector<TState, TProps, T14>,
InputSelector<TState, TProps, T15>,
InputSelector<TState, TProps, T16>
],
resultFunc: (
arg1: T1,
arg2: T2,
arg3: T3,
arg4: T4,
arg5: T5,
arg6: T6,
arg7: T7,
arg8: T8,
arg9: T9,
arg10: T10,
arg11: T11,
arg12: T12,
arg13: T13,
arg14: T14,
arg15: T15,
arg16: T16
) => TResult
): OutputSelector<TState, TProps, TResult>,
...
};
declare type Reselect = {|
createSelector: SelectorCreator,
defaultMemoize: <TFunc: Function>(
func: TFunc,
equalityCheck?: (a: any, b: any) => boolean
) => TFunc,
createSelectorCreator: (
memoize: Function,
...memoizeOptions: any[]
) => SelectorCreator,
createStructuredSelector: <TState, TProps, InputSelectors: {|[k: string | number]: InputSelector<TState, TProps, any>|}>(
inputSelectors: InputSelectors,
selectorCreator?: SelectorCreator
) => OutputSelector<TState, TProps, $ObjMap<InputSelectors, ExtractReturnType>>
|};
declare module.exports: Reselect;
}
```
|
/content/code_sandbox/flow-typed/reselect_v3.x.x.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 8,027
|
```javascript
declare module 'redux-mock-store' {
/*
S = State
A = Action
*/
declare type mockStore = { <S, A>(state: S): mockStoreWithoutMiddleware<S, A>, ... };
declare interface Dispatch<S, A> {
(action: A): A;
<T>(mixed): T; // TODO(#5006): fix type
// <T>((Function, Function) => T): T // this is too specific, not accommodating the
// // third argument... but also too loose, using the `any`-like `Function`
}
declare type mockStoreWithoutMiddleware<S, A> = {
getState(): S,
getActions(): Array<A>,
dispatch: Dispatch<S, A>,
clearActions(): void,
subscribe(callback: () => void): () => void,
replaceReducer(nextReducer: Function): void,
...
};
declare type Middleware = (any) => any => any;
declare module.exports: (middlewares: ?Array<Middleware>) => mockStore;
}
// Filename aliases
declare module 'redux-mock-store/src/index' {
declare module.exports: $Exports<'redux-mock-store'>;
}
declare module 'redux-mock-store/src/index.js' {
declare module.exports: $Exports<'redux-mock-store'>;
}
```
|
/content/code_sandbox/flow-typed/redux-mock-store_v1.2.x.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 284
|
```javascript
// Definitions we want Flow to assume.
//
// For docs on the format, see:
// path_to_url
declare var __TEST__: true | void;
```
|
/content/code_sandbox/flow-typed/globals.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 34
|
```javascript
// Assembled with help from Flowgen v1.10.0.
//
// The modules 'expo-apple-authentication/build/AppleAuthentication',
// 'expo-apple-authentication/build/AppleAuthenticationButton', and
// 'expo-apple-authentication/build/AppleAuthentication.types' are the
// result of passing those files in node_modules through Flowgen and
// doing some minor syntactic tweaks.
declare module 'expo-apple-authentication/build/AppleAuthentication' {
import type {
AppleAuthenticationSignInOptions,
AppleAuthenticationRefreshOptions,
AppleAuthenticationSignOutOptions,
AppleAuthenticationCredential,
AppleAuthenticationRevokeListener,
} from 'expo-apple-authentication/build/AppleAuthentication.types';
import typeof { AppleAuthenticationCredentialState } from 'expo-apple-authentication/build/AppleAuthentication.types';
declare type Subscription = {|
remove: () => void,
|};
declare export function isAvailableAsync(): Promise<boolean>;
declare export function signInAsync(
options?: AppleAuthenticationSignInOptions,
): Promise<AppleAuthenticationCredential>;
declare export function refreshAsync(
options: AppleAuthenticationRefreshOptions,
): Promise<AppleAuthenticationCredential>;
declare export function signOutAsync(
options: AppleAuthenticationSignOutOptions,
): Promise<AppleAuthenticationCredential>;
declare export function getCredentialStateAsync(
user: string,
): Promise<AppleAuthenticationCredentialState>;
declare export function addRevokeListener(
listener: AppleAuthenticationRevokeListener,
): Subscription;
}
declare module 'expo-apple-authentication/build/AppleAuthentication.types' {
declare export type AppleAuthenticationButtonProps = {
// TODO: `View`'s props and
/**
* The method to call when the user presses the button. You should call
* [`AppleAuthentication.signInAsync`](#isavailableasync) in here.
*/
onPress: () => void | Promise<void>,
/**
* The type of button text to display ("Sign In with Apple" vs.
* "Continue with Apple").
*/
buttonType: $Values<typeof AppleAuthenticationButtonType>,
/**
* The Apple-defined color scheme to use to display the button.
*/
buttonStyle: $Values<typeof AppleAuthenticationButtonStyle>,
/**
* The border radius to use when rendering the button. This works
* similarly to ` style.borderRadius` in other Views.
*/
cornerRadius?: number,
/**
* The custom style to apply to the button. Should not include
* `backgroundColor` or `borderRadius` properties.
*/
// TODO: implement
style?: mixed,
...
};
/**
* The options you can supply when making a call to `AppleAuthentication.signInAsync()`. None of
* these options are required.
* @see [Apple
* Documentation](path_to_url
* for more details.
*/
declare export type AppleAuthenticationSignInOptions = {
/**
* The scope of personal information to which your app is requesting access. The user can choose
* to deny your app access to any scope at the time of logging in.
* @defaults `[]` (no scopes).
*/
requestedScopes?: $Values<typeof AppleAuthenticationScope>[],
/**
* Data that's returned to you unmodified in the corresponding credential after a successful
* authentication. Used to verify that the response was from the request you made. Can be used to
* avoid replay attacks.
*/
state?: string,
/**
* Data that is used to verify the uniqueness of a response and prevent replay attacks.
*/
nonce?: string,
...
};
/**
* The options you can supply when making a call to `AppleAuthentication.refreshAsync()`. You must
* include the ID string of the user whose credentials you'd like to refresh.
* @see [Apple
* Documentation](path_to_url
* for more details.
*/
declare export type AppleAuthenticationRefreshOptions = {
user: string,
/**
* The scope of personal information to which your app is requesting access. The user can choose
* to deny your app access to any scope at the time of refreshing.
* @defaults `[]` (no scopes).
*/
requestedScopes?: $Values<typeof AppleAuthenticationScope>[],
/**
* Data that's returned to you unmodified in the corresponding credential after a successful
* authentication. Used to verify that the response was from the request you made. Can be used to
* avoid replay attacks.
*/
state?: string,
...
};
/**
* The options you can supply when making a call to `AppleAuthentication.signOutAsync()`. You must
* include the ID string of the user to sign out.
* @see [Apple
* Documentation](path_to_url
* for more details.
*/
declare export type AppleAuthenticationSignOutOptions = {
user: string,
/**
* Data that's returned to you unmodified in the corresponding credential after a successful
* authentication. Used to verify that the response was from the request you made. Can be used to
* avoid replay attacks.
*/
state?: string,
...
};
/**
* The user credentials returned from a successful call to `AppleAuthentication.signInAsync()`,
* `AppleAuthentication.refreshAsync()`, or `AppleAuthentication.signOutAsync()`.
* @see [Apple
* Documentation](path_to_url
* for more details.
*/
declare export type AppleAuthenticationCredential = {
/**
* An identifier associated with the authenticated user. You can use this to check if the user is
* still authenticated later. This is stable and can be shared across apps released under the same
* development team. The same user will have a different identifier for apps released by other
* developers.
*/
user: string,
/**
* An arbitrary string that your app provided as `state` in the request that generated the
* credential. Used to verify that the response was from the request you made. Can be used to
* avoid replay attacks.
*/
state: string | null,
/**
* The user's name. May be `null` or contain `null` values if you didn't request the `FULL_NAME`
* scope, if the user denied access, or if this is not the first time the user has signed into
* your app.
*/
fullName: AppleAuthenticationFullName | null,
/**
* The user's email address. Might not be present if you didn't request the `EMAIL` scope. May
* also be null if this is not the first time the user has signed into your app. If the user chose
* to withhold their email address, this field will instead contain an obscured email address with
* an Apple domain.
*/
email: string | null,
/**
* A value that indicates whether the user appears to the system to be a real person.
*/
realUserStatus: $Values<typeof AppleAuthenticationUserDetectionStatus>,
/**
* A JSON Web Token (JWT) that securely communicates information about the user to your app.
*/
identityToken: string,
/**
* A short-lived session token used by your app for proof of authorization when interacting with
* the app's server counterpart. Unlike `user`, this is ephemeral and will change each session.
*/
authorizationCode: string,
...
};
/**
* An object representing the tokenized portions of the user's full name.
*/
declare export type AppleAuthenticationFullName = {
namePrefix: string | null,
givenName: string | null,
middleName: string | null,
familyName: string | null,
nameSuffix: string | null,
nickname: string | null,
...
};
declare export type AppleAuthenticationRevokeListener = () => void;
/**
* Scopes you can request when calling `AppleAuthentication.signInAsync()` or
* `AppleAuthentication.refreshAsync()`.
* @note Note that it is possible that you will not be granted all of the scopes which you request.
* You will still need to handle null values for any fields you request.
* @see [Apple
* Documentation](path_to_url
* for more details.
*/
declare export var AppleAuthenticationScope: {|
+FULL_NAME: 0, // 0
+EMAIL: 1, // 1
|};
declare export var AppleAuthenticationOperation: {|
+IMPLICIT: 0, // 0
+LOGIN: 1, // 1
+REFRESH: 2, // 2
+LOGOUT: 3, // 3
|};
/**
* The state of the credential when checked with `AppleAuthentication.getCredentialStateAsync()`.
* @see [Apple
* Documentation](path_to_url
* for more details.
*/
declare export var AppleAuthenticationCredentialState: {|
+REVOKED: 0, // 0
+AUTHORIZED: 1, // 1
+NOT_FOUND: 2, // 2
+TRANSFERRED: 3, // 3
|};
/**
* A value that indicates whether the user appears to be a real person. You get this in the
* realUserStatus property of a `Credential` object. It can be used as one metric to help prevent
* fraud.
* @see [Apple
* Documentation](path_to_url
* for more details.
*/
declare export var AppleAuthenticationUserDetectionStatus: {|
+UNSUPPORTED: 0, // 0
+UNKNOWN: 1, // 1
+LIKELY_REAL: 2, // 2
|};
/**
* Controls the predefined text shown on the authentication button.
*/
declare export var AppleAuthenticationButtonType: {|
+SIGN_IN: 0, // 0
+CONTINUE: 1, // 1
|};
/**
* Controls the predefined style of the authenticating button.
*/
declare export var AppleAuthenticationButtonStyle: {|
+WHITE: 0, // 0
+WHITE_OUTLINE: 1, // 1
+BLACK: 2, // 2
|};
}
declare module 'expo-apple-authentication/build/AppleAuthenticationButton' {
import type { StatelessFunctionalComponent } from 'react';
/* eslint-disable-next-line */
import type { AppleAuthenticationButtonProps } from 'expo-apple-authentication/build/AppleAuthentication.types';
/**
* This component displays the proprietary "Sign In with Apple" / "Continue with Apple" button on
* your screen. The App Store Guidelines require you to use this component to start the sign in
* process instead of a custom button. You can customize the design of the button using the
* properties. You should start the sign in process when the `onPress` property is called.
*
* You should only attempt to render this if `AppleAuthentication.isAvailableAsync()` resolves to
* true. This component will render nothing if it is not available and you will get a warning if
* `__DEV__ === true`.
*
* The properties of this component extend from `View`; however, you should not attempt to set
* `backgroundColor` or `borderRadius` with the `style` property. This will not work and is against
* the App Store Guidelines. Instead, you should use the `buttonStyle` property to choose one of the
* predefined color styles and the `cornerRadius` property to change the border radius of the
* button.
* @see [Apple
* Documentation](path_to_url
* for more details.
*/
declare type AppleAuthenticationButton = StatelessFunctionalComponent<AppleAuthenticationButtonProps>;
declare export default AppleAuthenticationButton;
}
/*
* Flowtype definitions for AppleAuthenticationButton
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.10.0
*/
declare module 'expo-apple-authentication' {
declare export * from 'expo-apple-authentication/build/AppleAuthentication'
declare export * from 'expo-apple-authentication/build/AppleAuthentication.types'
declare export {
default as AppleAuthenticationButton,
} from 'expo-apple-authentication/build/AppleAuthenticationButton';
}
```
|
/content/code_sandbox/flow-typed/expo-apple-authentication_vx.x.x.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 2,667
|
```javascript
// flow-typed signature: dfa621fc2221dbcc5c75aa37a073b542
// flow-typed version: <<STUB>>/react-native-simple-toast_v0.1.1/flow_v0.92.0
/**
* Verbatim from index.d.ts.
*/
declare module 'react-native-simple-toast' {
declare type SimpleToast = {|
// Toast duration constants
SHORT: number,
LONG: number,
// Toast gravity constants
TOP: number,
BOTTOM: number,
CENTER: number,
show: (message: string, duration?: number) => void,
showWithGravity: (message: string, duration: number, gravity: number) => void,
|};
declare export default SimpleToast;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
// Filename aliases
declare module 'react-native-simple-toast/index' {
declare module.exports: $Exports<'react-native-simple-toast'>;
}
declare module 'react-native-simple-toast/index.js' {
declare module.exports: $Exports<'react-native-simple-toast'>;
}
```
|
/content/code_sandbox/flow-typed/react-native-simple-toast_vx.x.x.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 260
|
```javascript
// All definitions taken directly from:
// @react-native-async-storage/async-storage/lib/AsyncStorage.js
declare module '@react-native-async-storage/async-storage' {
declare type ReadOnlyArrayString = $ReadOnlyArray<string>;
declare export default {
getItem(
key: string,
callback?: ?(error: ?Error, result: string | null) => void,
): Promise<string | null>,
setItem(key: string, value: string, callback?: ?(error: ?Error) => void): Promise<mixed>,
multiSet(
keyValuePairs: Array<Array<string>>,
callback?: ?(errors: ?$ReadOnlyArray<?Error>) => void,
): Promise<mixed>,
removeItem(key: string, callback?: ?(error: ?Error) => void): Promise<mixed>,
getAllKeys(
callback?: ?(error: ?Error, keys: ?ReadOnlyArrayString) => void,
): Promise<ReadOnlyArrayString>,
clear(callback?: ?(error: ?Error) => void): Promise<mixed>,
...
};
}
```
|
/content/code_sandbox/flow-typed/@react-native-async-storage/async-storage_v1.x.x.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 235
|
```javascript
// flow-typed signature: 2a3c1f56ec559e89dd447792f9debaf6
// flow-typed version: c6154227d1/deep-freeze_v0.0.1/flow_>=v0.25.x <=v0.103.x
declare module 'deep-freeze' {
declare module.exports: <T>(o: T) => T;
}
```
|
/content/code_sandbox/flow-typed/npm/deep-freeze_v0.0.1.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 90
|
```javascript
// flow-typed signature: 4e6a5da3290fe9ea49e6bcdced64f358
// flow-typed version: c6154227d1/flow-bin_v0.x.x/flow_>=v0.25.x <=v0.103.x
declare module "flow-bin" {
declare module.exports: string;
}
```
|
/content/code_sandbox/flow-typed/npm/flow-bin_v0.x.x.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 78
|
```diff
diff --git a/node_modules/react-native/jest/setup.js b/node_modules/react-native/jest/setup.js
index 5bc654475..e61bbf49c 100644
--- a/node_modules/react-native/jest/setup.js
+++ b/node_modules/react-native/jest/setup.js
@@ -15,22 +15,52 @@ const mockComponent = jest.requireActual('./mockComponent');
jest.requireActual('@react-native/polyfills/Object.es8');
jest.requireActual('@react-native/polyfills/error-guard');
-global.__DEV__ = true;
-
-global.performance = {
- now: jest.fn(Date.now),
-};
-
-global.Promise = jest.requireActual('promise');
-global.regeneratorRuntime = jest.requireActual('regenerator-runtime/runtime');
-global.window = global;
-
-global.requestAnimationFrame = function (callback) {
- return setTimeout(callback, 0);
-};
-global.cancelAnimationFrame = function (id) {
- clearTimeout(id);
-};
+Object.defineProperties(global, {
+ __DEV__: {
+ configurable: true,
+ enumerable: true,
+ value: true,
+ writable: true,
+ },
+ Promise: {
+ configurable: true,
+ enumerable: true,
+ value: jest.requireActual('promise'),
+ writable: true,
+ },
+ cancelAnimationFrame: {
+ configurable: true,
+ enumerable: true,
+ value: id => clearTimeout(id),
+ writable: true,
+ },
+ performance: {
+ configurable: true,
+ enumerable: true,
+ value: {
+ now: jest.fn(Date.now),
+ },
+ writable: true,
+ },
+ regeneratorRuntime: {
+ configurable: true,
+ enumerable: true,
+ value: jest.requireActual('regenerator-runtime/runtime'),
+ writable: true,
+ },
+ requestAnimationFrame: {
+ configurable: true,
+ enumerable: true,
+ value: callback => setTimeout(callback, 0),
+ writable: true,
+ },
+ window: {
+ configurable: true,
+ enumerable: true,
+ value: global,
+ writable: true,
+ },
+});
// there's a __mock__ for it.
jest.setMock(
diff --git a/node_modules/react-native/scripts/react_native_pods.rb b/node_modules/react-native/scripts/react_native_pods.rb
index f2ceeda..c618f77 100644
--- a/node_modules/react-native/scripts/react_native_pods.rb
+++ b/node_modules/react-native/scripts/react_native_pods.rb
@@ -254,6 +254,7 @@ def react_native_post_install(installer)
cpp_flags = NEW_ARCH_OTHER_CPLUSPLUSFLAGS
end
modify_flags_for_new_architecture(installer, cpp_flags)
+ apply_xcode_15_patch(installer)
end
@@ -661,3 +662,16 @@ def __apply_Xcode_12_5_M1_post_install_workaround(installer)
time_header = "#{Pod::Config.instance.installation_root.to_s}/Pods/RCT-Folly/folly/portability/Time.h"
`sed -i -e $'s/ && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0)//' #{time_header}`
end
+
+# Fix to build react native on Xcode 15 beta 1
+def apply_xcode_15_patch(installer)
+ installer.target_installation_results.pod_target_installation_results
+ .each do |pod_name, target_installation_result|
+ target_installation_result.native_target.build_configurations.each do |config|
+ # unary_function and binary_function are no longer provided in C++17 and newer standard modes as part of Xcode 15. They can be re-enabled with setting _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
+ # Ref: path_to_url#Deprecations
+ config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= '$(inherited) '
+ config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << '"_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION" '
+ end
+ end
+end
```
|
/content/code_sandbox/patches/react-native+0.68.7.patch
|
diff
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 895
|
```unknown
// These are hand-written stubs, while we focus on other libraries
// that consume this one.
// @flow
import * as React from 'react';
export type PanGestureHandlerProps = $FlowFixMe;
export type PanGestureHandlerProperties = $FlowFixMe;
export type PanGestureHandlerGestureEvent = $FlowFixMe;
export class PanGestureHandler extends React.Component<PanGestureHandlerProps> {}
export type TapGestureHandler = $FlowFixMe;
export type TapGestureHandlerProperties = $FlowFixMe;
export type State = $FlowFixMe;
declare export var GestureHandlerRootView: $FlowFixMe;
declare export var BaseButton: $FlowFixMe;
```
|
/content/code_sandbox/types/react-native-gesture-handler.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 142
|
```javascript
// flow-typed signature: 8da1e134b3de1d6f6bf9ba1cc7e2dc7e
// flow-typed version: 387a235736/react-redux_v7.x.x/flow_>=v0.104.x
/**
The order of type arguments for connect() is as follows:
connect<Props, OwnProps, StateProps, DispatchProps, State, Dispatch>()
In Flow v0.89 only the first two are mandatory to specify. Other 4 can be repaced with the new awesome type placeholder:
connect<Props, OwnProps, _, _, _, _>()
But beware, in case of weird type errors somewhere in random places
just type everything and get to a green field and only then try to
remove the definitions you see bogus.
Decrypting the abbreviations:
WC = Component being wrapped
S = State
D = Dispatch
OP = OwnProps
SP = StateProps
DP = DispatchProps
MP = Merge props
RSP = Returned state props
RDP = Returned dispatch props
RMP = Returned merge props
CP = Props for returned component
Com = React Component
SS = Selected state
ST = Static properties of Com
EFO = Extra factory options (used only in connectAdvanced)
*/
declare module "react-redux" {
// ------------------------------------------------------------
// Typings for connect()
// ------------------------------------------------------------
declare export type Options<S, OP, SP, MP> = {|
pure?: boolean,
forwardRef?: boolean,
areStatesEqual?: (next: S, prev: S) => boolean,
areOwnPropsEqual?: (next: OP, prev: OP) => boolean,
areStatePropsEqual?: (next: SP, prev: SP) => boolean,
areMergedPropsEqual?: (next: MP, prev: MP) => boolean,
storeKey?: string,
|};
declare type MapStateToProps<-S, -OP, +SP> =
| ((state: S, ownProps: OP) => SP)
// If you want to use the factory function but get a strange error
// like "function is not an object" then just type the factory function
// like this:
// const factory: (State, OwnProps) => (State, OwnProps) => StateProps
// and provide the StateProps type to the SP type parameter.
| ((state: S, ownProps: OP) => (state: S, ownProps: OP) => SP);
declare type Bind<D> = <A, R>((...A) => R) => (...A) => $Call<D, R>;
declare type MapDispatchToPropsFn<D, -OP, +DP> =
| ((dispatch: D, ownProps: OP) => DP)
// If you want to use the factory function but get a strange error
// like "function is not an object" then just type the factory function
// like this:
// const factory: (Dispatch, OwnProps) => (Dispatch, OwnProps) => DispatchProps
// and provide the DispatchProps type to the DP type parameter.
| ((dispatch: D, ownProps: OP) => (dispatch: D, ownProps: OP) => DP);
declare class ConnectedComponent<OP, +WC> extends React$Component<OP> {
static +WrappedComponent: WC;
getWrappedInstance(): React$ElementRef<WC>;
}
// The connection of the Wrapped Component and the Connected Component
// happens here in `MP: P`. It means that type wise MP belongs to P,
// so to say MP >= P.
declare type Connector<P, OP, MP: P> = <WC: React$ComponentType<P>>(
WC,
) => Class<ConnectedComponent<OP, WC>> & WC;
// No `mergeProps` argument
// Got error like inexact OwnProps is incompatible with exact object type?
// Just make the OP parameter for `connect()` an exact object.
declare type MergeOP<OP, D> = {| ...$Exact<OP>, dispatch: D |};
declare type MergeOPSP<OP, SP, D> = {| ...$Exact<OP>, ...SP, dispatch: D |};
declare type MergeOPDP<OP, DP> = {| ...$Exact<OP>, ...DP |};
declare type MergeOPSPDP<OP, SP, DP> = {| ...$Exact<OP>, ...SP, ...DP |};
declare export function connect<-P, -OP, -SP, -DP, -S, -D>(
mapStateToProps?: null | void,
mapDispatchToProps?: null | void,
mergeProps?: null | void,
options?: ?Options<S, OP, {||}, MergeOP<OP, D>>,
): Connector<P, OP, MergeOP<OP, D>>;
declare export function connect<-P, -OP, -SP, -DP, -S, -D>(
// If you get error here try adding return type to your mapStateToProps function
mapStateToProps: MapStateToProps<S, OP, SP>,
mapDispatchToProps?: null | void,
mergeProps?: null | void,
options?: ?Options<S, OP, SP, MergeOPSP<OP, SP, D>>,
): Connector<P, OP, MergeOPSP<OP, SP, D>>;
// In this case DP is an object of functions which has been bound to dispatch
// by the given mapDispatchToProps function.
declare export function connect<-P, -OP, -SP, -DP, S, D>(
mapStateToProps: null | void,
mapDispatchToProps: MapDispatchToPropsFn<D, OP, DP>,
mergeProps?: null | void,
options?: ?Options<S, OP, {||}, MergeOPDP<OP, DP>>,
): Connector<P, OP, MergeOPDP<OP, DP>>;
// In this case DP is an object of action creators not yet bound to dispatch,
// this difference is not important in the vanila redux,
// but in case of usage with redux-thunk, the return type may differ.
declare export function connect<-P, -OP, -SP, -DP, S, D>(
mapStateToProps: null | void,
mapDispatchToProps: DP,
mergeProps?: null | void,
options?: ?Options<S, OP, {||}, MergeOPDP<OP, DP>>,
): Connector<P, OP, MergeOPDP<OP, $ObjMap<DP, Bind<D>>>>;
declare export function connect<-P, -OP, -SP, -DP, S, D>(
// If you get error here try adding return type to your mapStateToProps function
mapStateToProps: MapStateToProps<S, OP, SP>,
mapDispatchToProps: MapDispatchToPropsFn<D, OP, DP>,
mergeProps?: null | void,
options?: ?Options<S, OP, SP, {| ...OP, ...SP, ...DP |}>,
): Connector<P, OP, {| ...OP, ...SP, ...DP |}>;
declare export function connect<-P, -OP, -SP, -DP, S, D>(
// If you get error here try adding return type to your mapStateToProps function
mapStateToProps: MapStateToProps<S, OP, SP>,
mapDispatchToProps: DP,
mergeProps?: null | void,
options?: ?Options<S, OP, SP, MergeOPSPDP<OP, SP, DP>>,
): Connector<P, OP, MergeOPSPDP<OP, SP, $ObjMap<DP, Bind<D>>>>;
// With `mergeProps` argument
declare type MergeProps<+P, -OP, -SP, -DP> = (
stateProps: SP,
dispatchProps: DP,
ownProps: OP,
) => P;
declare export function connect<-P, -OP, -SP: {||}, -DP: {||}, S, D>(
mapStateToProps: null | void,
mapDispatchToProps: null | void,
// If you get error here try adding return type to you mapStateToProps function
mergeProps: MergeProps<P, OP, {||}, {| dispatch: D |}>,
options?: ?Options<S, OP, {||}, P>,
): Connector<P, OP, P>;
declare export function connect<-P, -OP, -SP, -DP: {||}, S, D>(
mapStateToProps: MapStateToProps<S, OP, SP>,
mapDispatchToProps: null | void,
// If you get error here try adding return type to you mapStateToProps function
mergeProps: MergeProps<P, OP, SP, {| dispatch: D |}>,
options?: ?Options<S, OP, SP, P>,
): Connector<P, OP, P>;
// In this case DP is an object of functions which has been bound to dispatch
// by the given mapDispatchToProps function.
declare export function connect<-P, -OP, -SP: {||}, -DP, S, D>(
mapStateToProps: null | void,
mapDispatchToProps: MapDispatchToPropsFn<D, OP, DP>,
mergeProps: MergeProps<P, OP, {||}, DP>,
options?: ?Options<S, OP, {||}, P>,
): Connector<P, OP, P>;
// In this case DP is an object of action creators not yet bound to dispatch,
// this difference is not important in the vanila redux,
// but in case of usage with redux-thunk, the return type may differ.
declare export function connect<-P, -OP, -SP: {||}, -DP, S, D>(
mapStateToProps: null | void,
mapDispatchToProps: DP,
mergeProps: MergeProps<P, OP, {||}, $ObjMap<DP, Bind<D>>>,
options?: ?Options<S, OP, {||}, P>,
): Connector<P, OP, P>;
// In this case DP is an object of functions which has been bound to dispatch
// by the given mapDispatchToProps function.
declare export function connect<-P, -OP, -SP, -DP, S, D>(
mapStateToProps: MapStateToProps<S, OP, SP>,
mapDispatchToProps: MapDispatchToPropsFn<D, OP, DP>,
mergeProps: MergeProps<P, OP, SP, DP>,
options?: ?Options<S, OP, SP, P>,
): Connector<P, OP, P>;
// In this case DP is an object of action creators not yet bound to dispatch,
// this difference is not important in the vanila redux,
// but in case of usage with redux-thunk, the return type may differ.
declare export function connect<-P, -OP, -SP, -DP, S, D>(
mapStateToProps: MapStateToProps<S, OP, SP>,
mapDispatchToProps: DP,
mergeProps: MergeProps<P, OP, SP, $ObjMap<DP, Bind<D>>>,
options?: ?Options<S, OP, SP, P>,
): Connector<P, OP, P>;
// ------------------------------------------------------------
// Typings for Hooks
// ------------------------------------------------------------
declare export function useDispatch<D>(): D;
declare export function useSelector<S, SS>(
selector: (state: S) => SS,
equalityFn?: (a: SS, b: SS) => boolean,
): SS;
declare export function useStore<Store>(): Store;
// ------------------------------------------------------------
// Typings for Provider
// ------------------------------------------------------------
declare export class Provider<Store> extends React$Component<{
store: Store,
children?: React$Node,
...
}> {}
declare export function createProvider(
storeKey?: string,
subKey?: string,
): Class<Provider<*>>;
// ------------------------------------------------------------
// Typings for connectAdvanced()
// ------------------------------------------------------------
declare type ConnectAdvancedOptions = {
getDisplayName?: (name: string) => string,
methodName?: string,
renderCountProp?: string,
shouldHandleStateChanges?: boolean,
storeKey?: string,
forwardRef?: boolean,
...
};
declare type SelectorFactoryOptions<Com> = {
getDisplayName: (name: string) => string,
methodName: string,
renderCountProp: ?string,
shouldHandleStateChanges: boolean,
storeKey: string,
forwardRef: boolean,
displayName: string,
wrappedComponentName: string,
WrappedComponent: Com,
...
};
declare type MapStateToPropsEx<S: Object, SP: Object, RSP: Object> = (
state: S,
props: SP,
) => RSP;
declare type SelectorFactory<
Com: React$ComponentType<*>,
Dispatch,
S: Object,
OP: Object,
EFO: Object,
CP: Object,
> = (
dispatch: Dispatch,
factoryOptions: SelectorFactoryOptions<Com> & EFO,
) => MapStateToPropsEx<S, OP, CP>;
declare export function connectAdvanced<
Com: React$ComponentType<*>,
D,
S: Object,
OP: Object,
CP: Object,
EFO: Object,
ST: { [_: $Keys<Com>]: any, ... },
>(
selectorFactory: SelectorFactory<Com, D, S, OP, EFO, CP>,
connectAdvancedOptions: ?(ConnectAdvancedOptions & EFO),
): (component: Com) => React$ComponentType<OP> & $Shape<ST>;
declare export function batch(() => void): void
declare export default {
Provider: typeof Provider,
createProvider: typeof createProvider,
connect: typeof connect,
connectAdvanced: typeof connectAdvanced,
useDispatch: typeof useDispatch,
useSelector: typeof useSelector,
useStore: typeof useStore,
batch: typeof batch,
...
};
}
```
|
/content/code_sandbox/flow-typed/npm/react-redux_v7.x.x.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 2,934
|
```unknown
/*
Types for the NPM package `sqlite3`.
Based on upstream API docs:
path_to_url
@flow strict-local
*/
/* eslint-disable */
// From `Statement::BindParameter` in the implementation.
// It actually also accepts arbitrary objects using ToString,
// but let's say that it doesn't.
export type QueryParameter = string | number | boolean | null | RegExp | Date | Buffer;
type Row = { ... };
type ResultCallback<T> = interface { (Error): void, (null, T): void };
declare export class Database {
constructor(filename: string): this; // not modeled: mode and callback
close(cb?: ResultCallback<void>): void;
// configure() not modeled
// Does the `run` callback get a second argument? Not sure from docs.
// Not modeled here: the `this` on the `run` callback.
run(sql: string, params: QueryParameter[], cb?: ResultCallback<void>): this;
run(sql: string, cb?: ResultCallback<void>): this;
get(sql: string, params: QueryParameter[], cb?: ResultCallback<Row | void>): this;
get(sql: string, cb?: ResultCallback<Row | void>): this;
all(sql: string, params: QueryParameter[], cb?: ResultCallback<Row[]>): this;
all(sql: string, cb?: ResultCallback<Row[]>): this;
each(
sql: string,
params: QueryParameter[],
cb?: ResultCallback<Row>,
complete?: ResultCallback<number>,
): this;
each(sql: string, cb?: ResultCallback<Row>, complete?: ResultCallback<number>): this;
exec(sql: string, cb?: ResultCallback<void>): this;
// Not modeled: the Statement class, and:
// prepare(sql: string, params: QueryParameter[], cb?: ResultCallback<void>): Statement;
// prepare(sql: string, cb?: ResultCallback<void>): Statement;
// The library also accepts forms one might write like:
// all(sql: string, ...params: QueryParameter[], cb?: ResultCallback<Row[]>): this
// with the query parameters splatted right into the arguments list.
// But that means a variable-length list of arguments followed by another
// argument, which the Flow type system doesn't permit. We include the
// zero-argument version of that for convenience; otherwise, pass an array.
//
// It also accepts `params` as an object like this:
// db.run("UPDATE tbl SET name = $name WHERE id = $id", { $id: 2, $name: "bar" });
// We leave that out for now.
}
export default {
// `verbose` function not modeled
Database,
// Statement class not modeled
};
```
|
/content/code_sandbox/types/sqlite3.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 591
|
```unknown
/**
* `react-intl`, translated from react-intl/react-intl.d.ts, with minimal
* tweaks to make it work.
*
* This used to refer to types from React's TypeScript libdef,
* @types/react. We've translated those places to use Flow instead,
* hopefully without errors or too much loss of information.
*
* @flow strict-local
*/
/**
* Flowtype definitions for react-intl
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.11.0
*/
import type { SubsetProperties } from '../src/generics';
type ArgumentElement = BaseElement<typeof TYPE.argument>;
interface BaseElement<T: $Values<typeof TYPE>> {
type: T;
value: string;
location?: Location_2;
}
/**
* Create intl object
* @param config intl config
* @param cache cache for formatter instances to prevent memory leak
*/
declare export function createIntl(config: OptionalIntlConfig, cache?: IntlCache): IntlShape;
declare export function createIntlCache(): IntlCache;
type CurrencyCode = string;
export interface CustomFormatConfig {
format?: string;
}
export type CustomFormats = {
relative?: {| [key: string]: IntlRelativeTimeFormatOptions |},
...
} & $Rest<Formats, { ... }>;
type DateElement = SimpleFormatElement<typeof TYPE.date, DateTimeSkeleton>;
type DateTimeFormatOptions = {
hourCycle?: 'h11' | 'h12' | 'h23' | 'h24',
dateStyle?: 'full' | 'long' | 'medium' | 'short',
timeStyle?: 'full' | 'long' | 'medium' | 'short',
fractionalSecondDigits?: number,
calendar?: | 'buddhist'
| 'chinese'
| 'coptic'
| 'ethiopia'
| 'ethiopic'
| 'gregory'
| 'hebrew'
| 'indian'
| 'islamic'
| 'iso8601'
| 'japanese'
| 'persian'
| 'roc',
numberingSystem?: string,
...
} & Intl$DateTimeFormatOptions;
interface DateTimeSkeleton {
type: typeof SKELETON_TYPE.dateTime;
pattern: string;
location?: Location_2;
}
declare var DEFAULT_INTL_CONFIG: SubsetProperties<
IntlConfig,
{|
formats: mixed,
messages: mixed,
timeZone?: mixed,
textComponent?: mixed,
defaultLocale: mixed,
defaultFormats: mixed,
onError: mixed,
|},
>;
declare export function defineMessage<T>(msg: T): T;
declare export function defineMessages<K: $Keys<$FlowFixMe>, T, U: {| [key: K]: T |}>(msgs: U): U;
declare class DisplayNames {
constructor(locales?: string | string[], options?: DisplayNamesOptions): this;
static supportedLocalesOf(
locales?: string | string[],
options?: SubsetProperties<DisplayNamesOptions, {| localeMatcher?: mixed |}>,
): string[];
static __addLocaleData(...data: DisplayNamesLocaleData[]): void;
of(code: string | number | {| [key: string]: $FlowFixMe |}): string | void;
resolvedOptions(): DisplayNamesResolvedOptions;
static localeData: {| [key: string]: DisplayNamesData |};
static +polyfilled: $FlowFixMe; // true
}
interface DisplayNamesData {
/**
* Note that for style fields, `short` and `narrow` might not exist.
* At runtime, the fallback order will be narrow -> short -> long.
*/
types: {
/**
* Maps language subtag like `zh-CN` to their display names.
*/
language: {
narrow: {| [key: LanguageTag]: string |},
short: {| [key: LanguageTag]: string |},
long: {| [key: LanguageTag]: string |},
...
},
region: {
narrow: {| [key: RegionCode]: string |},
short: {| [key: RegionCode]: string |},
long: {| [key: RegionCode]: string |},
...
},
script: {
narrow: {| [key: ScriptCode]: string |},
short: {| [key: ScriptCode]: string |},
long: {| [key: ScriptCode]: string |},
...
},
currency: {
narrow: {| [key: CurrencyCode]: string |},
short: {| [key: CurrencyCode]: string |},
long: {| [key: CurrencyCode]: string |},
...
},
...
};
/**
* Not in spec, but we need this to display both language and region in display name.
* e.g. zh-Hans-SG + "{0}{1}" ->
* Here {0} is replaced by language display name and {1} is replaced by region display name.
*/
patterns: {
locale: string,
...
};
}
type DisplayNamesLocaleData = LocaleData<DisplayNamesData>;
interface DisplayNamesOptions {
localeMatcher?: 'lookup' | 'best fit';
style?: 'narrow' | 'short' | 'long';
type?: 'language' | 'region' | 'script' | 'currency';
fallback?: 'code' | 'none';
}
interface DisplayNamesResolvedOptions {
locale: string;
style: $NonMaybeType<DisplayNamesOptions['style']>;
type: $NonMaybeType<DisplayNamesOptions['type']>;
fallback: $NonMaybeType<DisplayNamesOptions['fallback']>;
}
interface ElementPart {
type: 'element';
value: string;
}
declare var ErrorCode: {|
+MISSING_VALUE: 'MISSING_VALUE', // "MISSING_VALUE"
+INVALID_VALUE: 'INVALID_VALUE', // "INVALID_VALUE"
+MISSING_INTL_API: 'MISSING_INTL_API', // "MISSING_INTL_API"
|};
interface FieldData {
// $FlowFixMe[unsupported-syntax] - illegal name (these fixmes added in TS to Flow translation)
'0'?: string;
// $FlowFixMe[unsupported-syntax] - illegal name
'1'?: string;
// $FlowFixMe[unsupported-syntax] - illegal name
'-1'?: string;
// $FlowFixMe[unsupported-syntax] - illegal name
'2'?: string;
// $FlowFixMe[unsupported-syntax] - illegal name
'-2'?: string;
// $FlowFixMe[unsupported-syntax] - illegal name
'3'?: string;
// $FlowFixMe[unsupported-syntax] - illegal name
'-3'?: string;
future: RelativeTimeData;
past: RelativeTimeData;
}
export type FormatDateOptions = $Rest<DateTimeFormatOptions, { localeMatcher: mixed }> &
CustomFormatConfig;
export type FormatDisplayNameOptions = $Rest<DateTimeFormatOptions, { localeMatcher: mixed }>;
declare class FormatError mixins Error {
+code: $Values<typeof ErrorCode>;
/**
* Original message we're trying to format
* `undefined` if we're only dealing w/ AST
* @type {(string | void)}
* @memberof FormatError
*/
+originalMessage: string | void;
constructor(msg: string, code: $Values<typeof ErrorCode>, originalMessage?: string): this;
toString(): string;
}
export type FormatListOptions = $Rest<IntlListFormatOptions, { localeMatcher: mixed }>;
export type FormatNumberOptions = $Rest<NumberFormatOptions, { localeMatcher: mixed }> &
CustomFormatConfig;
export type FormatPluralOptions = $Rest<Intl$PluralRulesOptions, { localeMatcher: mixed }> &
CustomFormatConfig;
export type FormatRelativeTimeOptions = $Rest<
IntlRelativeTimeFormatOptions,
{ localeMatcher: mixed },
> &
CustomFormatConfig;
interface Formats {
number: {| [key: string]: Intl$NumberFormatOptions |};
date: {| [key: string]: Intl$DateTimeFormatOptions |};
time: {| [key: string]: Intl$DateTimeFormatOptions |};
}
type FormattableUnit = Unit | Units;
declare export var FormattedDate: React$StatelessFunctionalComponent<
DateTimeFormatOptions &
CustomFormatConfig & {
value: string | number | Date | void,
...
}, >;
declare export var FormattedDateParts: React$StatelessFunctionalComponent<
FormatDateOptions & {
value: Date | number | string, // Param of Intl.DateTimeFormat.prototype.format(), or `string`
children(val: $Call<Intl$DateTimeFormat['formatToParts'], mixed[]>): React$Element<React$ElementType> | null,
...
}, >;
declare export var FormattedDisplayName: React$StatelessFunctionalComponent<
DisplayNamesOptions & {
value: string | number | {| [key: string]: $FlowFixMe |},
...
}, >;
declare export var FormattedList: React$StatelessFunctionalComponent<
IntlListFormatOptions & {
value: React$Node[],
...
}, >;
declare export class FormattedMessage<
V: {| +[key: string]: $FlowFixMe |} = {|
+[key: string]:
| PrimitiveType
| React$Element<React$ElementType>
| FormatXMLElementFn<React$Node, React$Node>,
|},
// Changed `mixins` to `extends` in TS to Flow translation
> extends React$Component<Props_3<V>> {
shouldComponentUpdate(nextProps: Props_3<V>): boolean;
render(): React$Node;
}
declare export var FormattedNumber: React$StatelessFunctionalComponent<
NumberFormatOptions &
CustomFormatConfig & {
value: number,
...
}, >;
declare export var FormattedNumberParts: React$StatelessFunctionalComponent<
Formatter['formatNumber'] & {
// Param type of our IntlShape.formatNumber, alias of our
// IntlFormatters.formatNumber
value: number,
// Callers will get a Flow error until Flow adds a built-in
// definition for Intl.NumberFormat.prototype.formatToParts():
// path_to_url
children(val: $Call<Intl$NumberFormat['formatToParts'], mixed[]>): React$Element<React$ElementType> | null,
...
}, >;
declare export var FormattedPlural: React$StatelessFunctionalComponent<WithIntlProps<Props_2>> & {
WrappedComponent: React$ComponentType<Props_2>,
...
};
// Changed `mixins` to `extends` in TS to Flow translation
declare export class FormattedRelativeTime extends React$PureComponent<Props, State_2> {
_updateTimer: $FlowFixMe;
static defaultProps: SubsetProperties<Props, {| unit?: mixed, value?: mixed |}>;
state: State_2;
constructor(props: Props): this;
scheduleNextUpdate(x: Props, x: State_2): void;
componentDidMount(): void;
componentDidUpdate(): void;
componentWillUnmount(): void;
static getDerivedStateFromProps(props: Props, state: State_2): $Rest<State_2, { ... }> | null;
render(): React$Node;
}
declare export var FormattedTime: React$StatelessFunctionalComponent<
DateTimeFormatOptions &
CustomFormatConfig & {
value: string | number | Date | void,
...
}, >;
declare export var FormattedTimeParts: React$StatelessFunctionalComponent<
FormatDateOptions & {
value: Date | number | string, // Param of Intl.DateTimeFormat.prototype.format(), or `string`
children(val: $Call<Intl$DateTimeFormat['formatToParts'], mixed[]>): React$Element<React$ElementType> | null,
...
}, >;
type Formatter = {
formatDate: FormatDateOptions,
formatTime: FormatDateOptions,
formatNumber: FormatNumberOptions,
formatList: FormatListOptions,
formatDisplayName: FormatDisplayNameOptions,
...
};
// FlowIssue: Looks like we really want something like
// getDateTimeFormat: ConstructorOf<Intl.DateTimeFormat>
// but Flow doesn't have something like ConstructorOf; see
// path_to_url#issuecomment-184443566
type ConstructorParameters<C> = $FlowIssue[];
export interface Formatters {
getDateTimeFormat(
...args: ConstructorParameters<typeof Intl.DateTimeFormat>
): Intl$DateTimeFormat;
getNumberFormat(...args: ConstructorParameters<typeof Intl.NumberFormat>): Intl$NumberFormat;
getMessageFormat(...args: ConstructorParameters<typeof IntlMessageFormat>): IntlMessageFormat;
getRelativeTimeFormat(
...args: ConstructorParameters<typeof RelativeTimeFormat>
): RelativeTimeFormat;
getPluralRules(...args: ConstructorParameters<typeof Intl.PluralRules>): Intl$PluralRules;
getListFormat(...args: ConstructorParameters<typeof ListFormat>): ListFormat;
getDisplayNames(...args: ConstructorParameters<typeof DisplayNames>): DisplayNames;
}
interface Formatters_2 {
getNumberFormat(...args: ConstructorParameters<typeof Intl.NumberFormat>): Intl$NumberFormat;
getDateTimeFormat(
...args: ConstructorParameters<typeof Intl.DateTimeFormat>
): Intl$DateTimeFormat;
getPluralRules(...args: ConstructorParameters<typeof Intl.PluralRules>): Intl$PluralRules;
}
type FormatXMLElementFn<T, R = string | Array<string | T>> = (
parts: Array<string | T>,
) => R;
declare export function injectIntl<IntlPropName: string, P: WrappedComponentProps<IntlPropName>>(
WrappedComponent: React$ComponentType<P>,
options?: Opts<IntlPropName, false>,
): React$StatelessFunctionalComponent<WithIntlProps<P>> & {
WrappedComponent: React$ComponentType<P>,
...
};
declare export function injectIntl<
IntlPropName: string,
P: WrappedComponentProps<IntlPropName>,
T: React$ComponentType<P>,
>(
WrappedComponent: React$ComponentType<P>,
options?: Opts<IntlPropName, true>,
): React$AbstractComponent<
{|
...WithIntlProps<P>,
children?: React$Node,
ref?: React$Ref<T>,
|},
mixed,
> & {
WrappedComponent: React$ComponentType<P>,
...
};
export interface IntlCache {
dateTime: {| [key: string]: Intl.DateTimeFormat |};
number: {| [key: string]: Intl.NumberFormat |};
message: {| [key: string]: IntlMessageFormat |};
relativeTime: {| [key: string]: RelativeTimeFormat |};
pluralRules: {| [key: string]: typeof Intl.PluralRules |};
list: {| [key: string]: ListFormat |};
displayNames: {| [key: string]: DisplayNames |};
}
export type IntlConfig = {
locale: string;
timeZone?: string;
formats: CustomFormats;
textComponent?: React$ElementType,
messages: {| [key: string]: string |} | {| [key: string]: MessageFormatElement[] |};
defaultLocale: string;
defaultFormats: CustomFormats;
wrapRichTextChunksInFragment?: boolean;
onError(
err: | MissingTranslationError
| MessageFormatError
| MissingDataError
| InvalidConfigError
| UnsupportedFormatterError
| FormatError,
): void;
}
declare export var IntlContext: React$Context<IntlShape>;
export interface IntlFormatters<T = React$Node, R = T> {
formatDate(
value: Date | number | string, // Param of Intl.DateTimeFormat.prototype.format(), or `string`
opts?: FormatDateOptions,
): string;
formatTime(
value: Date | number | string, // Param of Intl.DateTimeFormat.prototype.format(), or `string`
opts?: FormatDateOptions,
): string;
formatDateToParts(
value: Date | number | string, // Param of Intl.DateTimeFormat.prototype.format(), or `string`
opts?: FormatDateOptions,
): $Call<Intl$DateTimeFormat['formatToParts'], mixed[]>;
formatTimeToParts(
value: Date | number | string, // Param of Intl.DateTimeFormat.prototype.format(), or `string`
opts?: FormatDateOptions,
): $Call<Intl$DateTimeFormat['formatToParts'], mixed[]>;
formatRelativeTime(
value: number, // First param of our RelativeTimeFormat.prototype.format()
unit?: FormattableUnit, // Second param of our RelativeTimeFormat.prototype.format()
opts?: FormatRelativeTimeOptions,
): string;
formatNumber(
value: number, // Param of Intl.NumberFormat.prototype.format()
opts?: FormatNumberOptions,
): string;
formatNumberToParts(
value: number, // Param of Intl.NumberFormat.prototype.format()
opts?: FormatNumberOptions,
// Callers will get a Flow error until Flow adds a built-in
// definition for Intl.NumberFormat.prototype.formatToParts():
// path_to_url
): $Call<Intl$NumberFormat['formatToParts'], mixed[]>;
formatPlural(
value: number, // Param of Intl.PluralRules.prototype.select()
opts?: FormatPluralOptions,
): $Call<<R>((...args: $FlowFixMe[]) => R) => R, typeof Intl.PluralRules['select']>;
formatMessage(
descriptor: MessageDescriptor,
// The `+` was added to make the properties covariant rather
// than invariant, something TypeScript can't do.
values?: {| +[key: string]: PrimitiveType | FormatXMLElementFn<string, string> |},
): string;
formatMessage(
descriptor: MessageDescriptor,
// The `+` was added to make the properties covariant rather
// than invariant, something TypeScript can't do.
values?: {| +[key: string]: PrimitiveType | React$Node | FormatXMLElementFn<T, R> |},
): React$Node;
formatList(values: Array<string>, opts?: FormatListOptions): string;
formatList(values: Array<string | React$Node>, opts?: FormatListOptions): React$Node;
formatDisplayName(
// First param of our DisplayNames.prototype.of()
value: string | number | {| [key: string]: $FlowFixMe |},
opts?: FormatDisplayNameOptions,
): string | void;
}
interface IntlListFormatOptions {
/**
* The locale matching algorithm to use.
* Possible values are "lookup" and "best fit"; the default is "best fit".
* For information about this option, see
* path_to_url#Locale_negotiation.
*/
localeMatcher?: 'best fit' | 'lookup';
/**
* The format of output message. Possible values are:
* - "always" (default, e.g., 1 day ago),
* - or "auto" (e.g., yesterday).
* The "auto" value allows to not always have to
* use numeric values in the output.
*/
type?: 'conjunction' | 'disjunction' | 'unit';
/**
* The length of the internationalized message. Possible values are:
* - "long" (default, e.g., in 1 month)
* - "short" (e.g., in 1 mo.),
* - or "narrow" (e.g., in 1 mo.).
* The narrow style could be similar to the short style for some locales.
*/
style?: 'long' | 'short' | 'narrow';
}
declare class IntlMessageFormat {
constructor(
message: string | MessageFormatElement[],
locales?: string | string[],
overrideFormats?: $Rest<Formats, { ... }>,
opts?: Options,
): this;
format: <T>(
values?: {|
[key: string]: | string
| number
| boolean
| Date
| T
| FormatXMLElementFn<T, string | (string | T)[]>
| null
| void,
|} | void,
) => string | T | (string | T)[];
formatToParts: <T>(
values?: {|
[key: string]: | string
| number
| boolean
| Date
| T
| FormatXMLElementFn<T, string | (string | T)[]>
| null
| void,
|} | void,
) => MessageFormatPart<T>[];
resolvedOptions: () => {
locale: string,
...
};
getAst: () => MessageFormatElement[];
defaultLocale: string;
static __parse: typeof parse | void;
static formats: {
number: {
currency: {
style: string,
...
},
percent: {
style: string,
...
},
...
},
date: {
short: {
month: string,
day: string,
year: string,
...
},
medium: {
month: string,
day: string,
year: string,
...
},
long: {
month: string,
day: string,
year: string,
...
},
full: {
weekday: string,
month: string,
day: string,
year: string,
...
},
...
},
time: {
short: {
hour: string,
minute: string,
...
},
medium: {
hour: string,
minute: string,
second: string,
...
},
long: {
hour: string,
minute: string,
second: string,
timeZoneName: string,
...
},
full: {
hour: string,
minute: string,
second: string,
timeZoneName: string,
...
},
...
},
...
};
}
declare export class IntlProvider extends React$PureComponent<
// Changed `mixins` to `extends` in TS to Flow translation
{|
...OptionalIntlConfig,
children?: React$Node,
|},
State,
> {
static defaultProps: SubsetProperties<
IntlConfig,
{
formats: mixed,
timeZone?: mixed,
onError: mixed,
messages: mixed,
textComponent?: mixed,
defaultLocale: mixed,
defaultFormats: mixed,
}
>;
state: State;
static getDerivedStateFromProps(
props: OptionalIntlConfig,
x: State,
): $Rest<State, { ... }> | null;
render(): React$Node;
}
interface IntlRelativeTimeFormatOptions {
/**
* The locale matching algorithm to use.
* Possible values are "lookup" and "best fit"; the default is "best fit".
* For information about this option, see
* path_to_url#Locale_negotiation.
*/
localeMatcher?: 'best fit' | 'lookup';
/**
* The format of output message. Possible values are:
* - "always" (default, e.g., 1 day ago),
* - or "auto" (e.g., yesterday).
* The "auto" value allows to not always have to
* use numeric values in the output.
*/
numeric?: 'always' | 'auto';
/**
* The length of the internationalized message. Possible values are:
* - "long" (default, e.g., in 1 month)
* - "short" (e.g., in 1 mo.),
* - or "narrow" (e.g., in 1 mo.).
* The narrow style could be similar to the short style for some locales.
*/
style?: 'long' | 'short' | 'narrow';
}
export type IntlShape = {
formatters: Formatters,
...
} & IntlConfig &
IntlFormatters<>;
declare export class InvalidConfigError
mixins ReactIntlError<typeof ReactIntlErrorCode.INVALID_CONFIG> {
constructor(message: string, exception?: Error): this;
}
interface IParseOptions {
filename?: string;
startRule?: string;
tracer?: $FlowFixMe;
[key: string]: $FlowFixMe;
}
type LanguageTag = string;
type LDMLPluralRule = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
declare class ListFormat {
constructor(locales?: string | string[], options?: IntlListFormatOptions): this;
format(elements: string[]): string;
formatToParts(elements: string[]): Part_2[];
resolvedOptions(): ResolvedIntlListFormatOptions;
static supportedLocalesOf(
locales: string | string[],
options?: SubsetProperties<IntlListFormatOptions, {| localeMatcher?: mixed |}>,
): string[];
static __addLocaleData(...data: ListPatternLocaleData[]): void;
static localeData: {| [key: string]: ListPatternFieldsData |};
static polyfilled: boolean;
}
interface ListPattern {
start: string;
middle: string;
end: string;
pair: string;
}
interface ListPatternData {
long: ListPattern;
short?: ListPattern;
narrow?: ListPattern;
}
interface ListPatternFieldsData {
conjunction?: ListPatternData;
disjunction?: ListPatternData;
unit?: ListPatternData;
}
type ListPatternLocaleData = LocaleData<ListPatternFieldsData>;
type LiteralElement = BaseElement<typeof TYPE.literal>;
interface LiteralPart {
type: 'literal';
value: string;
}
interface LiteralPart_2 {
type: typeof PART_TYPE.literal;
value: string;
}
type Locale = string;
interface LocaleData<T> {
data: {| [key: Locale]: T |};
availableLocales: string[];
}
type LocaleFieldsData = $ObjMapi<
{| [k: RelativeTimeField]: $FlowFixMe |},
<f>(f) => FieldData, > & {
nu?: Array<string | null>,
...
};
interface Location_2 {
start: LocationDetails;
end: LocationDetails;
}
interface LocationDetails {
offset: number;
line: number;
column: number;
}
// Changed from interface to type in TS to Flow translation
export type MessageDescriptor = {|
id?: string | number,
description?: string | {| [key: string]: $FlowFixMe |},
defaultMessage?: string,
|};
type MessageFormatElement =
| LiteralElement
| ArgumentElement
| NumberElement
| DateElement
| TimeElement
| SelectElement
| PluralElement
| TagElement
| PoundElement;
declare export class MessageFormatError
mixins ReactIntlError<typeof ReactIntlErrorCode.FORMAT_ERROR> {
+descriptor?: MessageDescriptor;
constructor(
message: string,
locale: string,
descriptor?: MessageDescriptor,
exception?: Error,
): this;
}
type MessageFormatPart<T> = LiteralPart_2 | ObjectPart<T>;
declare export class MissingDataError
mixins ReactIntlError<typeof ReactIntlErrorCode.MISSING_DATA> {
constructor(message: string, exception?: Error): this;
}
declare export class MissingTranslationError
mixins ReactIntlError<typeof ReactIntlErrorCode.MISSING_TRANSLATION> {
+descriptor?: MessageDescriptor;
constructor(descriptor: MessageDescriptor, locale: string): this;
}
type NumberElement = SimpleFormatElement<typeof TYPE._number, NumberSkeleton>;
interface NumberFormatDigitOptions {
minimumIntegerDigits?: number;
minimumSignificantDigits?: number;
maximumSignificantDigits?: number;
minimumFractionDigits?: number;
maximumFractionDigits?: number;
}
type NumberFormatNotation = 'standard' | 'scientific' | 'engineering' | 'compact';
type NumberFormatOptions = Intl$NumberFormatOptions &
NumberFormatDigitOptions & {
localeMatcher?: NumberFormatOptionsLocaleMatcher,
style?: NumberFormatOptionsStyle,
compactDisplay?: NumberFormatOptionsCompactDisplay,
currencyDisplay?: NumberFormatOptionsCurrencyDisplay,
currencySign?: NumberFormatOptionsCurrencySign,
notation?: NumberFormatOptionsNotation,
signDisplay?: NumberFormatOptionsSignDisplay,
unit?: string,
unitDisplay?: NumberFormatOptionsUnitDisplay,
numberingSystem?: string,
...
};
type NumberFormatOptionsCompactDisplay = 'short' | 'long';
type NumberFormatOptionsCurrencyDisplay = 'symbol' | 'code' | 'name' | 'narrowSymbol';
type NumberFormatOptionsCurrencySign = 'standard' | 'accounting';
type NumberFormatOptionsLocaleMatcher = 'lookup' | 'best fit';
type NumberFormatOptionsNotation = NumberFormatNotation;
type NumberFormatOptionsSignDisplay = 'auto' | 'always' | 'never' | 'exceptZero';
type NumberFormatOptionsStyle = 'decimal' | 'percent' | 'currency' | 'unit';
type NumberFormatOptionsUnitDisplay = 'long' | 'short' | 'narrow';
interface NumberSkeleton {
type: typeof SKELETON_TYPE._number;
tokens: NumberSkeletonToken[];
location?: Location_2;
}
interface NumberSkeletonToken {
stem: string;
options: string[];
}
interface ObjectPart<T = $FlowFixMe> {
type: typeof PART_TYPE.object;
value: T;
}
type OptionalIntlConfig = { ...IntlConfig, ...$Rest<typeof DEFAULT_INTL_CONFIG, { ... }> };
interface Options {
formatters?: Formatters_2;
/**
* Whether to treat HTML/XML tags as string literal
* instead of parsing them as tag token.
* When this is false we only allow simple tags without
* any attributes
*/
ignoreTag?: boolean;
}
interface Options_2 {
/**
* Whether to convert `#` in plural rule options
* to `{var, number}`
* Default is true
*/
normalizeHashtagInPlural?: boolean;
/**
* Capture location info in AST
* Default is false
*/
captureLocation?: boolean;
/**
* Whether to treat HTML/XML tags as string literal
* instead of parsing them as tag token.
* When this is false we only allow simple tags without
* any attributes
*/
ignoreTag?: boolean;
}
interface Opts<IntlPropName: string = 'intl', ForwardRef: boolean = false> {
intlPropName?: IntlPropName;
forwardRef?: ForwardRef;
enforceContext?: boolean;
}
declare function parse(input: string, opts?: ParseOptions): MessageFormatElement[];
type ParseOptions = Options_2 & IParseOptions;
type Part = LiteralPart | RelativeTimeFormatNumberPart;
type Part_2 = LiteralPart | ElementPart;
declare var PART_TYPE: {|
+literal: 0, // 0
+object: 1, // 1
|};
type PluralElement = {
options: {| [key: ValidPluralRule]: PluralOrSelectOption |},
offset: number,
pluralType: Intl$PluralRulesOptions['type'],
...
} & BaseElement<typeof TYPE.plural>;
interface PluralOrSelectOption {
value: MessageFormatElement[];
location?: Location_2;
}
interface PoundElement {
type: typeof TYPE.pound;
location?: Location_2;
}
type PrimitiveType = string | number | boolean | null | void | Date;
type Props = {
value?: number,
unit?: Unit,
updateIntervalInSeconds?: number,
children?: (value: string) => React$Element<React$ElementType> | string | number,
...
} & FormatRelativeTimeOptions;
type Props_2 = {
value: number,
intl: IntlShape,
other: React$Node,
zero?: React$Node,
one?: React$Node,
two?: React$Node,
few?: React$Node,
many?: React$Node,
children?: (value: React$Node) => React$Element<React$ElementType> | null,
...
} & FormatPluralOptions;
type Props_3<V: {| +[key: string]: $FlowFixMe |} = {| +[key: string]: React$Node |}> = {
...MessageDescriptor,
values?: V,
tagName?: React$ElementType,
children?: (...nodes: React$Node[]) => React$Node,
...
};
declare export var RawIntlProvider: React$ComponentType<{
value: IntlShape,
children?: React$Node,
...
}>;
declare export class ReactIntlError<
T: $Values<typeof ReactIntlErrorCode> = typeof ReactIntlErrorCode.FORMAT_ERROR,
> mixins Error {
+code: T;
constructor(code: T, message: string, exception?: Error): this;
}
declare export var ReactIntlErrorCode: {|
+FORMAT_ERROR: 'FORMAT_ERROR', // "FORMAT_ERROR"
+UNSUPPORTED_FORMATTER: 'UNSUPPORTED_FORMATTER', // "UNSUPPORTED_FORMATTER"
+INVALID_CONFIG: 'INVALID_CONFIG', // "INVALID_CONFIG"
+MISSING_DATA: 'MISSING_DATA', // "MISSING_DATA"
+MISSING_TRANSLATION: 'MISSING_TRANSLATION', // "MISSING_TRANSLATION"
|};
type RegionCode = string;
type RelativeTimeData = $ObjMapi<{| [k: LDMLPluralRule]: $FlowFixMe |}, <u>(u) => string>;
type RelativeTimeField =
| 'second'
| 'second-short'
| 'second-narrow'
| 'minute'
| 'minute-short'
| 'minute-narrow'
| 'hour'
| 'hour-short'
| 'hour-narrow'
| 'day'
| 'day-short'
| 'day-narrow'
| 'week'
| 'week-short'
| 'week-narrow'
| 'month'
| 'month-short'
| 'month-narrow'
| 'quarter'
| 'quarter-short'
| 'quarter-narrow'
| 'year'
| 'year-short'
| 'year-narrow';
declare class RelativeTimeFormat {
constructor(locales?: string | string[], options?: IntlRelativeTimeFormatOptions): this;
format(value: number, unit: FormattableUnit): string;
formatToParts(value: number, unit: FormattableUnit): Part[];
resolvedOptions(): ResolvedIntlRelativeTimeFormatOptions;
static supportedLocalesOf(
locales: string | string[],
options?: SubsetProperties<IntlRelativeTimeFormatOptions, {| localeMatcher?: mixed |}>,
): string[];
static __addLocaleData(...data: RelativeTimeLocaleData[]): void;
static localeData: {| [key: string]: LocaleFieldsData |};
static polyfilled: boolean;
}
type RelativeTimeFormatNumberPart = {
unit: Unit,
...
// Callers will get a Flow error until Flow adds a built-in
// definition for Intl.NumberFormat.prototype.formatToParts():
// path_to_url
} & $Call<Intl$NumberFormat['formatToParts'], mixed[]>[number];
type RelativeTimeLocaleData = LocaleData<LocaleFieldsData>;
interface ResolvedIntlListFormatOptions {
/**
* The BCP 47 language tag for the locale actually used.
* If any Unicode extension values were requested in the
* input BCP 47 language tag that led to this locale,
* the key-value pairs that were requested and are
* supported for this locale are included in locale.
*/
locale: string;
/**
* The format of output message. Possible values are:
* - "always" (default, e.g., 1 day ago),
* - or "auto" (e.g., yesterday).
* The "auto" value allows to not always have to
* use numeric values in the output.
*/
type: 'conjunction' | 'disjunction' | 'unit';
/**
* The length of the internationalized message. Possible values are:
* - "long" (default, e.g., in 1 month)
* - "short" (e.g., in 1 mo.),
* - or "narrow" (e.g., in 1 mo.).
* The narrow style could be similar to the short style for some locales.
*/
style: 'long' | 'short' | 'narrow';
}
type ResolvedIntlRelativeTimeFormatOptions = {
/**
* The BCP 47 language tag for the locale actually used.
* If any Unicode extension values were requested in the
* input BCP 47 language tag that led to this locale,
* the key-value pairs that were requested and are
* supported for this locale are included in locale.
*/
locale: string,
/**
* The value requested using the Unicode
* extension key "nu" or filled in as a default.
*/
numberingSystem: string,
...
};
type ScriptCode = string;
type SelectElement = {
options: {| [key: string]: PluralOrSelectOption |},
...
} & BaseElement<typeof TYPE.select>;
type SimpleFormatElement<T: $Values<typeof TYPE>, S: Skeleton> = {
style?: string | S | null,
...
} & BaseElement<T>;
type Skeleton = NumberSkeleton | DateTimeSkeleton;
declare var SKELETON_TYPE: {|
// Underscore added in TS to Flow translation ("Unexpected reserved type")
+_number: 0, // 0
+dateTime: 1, // 1
|};
interface State {
/**
* Explicit intl cache to prevent memory leaks
*/
cache: IntlCache;
/**
* Intl object we created
*/
intl?: IntlShape;
/**
* list of memoized config we care about.
* This is important since creating intl is
* very expensive
*/
prevConfig: OptionalIntlConfig;
}
interface State_2 {
prevUnit?: Unit;
prevValue?: number;
currentValueInSeconds: number;
}
interface TagElement {
type: typeof TYPE.tag;
value: string;
children: MessageFormatElement[];
location?: Location_2;
}
type TimeElement = SimpleFormatElement<typeof TYPE.time, DateTimeSkeleton>;
declare var TYPE: {|
+literal: 0, // 0
+argument: 1, // 1
// Underscore added in TS to Flow translation ("Unexpected reserved type")
+_number: 2, // 2
+date: 3, // 3
+time: 4, // 4
+select: 5, // 5
+plural: 6, // 6
+pound: 7, // 7
+tag: 8, // 8
|};
type Unit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
type Units =
| 'seconds'
| 'minutes'
| 'hours'
| 'days'
| 'weeks'
| 'months'
| 'quarters'
| 'years';
declare export class UnsupportedFormatterError
mixins ReactIntlError<typeof ReactIntlErrorCode.UNSUPPORTED_FORMATTER> {
constructor(message: string, exception?: Error): this;
}
declare export function useIntl(): IntlShape;
type ValidPluralRule = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other' | string;
export type WithIntlProps<P> = $Rest<P, WrappedComponentProps<>> & {
forwardedRef?: React$Ref<$FlowFixMe>,
...
};
export type WrappedComponentProps<IntlPropName: string = 'intl'> = $ObjMapi<
{| [k: IntlPropName]: $FlowFixMe |},
<k>(k) => IntlShape, >;
declare export {};
```
|
/content/code_sandbox/types/react-intl.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 8,559
|
```unknown
/* @flow
* @generated
*/
export * from './build/ScreenOrientation.js.flow';
```
|
/content/code_sandbox/types/expo-screen-orientation/index.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 21
|
```unknown
/* @flow
* @generated by TsFlower
*/
// This module seems pretty useless, so we've erased everything in it. If
// that seems wrong, we can process it (or part of it) as usual.
```
|
/content/code_sandbox/types/expo-screen-orientation/plugin/build/withScreenOrientation.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 49
|
```unknown
/* @flow
* @generated by TsFlower
*/
import { type Subscription as Subscription_ } from 'expo-modules-core';
import {
Orientation,
type OrientationT as OrientationT_,
type OrientationChangeEvent as OrientationChangeEvent_,
type OrientationChangeListener as OrientationChangeListener_,
OrientationLock,
type OrientationLockT as OrientationLockT_,
type PlatformOrientationInfo as PlatformOrientationInfo_,
WebOrientationLock,
WebOrientation,
SizeClassIOS,
type ScreenOrientationInfo as ScreenOrientationInfo_,
} from './ScreenOrientation.types';
export { Orientation, OrientationLock, WebOrientationLock, WebOrientation, SizeClassIOS };
export type OrientationT = OrientationT_;
export type OrientationLockT = OrientationLockT_;
export type PlatformOrientationInfo = PlatformOrientationInfo_;
export type OrientationChangeListener = OrientationChangeListener_;
export type OrientationChangeEvent = OrientationChangeEvent_;
export type ScreenOrientationInfo = ScreenOrientationInfo_;
export type Subscription = Subscription_;
declare export function lockAsync(orientationLock: OrientationLockT): Promise<void>;
declare export function lockPlatformAsync(options: PlatformOrientationInfo): Promise<void>;
declare export function unlockAsync(): Promise<void>;
declare export function getOrientationAsync(): Promise<OrientationT>;
declare export function getOrientationLockAsync(): Promise<OrientationLockT>;
declare export function getPlatformOrientationLockAsync(): Promise<PlatformOrientationInfo>;
declare export function supportsOrientationLockAsync(
orientationLock: OrientationLockT,
): Promise<boolean>;
declare export function addOrientationChangeListener(
listener: OrientationChangeListener,
): Subscription;
declare export function removeOrientationChangeListeners(): void;
declare export function removeOrientationChangeListener(subscription: Subscription): void;
```
|
/content/code_sandbox/types/expo-screen-orientation/build/ScreenOrientation.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 330
|
```unknown
/*
* Types translated from react-native-webview/lib/WebViewTypes.d.ts and
* lib/WebView.d.ts, with Flowgen v1.14.1.
*
* Done with `--interface-records` and `--no-inexact`, and edited lightly.
*
* @flow strict-local
*/
import type { SyntheticEvent, ScrollEvent } from 'react-native/Libraries/Types/CoreEventTypes';
import type { ViewStyleProp } from 'react-native/Libraries/StyleSheet/StyleSheet';
import type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes';
// Not represented:
// RNCWebViewUIManagerAndroid
// RNCWebViewUIManagerIOS
// RNCWebViewUIManagerMacOS
// RNCWebViewUIManagerWindows
type WebViewState = 'IDLE' | 'LOADING' | 'ERROR';
type BaseState = {|
viewState: WebViewState,
|};
type NormalState = {|
...$Exact<BaseState>,
viewState: 'IDLE' | 'LOADING',
lastErrorEvent: WebViewError | null,
|};
type ErrorState = {|
...$Exact<BaseState>,
viewState: 'ERROR',
lastErrorEvent: WebViewError,
|};
export type State = NormalState | ErrorState;
// Exports not represented:
// NativeWebViewIOS
// NativeWebViewMacOS
// NativeWebViewAndroid
// NativeWebViewWindows
export type ContentInsetProp = {|
top?: number,
left?: number,
bottom?: number,
right?: number,
|};
export type WebViewNativeEvent = {|
url: string,
loading: boolean,
title: string,
canGoBack: boolean,
canGoForward: boolean,
lockIdentifier: number,
|};
export type WebViewNativeProgressEvent = {|
...$Exact<WebViewNativeEvent>,
progress: number,
|};
export type WebViewNavigation = {|
...$Exact<WebViewNativeEvent>,
navigationType: 'click' | 'formsubmit' | 'backforward' | 'reload' | 'formresubmit' | 'other',
mainDocumentURL?: string,
|};
export type ShouldStartLoadRequest = {|
...$Exact<WebViewNavigation>,
isTopFrame: boolean,
|};
export type FileDownload = {|
downloadUrl: string,
|};
export type DecelerationRateConstant = 'normal' | 'fast';
export type WebViewMessage = {|
...$Exact<WebViewNativeEvent>,
data: string,
|};
export type WebViewError = {|
...$Exact<WebViewNativeEvent>,
/**
* `domain` is only used on iOS and macOS
*/
domain?: string,
code: number,
description: string,
|};
export type WebViewHttpError = {|
...$Exact<WebViewNativeEvent>,
description: string,
statusCode: number,
|};
export type WebViewRenderProcessGoneDetail = {|
didCrash: boolean,
|};
export type WebViewEvent = SyntheticEvent<WebViewNativeEvent>;
export type WebViewProgressEvent = SyntheticEvent<WebViewNativeProgressEvent>;
export type WebViewNavigationEvent = SyntheticEvent<WebViewNavigation>;
export type ShouldStartLoadRequestEvent = SyntheticEvent<ShouldStartLoadRequest>;
export type FileDownloadEvent = SyntheticEvent<FileDownload>;
export type WebViewMessageEvent = SyntheticEvent<WebViewMessage>;
export type WebViewErrorEvent = SyntheticEvent<WebViewError>;
export type WebViewTerminatedEvent = SyntheticEvent<WebViewNativeEvent>;
export type WebViewHttpErrorEvent = SyntheticEvent<WebViewHttpError>;
export type WebViewRenderProcessGoneEvent = SyntheticEvent<WebViewRenderProcessGoneDetail>;
export type WebViewScrollEvent = SyntheticEvent<ScrollEvent>;
export type DataDetectorTypes =
| 'phoneNumber'
| 'link'
| 'address'
| 'calendarEvent'
| 'trackingNumber'
| 'flightNumber'
| 'lookupSuggestion'
| 'none'
| 'all';
export type OverScrollModeType = 'always' | 'content' | 'never';
export type CacheMode =
| 'LOAD_DEFAULT'
| 'LOAD_CACHE_ONLY'
| 'LOAD_CACHE_ELSE_NETWORK'
| 'LOAD_NO_CACHE';
export type AndroidLayerType = 'none' | 'software' | 'hardware';
export type WebViewSourceUri = {|
/**
* The URI to load in the `WebView`. Can be a local or remote file.
*/
uri: string,
/**
* The HTTP Method to use. Defaults to GET if not specified.
* NOTE: On Android, only GET and POST are supported.
*/
method?: string,
/**
* Additional HTTP headers to send with the request.
* NOTE: On Android, this can only be used with GET requests.
*/
headers?: $FlowFixMe,
/**
* The HTTP body to send with the request. This must be a valid
* UTF-8 string, and will be sent exactly as specified, with no
* additional encoding (e.g. URL-escaping or base64) applied.
* NOTE: On Android, this can only be used with POST requests.
*/
body?: string,
|};
export type WebViewSourceHtml = {|
/**
* A static HTML page to display in the WebView.
*/
html: string,
/**
* The base URL to be used for any relative links in the HTML.
*/
baseUrl?: string,
|};
export type WebViewSource = WebViewSourceUri | WebViewSourceHtml;
export type ViewManager = {|
startLoadWithResult: $FlowFixMe,
|};
export type WebViewNativeConfig = {|
/**
* The native component used to render the WebView.
*/
component?: $FlowFixMe, // See 684498afd.
/**
* Set props directly on the native component WebView. Enables custom props which the
* original WebView doesn't pass through.
*/
props?: { ... },
/**
* Set the ViewManager to use for communication with the native side.
* @platform ios, macos
*/
viewManager?: ViewManager,
|};
export type OnShouldStartLoadWithRequest = (event: ShouldStartLoadRequest) => boolean;
export type CommonNativeWebViewProps = {|
...$Exact<ViewProps>,
cacheEnabled?: boolean,
incognito?: boolean,
injectedJavaScript?: string,
injectedJavaScriptBeforeContentLoaded?: string,
injectedJavaScriptForMainFrameOnly?: boolean,
injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean,
javaScriptCanOpenWindowsAutomatically?: boolean,
mediaPlaybackRequiresUserAction?: boolean,
messagingEnabled: boolean,
onScroll?: (event: WebViewScrollEvent) => void,
onLoadingError: (event: WebViewErrorEvent) => void,
onLoadingFinish: (event: WebViewNavigationEvent) => void,
onLoadingProgress: (event: WebViewProgressEvent) => void,
onLoadingStart: (event: WebViewNavigationEvent) => void,
onHttpError: (event: WebViewHttpErrorEvent) => void,
onMessage: (event: WebViewMessageEvent) => void,
onShouldStartLoadWithRequest: (event: ShouldStartLoadRequestEvent) => void,
showsHorizontalScrollIndicator?: boolean,
showsVerticalScrollIndicator?: boolean,
source: $FlowFixMe,
userAgent?: string,
/**
* Append to the existing user-agent. Overridden if `userAgent` is set.
*/
applicationNameForUserAgent?: string,
|};
export type AndroidNativeWebViewProps = {|
...$Exact<CommonNativeWebViewProps>,
cacheMode?: CacheMode,
allowFileAccess?: boolean,
scalesPageToFit?: boolean,
allowFileAccessFromFileURLs?: boolean,
allowUniversalAccessFromFileURLs?: boolean,
androidHardwareAccelerationDisabled?: boolean,
androidLayerType?: AndroidLayerType,
domStorageEnabled?: boolean,
geolocationEnabled?: boolean,
javaScriptEnabled?: boolean,
mixedContentMode?: 'never' | 'always' | 'compatibility',
onContentSizeChange?: (event: WebViewEvent) => void,
onRenderProcessGone?: (event: WebViewRenderProcessGoneEvent) => void,
overScrollMode?: OverScrollModeType,
saveFormDataDisabled?: boolean,
setSupportMultipleWindows?: boolean,
textZoom?: number,
thirdPartyCookiesEnabled?: boolean,
messagingModuleName?: string,
+urlPrefixesForDefaultIntent?: string[],
|};
export type ContentInsetAdjustmentBehavior =
| 'automatic'
| 'scrollableAxes'
| 'never'
| 'always';
export type ContentMode = 'recommended' | 'mobile' | 'desktop';
export type IOSNativeWebViewProps = {|
...$Exact<CommonNativeWebViewProps>,
allowingReadAccessToURL?: string,
allowsBackForwardNavigationGestures?: boolean,
allowsInlineMediaPlayback?: boolean,
allowsLinkPreview?: boolean,
allowFileAccessFromFileURLs?: boolean,
allowUniversalAccessFromFileURLs?: boolean,
automaticallyAdjustContentInsets?: boolean,
autoManageStatusBarEnabled?: boolean,
bounces?: boolean,
contentInset?: ContentInsetProp,
contentInsetAdjustmentBehavior?: ContentInsetAdjustmentBehavior,
contentMode?: ContentMode,
+dataDetectorTypes?: DataDetectorTypes | DataDetectorTypes[],
decelerationRate?: number,
directionalLockEnabled?: boolean,
hideKeyboardAccessoryView?: boolean,
pagingEnabled?: boolean,
scrollEnabled?: boolean,
useSharedProcessPool?: boolean,
onContentProcessDidTerminate?: (event: WebViewTerminatedEvent) => void,
injectedJavaScriptForMainFrameOnly?: boolean,
injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean,
onFileDownload?: (event: FileDownloadEvent) => void,
limitsNavigationsToAppBoundDomains?: boolean,
|};
export type MacOSNativeWebViewProps = {|
...$Exact<CommonNativeWebViewProps>,
allowingReadAccessToURL?: string,
allowFileAccessFromFileURLs?: boolean,
allowUniversalAccessFromFileURLs?: boolean,
allowsBackForwardNavigationGestures?: boolean,
allowsInlineMediaPlayback?: boolean,
allowsLinkPreview?: boolean,
automaticallyAdjustContentInsets?: boolean,
bounces?: boolean,
contentInset?: ContentInsetProp,
contentInsetAdjustmentBehavior?: ContentInsetAdjustmentBehavior,
directionalLockEnabled?: boolean,
hideKeyboardAccessoryView?: boolean,
pagingEnabled?: boolean,
scrollEnabled?: boolean,
useSharedProcessPool?: boolean,
onContentProcessDidTerminate?: (event: WebViewTerminatedEvent) => void,
|};
export type WindowsNativeWebViewProps = {|
...$Exact<CommonNativeWebViewProps>,
testID?: string,
|};
export type IOSWebViewProps = {|
...$Exact<WebViewSharedProps>,
/**
* Does not store any data within the lifetime of the WebView.
*/
incognito?: boolean,
/**
* Boolean value that determines whether the web view bounces
* when it reaches the edge of the content. The default value is `true`.
* @platform ios
*/
bounces?: boolean,
/**
* A floating-point number that determines how quickly the scroll view
* decelerates after the user lifts their finger. You may also use the
* string shortcuts `"normal"` and `"fast"` which match the underlying iOS
* settings for `UIScrollViewDecelerationRateNormal` and
* `UIScrollViewDecelerationRateFast` respectively:
*
* - normal: 0.998
* - fast: 0.99 (the default for iOS web view)
* @platform ios
*/
decelerationRate?: DecelerationRateConstant | number,
/**
* Boolean value that determines whether scrolling is enabled in the
* `WebView`. The default value is `true`.
* @platform ios
*/
scrollEnabled?: boolean,
/**
* If the value of this property is true, the scroll view stops on multiples
* of the scroll views bounds when the user scrolls.
* The default value is false.
* @platform ios
*/
pagingEnabled?: boolean,
/**
* Controls whether to adjust the content inset for web views that are
* placed behind a navigation bar, tab bar, or toolbar. The default value
* is `true`.
* @platform ios
*/
automaticallyAdjustContentInsets?: boolean,
/**
* Controls whether to adjust the scroll indicator inset for web views that are
* placed behind a navigation bar, tab bar, or toolbar. The default value
* is `false`. (iOS 13+)
* @platform ios
*/
automaticallyAdjustsScrollIndicatorInsets?: boolean,
/**
* This property specifies how the safe area insets are used to modify the
* content area of the scroll view. The default value of this property is
* "never". Available on iOS 11 and later.
*/
contentInsetAdjustmentBehavior?: ContentInsetAdjustmentBehavior,
/**
* The amount by which the web view content is inset from the edges of
* the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}.
* @platform ios
*/
contentInset?: ContentInsetProp,
/**
* Defaults to `recommended`, which loads mobile content on iPhone
* and iPad Mini but desktop content on other iPads.
*
* Possible values are:
* - `'recommended'`
* - `'mobile'`
* - `'desktop'`
* @platform ios
*/
contentMode?: ContentMode,
/**
* Determines the types of data converted to clickable URLs in the web view's content.
* By default only phone numbers are detected.
*
* You can provide one type or an array of many types.
*
* Possible values for `dataDetectorTypes` are:
*
* - `'phoneNumber'`
* - `'link'`
* - `'address'`
* - `'calendarEvent'`
* - `'none'`
* - `'all'`
*
* With the new WebKit implementation, we have three new values:
* - `'trackingNumber'`,
* - `'flightNumber'`,
* - `'lookupSuggestion'`,
* @platform ios
*/
+dataDetectorTypes?: DataDetectorTypes | DataDetectorTypes[],
/**
* Boolean that determines whether HTML5 videos play inline or use the
* native full-screen controller. The default value is `false`.
*
* **NOTE** : In order for video to play inline, not only does this
* property need to be set to `true`, but the video element in the HTML
* document must also include the `webkit-playsinline` attribute.
* @platform ios
*/
allowsInlineMediaPlayback?: boolean,
/**
* Hide the accessory view when the keyboard is open. Default is false to be
* backward compatible.
*/
hideKeyboardAccessoryView?: boolean,
/**
* A Boolean value indicating whether horizontal swipe gestures will trigger
* back-forward list navigations.
*/
allowsBackForwardNavigationGestures?: boolean,
/**
* A Boolean value indicating whether WebKit WebView should be created using a shared
* process pool, enabling WebViews to share cookies and localStorage between each other.
* Default is true but can be set to false for backwards compatibility.
* @platform ios
*/
useSharedProcessPool?: boolean,
/**
* The custom user agent string.
*/
userAgent?: string,
/**
* A Boolean value that determines whether pressing on a link
* displays a preview of the destination for the link.
*
* This property is available on devices that support 3D Touch.
* In iOS 10 and later, the default value is `true`; before that, the default value is `false`.
* @platform ios
*/
allowsLinkPreview?: boolean,
/**
* Set true if shared cookies from HTTPCookieStorage should used for every load request.
* The default value is `false`.
* @platform ios
*/
sharedCookiesEnabled?: boolean,
/**
* Set true if StatusBar should be light when user watch video fullscreen.
* The default value is `true`.
* @platform ios
*/
autoManageStatusBarEnabled?: boolean,
/**
* A Boolean value that determines whether scrolling is disabled in a particular direction.
* The default value is `true`.
* @platform ios
*/
directionalLockEnabled?: boolean,
/**
* A Boolean value indicating whether web content can programmatically display the keyboard.
*
* When this property is set to true, the user must explicitly tap the elements in the
* web view to display the keyboard (or other relevant input view) for that element.
* When set to false, a focus event on an element causes the input view to be displayed
* and associated with that element automatically.
*
* The default value is `true`.
* @platform ios
*/
keyboardDisplayRequiresUserAction?: boolean,
/**
* A String value that indicates which URLs the WebView's file can then
* reference in scripts, AJAX requests, and CSS imports. This is only used
* for WebViews that are loaded with a source.uri set to a `'file://'` URL.
*
* If not provided, the default is to only allow read access to the URL
* provided in source.uri itself.
* @platform ios
*/
allowingReadAccessToURL?: string,
/**
* Boolean that sets whether JavaScript running in the context of a file
* scheme URL should be allowed to access content from other file scheme URLs.
* Including accessing content from other file scheme URLs
* @platform ios
*/
allowFileAccessFromFileURLs?: boolean,
/**
* Boolean that sets whether JavaScript running in the context of a file
* scheme URL should be allowed to access content from any origin.
* Including accessing content from other file scheme URLs
* @platform ios
*/
allowUniversalAccessFromFileURLs?: boolean,
/**
* Function that is invoked when the WebKit WebView content process gets terminated.
* @platform ios
*/
onContentProcessDidTerminate?: (event: WebViewTerminatedEvent) => void,
/**
* If `true` (default), loads the `injectedJavaScript` only into the main frame.
* If `false`, loads it into all frames (e.g. iframes).
* @platform ios
*/
injectedJavaScriptForMainFrameOnly?: boolean,
/**
* If `true` (default), loads the `injectedJavaScriptBeforeContentLoaded` only into the main frame.
* If `false`, loads it into all frames (e.g. iframes).
* @platform ios
*/
injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean,
/**
* Boolean value that determines whether a pull to refresh gesture is
* available in the `WebView`. The default value is `false`.
* If `true`, sets `bounces` automatically to `true`
* @platform ios
*/
pullToRefreshEnabled?: boolean,
/**
* Function that is invoked when the client needs to download a file.
*
* iOS 13+ only: If the webview navigates to a URL that results in an HTTP
* response with a Content-Disposition header 'attachment...', then
* this will be called.
*
* iOS 8+: If the MIME type indicates that the content is not renderable by the
* webview, that will also cause this to be called. On iOS versions before 13,
* this is the only condition that will cause this function to be called.
*
* The application will need to provide its own code to actually download
* the file.
*
* If not provided, the default is to let the webview try to render the file.
*/
onFileDownload?: (event: FileDownloadEvent) => void,
/**
* A Boolean value which, when set to `true`, indicates to WebKit that a WKWebView
* will only navigate to app-bound domains. Once set, any attempt to navigate away
* from an app-bound domain will fail with the error App-bound domain failure.
*
* Applications can specify up to 10 app-bound domains using a new
* Info.plist key `WKAppBoundDomains`.
* @platform ios
*/
limitsNavigationsToAppBoundDomains?: boolean,
/**
* [object Object],[object Object],[object Object]
* @example window.webkit.messageHandlers.ReactNativeWebView.postMessage("hello apple pay")
* @platform ios
* The default value is false.
*/
enableApplePay?: boolean,
|};
export type MacOSWebViewProps = {|
...$Exact<WebViewSharedProps>,
/**
* Does not store any data within the lifetime of the WebView.
*/
incognito?: boolean,
/**
* Boolean value that determines whether the web view bounces
* when it reaches the edge of the content. The default value is `true`.
* @platform macos
*/
bounces?: boolean,
/**
* Boolean value that determines whether scrolling is enabled in the
* `WebView`. The default value is `true`.
* @platform macos
*/
scrollEnabled?: boolean,
/**
* If the value of this property is true, the scroll view stops on multiples
* of the scroll views bounds when the user scrolls.
* The default value is false.
* @platform macos
*/
pagingEnabled?: boolean,
/**
* Controls whether to adjust the content inset for web views that are
* placed behind a navigation bar, tab bar, or toolbar. The default value
* is `true`.
* @platform macos
*/
automaticallyAdjustContentInsets?: boolean,
/**
* This property specifies how the safe area insets are used to modify the
* content area of the scroll view. The default value of this property is
* "never". Available on iOS 11 and later.
*/
contentInsetAdjustmentBehavior?: ContentInsetAdjustmentBehavior,
/**
* The amount by which the web view content is inset from the edges of
* the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}.
* @platform macos
*/
contentInset?: ContentInsetProp,
/**
* Boolean that determines whether HTML5 videos play inline or use the
* native full-screen controller. The default value is `false`.
*
* **NOTE** : In order for video to play inline, not only does this
* property need to be set to `true`, but the video element in the HTML
* document must also include the `webkit-playsinline` attribute.
* @platform macos
*/
allowsInlineMediaPlayback?: boolean,
/**
* Hide the accessory view when the keyboard is open. Default is false to be
* backward compatible.
*/
hideKeyboardAccessoryView?: boolean,
/**
* A Boolean value indicating whether horizontal swipe gestures will trigger
* back-forward list navigations.
*/
allowsBackForwardNavigationGestures?: boolean,
/**
* A Boolean value indicating whether WebKit WebView should be created using a shared
* process pool, enabling WebViews to share cookies and localStorage between each other.
* Default is true but can be set to false for backwards compatibility.
* @platform macos
*/
useSharedProcessPool?: boolean,
/**
* The custom user agent string.
*/
userAgent?: string,
/**
* A Boolean value that determines whether pressing on a link
* displays a preview of the destination for the link.
*
* This property is available on devices that support Force Touch trackpad.
* @platform macos
*/
allowsLinkPreview?: boolean,
/**
* Set true if shared cookies from HTTPCookieStorage should used for every load request.
* The default value is `false`.
* @platform macos
*/
sharedCookiesEnabled?: boolean,
/**
* A Boolean value that determines whether scrolling is disabled in a particular direction.
* The default value is `true`.
* @platform macos
*/
directionalLockEnabled?: boolean,
/**
* A Boolean value indicating whether web content can programmatically display the keyboard.
*
* When this property is set to true, the user must explicitly tap the elements in the
* web view to display the keyboard (or other relevant input view) for that element.
* When set to false, a focus event on an element causes the input view to be displayed
* and associated with that element automatically.
*
* The default value is `true`.
* @platform macos
*/
keyboardDisplayRequiresUserAction?: boolean,
/**
* A String value that indicates which URLs the WebView's file can then
* reference in scripts, AJAX requests, and CSS imports. This is only used
* for WebViews that are loaded with a source.uri set to a `'file://'` URL.
*
* If not provided, the default is to only allow read access to the URL
* provided in source.uri itself.
* @platform macos
*/
allowingReadAccessToURL?: string,
/**
* Boolean that sets whether JavaScript running in the context of a file
* scheme URL should be allowed to access content from other file scheme URLs.
* Including accessing content from other file scheme URLs
* @platform macos
*/
allowFileAccessFromFileURLs?: boolean,
/**
* Boolean that sets whether JavaScript running in the context of a file
* scheme URL should be allowed to access content from any origin.
* Including accessing content from other file scheme URLs
* @platform macos
*/
allowUniversalAccessFromFileURLs?: boolean,
/**
* Function that is invoked when the WebKit WebView content process gets terminated.
* @platform macos
*/
onContentProcessDidTerminate?: (event: WebViewTerminatedEvent) => void,
|};
export type AndroidWebViewProps = {|
...$Exact<WebViewSharedProps>,
onNavigationStateChange?: (event: WebViewNavigation) => void,
onContentSizeChange?: (event: WebViewEvent) => void,
/**
* Function that is invoked when the `WebView` process crashes or is killed by the OS.
* Works only on Android (minimum API level 26).
*/
onRenderProcessGone?: (event: WebViewRenderProcessGoneEvent) => void,
/**
* path_to_url#setCacheMode(int)
* Set the cacheMode. Possible values are:
*
* - `'LOAD_DEFAULT'` (default)
* - `'LOAD_CACHE_ELSE_NETWORK'`
* - `'LOAD_NO_CACHE'`
* - `'LOAD_CACHE_ONLY'`
* @platform android
*/
cacheMode?: CacheMode,
/**
* path_to_url#OVER_SCROLL_NEVER
* Sets the overScrollMode. Possible values are:
*
* - `'always'` (default)
* - `'content'`
* - `'never'`
* @platform android
*/
overScrollMode?: OverScrollModeType,
/**
* Boolean that controls whether the web content is scaled to fit
* the view and enables the user to change the scale. The default value
* is `true`.
*/
scalesPageToFit?: boolean,
/**
* Sets whether Geolocation is enabled. The default is false.
* @platform android
*/
geolocationEnabled?: boolean,
/**
* Boolean that sets whether JavaScript running in the context of a file
* scheme URL should be allowed to access content from other file scheme URLs.
* Including accessing content from other file scheme URLs
* @platform android
*/
allowFileAccessFromFileURLs?: boolean,
/**
* Boolean that sets whether JavaScript running in the context of a file
* scheme URL should be allowed to access content from any origin.
* Including accessing content from other file scheme URLs
* @platform android
*/
allowUniversalAccessFromFileURLs?: boolean,
/**
* Sets whether the webview allow access to file system.
* @platform android
*/
allowFileAccess?: boolean,
/**
* Used on Android only, controls whether form autocomplete data should be saved
* @platform android
*/
saveFormDataDisabled?: boolean,
/**
* Boolean value to set whether the WebView supports multiple windows. Used on Android only
* The default value is `true`.
* @platform android
*/
setSupportMultipleWindows?: boolean,
/**
* [object Object],[object Object],[object Object]
* @platform android
*/
+urlPrefixesForDefaultIntent?: string[],
/**
* Boolean value to disable Hardware Acceleration in the `WebView`. Used on Android only
* as Hardware Acceleration is a feature only for Android. The default value is `false`.
* @platform android
*/
androidHardwareAccelerationDisabled?: boolean,
/**
* path_to_url#setLayerType(int,%20android.graphics.Paint)
* Sets the layerType. Possible values are:
*
* - `'none'` (default)
* - `'software'`
* - `'hardware'`
* @platform android
*/
androidLayerType?: AndroidLayerType,
/**
* Boolean value to enable third party cookies in the `WebView`. Used on
* Android Lollipop and above only as third party cookies are enabled by
* default on Android Kitkat and below and on iOS. The default value is `true`.
* @platform android
*/
thirdPartyCookiesEnabled?: boolean,
/**
* Boolean value to control whether DOM Storage is enabled. Used only in
* Android.
* @platform android
*/
domStorageEnabled?: boolean,
/**
* Sets the user-agent for the `WebView`.
* @platform android
*/
userAgent?: string,
/**
* Sets number that controls text zoom of the page in percent.
* @platform android
*/
textZoom?: number,
/**
* Specifies the mixed content mode. i.e WebView will allow a secure origin to load content from any other origin.
*
* Possible values for `mixedContentMode` are:
*
* - `'never'` (default) - WebView will not allow a secure origin to load content from an insecure origin.
* - `'always'` - WebView will allow a secure origin to load content from any other origin, even if that origin is insecure.
* - `'compatibility'` - WebView will attempt to be compatible with the approach of a modern web browser with regard to mixed content.
* @platform android
*/
mixedContentMode?: 'never' | 'always' | 'compatibility',
/**
* Sets ability to open fullscreen videos on Android devices.
*/
allowsFullscreenVideo?: boolean,
|};
export type WebViewSharedProps = {|
...$Exact<ViewProps>,
/**
* Loads static html or a uri (with optional headers) in the WebView.
*/
source?: WebViewSource,
/**
* Boolean value to enable JavaScript in the `WebView`. Used on Android only
* as JavaScript is enabled by default on iOS. The default value is `true`.
* @platform android
*/
javaScriptEnabled?: boolean,
/**
* A Boolean value indicating whether JavaScript can open windows without user interaction.
* The default value is `false`.
*/
javaScriptCanOpenWindowsAutomatically?: boolean,
/**
* Stylesheet object to set the style of the container view.
*/
containerStyle?: ViewStyleProp,
/**
* Function that returns a view to show if there's an error.
*/
renderError?: (
errorDomain: string | void,
errorCode: number,
errorDesc: string,
) => React$Element<React$ElementType>,
/**
* Function that returns a loading indicator.
*/
renderLoading?: () => React$Element<React$ElementType>,
/**
* Function that is invoked when the `WebView` scrolls.
*/
onScroll?: (event: WebViewScrollEvent) => void,
/**
* Function that is invoked when the `WebView` has finished loading.
*/
onLoad?: (event: WebViewNavigationEvent) => void,
/**
* Function that is invoked when the `WebView` load succeeds or fails.
*/
onLoadEnd?: (event: WebViewNavigationEvent | WebViewErrorEvent) => void,
/**
* Function that is invoked when the `WebView` starts loading.
*/
onLoadStart?: (event: WebViewNavigationEvent) => void,
/**
* Function that is invoked when the `WebView` load fails.
*/
onError?: (event: WebViewErrorEvent) => void,
/**
* Function that is invoked when the `WebView` receives an error status code.
* Works on iOS and Android (minimum API level 23).
*/
onHttpError?: (event: WebViewHttpErrorEvent) => void,
/**
* Function that is invoked when the `WebView` loading starts or ends.
*/
onNavigationStateChange?: (event: WebViewNavigation) => void,
/**
* Function that is invoked when the webview calls `window.ReactNativeWebView.postMessage`.
* Setting this property will inject this global into your webview.
*
* `window.ReactNativeWebView.postMessage` accepts one argument, `data`, which will be
* available on the event object, `event.nativeEvent.data`. `data` must be a string.
*/
onMessage?: (event: WebViewMessageEvent) => void,
/**
* Function that is invoked when the `WebView` is loading.
*/
onLoadProgress?: (event: WebViewProgressEvent) => void,
/**
* Boolean value that forces the `WebView` to show the loading view
* on the first load.
*/
startInLoadingState?: boolean,
/**
* Set this to provide JavaScript that will be injected into the web page
* when the view loads.
*/
injectedJavaScript?: string,
/**
* Set this to provide JavaScript that will be injected into the web page
* once the webview is initialized but before the view loads any content.
*/
injectedJavaScriptBeforeContentLoaded?: string,
/**
* If `true` (default; mandatory for Android), loads the `injectedJavaScript` only into the main frame.
* If `false` (only supported on iOS and macOS), loads it into all frames (e.g. iframes).
*/
injectedJavaScriptForMainFrameOnly?: boolean,
/**
* If `true` (default; mandatory for Android), loads the `injectedJavaScriptBeforeContentLoaded` only into the main frame.
* If `false` (only supported on iOS and macOS), loads it into all frames (e.g. iframes).
*/
injectedJavaScriptBeforeContentLoadedForMainFrameOnly?: boolean,
/**
* Boolean value that determines whether a horizontal scroll indicator is
* shown in the `WebView`. The default value is `true`.
*/
showsHorizontalScrollIndicator?: boolean,
/**
* Boolean value that determines whether a vertical scroll indicator is
* shown in the `WebView`. The default value is `true`.
*/
showsVerticalScrollIndicator?: boolean,
/**
* Boolean that determines whether HTML5 audio and video requires the user
* to tap them before they start playing. The default value is `true`.
*/
mediaPlaybackRequiresUserAction?: boolean,
/**
* List of origin strings to allow being navigated to. The strings allow
* wildcards and get matched against *just* the origin (not the full URL).
* If the user taps to navigate to a new page but the new page is not in
* this whitelist, we will open the URL in Safari.
* The default whitelisted origins are "path_to_url" and "path_to_url".
*/
+originWhitelist?: string[],
/**
* Function that allows custom handling of any web view requests. Return
* `true` from the function to continue loading the request and `false`
* to stop loading. The `navigationType` is always `other` on android.
*/
onShouldStartLoadWithRequest?: OnShouldStartLoadWithRequest,
/**
* Override the native component used to render the WebView. Enables a custom native
* WebView which uses the same JavaScript as the original WebView.
*/
nativeConfig?: WebViewNativeConfig,
/**
* Should caching be enabled. Default is true.
*/
cacheEnabled?: boolean,
/**
* Append to the existing user-agent. Overridden if `userAgent` is set.
*/
applicationNameForUserAgent?: string,
|};
//
// node_modules/react-native-webview/lib/WebView.d.ts
//
// A fudge: iOS will have IOSWebViewProps; Android will have
// AndroidWebViewProps. Hard to get Flow to check platform-specific
// codepaths separately.
export type WebViewProps = $ReadOnly<{| ...IOSWebViewProps, ...AndroidWebViewProps |}>;
// Incomplete; see methods at
// path_to_url#methods-index
// Some differ between platforms.
declare export var WebView: React$ComponentType<WebViewProps>;
declare export default typeof WebView;
```
|
/content/code_sandbox/types/react-native-webview.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 8,106
|
```unknown
/* @flow
* @generated by TsFlower
*/
import type { ProxyNativeModule as $tsflower_import_type$_$expo_2d_modules_2d_core$ProxyNativeModule } from 'expo-modules-core';
declare var _default: $tsflower_import_type$_$expo_2d_modules_2d_core$ProxyNativeModule;
export default _default;
```
|
/content/code_sandbox/types/expo-screen-orientation/build/ExpoScreenOrientation.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 79
|
```unknown
// @flow
// Simple manual stubs, while we focus on other libraries.
export class Node<T> {}
export class Value<T> {}
export class View<T> {}
export default { Node, Value, View };
```
|
/content/code_sandbox/types/react-native-reanimated/index.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 45
|
```unknown
/* @flow
* @generated by TsFlower
*/
declare export var Orientation: {|
/**
* An unknown screen orientation. For example, the device is flat, perhaps on a table.
*/
+UNKNOWN: 0,
/**
* Right-side up portrait interface orientation.
*/
+PORTRAIT_UP: 1,
/**
* Upside down portrait interface orientation.
*/
+PORTRAIT_DOWN: 2,
/**
* Left landscape interface orientation.
*/
+LANDSCAPE_LEFT: 3,
/**
* Right landscape interface orientation.
*/
+LANDSCAPE_RIGHT: 4,
|};
export type OrientationT = $Values<typeof Orientation>;
/**
* An enum whose values can be passed to the [`lockAsync`](#screenorientationlockasyncorientationlock)
* method.
* > __Note:__ `OrientationLock.ALL` and `OrientationLock.PORTRAIT` are invalid on devices which
* > don't support `OrientationLock.PORTRAIT_DOWN`.
*/
declare export var OrientationLock: {|
/**
* The default orientation. On iOS, this will allow all orientations except `Orientation.PORTRAIT_DOWN`.
* On Android, this lets the system decide the best orientation.
*/
+DEFAULT: 0,
/**
* All four possible orientations
*/
+ALL: 1,
/**
* Any portrait orientation.
*/
+PORTRAIT: 2,
/**
* Right-side up portrait only.
*/
+PORTRAIT_UP: 3,
/**
* Upside down portrait only.
*/
+PORTRAIT_DOWN: 4,
/**
* Any landscape orientation.
*/
+LANDSCAPE: 5,
/**
* Left landscape only.
*/
+LANDSCAPE_LEFT: 6,
/**
* Right landscape only.
*/
+LANDSCAPE_RIGHT: 7,
/**
* A platform specific orientation. This is not a valid policy that can be applied in [`lockAsync`](#screenorientationlockasyncorientationlock).
*/
+OTHER: 8,
/**
* An unknown screen orientation lock. This is not a valid policy that can be applied in [`lockAsync`](#screenorientationlockasyncorientationlock).
*/
+UNKNOWN: 9,
|};
export type OrientationLockT = $Values<typeof OrientationLock>;
/**
* Each iOS device has a default set of [size classes](path_to_url
* that you can use as a guide when designing your interface.
*/
declare export var SizeClassIOS: {|
+REGULAR: 0,
+COMPACT: 1,
+UNKNOWN: 2,
|};
export type SizeClassIOST = $Values<typeof SizeClassIOS>;
/**
* An enum representing the lock policies that can be applied on the web platform, modelled after
* the [W3C specification](path_to_url#dom-orientationlocktype).
* These values can be applied through the [`lockPlatformAsync`](#screenorientationlockplatformasyncoptions)
* method.
*/
declare export var WebOrientationLock: {|
+PORTRAIT_PRIMARY: 'portrait-primary',
+PORTRAIT_SECONDARY: 'portrait-secondary',
+PORTRAIT: 'portrait',
+LANDSCAPE_PRIMARY: 'landscape-primary',
+LANDSCAPE_SECONDARY: 'landscape-secondary',
+LANDSCAPE: 'landscape',
+ANY: 'any',
+NATURAL: 'natural',
+UNKNOWN: 'unknown',
|};
export type WebOrientationLockT = $Values<typeof WebOrientationLock>;
declare export var WebOrientation: {|
+PORTRAIT_PRIMARY: 'portrait-primary',
+PORTRAIT_SECONDARY: 'portrait-secondary',
+LANDSCAPE_PRIMARY: 'landscape-primary',
+LANDSCAPE_SECONDARY: 'landscape-secondary',
|};
export type WebOrientationT = $Values<typeof WebOrientation>;
export type PlatformOrientationInfo = {
screenOrientationConstantAndroid?: number,
screenOrientationArrayIOS?: OrientationT[],
screenOrientationLockWeb?: WebOrientationLockT,
...
};
export type ScreenOrientationInfo = {
orientation: OrientationT,
verticalSizeClass?: SizeClassIOST,
horizontalSizeClass?: SizeClassIOST,
...
};
export type OrientationChangeListener = (event: OrientationChangeEvent) => void;
export type OrientationChangeEvent = {
orientationLock: OrientationLockT,
orientationInfo: ScreenOrientationInfo,
...
};
```
|
/content/code_sandbox/types/expo-screen-orientation/build/ScreenOrientation.types.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 951
|
```javascript
/* @flow strict-local */
import { type NavigationProp } from '@react-navigation/native';
/* eslint-disable no-unused-vars */
function test_setParams() {
type NavProp<P> = NavigationProp<{| r: P |}, 'r'>;
function test_happy(navigation: NavProp<{| a: number |}>) {
navigation.setParams({ a: 1 });
}
function test_accepts_missing(navigation: NavProp<{| a: number, b: number |}>) {
navigation.setParams({ a: 1 });
}
function test_rejects_extra(navigation: NavProp<{| a: number |}>) {
// $FlowExpectedError[incompatible-call]
navigation.setParams({ b: 1 });
}
function test_rejects_mismatch(navigation: NavProp<{| a: number |}>) {
// $FlowExpectedError[incompatible-call]
navigation.setParams({ a: 'a' });
}
function test_rejects_object_to_void(navigation: NavProp<void>) {
// $FlowExpectedError[incompatible-call]
navigation.setParams({ a: 1 });
}
function test_rejects_void_to_object(navigation: NavProp<{| a: number |}>) {
// $FlowExpectedError[incompatible-call]
navigation.setParams();
}
}
```
|
/content/code_sandbox/types/__flow-tests__/@react-navigation/native-test.js
|
javascript
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 287
|
```unknown
/* @flow
* @generated
*/
export * from './build/index.js.flow';
```
|
/content/code_sandbox/types/expo-modules-core/index.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 19
|
```unknown
/* @flow
* @generated by TsFlower
*/
/* tsflower-unimplemented: ModuleDeclaration */
/* declare module 'react-native/Libraries/EventEmitter/NativeEventEmitter' {
import { EventEmitter } from 'react-native';
interface NativeEventEmitter extends EventEmitter {
new (nativeModule: NativeModule): NativeEventEmitters;
}
const NativeEventEmitter: NativeEventEmitter;
export default NativeEventEmitter;
type NativeModule = {
addListener: (eventType: string) => void;
removeListeners: (count: number) => void;
};
} */
```
|
/content/code_sandbox/types/expo-modules-core/src/ts-declarations/NativeEventEmitter.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 125
|
```unknown
/* @flow
* @generated by TsFlower
*/
import type { NativeEventEmitter as $tsflower_subst$RN$NativeEventEmitter } from 'tsflower/subst/react-native';
import { NativeEventEmitter } from 'react-native';
type NativeModule = {
startObserving?: () => void,
stopObserving?: () => void,
addListener: (eventName: string) => void,
removeListeners: (count: number) => void,
...
};
export type Subscription = { remove: () => void, ... };
declare export class EventEmitter {
_listenerCount: number;
_nativeModule: NativeModule;
_eventEmitter: $tsflower_subst$RN$NativeEventEmitter;
constructor(nativeModule: NativeModule): any;
addListener<T>(eventName: string, listener: (event: T) => void): Subscription;
removeAllListeners(eventName: string): void;
removeSubscription(subscription: Subscription): void;
emit(eventName: string, ...params: any[]): void;
}
export {};
```
|
/content/code_sandbox/types/expo-modules-core/build/EventEmitter.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 220
|
```unknown
/* @flow
* @generated by TsFlower
*/
/* tsflower-unimplemented: ModuleDeclaration */
/* declare global {
var ExpoModules: undefined | {
[key: string]: any;
};
} */
declare export function requireNativeModule<ModuleType = any>(moduleName: string): ModuleType;
```
|
/content/code_sandbox/types/expo-modules-core/build/requireNativeModule.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 66
|
```unknown
/**
* Types for the NPM package `@sentry/react-native`.
*
* @flow strict-local
*/
type Primitive =
| number
| string
| boolean
// | bigint (not supported yet; facebook/flow#6639)
| symbol
| null
| typeof undefined;
// Adapted from @sentry/types/src/options.ts et al.
//
// Despite being given as exact, many other options not listed here are
// available. See:
// * path_to_url
// * path_to_url
// * path_to_url
//
// Please add them to this declaration as (and if) they're needed.
export type Options = {|
/* Do not use this in Sentry.init(). As of 1.0.9, Sentry will only be
partially initialized if it's set to `false`, and anyway there's no good
way to toggle it. */
// enabled?: boolean,
/* This field is declared as optional in TypeScript, but it's not: the iOS
implementation will redbox if it's omitted from the `init()` call. The
underlying issue has been filed as getsentry/sentry-cocoa#347.
In the meantime, { dsn: 'path_to_url } may have the
same effect. */
dsn: string,
/** Enable NDK on Android
*
* @default true
*/
enableNdk?: boolean,
ignoreErrors?: Array<string | RegExp>,
/**
* A callback invoked during event submission, allowing to optionally modify
* the event before it is sent to Sentry.
*
* Note that you must return a valid event from this callback. If you do not
* wish to modify the event, simply return it at the end.
* Returning null will case the event to be dropped.
*
* @param event The error or message event generated by the SDK.
* @param hint May contain additional information about the original exception.
* @returns A new event that will be sent | null.
*/
beforeSend?: (event: Event, hint?: EventHint) => Promise<Event | null> | Event | null,
/**
* A callback invoked when adding a breadcrumb, allowing to optionally modify
* it before adding it to future events.
*
* Note that you must return a valid breadcrumb from this callback. If you do
* not wish to modify the breadcrumb, simply return it at the end.
* Returning null will case the breadcrumb to be dropped.
*
* @param breadcrumb The breadcrumb as created by the SDK.
* @returns The breadcrumb that will be added | null.
*/
beforeBreadcrumb?: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => Breadcrumb | null,
|};
// Adapted from @sentry/types/src/severity.ts.
//
// Flow doesn't support true enums, so we split the TypeScript `enum Severity`
// into a separate variable `Severity` and type `SeverityType`.
declare export var Severity: $ReadOnly<{|
Fatal: 'fatal',
Error: 'error',
Warning: 'warning',
Log: 'log',
Info: 'info',
Debug: 'debug',
Critical: 'critical',
|}>;
export type SeverityType = $Values<typeof Severity>;
// Taken from @sentry/types/src/event.ts.
//
// Commented-out members have types not (yet?) present in this file.
export type Event = {|
event_id?: string,
message?: string,
timestamp?: number,
start_timestamp?: number,
level?: SeverityType,
platform?: string,
logger?: string,
server_name?: string,
release?: string,
dist?: string,
environment?: string,
// sdk?: SdkInfo,
// request?: Request,
transaction?: string,
modules?: {| [key: string]: string |},
fingerprint?: string[],
// exception?: { values?: Exception[], },
// stacktrace?: Stacktrace,
breadcrumbs?: Breadcrumb[],
// contexts?: {| [key: string]: object |},
tags?: {| [key: string]: Primitive |},
extra?: {| [key: string]: $FlowFixMe |},
// user?: User,
type?: EventType,
|};
// Taken from @sentry/types/src/event.ts.
export type EventType = 'transaction';
// Taken from @sentry/types/src/event.ts.
export type EventHint = {|
event_id?: string,
captureContext?: CaptureContext,
syntheticException?: Error | null,
originalException?: Error | string | null,
data?: mixed,
|};
// Taken from @sentry/types/src/breadcrumb.ts.
// See doc at path_to_url
export type Breadcrumb = {|
type?: string,
level?: SeverityType,
event_id?: string,
category?: string,
message?: string,
data?: {|
[key: string]: mixed,
|},
timestamp?: number,
|};
// Taken from @sentry/types/src/breadcrumb.ts.
export type BreadcrumbHint = {| [key: string]: mixed |};
// Taken from @sentry/types/src/hub.ts. More methods are available.
export type Hub = {
getClient(): Client | typeof undefined,
captureException(exception: mixed, hint?: EventHint): string,
captureMessage(message: string, level?: SeverityType, hint?: EventHint): string,
...
};
// Really an exact object type with the commented-out properties present.
// (We omit them to be lazy.) Taken from
// path_to_url#L16-L24
export type ScopeContext = {
// user: User,
level: typeof Severity,
// extra: Extras,
// contexts: Contexts,
tags: { [key: string]: Primitive },
fingerprint: string[],
// requestSession: RequestSession,
...
}
// Taken from @sentry/{minimal,types}/src/scope.ts.
// More methods are available.
declare export class Scope {
/**
* Sets the level on the scope for future events.
* @param level string {@link Severity}
*/
setLevel(level: SeverityType): this;
/**
* Set an object that will be merged sent as tags data with the event.
* @param tags Tags context object to merge into current context.
*/
setTags(tags: {|
+[key: string]: Primitive,
|}): this;
/**
* Set key:value that will be sent as tags data with the event.
* @param key String key of tag
* @param value String value of tag
*/
setTag(key: string, value: Primitive): this;
/**
* Set key:value that will be sent as extra data with the event.
* @param key String of extra
* @param extra Any kind of data. This data will be normalized.
*/
setExtra(key: string, extra: $FlowFixMe): this;
/**
* Set an object that will be merged sent as extra data with the event.
* @param extras Extras object to merge into current context.
*/
setExtras(extras: {| +[key: string]: $FlowFixMe |}): this;
}
export type CaptureContext = Scope | $Rest<ScopeContext, { ... }> | ((scope: Scope) => Scope);
// Adapted from @sentry/types/src/client.ts, with some specialization.
export type Client = {
getOptions(): Options,
...
};
// Adapted from @sentry/react-native/src/sdk.ts.
declare export function init(o: Options): void;
// Taken from @sentry/hub/src/hub.ts.
declare export function getCurrentHub(): Hub;
// A slice of the so-called "Static API":
// path_to_url#static-api
//
// Taken from @sentry/minimal/src/index.ts.
declare export function captureException(
exception: mixed,
captureContext?: CaptureContext,
): string;
declare export function captureMessage(
message: string,
captureContext?: CaptureContext | SeverityType,
): string;
declare export function addBreadcrumb(breadcrumb: Breadcrumb): void;
/* Modifies the current scope. Avoid in favor of `withScope` wherever
possible. */
declare export function configureScope(callback: (scope: Scope) => void): void;
/**
* Performs actions in a new subscope.
*
* Note that an exception which escapes this scope will not necessarily have
* the relevant scope-changes applied to its Sentry event! This scope is only
* consulted when the event is finally captured for logging.
*/
declare export function withScope(callback: (scope: Scope) => void): void;
```
|
/content/code_sandbox/types/@sentry/react-native.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 1,831
|
```unknown
/* @flow
* @generated by TsFlower
*/
/* tsflower-unimplemented: EnumDeclaration */
/* export declare enum PermissionStatus {
GRANTED = "granted",
UNDETERMINED = "undetermined",
DENIED = "denied"
} */
export type PermissionExpiration = 'never' | number;
export interface PermissionResponse {
status: PermissionStatus;
expires: PermissionExpiration;
granted: boolean;
canAskAgain: boolean;
}
```
|
/content/code_sandbox/types/expo-modules-core/build/PermissionsInterface.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 100
|
```unknown
/* @flow
* @generated by TsFlower
*/
import * as React from 'react';
declare export function requireNativeViewManager<P = any>(viewName: string): React.ComponentType<P>;
```
|
/content/code_sandbox/types/expo-modules-core/build/NativeViewManagerAdapter.native.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 43
|
```unknown
/* @flow
* @generated by TsFlower
*/
import { type ProxyNativeModule } from './NativeModulesProxy.types';
declare var _default: { [moduleName: string]: ProxyNativeModule, ... };
export default _default;
```
|
/content/code_sandbox/types/expo-modules-core/build/NativeModulesProxy.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 50
|
```unknown
/* @flow
* @generated by TsFlower
*/
import * as React from 'react';
declare export function requireNativeViewManager<P = any>(viewName: string): React.ComponentType<P>;
```
|
/content/code_sandbox/types/expo-modules-core/build/NativeViewManagerAdapter.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 43
|
```unknown
/* @flow
* @generated by TsFlower
*/
// TODO[tsflower]: From @types/react-native; add to subst/react-native.
type PlatformOSType = 'ios' | 'android' | 'macos' | 'windows' | 'web' | 'native';
export type PlatformSelectOSType = PlatformOSType | 'native' | 'electron' | 'default';
export type PlatformSelect = <T>(
specifics: $FlowFixMe /* {
[platform in PlatformSelectOSType]?: T;
} */ /* tsflower-unimplemented: MappedType */,
) => T;
declare var Platform: {
OS: 'ios' | 'android' | 'windows' | 'macos' | 'web',
select: PlatformSelect,
isDOMAvailable: boolean,
canUseEventListeners: boolean,
canUseViewport: boolean,
isAsyncDebugging: boolean,
...
};
export default Platform;
```
|
/content/code_sandbox/types/expo-modules-core/build/Platform.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 201
|
```unknown
/* @flow
* @generated by TsFlower
*/
declare export default function deprecate(
library: string,
deprecatedAPI: string,
options?: {
replacement?: string,
currentVersion?: string,
versionToRemove?: string,
...
},
): void;
```
|
/content/code_sandbox/types/expo-modules-core/build/deprecate.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 61
|
```unknown
/* @flow
* @generated by TsFlower
*/
import { type PermissionResponse } from './PermissionsInterface';
type RequestPermissionMethod<Permission: PermissionResponse> = () => Promise<Permission>;
type GetPermissionMethod<Permission: PermissionResponse> = () => Promise<Permission>;
declare interface PermissionHookMethods<Permission: PermissionResponse, Options = empty> {
requestMethod: (options?: Options) => Promise<Permission>;
getMethod: (options?: Options) => Promise<Permission>;
}
declare interface PermissionHookBehavior {
get?: boolean;
request?: boolean;
}
export type PermissionHookOptions<Options: { ... }> = PermissionHookBehavior & Options;
declare export function createPermissionHook<Permission: PermissionResponse, Options: { ... }>(
methods: PermissionHookMethods<Permission, Options>,
): (
options?: PermissionHookOptions<Options> | void,
) => [Permission | null, RequestPermissionMethod<Permission>, GetPermissionMethod<Permission>];
export {};
```
|
/content/code_sandbox/types/expo-modules-core/build/PermissionsHook.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 204
|
```unknown
/* @flow
* @generated by TsFlower
*/
/* $FlowFixMe[missing-export]: Real RN doesn't have a type with this name.
It does exist in @types/react-native, but it's marked as deprecated.
Could send a PR to TsFlower, or wait for Expo to stop using this. */
import type { DeviceEventEmitterStatic as $tsflower_import_type$_$react_2d_native$DeviceEventEmitterStatic } from 'react-native';
import { DeviceEventEmitter } from 'react-native';
import { EventEmitter, type Subscription as Subscription_ } from './EventEmitter';
import NativeModulesProxy from './NativeModulesProxy';
import { type ProxyNativeModule as ProxyNativeModule_ } from './NativeModulesProxy.types';
import { requireNativeViewManager } from './NativeViewManagerAdapter';
import Platform from './Platform';
import SyntheticPlatformEmitter from './SyntheticPlatformEmitter';
import { CodedError } from './errors/CodedError';
import { UnavailabilityError } from './errors/UnavailabilityError';
/* tsflower-unimplemented: ImportDeclaration with no import clause */
/*
import './sweet/setUpErrorManager.fx'; */
export { default as deprecate } from './deprecate';
export {
DeviceEventEmitter,
EventEmitter,
NativeModulesProxy,
Platform,
SyntheticPlatformEmitter,
requireNativeViewManager,
CodedError,
UnavailabilityError,
};
export type ProxyNativeModule = ProxyNativeModule_;
export type Subscription = Subscription_;
export * from './requireNativeModule';
// See comment on DeviceEventEmitterStatic import, above.
declare export var RCTDeviceEventEmitter: $FlowFixMe; // $tsflower_import_type$_$react_2d_native$DeviceEventEmitterStatic
export * from './PermissionsInterface';
export * from './PermissionsHook';
```
|
/content/code_sandbox/types/expo-modules-core/build/index.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 377
|
```unknown
/* @flow
* @generated by TsFlower
*/
export { default } from 'react-native/Libraries/EventEmitter/RCTDeviceEventEmitter';
```
|
/content/code_sandbox/types/expo-modules-core/build/SyntheticPlatformEmitter.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 33
|
```unknown
/* @flow
* @generated by TsFlower
*/
export type ProxyNativeModule = {
[propertyName: string]: any,
addListener: (eventName: string) => void,
removeListeners: (count: number) => void,
...
};
```
|
/content/code_sandbox/types/expo-modules-core/build/NativeModulesProxy.types.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 56
|
```unknown
/* @flow
* @generated by TsFlower
*/
export {};
```
|
/content/code_sandbox/types/expo-modules-core/build/sweet/setUpErrorManager.fx.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 16
|
```unknown
/* @flow
* @generated by TsFlower
*/
import { type ProxyNativeModule } from './NativeModulesProxy.types';
declare var NativeModulesProxy: { [moduleName: string]: ProxyNativeModule, ... };
export default NativeModulesProxy;
```
|
/content/code_sandbox/types/expo-modules-core/build/NativeModulesProxy.native.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 52
|
```unknown
/* @flow
* @generated by TsFlower
*/
declare export class CodedError extends Error {
code: string;
info?: any;
constructor(code: string, message: string): any;
}
```
|
/content/code_sandbox/types/expo-modules-core/build/errors/CodedError.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 46
|
```unknown
/* @flow
* @generated by TsFlower
*/
import type { ProxyNativeModule as $tsflower_import_type$_$_2e__2e_$ProxyNativeModule } from '..';
declare var _default: $tsflower_import_type$_$_2e__2e_$ProxyNativeModule;
export default _default;
```
|
/content/code_sandbox/types/expo-modules-core/build/sweet/NativeErrorManager.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 68
|
```unknown
/* @flow
* @generated by TsFlower
*/
import { CodedError } from './CodedError';
declare export class UnavailabilityError extends CodedError {
constructor(moduleName: string, propertyName: string): any;
}
```
|
/content/code_sandbox/types/expo-modules-core/build/errors/UnavailabilityError.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 51
|
```unknown
/* @flow
* @generated by TsFlower
*/
declare export var isDOMAvailable: $FlowFixMe /* false */ /* tsflower-error: const type inferred from FalseKeyword */;
declare export var canUseEventListeners: $FlowFixMe /* false */ /* tsflower-error: const type inferred from FalseKeyword */;
declare export var canUseViewport: $FlowFixMe /* false */ /* tsflower-error: const type inferred from FalseKeyword */;
declare export var isAsyncDebugging: boolean;
```
|
/content/code_sandbox/types/expo-modules-core/build/environment/browser.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 106
|
```unknown
/* @flow
* @generated
*/
export * from './lib/typescript/index.js.flow';
```
|
/content/code_sandbox/types/@react-native-camera-roll/camera-roll/index.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 21
|
```unknown
/* @flow
* @generated by TsFlower
*/
class NotificationSetting {
static open: () => void;
}
export default NotificationSetting;
```
|
/content/code_sandbox/types/react-native-open-notification/index.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 32
|
```unknown
/* @flow
* @generated by TsFlower
*/
declare var _default: any;
export default _default;
```
|
/content/code_sandbox/types/@react-native-camera-roll/camera-roll/lib/typescript/cameraRollPermissionNativeInterface.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 26
|
```unknown
/* @flow
* @generated by TsFlower
*/
export * from './useCameraRoll';
export * from './CameraRoll';
export * from './CameraRollIOSPermission';
```
|
/content/code_sandbox/types/@react-native-camera-roll/camera-roll/lib/typescript/index.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 38
|
```unknown
/* @flow
* @generated by TsFlower
*/
import {
type GetPhotosParams,
type PhotoIdentifiersPage,
type SaveToCameraRollOptions,
} from './CameraRoll';
type UseCameraRollResult = [
PhotoIdentifiersPage,
(config?: GetPhotosParams) => Promise<void>,
(tag: string, options?: SaveToCameraRollOptions) => Promise<void>,
];
declare export function useCameraRoll(): UseCameraRollResult;
export {};
```
|
/content/code_sandbox/types/@react-native-camera-roll/camera-roll/lib/typescript/useCameraRoll.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 101
|
```unknown
/* @flow
* @generated by TsFlower
*/
declare var _default: any;
export default _default;
```
|
/content/code_sandbox/types/@react-native-camera-roll/camera-roll/lib/typescript/nativeInterface.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 26
|
```unknown
/* @flow
* @generated by TsFlower
*/
export type GroupTypes =
| 'Album'
| 'All'
| 'Event'
| 'Faces'
| 'Library'
| 'PhotoStream'
| 'SavedPhotos';
export type Include =
| 'filename'
| 'fileSize'
| 'fileExtension'
| 'location'
| 'imageSize'
| 'playableDuration'
| 'orientation';
export type AssetType = 'All' | 'Videos' | 'Photos';
export type GetPhotosParams = {
first: number,
after?: string,
groupTypes?: GroupTypes,
groupName?: string,
assetType?: AssetType,
fromTime?: number,
toTime?: number,
mimeTypes?: Array<string>,
include?: Include[],
...
};
export type PhotoIdentifier = {
node: {
type: string,
group_name: string,
image: {
filename: string | null,
filepath: string | null,
extension: string | null,
uri: string,
height: number,
width: number,
fileSize: number | null,
playableDuration: number,
orientation: number | null,
...
},
timestamp: number,
location: {
latitude?: number,
longitude?: number,
altitude?: number,
heading?: number,
speed?: number,
...
} | null,
...
},
...
};
export type PhotoConvertionOptions = { convertHeicImages: boolean, ... };
export type PhotoIdentifiersPage = {
edges: Array<PhotoIdentifier>,
page_info: {
has_next_page: boolean,
start_cursor?: string,
end_cursor?: string,
...
},
limited?: boolean,
...
};
export type SaveToCameraRollOptions = {
type?: 'photo' | 'video' | 'auto',
album?: string,
...
};
export type GetAlbumsParams = { assetType?: AssetType, ... };
export type Album = {
title: string,
count: number,
...
};
declare export class CameraRoll {
static GroupTypesOptions: {
Album: string,
All: string,
Event: string,
Faces: string,
Library: string,
PhotoStream: string,
SavedPhotos: string,
...
};
static AssetTypeOptions: {
All: string,
Videos: string,
Photos: string,
...
};
static deletePhotos(photoUris: Array<string>): void;
static save(tag: string, options?: SaveToCameraRollOptions): Promise<string>;
static saveToCameraRoll(tag: string, type?: 'photo' | 'video' | 'auto'): Promise<string>;
static getAlbums(params?: GetAlbumsParams): Promise<Album[]>;
static getParamsWithDefaults(params: GetPhotosParams): GetPhotosParams;
static getPhotos(params: GetPhotosParams): Promise<PhotoIdentifiersPage>;
static iosGetImageDataById(
internalID: string,
convertHeicImages?: boolean,
): Promise<PhotoIdentifier>;
}
```
|
/content/code_sandbox/types/@react-native-camera-roll/camera-roll/lib/typescript/CameraRoll.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 662
|
```unknown
/* @flow
* @generated by TsFlower
*/
```
|
/content/code_sandbox/types/@react-native-camera-roll/camera-roll/lib/typescript/__mocks__/nativeInterface.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 14
|
```unknown
/* @flow
* @generated by TsFlower
*/
import type { NativeEventEmitter as $tsflower_subst$RN$NativeEventEmitter } from 'tsflower/subst/react-native';
import { NativeEventEmitter } from 'react-native';
export type AccessLevel = 'addOnly' | 'readWrite';
export type CameraRollAuthorizationStatus =
| 'granted'
| 'limited'
| 'denied'
| 'unavailable'
| 'blocked'
| 'not-determined';
declare export var cameraRollEventEmitter: $tsflower_subst$RN$NativeEventEmitter;
declare export var iosReadGalleryPermission: (
accessLevel: AccessLevel,
) => Promise<CameraRollAuthorizationStatus>;
declare export var iosRequestReadWriteGalleryPermission: () => Promise<CameraRollAuthorizationStatus>;
declare export var iosRequestAddOnlyGalleryPermission: () => Promise<CameraRollAuthorizationStatus>;
declare export var iosRefreshGallerySelection: () => Promise<boolean>;
```
|
/content/code_sandbox/types/@react-native-camera-roll/camera-roll/lib/typescript/CameraRollIOSPermission.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 204
|
```unknown
/* @flow
* @generated by TsFlower
*/
export {};
```
|
/content/code_sandbox/types/@react-native-camera-roll/camera-roll/lib/typescript/__tests__/CameraRollTest.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 16
|
```unknown
/* @flow
* @generated by TsFlower
*/
export {};
```
|
/content/code_sandbox/types/@react-native-camera-roll/camera-roll/lib/typescript/__tests__/CameraRollIOSPermissionTest.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 16
|
```unknown
/* @flow
* @generated by TsFlower
*/
export {};
```
|
/content/code_sandbox/types/@react-native-camera-roll/camera-roll/lib/typescript/__tests__/useCameraRoll.js.flow
|
unknown
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 16
|
```diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Chris Bobbe <cbobbe@zulip.com>
Date: Mon, 25 Jul 2022 14:37:40 -0700
Subject: [tsflower] expo-modules-core: Fix React import, to use
React.ComponentType
---
types/expo-modules-core/build/NativeViewManagerAdapter.js.flow | 2 +-
.../build/NativeViewManagerAdapter.native.js.flow | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git types/expo-modules-core/build/NativeViewManagerAdapter.js.flow types/expo-modules-core/build/NativeViewManagerAdapter.js.flow
index 7b0801647..c09f510f2 100644
--- types/expo-modules-core/build/NativeViewManagerAdapter.js.flow
+++ types/expo-modules-core/build/NativeViewManagerAdapter.js.flow
@@ -1,5 +1,5 @@
/* @flow
* @generated by TsFlower
*/
-import React from 'react';
+import * as React from 'react';
declare export function requireNativeViewManager<P = any>(viewName: string): React.ComponentType<P>;
diff --git types/expo-modules-core/build/NativeViewManagerAdapter.native.js.flow types/expo-modules-core/build/NativeViewManagerAdapter.native.js.flow
index 7b0801647..c09f510f2 100644
--- types/expo-modules-core/build/NativeViewManagerAdapter.native.js.flow
+++ types/expo-modules-core/build/NativeViewManagerAdapter.native.js.flow
@@ -1,5 +1,5 @@
/* @flow
* @generated by TsFlower
*/
-import React from 'react';
+import * as React from 'react';
declare export function requireNativeViewManager<P = any>(viewName: string): React.ComponentType<P>;
--
2.32.0
```
|
/content/code_sandbox/types/patches/0035-tsflower-expo-modules-core-Fix-React-import-to-use-R.patch
|
diff
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 431
|
```diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Greg Price <greg@zulip.com>
Date: Wed, 25 May 2022 16:31:50 -0700
Subject: [???] rnav: Fix odd initialRouteName "index signature" error
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This sacrifices a bit of type-checking: it lets an `initialRouteName`
prop be any string, rather than only actual route names.
It avoids the puzzling error below -- one at each of our navigators.
There's probably something deeper going on, something wrong with these
type definitions somewhere else. And definitely Flow could be better
at explaining what the error is here, to help us find that something.
Error src/nav/AppNavigator.js:103:6
Cannot create `Stack.Navigator` element because an index signature
declaring the expected key / value type is missing in `GlobalParamList` [1]
in property `initialRouteName`. [prop-missing]
src/nav/AppNavigator.js:103:6
103 <Stack.Navigator
^^^^^^^^^^^^^^^
References:
src/nav/AppNavigator.js:89:36
89 const Stack = createStackNavigator<GlobalParamList>();
^^^^^^^^^^^^^^^ [1]
---
types/@react-navigation/core/lib/typescript/src/types.js.flow | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git types/@react-navigation/core/lib/typescript/src/types.js.flow types/@react-navigation/core/lib/typescript/src/types.js.flow
index 4d918550e..58cf56a85 100644
--- types/@react-navigation/core/lib/typescript/src/types.js.flow
+++ types/@react-navigation/core/lib/typescript/src/types.js.flow
@@ -24,7 +24,7 @@ import {
export type DefaultNavigatorOptions<
ScreenOptions: { ... },
ParamList: ParamListBase = ParamListBase,
-> = DefaultRouterOptions<Extract<$Keys<ParamList>, string>> & {
+> = DefaultRouterOptions<string> & {
children: $tsflower_subst$React$ReactNode,
screenOptions?:
| ScreenOptions
--
2.32.0
```
|
/content/code_sandbox/types/patches/0025-rnav-Fix-odd-initialRouteName-index-signature-error.patch
|
diff
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 513
|
```diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Chris Bobbe <cbobbe@zulip.com>
Date: Fri, 1 Sep 2023 18:05:02 -0700
Subject: [tsflower] rnsac: Use $ReadOnlyArray
---
.../lib/typescript/src/SafeArea.types.js.flow | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git types/react-native-safe-area-context/lib/typescript/src/SafeArea.types.js.flow types/react-native-safe-area-context/lib/typescript/src/SafeArea.types.js.flow
index 2a11287b6..c4e816378 100644
--- types/react-native-safe-area-context/lib/typescript/src/SafeArea.types.js.flow
+++ types/react-native-safe-area-context/lib/typescript/src/SafeArea.types.js.flow
@@ -17,9 +17,7 @@ export type EdgeMode = 'off' | 'additive' | 'maximum';
export type EdgeRecord =
Partial<$FlowFixMe /* Record<Edge, EdgeMode> */ /* tsflower-unimplemented: Record with key type TypeReference */>;
-export type Edges =
- /* tsflower-warning: unimplemented: 'readonly' as type operator */
- Edge[] /* readonly Edge[] */ | Readonly<EdgeRecord>;
+export type Edges = $ReadOnlyArray<Edge> | Readonly<EdgeRecord>;
export interface EdgeInsets {
top: number;
--
2.32.0
```
|
/content/code_sandbox/types/patches/0002-tsflower-rnsac-Use-ReadOnlyArray.patch
|
diff
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 338
|
```diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Chris Bobbe <cbobbe@zulip.com>
Date: Fri, 1 Sep 2023 18:29:58 -0700
Subject: [tsflower] rnsac: Translate a TS `Record` type
---
.../lib/typescript/src/SafeArea.types.js.flow | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git types/react-native-safe-area-context/lib/typescript/src/SafeArea.types.js.flow types/react-native-safe-area-context/lib/typescript/src/SafeArea.types.js.flow
index c4e816378..3a71dca37 100644
--- types/react-native-safe-area-context/lib/typescript/src/SafeArea.types.js.flow
+++ types/react-native-safe-area-context/lib/typescript/src/SafeArea.types.js.flow
@@ -14,8 +14,7 @@ import 'react-native';
import NativeSafeAreaView from './specs/NativeSafeAreaView';
export type Edge = 'top' | 'right' | 'bottom' | 'left';
export type EdgeMode = 'off' | 'additive' | 'maximum';
-export type EdgeRecord =
- Partial<$FlowFixMe /* Record<Edge, EdgeMode> */ /* tsflower-unimplemented: Record with key type TypeReference */>;
+export type EdgeRecord = {| [Edge]: EdgeMode |};
export type Edges = $ReadOnlyArray<Edge> | Readonly<EdgeRecord>;
--
2.32.0
```
|
/content/code_sandbox/types/patches/0003-tsflower-rnsac-Translate-a-TS-Record-type.patch
|
diff
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 344
|
```diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Greg Price <greg@zulip.com>
Date: Tue, 24 May 2022 18:48:07 -0700
Subject: [upstream] rnav: Fix type-parameter defaults that don't meet bounds
In the type aliases NavigationProp, StackNavigationProp,
NavigationHelpers, and Descriptor.
These are all quite bogus, and Flow gives an extremely confusing error
when you try to instantiate these types and use the defaults.
TypeScript apparently just lets them slide.
Fortunately it's easy to fix: give the bound as the default, instead
of some other type that's above the bound.
TsFlower could also quite likely work around this with a hack: for
the default, emit the intersection of the original default and the
bound. Though that's not good in some more-interesting cases, where
the default will only sometimes fail to meet the bound, and the
library author's intention is for the user to get an error in that
case. For example, our `typesEquivalent` in src/generics.js.
---
.../core/lib/typescript/src/types.js.flow | 8 ++++----
.../stack/lib/typescript/src/types.js.flow | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git types/@react-navigation/core/lib/typescript/src/types.js.flow types/@react-navigation/core/lib/typescript/src/types.js.flow
index b6145283b..e3dd9a0d0 100644
--- types/@react-navigation/core/lib/typescript/src/types.js.flow
+++ types/@react-navigation/core/lib/typescript/src/types.js.flow
@@ -181,7 +181,7 @@ type NavigationHelpersCommon<
export type NavigationHelpers<
ParamList: ParamListBase,
- EventMap: EventMapBase = { ... },
+ EventMap: EventMapBase = EventMapBase,
> = NavigationHelpersCommon<ParamList> &
EventEmitter<EventMap> & {
setParams<RouteName: $Keys<ParamList>>(
@@ -201,10 +201,10 @@ export type NavigationContainerProps = {
export type NavigationProp<
ParamList: ParamListBase,
- RouteName: $Keys<ParamList> = string,
+ RouteName: $Keys<ParamList> = $Keys<ParamList>,
State: NavigationState<> = NavigationState<ParamList>,
ScreenOptions: { ... } = { ... },
- EventMap: EventMapBase = { ... },
+ EventMap: EventMapBase = EventMapBase,
> = NavigationHelpersCommon<ParamList, State> & {
setParams(params: Partial<$ElementType<ParamList, RouteName>>): void,
setOptions(options: Partial<ScreenOptions>): void,
@@ -250,7 +250,7 @@ export type Descriptor<
RouteName: $Keys<ParamList> = string,
State: NavigationState<> = NavigationState<>,
ScreenOptions: { ... } = { ... },
- EventMap: EventMapBase = { ... },
+ EventMap: EventMapBase = EventMapBase,
> = {
render(): $tsflower_subst$React$JSX$Element,
options: ScreenOptions,
diff --git types/@react-navigation/stack/lib/typescript/src/types.js.flow types/@react-navigation/stack/lib/typescript/src/types.js.flow
index 946df1eb6..94ea2dee5 100644
--- types/@react-navigation/stack/lib/typescript/src/types.js.flow
+++ types/@react-navigation/stack/lib/typescript/src/types.js.flow
@@ -43,7 +43,7 @@ export type StackNavigationHelpers = NavigationHelpers<ParamListBase, StackNavig
StackActionHelpers<ParamListBase>;
export type StackNavigationProp<
ParamList: ParamListBase,
- RouteName: $Keys<ParamList> = string,
+ RouteName: $Keys<ParamList> = $Keys<ParamList>,
> = NavigationProp<
ParamList,
RouteName,
--
2.32.0
```
|
/content/code_sandbox/types/patches/0006-upstream-rnav-Fix-type-parameter-defaults-that-don-t.patch
|
diff
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 894
|
```diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Chris Bobbe <cbobbe@zulip.com>
Date: Mon, 25 Jul 2022 13:38:39 -0700
Subject: [tsflower] expo-web-browser: Fix export { ... } of types
---
.../expo-web-browser/build/WebBrowser.js.flow | 45 +++++++++++++------
1 file changed, 31 insertions(+), 14 deletions(-)
diff --git types/expo-web-browser/build/WebBrowser.js.flow types/expo-web-browser/build/WebBrowser.js.flow
index 97be5b587..3c98c8a32 100644
--- types/expo-web-browser/build/WebBrowser.js.flow
+++ types/expo-web-browser/build/WebBrowser.js.flow
@@ -2,24 +2,41 @@
* @generated by TsFlower
*/
import {
- type WebBrowserAuthSessionResult,
- type WebBrowserCompleteAuthSessionOptions,
- type WebBrowserCompleteAuthSessionResult,
- type WebBrowserCoolDownResult,
- type WebBrowserCustomTabsResults,
- type WebBrowserMayInitWithUrlResult,
- type WebBrowserOpenOptions,
- type WebBrowserRedirectResult,
- type WebBrowserResult,
+ type WebBrowserAuthSessionResult as WebBrowserAuthSessionResult_,
+ type WebBrowserCompleteAuthSessionOptions as WebBrowserCompleteAuthSessionOptions_,
+ type WebBrowserCompleteAuthSessionResult as WebBrowserCompleteAuthSessionResult_,
+ type WebBrowserCoolDownResult as WebBrowserCoolDownResult_,
+ type WebBrowserCustomTabsResults as WebBrowserCustomTabsResults_,
+ type WebBrowserMayInitWithUrlResult as WebBrowserMayInitWithUrlResult_,
+ type WebBrowserOpenOptions as WebBrowserOpenOptions_,
+ type WebBrowserRedirectResult as WebBrowserRedirectResult_,
+ type WebBrowserResult as WebBrowserResult_,
WebBrowserResultType,
- type WebBrowserResultTypeT,
- type WebBrowserWarmUpResult,
- type WebBrowserWindowFeatures,
+ type WebBrowserResultTypeT as WebBrowserResultTypeT_,
+ type WebBrowserWarmUpResult as WebBrowserWarmUpResult_,
+ type WebBrowserWindowFeatures as WebBrowserWindowFeatures_,
WebBrowserPresentationStyle,
- type AuthSessionOpenOptions,
+ type WebBrowserPresentationStyleT as WebBrowserPresentationStyleT_,
+ type AuthSessionOpenOptions as AuthSessionOpenOptions_,
} from "./WebBrowser.types";
-export { WebBrowserAuthSessionResult, WebBrowserCompleteAuthSessionOptions, WebBrowserCompleteAuthSessionResult, WebBrowserCoolDownResult, WebBrowserCustomTabsResults, WebBrowserMayInitWithUrlResult, WebBrowserOpenOptions, WebBrowserRedirectResult, WebBrowserResult, WebBrowserResultType, WebBrowserResultTypeT, WebBrowserWarmUpResult, WebBrowserWindowFeatures, WebBrowserPresentationStyle, WebBrowserPresentationStyleT, AuthSessionOpenOptions };
+export { WebBrowserResultType, WebBrowserPresentationStyle };
+
+export type WebBrowserAuthSessionResult = WebBrowserAuthSessionResult_;
+export type WebBrowserCompleteAuthSessionOptions = WebBrowserCompleteAuthSessionOptions_;
+export type WebBrowserCompleteAuthSessionResult = WebBrowserCompleteAuthSessionResult_;
+export type WebBrowserCoolDownResult = WebBrowserCoolDownResult_;
+export type WebBrowserCustomTabsResults = WebBrowserCustomTabsResults_;
+export type WebBrowserMayInitWithUrlResult = WebBrowserMayInitWithUrlResult_;
+export type WebBrowserOpenOptions = WebBrowserOpenOptions_;
+export type WebBrowserRedirectResult = WebBrowserRedirectResult_;
+export type WebBrowserResult = WebBrowserResult_;
+export type WebBrowserResultTypeT = WebBrowserResultTypeT_;
+export type WebBrowserWarmUpResult = WebBrowserWarmUpResult_;
+export type WebBrowserWindowFeatures = WebBrowserWindowFeatures_;
+export type WebBrowserPresentationStyleT = WebBrowserPresentationStyleT_;
+export type AuthSessionOpenOptions = AuthSessionOpenOptions_;
+
declare export function getCustomTabsSupportingBrowsersAsync(): Promise<WebBrowserCustomTabsResults>;
declare export function warmUpAsync(browserPackage?: string): Promise<WebBrowserWarmUpResult>;
declare export function mayInitWithUrlAsync(url: string, browserPackage?: string): Promise<WebBrowserMayInitWithUrlResult>;
--
2.32.0
```
|
/content/code_sandbox/types/patches/0042-tsflower-expo-web-browser-Fix-export-.-of-types.patch
|
diff
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 939
|
```diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Greg Price <greg@zulip.com>
Date: Tue, 7 Jun 2022 20:57:09 -0700
Subject: [tsflower] Replace interface-extends with spread for non-interface
bases
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In TypeScript, `interface T { }` and `type T = { }`, when there
are no other type definitions for T, mean exactly the same thing.
In Flow, they're different -- an interface is a different kind of
type from an object type. In particular, a further interface
definition can extend an interface, but can't extend an object type.
Currently, TsFlower emits an interface when it sees an interface.
That's good if the type definitions are going to go on to use that
interface as the base for another interface, or for a class; it's
bad if it was extending another type that turns out to be just an
object type.
Probably an improvement to the heuristic would be to convert an
interface declaration to an object type, with `extends` turned into
a spread, when the base is an object type -- as it is in these
examples.
---
.../lib/typescript/src/SafeArea.types.js.flow | 24 +++++++++++--------
.../typescript/src/SafeAreaContext.js.flow | 12 ++++++----
.../src/specs/NativeSafeAreaProvider.js.flow | 8 ++++---
.../src/specs/NativeSafeAreaView.js.flow | 10 ++++----
4 files changed, 32 insertions(+), 22 deletions(-)
diff --git types/react-native-safe-area-context/lib/typescript/src/SafeArea.types.js.flow types/react-native-safe-area-context/lib/typescript/src/SafeArea.types.js.flow
index 3a71dca37..81a9fb120 100644
--- types/react-native-safe-area-context/lib/typescript/src/SafeArea.types.js.flow
+++ types/react-native-safe-area-context/lib/typescript/src/SafeArea.types.js.flow
@@ -40,15 +40,19 @@ export interface Metrics {
export type InsetChangedEvent = $tsflower_subst$RN$NativeSyntheticEvent<Metrics>;
export type InsetChangeNativeCallback = (event: InsetChangedEvent) => void;
-export interface NativeSafeAreaProviderProps extends $tsflower_subst$RN$ViewProps {
- children?: $tsflower_subst$React$ReactNode;
- onInsetsChange: InsetChangeNativeCallback;
-}
-
-export interface NativeSafeAreaViewProps extends $tsflower_subst$RN$ViewProps {
- children?: $tsflower_subst$React$ReactNode;
- mode?: 'padding' | 'margin';
- edges?: Edges;
-}
+export type NativeSafeAreaProviderProps = {
+ ...$tsflower_subst$RN$ViewProps,
+ children?: $tsflower_subst$React$ReactNode,
+ onInsetsChange: InsetChangeNativeCallback,
+ ...
+};
+
+export type NativeSafeAreaViewProps = {
+ ...$tsflower_subst$RN$ViewProps,
+ children?: $tsflower_subst$React$ReactNode,
+ mode?: 'padding' | 'margin',
+ edges?: Edges,
+ ...
+};
export type NativeSafeAreaViewInstance = InstanceType<typeof NativeSafeAreaView>;
diff --git types/react-native-safe-area-context/lib/typescript/src/SafeAreaContext.js.flow types/react-native-safe-area-context/lib/typescript/src/SafeAreaContext.js.flow
index 7231a733b..5e7699444 100644
--- types/react-native-safe-area-context/lib/typescript/src/SafeAreaContext.js.flow
+++ types/react-native-safe-area-context/lib/typescript/src/SafeAreaContext.js.flow
@@ -18,11 +18,13 @@ import { type EdgeInsets, type Metrics, type Rect } from './SafeArea.types';
declare export var SafeAreaInsetsContext: $tsflower_subst$React$Context<EdgeInsets | null>;
declare export var SafeAreaFrameContext: $tsflower_subst$React$Context<Rect | null>;
-export interface SafeAreaProviderProps extends $tsflower_subst$RN$ViewProps {
- children?: $tsflower_subst$React$ReactNode;
- initialMetrics?: Metrics | null;
- initialSafeAreaInsets?: EdgeInsets | null;
-}
+export type SafeAreaProviderProps = {
+ ...$tsflower_subst$RN$ViewProps,
+ children?: $tsflower_subst$React$ReactNode,
+ initialMetrics?: Metrics | null,
+ initialSafeAreaInsets?: EdgeInsets | null,
+ ...
+};
declare export function SafeAreaProvider(SafeAreaProviderProps): $tsflower_subst$React$JSX$Element;
declare export function useSafeAreaInsets(): EdgeInsets;
diff --git types/react-native-safe-area-context/lib/typescript/src/specs/NativeSafeAreaProvider.js.flow types/react-native-safe-area-context/lib/typescript/src/specs/NativeSafeAreaProvider.js.flow
index 7a1594b3b..5d9e21df4 100644
--- types/react-native-safe-area-context/lib/typescript/src/specs/NativeSafeAreaProvider.js.flow
+++ types/react-native-safe-area-context/lib/typescript/src/specs/NativeSafeAreaProvider.js.flow
@@ -27,8 +27,10 @@ export type Event = Readonly<{
...
}>;
-export interface NativeProps extends $tsflower_subst$RN$ViewProps {
- onInsetsChange?: DirectEventHandler<Event, 'paperInsetsChange'>;
-}
+export type NativeProps = {
+ ...$tsflower_subst$RN$ViewProps,
+ onInsetsChange?: DirectEventHandler<Event, 'paperInsetsChange'>,
+ ...
+};
declare var _default: HostComponent<NativeProps>;
export default _default;
diff --git types/react-native-safe-area-context/lib/typescript/src/specs/NativeSafeAreaView.js.flow types/react-native-safe-area-context/lib/typescript/src/specs/NativeSafeAreaView.js.flow
index e30582cb5..87fdeaef0 100644
--- types/react-native-safe-area-context/lib/typescript/src/specs/NativeSafeAreaView.js.flow
+++ types/react-native-safe-area-context/lib/typescript/src/specs/NativeSafeAreaView.js.flow
@@ -6,16 +6,18 @@ import type { Readonly } from 'tsflower/subst/lib';
import { typeof WithDefault } from 'react-native/Libraries/Types/CodegenTypes';
import { type HostComponent } from 'react-native';
-export interface NativeProps extends $tsflower_subst$RN$ViewProps {
- mode?: WithDefault<'padding' | 'margin', 'padding'>;
+export type NativeProps = {
+ ...$tsflower_subst$RN$ViewProps,
+ mode?: WithDefault<'padding' | 'margin', 'padding'>,
edges?: Readonly<{
top: string,
right: string,
bottom: string,
left: string,
...
- }>;
-}
+ }>,
+ ...
+};
declare var _default: HostComponent<NativeProps>;
export default _default;
--
2.32.0
```
|
/content/code_sandbox/types/patches/0027-tsflower-Replace-interface-extends-with-spread-for-n.patch
|
diff
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 1,593
|
```diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Greg Price <greg@zulip.com>
Date: Wed, 8 Jun 2022 10:44:44 -0700
Subject: [adhoc] rnav: Manually implement conditionals in function param lists
In Flow, this conditional is completely unnecessary: if a function
accepts void/undefined in its last parameter, then callers can omit
that parameter just fine.
That makes this a case that TsFlower could potentially just handle
automatically, if it turns out to keep coming up in practice.
---
.../routers/lib/typescript/src/StackRouter.js.flow | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git types/@react-navigation/routers/lib/typescript/src/StackRouter.js.flow types/@react-navigation/routers/lib/typescript/src/StackRouter.js.flow
index cce94da4b..5d79cf4a3 100644
--- types/@react-navigation/routers/lib/typescript/src/StackRouter.js.flow
+++ types/@react-navigation/routers/lib/typescript/src/StackRouter.js.flow
@@ -60,13 +60,13 @@ export type StackNavigationState<ParamList: ParamListBase> = NavigationState<Par
};
export type StackActionHelpers<ParamList: ParamListBase> = {
- // prettier-ignore
replace<RouteName: $Keys<ParamList>>(
- ...args: $FlowFixMe /* undefined extends ParamList[RouteName] ? [RouteName] | [RouteName, ParamList[RouteName]] : [RouteName, ParamList[RouteName]] */ /* tsflower-unimplemented: ConditionalType */
+ name: RouteName,
+ params: $ElementType<ParamList, RouteName>,
): void,
- // prettier-ignore
push<RouteName: $Keys<ParamList>>(
- ...args: $FlowFixMe /* undefined extends ParamList[RouteName] ? [RouteName] | [RouteName, ParamList[RouteName]] : [RouteName, ParamList[RouteName]] */ /* tsflower-unimplemented: ConditionalType */
+ name: RouteName,
+ params: $ElementType<ParamList, RouteName>,
): void,
pop(count?: number): void,
popToTop(): void,
--
2.32.0
```
|
/content/code_sandbox/types/patches/0026-adhoc-rnav-Manually-implement-conditionals-in-functi.patch
|
diff
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 533
|
```diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Greg Price <greg@zulip.com>
Date: Tue, 24 May 2022 22:46:07 -0700
Subject: [upstream] rnav: Covariant indexer in ParamListBase
---
.../@react-navigation/routers/lib/typescript/src/types.js.flow | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git types/@react-navigation/routers/lib/typescript/src/types.js.flow types/@react-navigation/routers/lib/typescript/src/types.js.flow
index 65d187165..a194fa5fa 100644
--- types/@react-navigation/routers/lib/typescript/src/types.js.flow
+++ types/@react-navigation/routers/lib/typescript/src/types.js.flow
@@ -70,7 +70,7 @@ export type Route<RouteName: string, Params: { ... } | void = { ... } | void> =
params: Readonly<Params>;
}> */ /* tsflower-unimplemented: ConditionalType */;
-export type ParamListBase = { [key: string]: { ... } | void };
+export type ParamListBase = { +[key: string]: { ... } | void };
export type NavigationAction = Readonly<{
type: string,
--
2.32.0
```
|
/content/code_sandbox/types/patches/0009-upstream-rnav-Covariant-indexer-in-ParamListBase.patch
|
diff
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 302
|
```diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Greg Price <greg@zulip.com>
Date: Tue, 24 May 2022 18:30:49 -0700
Subject: [irreducible] rnav: Make action types exact
Otherwise they're not subtypes of the base action type,
which specifies types on some optional properties.
Classifying as "irreducible" because I don't think there's anything
either this library upstream, or TsFlower, could do to take care of
this. (Maybe someday TypeScript will have exact object types.)
---
.../routers/lib/typescript/src/CommonActions.js.flow | 5 +++--
.../routers/lib/typescript/src/StackRouter.js.flow | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git types/@react-navigation/routers/lib/typescript/src/CommonActions.js.flow types/@react-navigation/routers/lib/typescript/src/CommonActions.js.flow
index dcd559b0a..054215538 100644
--- types/@react-navigation/routers/lib/typescript/src/CommonActions.js.flow
+++ types/@react-navigation/routers/lib/typescript/src/CommonActions.js.flow
@@ -10,7 +10,7 @@ type ResetState =
...
});
-export type Action =
+export type Action = $Exact<
| {
type: 'GO_BACK',
source?: string,
@@ -51,7 +51,8 @@ export type Action =
source?: string,
target?: string,
...
- };
+ },
+>;
declare export function goBack(): Action;
diff --git types/@react-navigation/routers/lib/typescript/src/StackRouter.js.flow types/@react-navigation/routers/lib/typescript/src/StackRouter.js.flow
index 3bd89b8ce..d7bdf0f5e 100644
--- types/@react-navigation/routers/lib/typescript/src/StackRouter.js.flow
+++ types/@react-navigation/routers/lib/typescript/src/StackRouter.js.flow
@@ -12,7 +12,7 @@ import {
type ParamListBase,
} from './types';
-export type StackActionType =
+export type StackActionType = $Exact<
| {
type: 'REPLACE',
payload: {
@@ -49,7 +49,8 @@ export type StackActionType =
source?: string,
target?: string,
...
- };
+ },
+>;
export type StackRouterOptions = DefaultRouterOptions<>;
export type StackNavigationState<ParamList: ParamListBase> = NavigationState<ParamList> & {
--
2.32.0
```
|
/content/code_sandbox/types/patches/0013-irreducible-rnav-Make-action-types-exact.patch
|
diff
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 590
|
```diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Greg Price <greg@zulip.com>
Date: Fri, 27 May 2022 15:26:23 -0700
Subject: [tsflower] Substitute for React.ReactText
---
.../core/lib/typescript/src/checkSerializable.js.flow | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git types/@react-navigation/core/lib/typescript/src/checkSerializable.js.flow types/@react-navigation/core/lib/typescript/src/checkSerializable.js.flow
index 58e35d769..2c1a6e404 100644
--- types/@react-navigation/core/lib/typescript/src/checkSerializable.js.flow
+++ types/@react-navigation/core/lib/typescript/src/checkSerializable.js.flow
@@ -1,13 +1,13 @@
/* @flow
* @generated by TsFlower
*/
-import type { ReactText as $tsflower_import_type$_$react$ReactText } from 'react';
+type ReactText = string | number; // verbatim from @types/react
declare export default function checkSerializable(o: { [key: string]: any, ... }):
| { serializable: true, ... }
| {
serializable: false,
- location: $tsflower_import_type$_$react$ReactText[],
+ location: ReactText[],
reason: string,
...
};
--
2.32.0
```
|
/content/code_sandbox/types/patches/0022-tsflower-Substitute-for-React.ReactText.patch
|
diff
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 331
|
```diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Greg Price <greg@zulip.com>
Date: Tue, 24 May 2022 22:12:21 -0700
Subject: [irreducible] rnav: EventMap types exact and covariant
Otherwise these FooEventMap types aren't actually subtypes of
EventMapBase. Without exactness, their value types aren't actually
subtypes of the latter's.
---
.../lib/typescript/src/types.js.flow | 12 +++---
.../core/lib/typescript/src/types.js.flow | 41 ++++++++-----------
.../lib/typescript/src/types.js.flow | 16 ++++----
.../stack/lib/typescript/src/types.js.flow | 15 ++++---
4 files changed, 37 insertions(+), 47 deletions(-)
diff --git types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow
index 3bc615faa..ed9343057 100644
--- types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow
+++ types/@react-navigation/bottom-tabs/lib/typescript/src/types.js.flow
@@ -32,15 +32,13 @@ import {
type RouteProp,
} from '@react-navigation/native';
-export type BottomTabNavigationEventMap = {
- tabPress: {
+export type BottomTabNavigationEventMap = {|
+ tabPress: {|
data: void,
canPreventDefault: true,
- ...
- },
- tabLongPress: { data: void, ... },
- ...
-};
+ |},
+ tabLongPress: {| data: void |},
+|};
export type LabelPosition = 'beside-icon' | 'below-icon';
export type BottomTabNavigationHelpers = NavigationHelpers<
diff --git types/@react-navigation/core/lib/typescript/src/types.js.flow types/@react-navigation/core/lib/typescript/src/types.js.flow
index ccdd92d43..1421d39dd 100644
--- types/@react-navigation/core/lib/typescript/src/types.js.flow
+++ types/@react-navigation/core/lib/typescript/src/types.js.flow
@@ -45,24 +45,21 @@ export type DefaultNavigatorOptions<
};
export type EventMapBase = {
- [key: string]: {
- data?: any,
- canPreventDefault?: boolean,
- ...
- },
+ +[key: string]: {|
+ +data?: any,
+ +canPreventDefault?: boolean,
+ |},
};
-export type EventMapCore<State: NavigationState<>> = {
- focus: { data: void, ... },
- blur: { data: void, ... },
- state: { data: { state: State, ... }, ... },
- beforeRemove: {
+export type EventMapCore<State: NavigationState<>> = {|
+ focus: {| data: void |},
+ blur: {| data: void |},
+ state: {| data: { state: State, ... } |},
+ beforeRemove: {|
data: { action: NavigationAction, ... },
canPreventDefault: true,
- ...
- },
- ...
-};
+ |},
+|};
export type EventArg<EventName: string, CanPreventDefault: boolean | void = false, Data = void> = {
+type: EventName,
@@ -209,7 +206,7 @@ export type NavigationProp<
setParams(params: Partial<$ElementType<ParamList, RouteName>>): void,
setOptions(options: Partial<ScreenOptions>): void,
...
-} & EventConsumer<EventMap & EventMapCore<State>> &
+} & EventConsumer<{| ...EventMap, ...EventMapCore<State> |}> &
PrivateValueStore<ParamList, RouteName, EventMap>;
export type RouteProp<+ParamList: ParamListBase, +RouteName: $Keys<ParamList>> = Route<
@@ -314,19 +311,17 @@ export type RouteConfig<
...
};
-export type NavigationContainerEventMap = {
- state: { data: { state: NavigationState<> | PartialState<NavigationState<>> | void, ... }, ... },
- options: { data: { options: { ... }, ... }, ... },
- __unsafe_action__: {
+export type NavigationContainerEventMap = {|
+ state: {| data: { state: NavigationState<> | PartialState<NavigationState<>> | void, ... } |},
+ options: {| data: { options: { ... }, ... } |},
+ __unsafe_action__: {|
data: {
action: NavigationAction,
noop: boolean,
...
},
- ...
- },
- ...
-};
+ |},
+|};
export type NavigationContainerRef = NavigationHelpers<ParamListBase> &
EventConsumer<NavigationContainerEventMap> & {
diff --git types/@react-navigation/material-top-tabs/lib/typescript/src/types.js.flow types/@react-navigation/material-top-tabs/lib/typescript/src/types.js.flow
index 8d2ea317f..36bc57918 100644
--- types/@react-navigation/material-top-tabs/lib/typescript/src/types.js.flow
+++ types/@react-navigation/material-top-tabs/lib/typescript/src/types.js.flow
@@ -23,17 +23,15 @@ import {
type RouteProp,
} from '@react-navigation/native';
-export type MaterialTopTabNavigationEventMap = {
- tabPress: {
+export type MaterialTopTabNavigationEventMap = {|
+ tabPress: {|
data: void,
canPreventDefault: true,
- ...
- },
- tabLongPress: { data: void, ... },
- swipeStart: { data: void, ... },
- swipeEnd: { data: void, ... },
- ...
-};
+ |},
+ tabLongPress: {| data: void |},
+ swipeStart: {| data: void |},
+ swipeEnd: {| data: void |},
+|};
export type MaterialTopTabNavigationHelpers = NavigationHelpers<
ParamListBase,
diff --git types/@react-navigation/stack/lib/typescript/src/types.js.flow types/@react-navigation/stack/lib/typescript/src/types.js.flow
index da137e97a..fa014c506 100644
--- types/@react-navigation/stack/lib/typescript/src/types.js.flow
+++ types/@react-navigation/stack/lib/typescript/src/types.js.flow
@@ -30,14 +30,13 @@ import {
type RouteProp,
} from '@react-navigation/native';
-export type StackNavigationEventMap = {
- transitionStart: { data: { closing: boolean, ... }, ... },
- transitionEnd: { data: { closing: boolean, ... }, ... },
- gestureStart: { data: void, ... },
- gestureEnd: { data: void, ... },
- gestureCancel: { data: void, ... },
- ...
-};
+export type StackNavigationEventMap = {|
+ transitionStart: {| data: { closing: boolean, ... } |},
+ transitionEnd: {| data: { closing: boolean, ... } |},
+ gestureStart: {| data: void |},
+ gestureEnd: {| data: void |},
+ gestureCancel: {| data: void |},
+|};
export type StackNavigationHelpers = NavigationHelpers<ParamListBase, StackNavigationEventMap> &
StackActionHelpers<ParamListBase>;
--
2.32.0
```
|
/content/code_sandbox/types/patches/0015-irreducible-rnav-EventMap-types-exact-and-covariant.patch
|
diff
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 1,654
|
```diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Greg Price <greg@zulip.com>
Date: Wed, 25 May 2022 17:31:01 -0700
Subject: [upstream] rnav: $ReadOnlyArray on NavigationState properties
I believe this could be expressed upstream, with `readonly Foo[]`.
---
.../routers/lib/typescript/src/types.js.flow | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git types/@react-navigation/routers/lib/typescript/src/types.js.flow types/@react-navigation/routers/lib/typescript/src/types.js.flow
index 574ad164b..65d187165 100644
--- types/@react-navigation/routers/lib/typescript/src/types.js.flow
+++ types/@react-navigation/routers/lib/typescript/src/types.js.flow
@@ -12,9 +12,9 @@ type NavigationRoute<ParamList: ParamListBase, RouteName: $Keys<ParamList>> = Ro
export type NavigationState<ParamList: ParamListBase = ParamListBase> = Readonly<{
key: string,
index: number,
- routeNames: Extract<$Keys<ParamList>, string>[],
- history?: mixed[],
- routes: NavigationRoute<ParamList, $Keys<ParamList>>[],
+ routeNames: $ReadOnlyArray<Extract<$Keys<ParamList>, string>>,
+ history?: $ReadOnlyArray<mixed>,
+ routes: $ReadOnlyArray<NavigationRoute<ParamList, $Keys<ParamList>>>,
type: string,
stale: false,
...
--
2.32.0
```
|
/content/code_sandbox/types/patches/0004-upstream-rnav-ReadOnlyArray-on-NavigationState-prope.patch
|
diff
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 373
|
```diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Greg Price <greg@zulip.com>
Date: Tue, 7 Jun 2022 21:19:03 -0700
Subject: [tsflower] Fix a `typeof` to `type` in TurboModule imports
---
.../lib/typescript/platforms/NativeImagePicker.js.flow | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git types/react-native-image-picker/lib/typescript/platforms/NativeImagePicker.js.flow types/react-native-image-picker/lib/typescript/platforms/NativeImagePicker.js.flow
index 0e0f49f69..1e426ab40 100644
--- types/react-native-image-picker/lib/typescript/platforms/NativeImagePicker.js.flow
+++ types/react-native-image-picker/lib/typescript/platforms/NativeImagePicker.js.flow
@@ -1,7 +1,7 @@
/* @flow
* @generated by TsFlower
*/
-import { typeof TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
+import { type TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
export interface Spec extends TurboModule {
launchCamera(options: Object, callback: () => void): void;
--
2.32.0
```
|
/content/code_sandbox/types/patches/0031-tsflower-Fix-a-typeof-to-type-in-TurboModule-imports.patch
|
diff
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 306
|
```diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Greg Price <greg@zulip.com>
Date: Wed, 8 Jun 2022 14:40:53 -0700
Subject: [upstream?] rnav: Can initialParams really be partial?
If true, that'd mean that a screen could never actually count on
getting the route params its type says it should get. Right?
Even if upstream really does want this API, I'm pretty sure *we*
don't want it. We can eliminate it by tightening this type here.
---
types/@react-navigation/core/lib/typescript/src/types.js.flow | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git types/@react-navigation/core/lib/typescript/src/types.js.flow types/@react-navigation/core/lib/typescript/src/types.js.flow
index 58cf56a85..b5cf2cdc8 100644
--- types/@react-navigation/core/lib/typescript/src/types.js.flow
+++ types/@react-navigation/core/lib/typescript/src/types.js.flow
@@ -291,7 +291,7 @@ export type RouteConfig<
...
}) => ScreenListeners<State, EventMap>),
getId?: ({ params: $ElementType<ParamList, RouteName>, ... }) => string | void,
- initialParams?: Partial<$ElementType<ParamList, RouteName>>,
+ initialParams?: $ElementType<ParamList, RouteName>,
...
} & (
| {
--
2.32.0
```
|
/content/code_sandbox/types/patches/0029-upstream-rnav-Can-initialParams-really-be-partial.patch
|
diff
| 2016-05-08T05:41:48
| 2024-08-15T07:25:47
|
zulip-mobile
|
zulip/zulip-mobile
| 1,274
| 342
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.