Page MenuHomePhabricator

D7589.id25620.diff
No OneTemporary

D7589.id25620.diff

diff --git a/native/chat/settings/thread-settings-description.react.js b/native/chat/settings/thread-settings-description.react.js
--- a/native/chat/settings/thread-settings-description.react.js
+++ b/native/chat/settings/thread-settings-description.react.js
@@ -74,17 +74,6 @@
this.props.descriptionEditValue !== null &&
this.props.descriptionEditValue !== undefined
) {
- let button;
- if (this.props.loadingStatus !== 'loading') {
- button = <SaveSettingButton onPress={this.onSubmit} />;
- } else {
- button = (
- <ActivityIndicator
- size="small"
- color={this.props.colors.panelForegroundSecondaryLabel}
- />
- );
- }
const textInputStyle = {};
if (
this.props.descriptionTextHeight !== undefined &&
@@ -109,7 +98,7 @@
ref={this.textInputRef}
selectionColor={`#${this.props.threadInfo.color}`}
/>
- {button}
+ {this.renderButton()}
</View>
<ThreadSettingsCategoryFooter type="full" />
</View>
@@ -124,11 +113,7 @@
<Text style={this.props.styles.text} onLayout={this.onLayoutText}>
{this.props.threadInfo.description}
</Text>
- <EditSettingButton
- onPress={this.onPressEdit}
- canChangeSettings={this.props.canChangeSettings}
- key="editButton"
- />
+ {this.renderButton()}
</View>
<ThreadSettingsCategoryFooter type="full" />
</View>
@@ -170,6 +155,28 @@
return null;
}
+ renderButton() {
+ if (this.props.loadingStatus === 'loading') {
+ return (
+ <ActivityIndicator
+ size="small"
+ color={this.props.colors.panelForegroundSecondaryLabel}
+ />
+ );
+ } else if (
+ this.props.descriptionEditValue === null ||
+ this.props.descriptionEditValue === undefined
+ ) {
+ return (
+ <EditSettingButton
+ onPress={this.onPressEdit}
+ canChangeSettings={this.props.canChangeSettings}
+ />
+ );
+ }
+ return <SaveSettingButton onPress={this.onSubmit} />;
+ }
+
textInputRef = (textInput: ?React.ElementRef<typeof BaseTextInput>) => {
this.textInput = textInput;
};

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 7:43 AM (19 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2596331
Default Alt Text
D7589.id25620.diff (2 KB)

Event Timeline