From 1ec094ce7231947b5adc36b62e2390d1e86926cd Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Fri, 22 May 2020 17:01:32 -0300 Subject: [PATCH] Create channel --- app/views/CreateChannelView.js | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/app/views/CreateChannelView.js b/app/views/CreateChannelView.js index 29b74226a..a224cc320 100644 --- a/app/views/CreateChannelView.js +++ b/app/views/CreateChannelView.js @@ -19,7 +19,6 @@ import { CustomHeaderButtons, Item } from '../containers/HeaderButton'; import StatusBar from '../containers/StatusBar'; import { SWITCH_TRACK_COLOR, themes } from '../constants/colors'; import { withTheme } from '../theme'; -import { themedHeader } from '../utils/navigation'; import { Review } from '../utils/review'; import { getUserSelector } from '../selectors/login'; import SafeAreaView from '../containers/SafeAreaView'; @@ -73,21 +72,8 @@ const styles = StyleSheet.create({ }); class CreateChannelView extends React.Component { - static navigationOptions = ({ route }) => { - const submit = route.param?.submit ?? (() => {}); - const showSubmit = route.param?.showSubmit ?? false; - return { - title: I18n.t('Create_Channel'), - headerRight: () => ( - showSubmit - ? ( - - - - ) - : null - ) - }; + static navigationOptions = { + title: I18n.t('Create_Channel') } static propTypes = { @@ -147,9 +133,19 @@ class CreateChannelView extends React.Component { return false; } - onChangeText = (channelName) => { + toggleRightButton = (channelName) => { const { navigation } = this.props; - navigation.setParams({ showSubmit: channelName.trim().length > 0 }); + navigation.setOptions({ + headerRight: () => channelName.trim().length > 0 && ( + + + + ) + }); + } + + onChangeText = (channelName) => { + this.toggleRightButton(channelName); this.setState({ channelName }); }