react-native-chat-sdk-btaskee
v0.1.8
Published
react native chat sdk btaskee
Downloads
1
Readme
react-native-chat-sdk-btaskee
react native chat sdk btaskee
Setup
npm install --save react-native-btaskee-mini-app
--- or ---
yarn add react-native-btaskee-mini-app
Don't forget to run pod install
after that !
Require: Please setup
- react native navigation (https://reactnavigation.org/docs/getting-started/)
- i18n-js (https://reactnavigation.org/docs/getting-started/)
Example usage
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import React from 'react';
import { Button, StatusBar, StyleSheet, View } from 'react-native';
import Chat, { IsoCode, Locale } from 'react-native-chat-sdk-btaskee';
import { SafeAreaProvider } from 'react-native-safe-area-context';
const Stack = createNativeStackNavigator();
const HomeScreen = ({ navigation }: any) => {
return (
<View style={styles.container}>
<Button title="Chat" onPress={() => navigation.navigate('ChatScreen')} />
</View>
);
};
const ChatScreen = () => {
return (
<View style={styles.flex1}>
<StatusBar barStyle={'light-content'} />
<Chat
user={{
_id: '6368c1daff64160332e516ccvn',
token: '',
name: 'Test 1',
avatar: 'https//:...',
}}
config={{
locale: Locale.vi,
isoCode: IsoCode.VN,
apiKey: '',
domainApi: '',
domainWs: '',
partnerCode: 'ASKER',
accessKey: '',
AWS3: {
accessKey: '',
bucket: '',
region: '',
secretKey: '',
keyPrefix: '',
},
}}
/>
</View>
);
};
const App = () => {
return (
<NavigationContainer>
<SafeAreaProvider>
<Stack.Navigator>
<Stack.Screen options={{ headerShown: false }} name="HomeScreen" component={HomeScreen} />
<Stack.Screen options={{ headerShown: false }} name="ChatScreen" component={ChatScreen} />
</Stack.Navigator>
</SafeAreaProvider>
</NavigationContainer>
);
};
export default App;
const styles = StyleSheet.create({
flex1: {
flex: 1,
},
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
});
Run Example
cd example
yarn
cd ios && pod install && cd ..
yarn ios
Props:
user={{
_id: string,
token: string,
name: string,
avatar: string,
}}
config={{
locale: Locale,
isoCode: IsoCode,
apiKey: string,
domainApi: string,
domainWs: string,
partnerCode: 'ASKER' | "TASKER",
accessKey: string,
AWS3: {
accessKey: string,
bucket: string,
region: string,
secretKey: string,
keyPrefix: string,
},
}}