StatusView

This commit is contained in:
Diego Mello 2020-05-27 13:48:07 -03:00
parent 69e2fe8bc5
commit 6c132cbbcd
2 changed files with 18 additions and 16 deletions

View File

@ -50,7 +50,7 @@ class SetUsernameView extends React.Component {
saving: false
};
const { server } = this.props;
props.navigation.setParams({ title: server });
props.navigation.setOptions({ title: server });
if (!isTablet) {
Orientation.lockToPortrait();
}

View File

@ -56,20 +56,6 @@ const styles = StyleSheet.create({
});
class StatusView extends React.Component {
static navigationOptions = ({ route }) => ({
title: I18n.t('Edit_Status'),
headerLeft: () => <CancelModalButton onPress={route.params?.close ?? (() => {})} />,
headerRight: () => (
<CustomHeaderButtons>
<Item
title={I18n.t('Done')}
onPress={route.params?.submit ?? (() => {})}
testID='status-view-submit'
/>
</CustomHeaderButtons>
)
})
static propTypes = {
user: PropTypes.shape({
id: PropTypes.string,
@ -86,8 +72,24 @@ class StatusView extends React.Component {
const { statusText } = props.user;
this.state = { statusText, loading: false };
this.setHeader();
}
props.navigation.setParams({ submit: this.submit, close: this.close });
setHeader = () => {
const { navigation } = this.props;
navigation.setOptions({
title: I18n.t('Edit_Status'),
headerLeft: () => <CancelModalButton onPress={this.close} />,
headerRight: () => (
<CustomHeaderButtons>
<Item
title={I18n.t('Done')}
onPress={this.submit}
testID='status-view-submit'
/>
</CustomHeaderButtons>
)
});
}
submit = async() => {