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