How to use react-native-im-easemob - 10 common examples

To help you get started, we’ve selected a few react-native-im-easemob examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gaoxiaosong / react-native-im / plugin / easemob / MoreBoardAction.ts View on Github external
export default function () {
    type ActionItem = [string, Typings.Action.MoreBoard.GeneralResult, number];
    const moreboardActions: ActionItem[] = [
        ['photo', StandardMessage.MoreBoard.takePhoto, IMConstant.MessageType.image],
        ['camera', StandardMessage.MoreBoard.takeCamera, IMConstant.MessageType.image],
        ['video', StandardMessage.MoreBoard.takeVideo, IMConstant.MessageType.video],
        ['location', StandardMessage.MoreBoard.chooseLocation, IMConstant.MessageType.location],
    ];
    moreboardActions.forEach(([action, handle, messageType]) => {
        Model.Action.MoreBoard.registerDefault(action, {...handle, messageType});
    });
    // 默认值设置
    Delegate.component.MoreBoard.defaultProps.getItems = () =>
        ['photo', 'camera', 'video', 'location'];
}
github gaoxiaosong / react-native-im / plugin / easemob / MoreBoardAction.ts View on Github external
export default function () {
    type ActionItem = [string, Typings.Action.MoreBoard.GeneralResult, number];
    const moreboardActions: ActionItem[] = [
        ['photo', StandardMessage.MoreBoard.takePhoto, IMConstant.MessageType.image],
        ['camera', StandardMessage.MoreBoard.takeCamera, IMConstant.MessageType.image],
        ['video', StandardMessage.MoreBoard.takeVideo, IMConstant.MessageType.video],
        ['location', StandardMessage.MoreBoard.chooseLocation, IMConstant.MessageType.location],
    ];
    moreboardActions.forEach(([action, handle, messageType]) => {
        Model.Action.MoreBoard.registerDefault(action, {...handle, messageType});
    });
    // 默认值设置
    Delegate.component.MoreBoard.defaultProps.getItems = () =>
        ['photo', 'camera', 'video', 'location'];
}
github gaoxiaosong / react-native-im / plugin / easemob / index.ts View on Github external
export function setup() {
    setup_parse_action();
    setup_display_action();
    setup_abstract_action();
    setup_moreboard_action();
    setup_send_action();
    setup_im_conversation_delegate();
    setup_im_group_delegate();
    // 代理设置
    Delegate.config.messageType.text = EMSDK.IMConstant.MessageType.text;
    Delegate.config.messageType.voice = EMSDK.IMConstant.MessageType.voice;
    Delegate.config.messageType.system = EMSDK.IMConstant.MessageType.command;
}
github gaoxiaosong / react-native-im / plugin / easemob / index.ts View on Github external
export function setup() {
    setup_parse_action();
    setup_display_action();
    setup_abstract_action();
    setup_moreboard_action();
    setup_send_action();
    setup_im_conversation_delegate();
    setup_im_group_delegate();
    // 代理设置
    Delegate.config.messageType.text = EMSDK.IMConstant.MessageType.text;
    Delegate.config.messageType.voice = EMSDK.IMConstant.MessageType.voice;
    Delegate.config.messageType.system = EMSDK.IMConstant.MessageType.command;
}
github gaoxiaosong / react-native-im / plugin / easemob / IMConversationDelegate.ts View on Github external
Delegate.im.conversation.deleteOne = (imId) => {
        return ChatManager.deleteConversation(imId);
    };
    // TODO updateConfig
github gaoxiaosong / react-native-im / plugin / easemob / IMConversationDelegate.ts View on Github external
Delegate.im.conversation.markAllRead = (imId, chatType) => {
        return ChatManager.markAllMessagesAsRead(imId, chatType);
    };
    // TODO markLatestUnread
github gaoxiaosong / react-native-im / plugin / easemob / DisplayAction.ts View on Github external
export default function () {
    const displayActions = [
        [[], StandardMessage.Display.GeneralBubble],
        [IMConstant.MessageType.text, StandardMessage.Display.TextBubble],
        [IMConstant.MessageType.image, StandardMessage.Display.ImageBubble],
        [IMConstant.MessageType.location, StandardMessage.Display.LocationBubble],
        [IMConstant.MessageType.video, StandardMessage.Display.VideoBubble],
        [IMConstant.MessageType.voice, StandardMessage.Display.VoiceBubble],
    ];
    displayActions.forEach(function ([messageType, handleFunc]) {
        Model.Action.Display.registerDefault(messageType, handleFunc);
    });
}
github gaoxiaosong / react-native-im / plugin / easemob / AbstractAction.ts View on Github external
export default function () {
    const abstractActions = [
        [[], () => ''],
        [IMConstant.MessageType.text, StandardMessage.Abstract.TextAbstract],
        [IMConstant.MessageType.image, StandardMessage.Abstract.ImageAbstract],
        [IMConstant.MessageType.location, StandardMessage.Abstract.LocationAbstract],
        [IMConstant.MessageType.video, StandardMessage.Abstract.VideoAbstract],
        [IMConstant.MessageType.voice, StandardMessage.Abstract.VoiceAbstract],
        [IMConstant.MessageType.file, StandardMessage.Abstract.FileAbstract],
    ];
    abstractActions.forEach(function ([messageType, abstractFunc]) {
        Model.Action.Abstract.registerDefault(messageType, abstractFunc);
    });
}
github gaoxiaosong / react-native-im / plugin / easemob / SendAction.ts View on Github external
export default function () {
    type ActionItem = [
        number,
        (params: Typings.Action.Send.Params) => Typings.Action.Send.Result
        ];
    const sendActions: ActionItem[] = [
        [IMConstant.MessageType.text, sendText],
        [IMConstant.MessageType.image, sendImage],
        [IMConstant.MessageType.location, sendLocation],
        [IMConstant.MessageType.video, sendVideo],
        [IMConstant.MessageType.voice, sendVoice],
        [IMConstant.MessageType.file, sendFile],
    ];
    sendActions.forEach(([type, func]) => {
        Model.Action.Send.registerSpecial(
            type,
            (_?: Typings.Action.Send.State) => true,
            func,
            Specials.PRIORITY.LOW
        );
    });
}
github gaoxiaosong / react-native-im / plugin / message / display / ImageBubble.tsx View on Github external
        const images = messages.filter(({type}) => type === IMConstant.MessageType.image).reverse();
        const currentIndex = images.findIndex(image => image.messageId === messageId);