Skip to content

Commit f0bb375

Browse files
Himanshu SatijaHimanshu Satija
authored andcommitted
remove getChildStyle func
1 parent 3c9d0dc commit f0bb375

File tree

1 file changed

+30
-32
lines changed

1 file changed

+30
-32
lines changed

Components/Widgets/ListItem.js

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -103,52 +103,50 @@ export default class ListItemNB extends NativeBaseComponent {
103103
return buttonComponentPresent;
104104
}
105105

106-
getChildStyle(child) {
107-
var mergedStyle = {};
108-
if(child.type == Icon) {
109-
return _.merge(mergedStyle, this.getInitialStyle().itemIcon, child.props.style);
110-
}
111-
112-
else if(child.type == Text) {
113-
if(child.props.note && this.thumbnailPresent())
114-
return _.merge(mergedStyle, this.getInitialStyle().itemSubNote, child.props.style);
115-
else if(child.props.note)
116-
return _.merge(mergedStyle, this.getInitialStyle().itemNote, child.props.style);
117-
else
118-
return _.merge(mergedStyle, this.getInitialStyle().itemText, child.props.style);
119-
}
120-
121-
else if(child.type == Button) {
122-
return _.merge(mergedStyle, this.getInitialStyle().itemButton, child.props.style);
123-
}
124-
125-
else if(child.type == Thumbnail) {
126-
return _.merge(mergedStyle, this.getInitialStyle().thumbnail, child.props.style);
127-
}
128-
129-
else if(child.type == Image && !Array.isArray(this.props.children))
130-
return _.merge(mergedStyle, this.getInitialStyle().fullImage, child.props.style);
131-
else
132-
return child.props.style;
133-
}
134-
135106
getChildProps(child) {
136107
var defaultProps = {};
137108
if(child.type == Image && !Array.isArray(this.props.children)) {
138109
defaultProps = {
139110
resizeMode: 'stretch',
140-
style: this.getChildStyle(child)
111+
style: this.getInitialStyle().fullImage
141112
}
142113
}
143114
else if(child.type == Button) {
144115
defaultProps = {
145116
small: true,
146-
style: this.getChildStyle(child)
117+
style: this.getInitialStyle().itemButton
118+
}
119+
}
120+
else if(child.type == Text) {
121+
if(child.props.note && this.thumbnailPresent()) {
122+
defaultProps = {
123+
style: this.getInitialStyle().itemSubNote
124+
}
125+
}
126+
else if(child.props.note) {
127+
defaultProps = {
128+
style: this.getInitialStyle().itemNote
129+
}
130+
}
131+
else {
132+
defaultProps = {
133+
style: this.getInitialStyle().itemText
134+
}
135+
}
136+
}
137+
else if(child.type == Icon) {
138+
defaultProps = {
139+
style: this.getInitialStyle().itemIcon
140+
}
141+
}
142+
else if(child.type == Thumbnail) {
143+
defaultProps = {
144+
style: this.getInitialStyle().thumbnail
147145
}
148146
}
149147
else {
150148
defaultProps = {
151-
style: this.getChildStyle(child)
149+
style: {}
152150
}
153151
}
154152

0 commit comments

Comments
 (0)