Hey Tyler, thank you for getting back to us.
I am basically copying from the code from here: GitHub - sendbird/sendbird-uikit-sample-react-native-expo: [Sample] React-Native UIKit for Expo
More info bellow, let me know if you need any other information, thanks!
factory.ts (see https://github.com/sendbird/sendbird-uikit-sample-react-native-expo/blob/77f8cbe9bc21f15c15796af75375078013db4a41/src/factory/index.ts)
App.tsx
function App() {
[ ... ]
return (
<AppContext.Provider value={{ state, ...methods, dispatch }}>
<SendbirdUIKitContainer
appId={process.env.EXPO_PUBLIC_SENDBIRD_APP_ID as string}
uikitOptions={{
common: {
enableUsingDefaultUserProfile: true,
},
groupChannel: {
enableMention: true,
},
groupChannelList: {
enableTypingIndicator: true,
enableMessageReceiptStatus: true,
},
groupChannelSettings: {
enableMessageSearch: true,
},
}}
chatOptions={{
localCacheStorage: AsyncStorage,
onInitialized: SetSendbirdSDK,
enableAutoPushTokenRegistration: true,
}}
platformServices={platformServices}
styles={{
defaultHeaderTitleAlign: "left", //'center',
theme: LightUIKitTheme,
statusBarTranslucent: GetTranslucent(),
}}
errorBoundary={{ ErrorInfoComponent: ErrorInfoScreen }}
userProfile={{
onCreateChannel: (channel: any ) => {
const params = { channelUrl: channel.url };
if (channel.isGroupChannel()) {
messagingNavigationRef.navigate(MessagingRoutes.GroupChannel, params);
}
},
}}
>
[...]
</NavigationContainer>
</RootSiblingParent>
</SendbirdUIKitContainer>
</AppContext.Provider>
GroupChannelListScreen.tsx
import { createGroupChannelListFragment } from '@sendbird/uikit-react-native';
import { useConnection } from '@sendbird/uikit-react-native';
import { User } from '@sendbird/chat';
const GroupChannelListFragment = createGroupChannelListFragment();
const GroupChannelListScreen = ({ navigation } : ScreenProps) => {
const [user, setUser] = useState<User | null>(null);
const { connect } = useConnection();
useEffect(() => {
connect('USER_ID', { accessToken: _token })
.then((_user: User) => {
console.log('User is connected to Sendbird server', _user);
// do stuff wit user
})
.catch((_err) => {
console.log('User is not connected to Sendbird server', _err);
});
}, [connect, setUser]);
if(!user) return (
<View style={{}}<Text>Connecting to send bird...</Text></View>
)
return (
<GroupChannelListFragment
onPressCreateChannel={() => {
// ignore for now
}}
onPressChannel={(channel) => {
navigation.navigate (MessagingRoutes.GroupChannel, { channelUrl: channel.url });
}}
/>
);
};