@@ -120,17 +120,27 @@ class SeeMore extends React.Component {
120120 return null ;
121121 }
122122
123+ const SeeLessText =
124+ typeof seeLessText === 'string' ? (
125+ < Text style = { seeLessTextStyle } > { seeLessText } </ Text >
126+ ) : (
127+ seeLessText
128+ ) ;
129+
130+ const SeeMoreText =
131+ typeof seeMoreText === 'string' ? (
132+ < Text style = { seeMoreTextStyle } > { seeMoreText } </ Text >
133+ ) : (
134+ seeMoreText
135+ ) ;
136+
123137 return (
124138 < Text
125139 { ...this . props }
126140 { ...this . panResponder . panHandlers }
127141 style = { [ style , { color : isLinkPressed ? linkPressedColor : linkColor } ] } >
128142 { isShowingMore ? null : < Text { ...this . props } > ...</ Text > }
129- { isShowingMore ? (
130- < Text style = { seeLessTextStyle } > { seeLessText } </ Text >
131- ) : (
132- < Text style = { seeMoreTextStyle } > { seeMoreText } </ Text >
133- ) }
143+ { isShowingMore ? SeeLessText : SeeMoreText }
134144 </ Text >
135145 ) ;
136146 }
@@ -141,9 +151,11 @@ class SeeMore extends React.Component {
141151
142152 return (
143153 < Text
154+ testID = "SeeMore"
144155 onLayout = { isShowingMore ? undefined : this . onLayout }
145156 numberOfLines = { isShowingMore ? undefined : numberOfLines }
146- { ...this . panResponder . panHandlers } >
157+ { ...this . panResponder . panHandlers }
158+ >
147159 < Text { ...this . props } > { isShowingMore ? text : text . slice ( 0 , truncationIndex ) } </ Text >
148160 { this . renderSeeMoreSeeLessLink ( ) }
149161 </ Text >
@@ -158,8 +170,8 @@ SeeMore.propTypes = {
158170 linkPressedColor : PropTypes . string ,
159171 seeMoreTextStyle : PropTypes . oneOfType ( [ PropTypes . object , PropTypes . array ] ) ,
160172 seeLessTextStyle : PropTypes . oneOfType ( [ PropTypes . object , PropTypes . array ] ) ,
161- seeMoreText : PropTypes . string ,
162- seeLessText : PropTypes . string ,
173+ seeMoreText : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . object ] ) ,
174+ seeLessText : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . object ] ) ,
163175 style : PropTypes . oneOfType ( [ PropTypes . object , PropTypes . array ] ) ,
164176} ;
165177
0 commit comments