react-native-srschat 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +12 -0
- package/dist/index.js +243 -0
- package/package.json +38 -188
- package/README.md +0 -33
- package/android/generated/android/app/build/generated/source/codegen/jni/CMakeLists.txt +0 -36
- package/android/generated/android/app/build/generated/source/codegen/jni/RNSrschatSpec-generated.cpp +0 -22
- package/android/generated/android/app/build/generated/source/codegen/jni/RNSrschatSpec.h +0 -24
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNSrschatSpec/RNSrschatSpecJSI-generated.cpp +0 -17
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNSrschatSpec/RNSrschatSpecJSI.h +0 -19
- package/ios/generated/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm +0 -2321
- package/ios/generated/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h +0 -2761
- package/ios/generated/build/generated/ios/FBReactNativeSpecJSI-generated.cpp +0 -2923
- package/ios/generated/build/generated/ios/FBReactNativeSpecJSI.h +0 -7718
- package/ios/generated/build/generated/ios/RCTModulesConformingToProtocolsProvider.h +0 -18
- package/ios/generated/build/generated/ios/RCTModulesConformingToProtocolsProvider.mm +0 -33
- package/ios/generated/build/generated/ios/RNSrschatSpec/RNSrschatSpec-generated.mm +0 -16
- package/ios/generated/build/generated/ios/RNSrschatSpec/RNSrschatSpec.h +0 -35
- package/ios/generated/build/generated/ios/RNSrschatSpecJSI-generated.cpp +0 -17
- package/ios/generated/build/generated/ios/RNSrschatSpecJSI.h +0 -19
- package/lib/commonjs/components/Chat.js +0 -43
- package/lib/commonjs/components/Chat.js.map +0 -1
- package/lib/commonjs/components/ChatInput.js +0 -64
- package/lib/commonjs/components/ChatInput.js.map +0 -1
- package/lib/commonjs/components/ChatMessage.js +0 -58
- package/lib/commonjs/components/ChatMessage.js.map +0 -1
- package/lib/commonjs/index.js +0 -37
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/types.js +0 -2
- package/lib/commonjs/types.js.map +0 -1
- package/lib/module/components/Chat.js +0 -39
- package/lib/module/components/Chat.js.map +0 -1
- package/lib/module/components/ChatInput.js +0 -60
- package/lib/module/components/ChatInput.js.map +0 -1
- package/lib/module/components/ChatMessage.js +0 -54
- package/lib/module/components/ChatMessage.js.map +0 -1
- package/lib/module/index.js +0 -8
- package/lib/module/index.js.map +0 -1
- package/lib/module/types.js +0 -2
- package/lib/module/types.js.map +0 -1
- package/lib/typescript/commonjs/package.json +0 -1
- package/lib/typescript/commonjs/src/components/Chat.d.ts +0 -3
- package/lib/typescript/commonjs/src/components/Chat.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/ChatInput.d.ts +0 -6
- package/lib/typescript/commonjs/src/components/ChatInput.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/ChatMessage.d.ts +0 -8
- package/lib/typescript/commonjs/src/components/ChatMessage.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/index.d.ts +0 -4
- package/lib/typescript/commonjs/src/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types.d.ts +0 -12
- package/lib/typescript/commonjs/src/types.d.ts.map +0 -1
- package/lib/typescript/module/package.json +0 -1
- package/lib/typescript/module/src/components/Chat.d.ts +0 -3
- package/lib/typescript/module/src/components/Chat.d.ts.map +0 -1
- package/lib/typescript/module/src/components/ChatInput.d.ts +0 -6
- package/lib/typescript/module/src/components/ChatInput.d.ts.map +0 -1
- package/lib/typescript/module/src/components/ChatMessage.d.ts +0 -8
- package/lib/typescript/module/src/components/ChatMessage.d.ts.map +0 -1
- package/lib/typescript/module/src/index.d.ts +0 -4
- package/lib/typescript/module/src/index.d.ts.map +0 -1
- package/lib/typescript/module/src/types.d.ts +0 -12
- package/lib/typescript/module/src/types.d.ts.map +0 -1
- package/src/components/Chat.tsx +0 -34
- package/src/components/ChatInput.tsx +0 -58
- package/src/components/ChatMessage.tsx +0 -51
- package/src/index.tsx +0 -6
- package/src/types.ts +0 -12
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../../../../src/components/Chat.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAI1C,wBAAgB,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,SAAS,2CAkBlE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChatInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatInput.tsx"],"names":[],"mappings":"AAIA,UAAU,cAAc;IACtB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE,cAAc,2CAwBnD"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Message } from '../types';
|
|
2
|
-
interface ChatMessageProps {
|
|
3
|
-
message: Message;
|
|
4
|
-
isOwnMessage: boolean;
|
|
5
|
-
}
|
|
6
|
-
export declare function ChatMessage({ message, isOwnMessage }: ChatMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=ChatMessage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChatMessage.d.ts","sourceRoot":"","sources":["../../../../../src/components/ChatMessage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,UAAU,gBAAgB;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,gBAAgB,2CAUtE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface Message {
|
|
2
|
-
id: string;
|
|
3
|
-
text: string;
|
|
4
|
-
sender: string;
|
|
5
|
-
timestamp: number;
|
|
6
|
-
}
|
|
7
|
-
export interface ChatProps {
|
|
8
|
-
userId: string;
|
|
9
|
-
messages: Message[];
|
|
10
|
-
onSendMessage: (text: string) => void;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC"}
|
package/src/components/Chat.tsx
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { View, FlatList, StyleSheet } from 'react-native';
|
|
2
|
-
import type { ChatProps } from '../types';
|
|
3
|
-
import { ChatMessage } from './ChatMessage';
|
|
4
|
-
import { ChatInput } from './ChatInput';
|
|
5
|
-
|
|
6
|
-
export function Chat({ userId, messages, onSendMessage }: ChatProps) {
|
|
7
|
-
return (
|
|
8
|
-
<View style={styles.container}>
|
|
9
|
-
<FlatList
|
|
10
|
-
data={messages}
|
|
11
|
-
keyExtractor={(item) => item.id}
|
|
12
|
-
renderItem={({ item }) => (
|
|
13
|
-
<ChatMessage
|
|
14
|
-
message={item}
|
|
15
|
-
isOwnMessage={item.sender === userId}
|
|
16
|
-
/>
|
|
17
|
-
)}
|
|
18
|
-
style={styles.messageList}
|
|
19
|
-
inverted
|
|
20
|
-
/>
|
|
21
|
-
<ChatInput onSend={onSendMessage} />
|
|
22
|
-
</View>
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const styles = StyleSheet.create({
|
|
27
|
-
container: {
|
|
28
|
-
flex: 1,
|
|
29
|
-
backgroundColor: '#F2F2F7',
|
|
30
|
-
},
|
|
31
|
-
messageList: {
|
|
32
|
-
flex: 1,
|
|
33
|
-
},
|
|
34
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { View, TextInput, TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
|
-
import { Ionicons } from '@expo/vector-icons';
|
|
4
|
-
|
|
5
|
-
interface ChatInputProps {
|
|
6
|
-
onSend: (text: string) => void;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function ChatInput({ onSend }: ChatInputProps) {
|
|
10
|
-
const [message, setMessage] = useState('');
|
|
11
|
-
|
|
12
|
-
const handleSend = () => {
|
|
13
|
-
if (message.trim()) {
|
|
14
|
-
onSend(message.trim());
|
|
15
|
-
setMessage('');
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<View style={styles.container}>
|
|
21
|
-
<TextInput
|
|
22
|
-
style={styles.input}
|
|
23
|
-
value={message}
|
|
24
|
-
onChangeText={setMessage}
|
|
25
|
-
placeholder="Type a message..."
|
|
26
|
-
multiline
|
|
27
|
-
/>
|
|
28
|
-
<TouchableOpacity onPress={handleSend} style={styles.sendButton}>
|
|
29
|
-
<Ionicons name="send" size={24} color="#007AFF" />
|
|
30
|
-
</TouchableOpacity>
|
|
31
|
-
</View>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const styles = StyleSheet.create({
|
|
36
|
-
container: {
|
|
37
|
-
flexDirection: 'row',
|
|
38
|
-
padding: 10,
|
|
39
|
-
borderTopWidth: 1,
|
|
40
|
-
borderTopColor: '#E5E5EA',
|
|
41
|
-
backgroundColor: 'white',
|
|
42
|
-
},
|
|
43
|
-
input: {
|
|
44
|
-
flex: 1,
|
|
45
|
-
borderWidth: 1,
|
|
46
|
-
borderColor: '#E5E5EA',
|
|
47
|
-
borderRadius: 20,
|
|
48
|
-
paddingHorizontal: 15,
|
|
49
|
-
paddingVertical: 8,
|
|
50
|
-
marginRight: 10,
|
|
51
|
-
maxHeight: 100,
|
|
52
|
-
},
|
|
53
|
-
sendButton: {
|
|
54
|
-
justifyContent: 'center',
|
|
55
|
-
alignItems: 'center',
|
|
56
|
-
width: 44,
|
|
57
|
-
},
|
|
58
|
-
});
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { View, Text, StyleSheet } from 'react-native';
|
|
2
|
-
import type { Message } from '../types';
|
|
3
|
-
|
|
4
|
-
interface ChatMessageProps {
|
|
5
|
-
message: Message;
|
|
6
|
-
isOwnMessage: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function ChatMessage({ message, isOwnMessage }: ChatMessageProps) {
|
|
10
|
-
return (
|
|
11
|
-
<View style={[styles.messageContainer, isOwnMessage ? styles.ownMessage : styles.otherMessage]}>
|
|
12
|
-
<Text style={styles.sender}>{message.sender}</Text>
|
|
13
|
-
<Text style={styles.messageText}>{message.text}</Text>
|
|
14
|
-
<Text style={styles.timestamp}>
|
|
15
|
-
{new Date(message.timestamp).toLocaleTimeString()}
|
|
16
|
-
</Text>
|
|
17
|
-
</View>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const styles = StyleSheet.create({
|
|
22
|
-
messageContainer: {
|
|
23
|
-
padding: 10,
|
|
24
|
-
marginVertical: 5,
|
|
25
|
-
marginHorizontal: 10,
|
|
26
|
-
maxWidth: '80%',
|
|
27
|
-
borderRadius: 10,
|
|
28
|
-
},
|
|
29
|
-
ownMessage: {
|
|
30
|
-
alignSelf: 'flex-end',
|
|
31
|
-
backgroundColor: '#007AFF',
|
|
32
|
-
},
|
|
33
|
-
otherMessage: {
|
|
34
|
-
alignSelf: 'flex-start',
|
|
35
|
-
backgroundColor: '#E5E5EA',
|
|
36
|
-
},
|
|
37
|
-
sender: {
|
|
38
|
-
fontSize: 12,
|
|
39
|
-
color: '#666',
|
|
40
|
-
marginBottom: 2,
|
|
41
|
-
},
|
|
42
|
-
messageText: {
|
|
43
|
-
fontSize: 16,
|
|
44
|
-
},
|
|
45
|
-
timestamp: {
|
|
46
|
-
fontSize: 10,
|
|
47
|
-
color: '#666',
|
|
48
|
-
alignSelf: 'flex-end',
|
|
49
|
-
marginTop: 2,
|
|
50
|
-
},
|
|
51
|
-
});
|
package/src/index.tsx
DELETED