mirror of
https://github.com/wassname/talk.git
synced 2026-07-25 13:30:59 +08:00
Rename WrappedComponent to BaseComponent
This commit is contained in:
@@ -22,10 +22,10 @@ function createMutationContainer<T extends string, I, R>(
|
||||
): InferableComponentEnhancer<{ [P in T]: (input: I) => Promise<R> }> {
|
||||
return compose(
|
||||
withContext(({ relayEnvironment }) => ({ relayEnvironment })),
|
||||
hoistStatics((WrappedComponent: React.ComponentType<any>) => {
|
||||
hoistStatics((BaseComponent: React.ComponentType<any>) => {
|
||||
class CreateMutationContainer extends React.Component<any> {
|
||||
public static displayName = wrapDisplayName(
|
||||
WrappedComponent,
|
||||
BaseComponent,
|
||||
"createMutationContainer"
|
||||
);
|
||||
|
||||
@@ -38,7 +38,7 @@ function createMutationContainer<T extends string, I, R>(
|
||||
const inject = {
|
||||
[propName]: this.commit,
|
||||
};
|
||||
return <WrappedComponent {...rest} {...inject} />;
|
||||
return <BaseComponent {...rest} {...inject} />;
|
||||
}
|
||||
}
|
||||
return CreateMutationContainer as React.ComponentType<any>;
|
||||
|
||||
@@ -34,7 +34,7 @@ function withLocalStateContainer<T>(
|
||||
): InferableComponentEnhancer<{ local: T }> {
|
||||
return compose(
|
||||
withContext(({ relayEnvironment }) => ({ relayEnvironment })),
|
||||
hoistStatics((WrappedComponent: React.ComponentType<any>) => {
|
||||
hoistStatics((BaseComponent: React.ComponentType<any>) => {
|
||||
class LocalStateContainer extends React.Component<Props, any> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
@@ -65,7 +65,7 @@ function withLocalStateContainer<T>(
|
||||
|
||||
public render() {
|
||||
const { relayEnvironment: _, ...rest } = this.props;
|
||||
return <WrappedComponent {...rest} local={this.state.data} />;
|
||||
return <BaseComponent {...rest} local={this.state.data} />;
|
||||
}
|
||||
}
|
||||
return LocalStateContainer as React.ComponentType<any>;
|
||||
|
||||
@@ -15,7 +15,7 @@ interface InjectedProps {
|
||||
* or touch.
|
||||
*/
|
||||
const withKeyboardFocus = hoistStatics<InjectedProps>(
|
||||
<T extends InjectedProps>(WrappedComponent: React.ComponentType<T>) => {
|
||||
<T extends InjectedProps>(BaseComponent: React.ComponentType<T>) => {
|
||||
class WithKeyboardFocus extends React.Component<any> {
|
||||
public state = {
|
||||
keyboardFocus: false,
|
||||
@@ -48,7 +48,7 @@ const withKeyboardFocus = hoistStatics<InjectedProps>(
|
||||
|
||||
public render() {
|
||||
return (
|
||||
<WrappedComponent
|
||||
<BaseComponent
|
||||
{...this.props}
|
||||
onFocus={this.handleFocus}
|
||||
onBlur={this.handleBlur}
|
||||
@@ -65,5 +65,5 @@ const withKeyboardFocus = hoistStatics<InjectedProps>(
|
||||
|
||||
// TODO: workaround, add bug link.
|
||||
export default withKeyboardFocus as <P extends Partial<InjectedProps>>(
|
||||
WrappedComponent: React.ComponentType<P>
|
||||
BaseComponent: React.ComponentType<P>
|
||||
) => React.ComponentType<P>;
|
||||
|
||||
@@ -15,7 +15,7 @@ interface InjectedProps {
|
||||
* or touch.
|
||||
*/
|
||||
const withMouseHover = hoistStatics<InjectedProps>(
|
||||
<T extends InjectedProps>(WrappedComponent: React.ComponentType<T>) => {
|
||||
<T extends InjectedProps>(BaseComponent: React.ComponentType<T>) => {
|
||||
class WithMouseHover extends React.Component<any> {
|
||||
public state = {
|
||||
mouseHover: false,
|
||||
@@ -48,7 +48,7 @@ const withMouseHover = hoistStatics<InjectedProps>(
|
||||
|
||||
public render() {
|
||||
return (
|
||||
<WrappedComponent
|
||||
<BaseComponent
|
||||
{...this.props}
|
||||
onMouseOver={this.handleMouseOver}
|
||||
onMouseOut={this.handleMouseOut}
|
||||
@@ -65,5 +65,5 @@ const withMouseHover = hoistStatics<InjectedProps>(
|
||||
|
||||
// TODO: workaround, add bug link.
|
||||
export default withMouseHover as <P extends Partial<InjectedProps>>(
|
||||
WrappedComponent: React.ComponentType<P>
|
||||
BaseComponent: React.ComponentType<P>
|
||||
) => React.ComponentType<P>;
|
||||
|
||||
Reference in New Issue
Block a user