forked from Ivasoft/mattermost-mobile
MM-43300: Calls v2 first cut (#6475)
* Android and iOS requirements
* external types
* babel config for calls, package.json for calls dependencies
* state in rxJS; tests
* actions, client/rest, websocket events, constants
* webrtc connection logic
* calls components / screens
* handle peer destroyed gracefully
* PR comments
* remove ViewPropTypes from mocks; no need to ignore error in LogBox
* calls.d.ts -> calls.ts; i18-extract
* @app/products/calls -> @calls
* PR comments; test cleanup
* Revert "remove ViewPropTypes from mocks; no need to ignore error in LogBox"
This reverts commit f9bd171a54.
* working on typing withServerUrl
* added exportedForInternalUse instead of commenting "internal export"
* better switchToThread in call_screen
* i18n
* typed withServerUrl
This commit is contained in:
committed by
GitHub
parent
9bbd59e4dd
commit
5bb240dec8
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import React, {ComponentType, createContext} from 'react';
|
||||
import React, {createContext} from 'react';
|
||||
|
||||
type Props = {
|
||||
server: ServerContext;
|
||||
@@ -12,6 +12,8 @@ type WithServerUrlProps = {
|
||||
serverUrl: string;
|
||||
}
|
||||
|
||||
type GetProps<C> = C extends React.ComponentType<infer P & WithServerUrlProps> ? P : never
|
||||
|
||||
type ServerContext = {
|
||||
displayName: string;
|
||||
url: string;
|
||||
@@ -26,8 +28,8 @@ function ServerUrlProvider({server, children}: Props) {
|
||||
);
|
||||
}
|
||||
|
||||
export function withServerUrl<T extends WithServerUrlProps>(Component: ComponentType<T>): ComponentType<T> {
|
||||
return function ServerUrlComponent(props) {
|
||||
export function withServerUrl<C extends React.ComponentType<P>, P = GetProps<C>>(Component: C) {
|
||||
return function ServerUrlComponent(props: JSX.LibraryManagedAttributes<C, P>) {
|
||||
return (
|
||||
<Consumer>
|
||||
{(server: ServerContext) => (
|
||||
|
||||
Reference in New Issue
Block a user