MCPcopy Index your code
hub / github.com/ccm-innovation/react-native-twilio-chat

github.com/ccm-innovation/react-native-twilio-chat @v0.3.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3.1 ↗ · + Follow
231 symbols 539 edges 31 files 1 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

React Native Twilio Chat

npm version

React Native wrapper for the Twilio Programmable Chat iOS and Android SDKs

Note - this project is currently in development for a beta release. If you are looking for the legacy package for the Twilio IP Messaging SDKs, see the original repository here.

View migration doc from react-native-ip-messaging here

Installation

npm install --save react-native-twilio-chat

iOS - CocoaPods

Install the Twilio Chat SDK and this package via CocoaPods. See the full Podfile example for more details.

pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'React', :subspecs => ['Core', /* any other subspecs you require */], :path => '../node_modules/react-native'
pod 'RCTTwilioChat', :path => '../node_modules/react-native-twilio-chat/ios'

source 'https://github.com/twilio/cocoapod-specs'
pod 'TwilioChatClient', '~> 0.17.1'
pod 'TwilioAccessManager', '~> 0.1.3'

Note: the underlying Twilio SDKs require a minimum deployment target of 8.1. If your project's target is less than this you will get a CocoaPods install error (Unable to satisfy the following requirements...).

Make sure that you add the $(inherited) value to Other Linker Flags and Framework Search Paths for your target's Build Settings. This is also assuming you have already loaded React via CocoaPods as well.

Android

In android/settings.gradle:

include ':RCTTwilioChat', ':app'
project(':RCTTwilioChat').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-twilio-chat/android')

In android/app/build.gradle:

...
dependencies {
    ...
    compile project(':RCTTwilioChat')
}

Register the module in MainApplication.java:

// import package
import com.bradbumbalough.RCTTwilioChat.RCTTwilioChatPackage;

...

// register package in getPackages()
@Override
protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
        new RCTTwilioChatPackage(),
        ... other packages
    );
}

Note: You might have to enable multidex in your build.gradle file and increase the heap size if you're getting errors while buliding. The minSdkVersion must also be at least 19, per the Twilio SDKs.

android {
    ....
    dexOptions {
        javaMaxHeapSize "2048M"
    }

    defaultConfig {
        ...
        minSdkVersion 19
        multiDexEnabled true
    }

Usage

```javascript / Initialization /

import { AccessManager, Client, Constants } from 'react-native-twilio-chat';

// create the access manager const accessManager = new AccessManager(token);

// specify any handlers for events accessManager.onTokenWillExpire = () => { getNewTokenFromServer() .then(accessManager.updateToken); }

// create the client const client = new Client(token);

// specify any global events client.onError = ({error, userInfo}) => console.log(error);

// initialize the client client.initialize();

// wait for sync to finish client.onClientSynchronized = () => { client.getUserChannels() .then((channelPaginator) => console.log(channelPaginator.items)); }

/ Individual Channel /

// an instance of Channel is passed down in the app via props let channel = this.props.channel

// specify channel specific events channel.onMessageAdded = (message) => console.log(message.author + ": " + message.body); channel.onTypingStarted = (member) => console.log(member.identity + " started typing..."); channel.onTypingEnded = (member) => console.log(member.identity + " stopped typing..."); channel.onMemberAdded = (member) => console.log(member.identity + " joined " + channel.friendlyName);

// sending a message { this.setState({body}); channel.typing(); }} onSubmitEditing={() => { channel.sendMessage(this.state.body)} } /> ````

Documentation

Contributers 🍻

Thank you for your help in maintaining this project! Haven't contributed yet? Check out our Contributing guidelines.... - bradbumbalough - johndrkurtcom - jck2 - Baisang - thathirsch - n8stowell82 - svlaev - Maxwell2022 - bbil - jhabdas - plonkus - mattshen - Kabangi

TODO 🗒

  • [x] Copy code from programable-chat branch on old package
  • [x] Copy issues and PRs over
  • [x] Update docs (wiki?)
  • [x] Migration guide
  • [x] Publish to npm
  • [x] Update twilio-ip-messaging to reference twilio-chat
  • [ ] 1.0 release
  • [ ] Testing

License

This project is licensed under the MIT License.

Core symbols most depended-on inside this repo

remove
called by 38
lib/Channel.js
loadChannelFromSid
called by 13
android/src/main/java/com/bradbumbalough/RCTTwilioChat/RCTTwilioChatChannels.java
getInstance
called by 13
android/src/main/java/com/bradbumbalough/RCTTwilioChat/RCTTwilioChatClient.java
loadMessagesFromChannelSid
called by 12
android/src/main/java/com/bradbumbalough/RCTTwilioChat/RCTTwilioChatMessages.java
sendEvent
called by 12
android/src/main/java/com/bradbumbalough/RCTTwilioChat/RCTTwilioChatClient.java
sendEvent
called by 9
android/src/main/java/com/bradbumbalough/RCTTwilioChat/RCTTwilioChatChannels.java
Channel
called by 7
android/src/main/java/com/bradbumbalough/RCTTwilioChat/RCTConvert.java
add
called by 6
android/src/main/java/com/bradbumbalough/RCTTwilioChat/RCTTwilioChatMembers.java

Shape

Method 187
Class 26
Function 18

Languages

Java61%
TypeScript39%

Modules by API surface

android/src/main/java/com/bradbumbalough/RCTTwilioChat/RCTTwilioChatChannels.java36 symbols
lib/Channel.js32 symbols
android/src/main/java/com/bradbumbalough/RCTTwilioChat/RCTTwilioChatClient.java29 symbols
android/src/main/java/com/bradbumbalough/RCTTwilioChat/RCTTwilioChatMessages.java18 symbols
android/src/main/java/com/bradbumbalough/RCTTwilioChat/RCTConvert.java18 symbols
lib/Client.js14 symbols
Example/GiftedMessengerContainer.js14 symbols
android/src/main/java/com/bradbumbalough/RCTTwilioChat/RCTTwilioChatPaginator.java10 symbols
android/src/main/java/com/bradbumbalough/RCTTwilioChat/RCTTwilioChatMembers.java10 symbols
android/src/main/java/com/bradbumbalough/RCTTwilioChat/RCTTwilioAccessManager.java9 symbols
lib/AccessManager.js7 symbols
lib/UserInfo.js6 symbols

For agents

$ claude mcp add react-native-twilio-chat \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page