getParam
This commit is contained in:
parent
ffda9e528f
commit
4f010e5e37
|
@ -27,6 +27,10 @@ import MessagesView from '../views/MessagesView';
|
|||
import AutoTranslateView from '../views/AutoTranslateView';
|
||||
import DirectoryView from '../views/DirectoryView';
|
||||
import NotificationPrefView from '../views/NotificationPreferencesView';
|
||||
import VisitorNavigationView from '../views/VisitorNavigationView';
|
||||
import ForwardLivechatView from '../views/ForwardLivechatView';
|
||||
import LivechatEditView from '../views/LivechatEditView';
|
||||
import PickerView from '../views/PickerView';
|
||||
import ThreadMessagesView from '../views/ThreadMessagesView';
|
||||
import MarkdownTableView from '../views/MarkdownTableView';
|
||||
import ReadReceiptsView from '../views/ReadReceiptView';
|
||||
|
@ -130,6 +134,26 @@ const ChatsStack = () => {
|
|||
component={NotificationPrefView}
|
||||
options={NotificationPrefView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='VisitorNavigationView'
|
||||
component={VisitorNavigationView}
|
||||
options={VisitorNavigationView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='ForwardLivechatView'
|
||||
component={ForwardLivechatView}
|
||||
options={ForwardLivechatView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='LivechatEditView'
|
||||
component={LivechatEditView}
|
||||
options={LivechatEditView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='PickerView'
|
||||
component={PickerView}
|
||||
options={PickerView.navigationOptions}
|
||||
/>
|
||||
<Chats.Screen
|
||||
name='ThreadMessagesView'
|
||||
component={ThreadMessagesView}
|
||||
|
|
|
@ -18,14 +18,16 @@ const styles = StyleSheet.create({
|
|||
}
|
||||
});
|
||||
|
||||
const ForwardLivechatView = ({ forwardRoom, navigation, theme }) => {
|
||||
const ForwardLivechatView = ({
|
||||
forwardRoom, navigation, route, theme
|
||||
}) => {
|
||||
const [departments, setDepartments] = useState([]);
|
||||
const [departmentId, setDepartment] = useState();
|
||||
const [users, setUsers] = useState([]);
|
||||
const [userId, setUser] = useState();
|
||||
const [room, setRoom] = useState();
|
||||
|
||||
const rid = navigation.getParam('rid');
|
||||
const rid = route.params?.rid;
|
||||
|
||||
const getDepartments = async() => {
|
||||
try {
|
||||
|
@ -137,6 +139,7 @@ const ForwardLivechatView = ({ forwardRoom, navigation, theme }) => {
|
|||
ForwardLivechatView.propTypes = {
|
||||
forwardRoom: PropTypes.func,
|
||||
navigation: PropTypes.object,
|
||||
route: PropTypes.object,
|
||||
theme: PropTypes.string
|
||||
};
|
||||
ForwardLivechatView.navigationOptions = {
|
||||
|
|
|
@ -16,6 +16,7 @@ const formatUrl = (url, baseUrl, uriSize, avatarAuthURLFragment) => (
|
|||
class JitsiMeetView extends React.Component {
|
||||
static propTypes = {
|
||||
navigation: PropTypes.object,
|
||||
route: PropTypes.object,
|
||||
baseUrl: PropTypes.string,
|
||||
user: PropTypes.shape({
|
||||
id: PropTypes.string,
|
||||
|
@ -27,14 +28,14 @@ class JitsiMeetView extends React.Component {
|
|||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.rid = props.navigation.getParam('rid');
|
||||
this.rid = props.route.params?.rid;
|
||||
this.onConferenceTerminated = this.onConferenceTerminated.bind(this);
|
||||
this.onConferenceJoined = this.onConferenceJoined.bind(this);
|
||||
this.jitsiTimeout = null;
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { navigation, user, baseUrl } = this.props;
|
||||
const { route, user, baseUrl } = this.props;
|
||||
const {
|
||||
name: displayName, id: userId, token, username
|
||||
} = user;
|
||||
|
@ -47,8 +48,8 @@ class JitsiMeetView extends React.Component {
|
|||
displayName,
|
||||
avatar
|
||||
};
|
||||
const url = navigation.getParam('url');
|
||||
const onlyAudio = navigation.getParam('onlyAudio', false);
|
||||
const url = route.params?.url;
|
||||
const onlyAudio = route.params?.onlyAudio ?? false;
|
||||
if (onlyAudio) {
|
||||
JitsiMeet.audioCall(url, userInfo);
|
||||
} else {
|
||||
|
|
|
@ -36,15 +36,17 @@ Title.propTypes = {
|
|||
theme: PropTypes.string
|
||||
};
|
||||
|
||||
const LivechatEditView = ({ user, navigation, theme }) => {
|
||||
const LivechatEditView = ({
|
||||
user, navigation, route, theme
|
||||
}) => {
|
||||
const [customFields, setCustomFields] = useState({});
|
||||
const [availableUserTags, setAvailableUserTags] = useState([]);
|
||||
|
||||
const params = {};
|
||||
const inputs = {};
|
||||
|
||||
const livechat = navigation.getParam('room', {});
|
||||
const visitor = navigation.getParam('roomUser', {});
|
||||
const livechat = route.params?.room ?? {};
|
||||
const visitor = route.params?.roomUser ?? {};
|
||||
|
||||
const getCustomFields = async() => {
|
||||
const result = await RocketChat.getCustomFields();
|
||||
|
@ -148,8 +150,8 @@ const LivechatEditView = ({ user, navigation, theme }) => {
|
|||
contentContainerStyle={sharedStyles.container}
|
||||
keyboardVerticalOffset={128}
|
||||
>
|
||||
<ScrollView {...scrollPersistTaps}>
|
||||
<SafeAreaView style={styles.container} theme={theme}>
|
||||
<ScrollView {...scrollPersistTaps} style={styles.container}>
|
||||
<SafeAreaView theme={theme}>
|
||||
<Title
|
||||
title={visitor?.username}
|
||||
theme={theme}
|
||||
|
@ -271,6 +273,7 @@ const LivechatEditView = ({ user, navigation, theme }) => {
|
|||
LivechatEditView.propTypes = {
|
||||
user: PropTypes.object,
|
||||
navigation: PropTypes.object,
|
||||
route: PropTypes.object,
|
||||
theme: PropTypes.string
|
||||
};
|
||||
LivechatEditView.navigationOptions = ({
|
||||
|
|
|
@ -83,7 +83,7 @@ class RoomInfoView extends React.Component {
|
|||
}
|
||||
|
||||
const { navigation } = this.props;
|
||||
this.willFocusListener = navigation.addListener('willFocus', () => {
|
||||
this.willFocusListener = navigation.addListener('focus', () => {
|
||||
if (this.isLivechat) {
|
||||
this.loadVisitor();
|
||||
}
|
||||
|
@ -94,8 +94,8 @@ class RoomInfoView extends React.Component {
|
|||
if (this.subscription && this.subscription.unsubscribe) {
|
||||
this.subscription.unsubscribe();
|
||||
}
|
||||
if (this.willFocusListener && this.willFocusListener.remove) {
|
||||
this.willFocusListener.remove();
|
||||
if (this.willFocusListener) {
|
||||
this.willFocusListener();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ const Icon = React.memo(({
|
|||
} else if (type === 'c') {
|
||||
icon = 'hashtag';
|
||||
} else if (type === 'l') {
|
||||
icon = 'livechat';
|
||||
icon = 'omnichannel';
|
||||
} else if (type === 'd') {
|
||||
icon = 'team';
|
||||
} else {
|
||||
|
|
|
@ -37,13 +37,13 @@ Item.propTypes = {
|
|||
theme: PropTypes.string
|
||||
};
|
||||
|
||||
const VisitorNavigationView = ({ navigation, theme }) => {
|
||||
const VisitorNavigationView = ({ route, theme }) => {
|
||||
let offset;
|
||||
let total = 0;
|
||||
const [pages, setPages] = useState([]);
|
||||
|
||||
const getPages = async() => {
|
||||
const rid = navigation.getParam('rid');
|
||||
const rid = route.params?.rid;
|
||||
if (rid) {
|
||||
try {
|
||||
const result = await RocketChat.getPagesLivechat(rid, offset);
|
||||
|
@ -89,7 +89,7 @@ const VisitorNavigationView = ({ navigation, theme }) => {
|
|||
};
|
||||
VisitorNavigationView.propTypes = {
|
||||
theme: PropTypes.string,
|
||||
navigation: PropTypes.object
|
||||
route: PropTypes.object
|
||||
};
|
||||
VisitorNavigationView.navigationOptions = {
|
||||
title: I18n.t('Navigation_history')
|
||||
|
|
Loading…
Reference in New Issue