Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3249210
D5426.id17704.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D5426.id17704.diff
View Options
diff --git a/native/chat/chat.react.js b/native/chat/chat.react.js
--- a/native/chat/chat.react.js
+++ b/native/chat/chat.react.js
@@ -221,18 +221,15 @@
return {
// This is a render prop, not a component
// eslint-disable-next-line react/display-name
- headerTitle: () => (
+ headerTitle: props => (
<MessageListHeaderTitle
threadInfo={route.params.threadInfo}
navigate={navigation.navigate}
areSettingsEnabled={areSettingsEnabled}
isSearchEmpty={isSearchEmpty}
+ {...props}
/>
),
- headerTitleContainerStyle: {
- marginHorizontal: Platform.select({ ios: 80, default: 0 }),
- flex: 1,
- },
headerRight:
Platform.OS === 'android' && areSettingsEnabled
? // This is a render prop, not a component
diff --git a/native/chat/message-list-header-title.react.js b/native/chat/message-list-header-title.react.js
--- a/native/chat/message-list-header-title.react.js
+++ b/native/chat/message-list-header-title.react.js
@@ -1,6 +1,9 @@
// @flow
-import { HeaderTitle } from '@react-navigation/elements';
+import {
+ HeaderTitle,
+ type StackHeaderTitleInputProps,
+} from '@react-navigation/elements';
import * as React from 'react';
import { View, Platform } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
@@ -18,6 +21,7 @@
+navigate: $PropertyType<ChatNavigationProp<'MessageList'>, 'navigate'>,
+isSearchEmpty: boolean,
+areSettingsEnabled: boolean,
+ ...StackHeaderTitleInputProps,
};
type Props = {
...BaseProps,
@@ -25,38 +29,37 @@
};
class MessageListHeaderTitle extends React.PureComponent<Props> {
render() {
+ const {
+ threadInfo,
+ navigate,
+ isSearchEmpty,
+ areSettingsEnabled,
+ styles,
+ ...rest
+ } = this.props;
+
let icon, fakeIcon;
- if (Platform.OS === 'ios' && this.props.areSettingsEnabled) {
+ if (Platform.OS === 'ios' && areSettingsEnabled) {
icon = (
- <Icon
- name="ios-arrow-forward"
- size={20}
- style={this.props.styles.forwardIcon}
- />
+ <Icon name="ios-arrow-forward" size={20} style={styles.forwardIcon} />
);
fakeIcon = (
- <Icon
- name="ios-arrow-forward"
- size={20}
- style={this.props.styles.fakeIcon}
- />
+ <Icon name="ios-arrow-forward" size={20} style={styles.fakeIcon} />
);
}
- const title = this.props.isSearchEmpty
- ? 'New Message'
- : this.props.threadInfo.uiName;
+ const title = isSearchEmpty ? 'New Message' : threadInfo.uiName;
return (
<Button
onPress={this.onPress}
- style={this.props.styles.button}
+ style={styles.button}
androidBorderlessRipple={true}
- disabled={!this.props.areSettingsEnabled}
+ disabled={!areSettingsEnabled}
>
- <View style={this.props.styles.container}>
+ <View style={styles.container}>
{fakeIcon}
- <HeaderTitle>{firstLine(title)}</HeaderTitle>
+ <HeaderTitle {...rest}>{firstLine(title)}</HeaderTitle>
{icon}
</View>
</Button>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 16, 12:40 PM (21 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2497375
Default Alt Text
D5426.id17704.diff (3 KB)
Attached To
Mode
D5426: [native] [33/34] ReactNav6: Update HeaderTitle to use flex positioning
Attached
Detach File
Event Timeline
Log In to Comment