Skip to content

Commit

Permalink
react-native-messageList add maxBubbleWidth prop
Browse files Browse the repository at this point in the history
  • Loading branch information
huangminlinux committed Aug 28, 2018
1 parent d928371 commit 4b2330b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ReactNative/ios/RCTAuroraIMUI/RCTMessageListView.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
@property (nonatomic, copy) RCTBubblingEventBlock onPullToRefresh;

// custom layout
//maxBubbleWidth
@property(assign, nonatomic) CGFloat maxBubbleWidth;

@property(copy, nonatomic) NSString *messageListBackgroundColor;

@property(strong, nonatomic) NSDictionary *sendBubble;
Expand Down
6 changes: 6 additions & 0 deletions ReactNative/ios/RCTAuroraIMUI/RCTMessageListViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ - (UIView *)view

}

RCT_CUSTOM_VIEW_PROPERTY(maxBubbleWidth, NSNumber, RCTMessageListView) {
NSNumber *widthPercent = [RCTConvert NSNumber: json];

IMUIMessageCellLayout.bubbleMaxWidth = UIScreen.mainScreen.bounds.size.width * widthPercent.floatValue;
}

RCT_CUSTOM_VIEW_PROPERTY(sendBubbleTextColor, NSString, RCTMessageListView) {
NSString *colorString = [RCTConvert NSString: json];
UIColor *color = [UIColor hexStringToUIColorWithHex:colorString];
Expand Down
2 changes: 1 addition & 1 deletion ReactNative/messagelist.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ MessageList.propTypes = {
displayNameTextSize: PropTypes.number,
displayNameTextColor: PropTypes.string,
displayNamePadding: PropTypes.object,

maxBubbleWidth: PropTypes.number,
eventTextLineHeight: PropTypes.number, //TODO:
messageTextLineHeight: PropTypes.number, //TODO:
...ViewPropTypes
Expand Down
1 change: 1 addition & 0 deletions ReactNative/sample/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ export default class TestRNIMUI extends Component {
datePadding={{ left: 5, top: 5, right: 5, bottom: 5 }}
dateBackgroundColor={"#F3F3F3"}
photoMessageRadius={5}
maxBubbleWidth={0.7}
videoDurationTextColor={"#ffffff"}
/>
<InputView style={this.state.inputViewLayout}
Expand Down

0 comments on commit 4b2330b

Please sign in to comment.