Skip to content

Commit

Permalink
remove castProps and use destructure in NewInput instead
Browse files Browse the repository at this point in the history
  • Loading branch information
buoyad committed Sep 18, 2018
1 parent 3f33463 commit bb6a720
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 15 deletions.
9 changes: 3 additions & 6 deletions shared/common-adapters/new-input.js
@@ -1,10 +1,6 @@
// @flow
import * as React from 'react'
import PlainInput, {
castProps as plainInputCastProps,
type PropsWithInput,
type KeyboardType,
} from './plain-input'
import PlainInput, {type PropsWithInput, type KeyboardType} from './plain-input'
import Box, {Box2} from './box'
import Icon, {type IconType, castPlatformStyles} from './icon'
import {getStyle as getTextStyle, type TextType} from './text'
Expand Down Expand Up @@ -59,6 +55,7 @@ class ReflessNewInput extends React.Component<DefaultProps & Props, State> {

render() {
const textStyle = getTextStyle(this.props.textType)
const {containerStyle, decoration, error, forwardedRef, hideBorder, icon, ...plainInputProps} = this.props
return (
<Box2
direction="horizontal"
Expand All @@ -81,7 +78,7 @@ class ReflessNewInput extends React.Component<DefaultProps & Props, State> {
</Box>
)}
<PlainInput
{...plainInputCastProps(this.props)}
{...plainInputProps}
onFocus={this._onFocus}
onBlur={this._onBlur}
ref={this.props.forwardedRef}
Expand Down
1 change: 0 additions & 1 deletion shared/common-adapters/plain-input.desktop.js
Expand Up @@ -254,4 +254,3 @@ const styles = styleSheetCreate({
})

export default PlainInput
export {castProps} from './plain-input.shared'
3 changes: 0 additions & 3 deletions shared/common-adapters/plain-input.js.flow
Expand Up @@ -64,9 +64,6 @@ export type PropsWithInput<P> = {|
...$Exact<P>,
|}

// Use this in components that use PropsWithInput to pass `this.props` through to this component
declare export function castProps<T>(p: PropsWithInput<T>): Props

/**
* Flow does the work of making the default props nullable when instantiating
* this component, but doesn't go as far as letting the props be
Expand Down
1 change: 0 additions & 1 deletion shared/common-adapters/plain-input.native.js
Expand Up @@ -247,4 +247,3 @@ const styles = styleSheetCreate({
})

export default PlainInput
export {castProps} from './plain-input.shared'
4 changes: 0 additions & 4 deletions shared/common-adapters/plain-input.shared.js

This file was deleted.

0 comments on commit bb6a720

Please sign in to comment.