diff --git a/app/stacks/InsideStack.js b/app/stacks/InsideStack.js
index dce630619..d637241c4 100644
--- a/app/stacks/InsideStack.js
+++ b/app/stacks/InsideStack.js
@@ -53,6 +53,7 @@ import AttachmentView from '../views/AttachmentView';
import ModalBlockView from '../views/ModalBlockView';
import JitsiMeetView from '../views/JitsiMeetView';
import StatusView from '../views/StatusView';
+import CreateDiscussionView from '../views/CreateDiscussionView';
// ChatsStack
const Chats = createStackNavigator();
@@ -100,7 +101,6 @@ const ChatsStack = () => {
{
SelectedUsersView.navigationOptions({ ...props })}
/>
+
);
};
@@ -278,12 +281,10 @@ const InsideStackModal = () => {
{
- const submit = route.params?.submit ?? (() => {});
- const showSubmit = route.params?.showSubmit ?? route.params?.message;
- return {
- title: I18n.t('Create_Discussion'),
- headerRight: (
- showSubmit
- ? (
-
-
-
- )
- : null
- ),
- headerLeft:
- };
- }
-
propTypes = {
navigation: PropTypes.object,
+ route: PropTypes.object,
server: PropTypes.string,
user: PropTypes.object,
create: PropTypes.func,
@@ -58,26 +41,26 @@ class CreateChannelView extends React.Component {
constructor(props) {
super(props);
- const { navigation } = props;
- navigation.setParams({ submit: this.submit });
- this.channel = navigation.getParam('channel');
- const message = navigation.getParam('message', {});
+ const { route } = props;
+ this.channel = route.params?.channel;
+ const message = route.params?.message ?? {};
this.state = {
channel: this.channel,
message,
- name: message.msg || '',
+ name: message?.msg || '',
users: [],
reply: ''
};
+ this.setHeader();
}
componentDidUpdate(prevProps, prevState) {
const {
- loading, failure, error, result, navigation
+ loading, failure, error, result
} = this.props;
if (!isEqual(this.state, prevState)) {
- navigation.setParams({ showSubmit: this.valid() });
+ this.setHeader();
}
if (!loading && loading !== prevProps.loading) {
@@ -98,6 +81,23 @@ class CreateChannelView extends React.Component {
}
}
+ setHeader = () => {
+ const { navigation } = this.props;
+ navigation.setOptions({
+ title: I18n.t('Create_Discussion'),
+ headerRight: (
+ this.valid()
+ ? () => (
+
+
+
+ )
+ : null
+ ),
+ headerLeft: () =>
+ });
+ }
+
submit = () => {
const {
name: t_name, channel: { prid, rid }, message: { id: pmid }, reply, users