Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32174886
D8430.1765066378.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D8430.1765066378.diff
View Options
diff --git a/native/roles/create-roles-header-right-button.react.js b/native/roles/create-roles-header-right-button.react.js
--- a/native/roles/create-roles-header-right-button.react.js
+++ b/native/roles/create-roles-header-right-button.react.js
@@ -50,14 +50,35 @@
navigation,
]);
- return (
- <TouchableOpacity onPress={onPressCreate}>
- <Text style={styles.createButton}>Create</Text>
- </TouchableOpacity>
- );
+ const shouldHeaderRightBeDisabled = roleName.length === 0;
+ const createButton = React.useMemo(() => {
+ const textStyle = shouldHeaderRightBeDisabled
+ ? styles.createButtonDisabled
+ : styles.createButton;
+
+ return (
+ <TouchableOpacity
+ onPress={onPressCreate}
+ disabled={shouldHeaderRightBeDisabled}
+ >
+ <Text style={textStyle}>Create</Text>
+ </TouchableOpacity>
+ );
+ }, [
+ shouldHeaderRightBeDisabled,
+ styles.createButtonDisabled,
+ styles.createButton,
+ onPressCreate,
+ ]);
+
+ return createButton;
}
const unboundStyles = {
+ createButtonDisabled: {
+ color: 'disabledButton',
+ marginRight: 10,
+ },
createButton: {
color: 'purpleLink',
marginRight: 10,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 7, 12:12 AM (10 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5841529
Default Alt Text
D8430.1765066378.diff (1 KB)
Attached To
Mode
D8430: [native] Disable headerRight when the role name is empty
Attached
Detach File
Event Timeline
Log In to Comment