Skip to content

Commit 3500848

Browse files
committed
chore: fail for uikit
1 parent 42416e4 commit 3500848

File tree

9 files changed

+416
-209
lines changed

9 files changed

+416
-209
lines changed

Chat-RN/uikit_quick_start_demo/App.tsx

+21-25
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
import * as React from 'react';
99
import {Pressable, SafeAreaView, Text, View} from 'react-native';
1010
import {
11-
Container,
12-
ConversationDetail,
11+
ChatFragment,
1312
TextInput,
14-
useChatContext,
15-
} from 'react-native-chat-uikit';
13+
useChatSdkContext,
14+
} from 'react-native-agora-chat-uikit';
15+
16+
import {GlobalContainer} from 'react-native-agora-chat-uikit';
1617

1718
const appKey = 'xxx';
1819
const userId = 'xxx';
@@ -25,7 +26,7 @@ function SendMessage() {
2526
const [id, setId] = React.useState(userId);
2627
const [ps, setPs] = React.useState(userPs);
2728
const [peer, setPeer] = React.useState(peerId);
28-
const im = useChatContext();
29+
const im = useChatSdkContext();
2930

3031
if (page === 0) {
3132
return (
@@ -55,14 +56,16 @@ function SendMessage() {
5556
onPress={() => {
5657
console.log('test:zuoyu:login', id, ps);
5758
im.login({
58-
userId: id,
59-
userToken: ps,
60-
usePassword: true,
61-
result: res => {
59+
id: id,
60+
pass: ps,
61+
type: 'agora',
62+
onResult: res => {
6263
console.log('login result', res);
6364
console.log('test:zuoyu:error', res);
64-
if (res.isOk === true) {
65+
if (res.result === true) {
6566
setPage(1);
67+
} else {
68+
console.warn('login failed');
6669
}
6770
},
6871
});
@@ -72,7 +75,9 @@ function SendMessage() {
7275
<Pressable
7376
onPress={() => {
7477
im.logout({
75-
result: () => {},
78+
onResult: result => {
79+
console.log('logout result', result);
80+
},
7681
});
7782
}}>
7883
<Text>{'Logout'}</Text>
@@ -83,17 +88,7 @@ function SendMessage() {
8388
// 聊天页面
8489
return (
8590
<SafeAreaView style={{flex: 1}}>
86-
<ConversationDetail
87-
convId={peer}
88-
convType={0}
89-
onBack={() => {
90-
setPage(0);
91-
im.logout({
92-
result: () => {},
93-
});
94-
}}
95-
type={'chat'}
96-
/>
91+
<ChatFragment screenParams={{params: {chatId: peer, chatType: 0}}} />
9792
</SafeAreaView>
9893
);
9994
} else {
@@ -102,11 +97,12 @@ function SendMessage() {
10297
}
10398

10499
function App(): React.JSX.Element {
105-
// 初始化 UIKit
100+
// return <View><Text>{'test'}</Text></View>;
106101
return (
107-
<Container options={{appKey: appKey, autoLogin: false}}>
102+
<GlobalContainer
103+
option={{appKey: appKey, autoLogin: false, debugModel: true}}>
108104
<SendMessage />
109-
</Container>
105+
</GlobalContainer>
110106
);
111107
}
112108

Chat-RN/uikit_quick_start_demo/ios/Podfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ target 'TestUIKitDemo074' do
2020
use_react_native!(
2121
:path => config[:reactNativePath],
2222
# An absolute path to your application root.
23-
:app_path => "#{Pod::Config.instance.installation_root}/.."
23+
:app_path => "#{Pod::Config.instance.installation_root}/..",
24+
:hermes_enabled => false,
25+
:new_arch_enabled => false,
26+
:fabric_enabled => false
2427
)
2528

2629
target 'TestUIKitDemo074Tests' do

0 commit comments

Comments
 (0)