Skip to content

Commit

Permalink
feat(input): update input styles when view & flex props are intercros…
Browse files Browse the repository at this point in the history
…sed each other (#1351)
  • Loading branch information
whitestranger7 committed Mar 26, 2021
1 parent ab5cac7 commit b9dbd58
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/devsupport/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export {
PropsService,
TextStyleProps,
FlexStyleProps,
FlexViewCrossStyleProps,
} from './services/props/props.service';

export * from './typings';
10 changes: 10 additions & 0 deletions src/components/devsupport/services/props/props.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ export const FlexStyleProps: string[] = [
'direction',
];

const FlexViewCrossStyleValues = [
'borderBottomWidth',
'borderLeftWidth',
'borderRightWidth',
'borderTopWidth',
'borderWidth',
];

export const FlexViewCrossStyleProps: string[] = FlexStyleProps.filter((el) => !FlexViewCrossStyleValues.includes(el));

export interface Props {
[key: string]: any;
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/ui/input/input.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
FalsyFC,
FalsyText,
FlexStyleProps,
FlexViewCrossStyleProps,
PropsService,
RenderProp,
WebEventResponder,
Expand Down Expand Up @@ -181,7 +182,7 @@ export class Input extends React.Component<InputProps> implements WebEventRespon

private getComponentStyle = (source: StyleType) => {
const flatStyles: ViewStyle = StyleSheet.flatten(this.props.style);
const { rest: inputContainerStyle, ...containerStyle } = PropsService.allWithRest(flatStyles, FlexStyleProps);
const { rest: inputContainerStyle, ...containerStyle } = PropsService.allWithRest(flatStyles, FlexViewCrossStyleProps);

const {
textMarginHorizontal,
Expand Down

0 comments on commit b9dbd58

Please sign in to comment.