-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from hecom-rn/hanhu
- Loading branch information
Showing
6 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React from 'react'; | ||
import { View } from 'react-native'; | ||
import Toast from 'react-native-root-toast'; | ||
import i18n from 'i18n-js'; | ||
import { Typings, Delegate } from '../../standard'; | ||
|
||
export const name = 'IMSettingGroupDataInfo'; | ||
|
||
export function getUi(props: Typings.Action.Setting.Params): Typings.Action.Setting.Result { | ||
const {key, imId, chatType} = props; | ||
const isGroup = chatType === Typings.Conversation.ChatType.Group; | ||
if (!isGroup) { | ||
return null; | ||
} | ||
const groupName = Delegate.model.Group.getName(imId, false); | ||
const groupOwner = Delegate.model.Group.getOwner(imId); | ||
const isOwner = groupOwner === Delegate.user.getMine().userId; | ||
return ( | ||
<GroupDataInfoCell | ||
key={key} | ||
isOwner={isOwner} | ||
groupName={groupName} | ||
imId={imId} | ||
/> | ||
); | ||
} | ||
|
||
export interface Props { | ||
isOwner: boolean; | ||
groupName: string | void; | ||
imId: string; | ||
} | ||
|
||
export interface State { | ||
} | ||
|
||
export class GroupDataInfoCell extends React.PureComponent<Props,State> { | ||
state: State = { | ||
}; | ||
|
||
render() { | ||
return ( | ||
<View> | ||
<Delegate.component.SettingItem | ||
type={Typings.Component.SettingItemType.Text} | ||
title={i18n.t('IMSettingGroupDataInfo')} | ||
data={""} | ||
onPressLine={this._clickLine.bind(this)} | ||
/> | ||
</View> | ||
); | ||
} | ||
|
||
protected _clickLine() { | ||
const {imId} = this.props; | ||
Delegate.model.Group.showGroupDataRecord(imId) | ||
.catch(() => { | ||
Toast.show(i18n.t('IMToastError', { | ||
action: i18n.t('IMSettingGroupDataInfo'), | ||
})); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters