Skip to content

Commit

Permalink
fix(ui): common issues
Browse files Browse the repository at this point in the history
  • Loading branch information
artyorsh authored May 16, 2019
1 parent 8718ee7 commit d0835af
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/framework/ui/avatar/avatar.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ export class AvatarComponent extends React.Component<AvatarProps> {
const borderRadius: number = roundCoefficient * baseStyle.height;

return {
...baseStyle,
borderRadius,
...baseStyle,
};
};

Expand Down
10 changes: 6 additions & 4 deletions src/framework/ui/topNavigation/topNavigation.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
TextStyle,
View,
ViewProps,
ViewStyle,
} from 'react-native';
import {
styled,
Expand Down Expand Up @@ -205,15 +206,15 @@ export class TopNavigationComponent extends React.Component<TopNavigationProps>
};
};

private renderTextElement = (text: string, style: StyleType): TextElement => {
private renderTextElement = (text: string, style: StyleProp<TextStyle>): TextElement => {
return (
<Text style={style}>
{text}
</Text>
);
};

private renderActionElements(source: ActionElementProp, style: StyleType): ActionElement[] {
private renderActionElements(source: ActionElementProp, style: StyleProp<ViewStyle>): ActionElement[] {
return React.Children.map(source, (element: ActionElement): ActionElement => {
return React.cloneElement(element, {
style: [style, element.props.style],
Expand All @@ -225,7 +226,7 @@ export class TopNavigationComponent extends React.Component<TopNavigationProps>
const { title, subtitle, leftControl, rightControls } = this.props;

return [
isValidString('Loh Pidr') && this.renderTextElement(title, style.title),
isValidString(title) && this.renderTextElement(title, style.title),
isValidString(subtitle) && this.renderTextElement(subtitle, style.subtitle),
leftControl && this.renderActionElements(leftControl, style.action),
rightControls && this.renderActionElements(rightControls, style.action),
Expand All @@ -252,7 +253,8 @@ export class TopNavigationComponent extends React.Component<TopNavigationProps>

return (
<View
style={container}>
style={container}
{...restProps}>
<View style={leftControlContainer}>
{leftControlElement}
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ class TopNavigationActionComponent extends React.Component<TopNavigationActionPr
};

private renderIconElement = (style: StyleType): React.ReactElement<ImageProps> => {
const iconElement = this.props.icon(style);

return React.cloneElement(iconElement, {
style: [style, iconElement.props.style],
});
return this.props.icon(style);
};

public render(): React.ReactNode {
Expand Down

0 comments on commit d0835af

Please sign in to comment.