Page MenuHomePhabricator

D9586.id32450.diff
No OneTemporary

D9586.id32450.diff

diff --git a/native/navigation/header-right-text-button.react.js b/native/navigation/header-right-text-button.react.js
new file mode 100644
--- /dev/null
+++ b/native/navigation/header-right-text-button.react.js
@@ -0,0 +1,33 @@
+// @flow
+
+import * as React from 'react';
+import { Text, TouchableOpacity } from 'react-native';
+
+import { useStyles } from '../themes/colors.js';
+
+type Props = {
+ +label: string,
+ +onPress: () => mixed,
+};
+
+function HeaderRightTextButton(props: Props): React.Node {
+ const { label, onPress } = props;
+
+ const styles = useStyles(unboundStyles);
+
+ return (
+ <TouchableOpacity onPress={onPress}>
+ <Text style={styles.textStyle}>{label}</Text>
+ </TouchableOpacity>
+ );
+}
+
+const unboundStyles = {
+ textStyle: {
+ color: 'purpleLink',
+ fontSize: 16,
+ marginRight: 10,
+ },
+};
+
+export default HeaderRightTextButton;
diff --git a/native/profile/linked-devices-header-right-button.react.js b/native/profile/linked-devices-header-right-button.react.js
--- a/native/profile/linked-devices-header-right-button.react.js
+++ b/native/profile/linked-devices-header-right-button.react.js
@@ -2,15 +2,13 @@
import { useNavigation } from '@react-navigation/native';
import * as React from 'react';
-import { Text, TouchableOpacity } from 'react-native';
+import HeaderRightTextButton from '../navigation/header-right-text-button.react.js';
import { SecondaryDeviceQRCodeScannerRouteName } from '../navigation/route-names.js';
-import { useStyles } from '../themes/colors.js';
import Alert from '../utils/alert.js';
import { deviceIsEmulator } from '../utils/url-utils.js';
function LinkedDevicesHeaderRightButton(): React.Node {
- const styles = useStyles(unboundStyles);
const { navigate } = useNavigation();
const navigateToQRCodeScanner = React.useCallback(() => {
@@ -27,18 +25,8 @@
}, [navigate]);
return (
- <TouchableOpacity onPress={navigateToQRCodeScanner}>
- <Text style={styles.textStyle}>Add</Text>
- </TouchableOpacity>
+ <HeaderRightTextButton label="Add" onPress={navigateToQRCodeScanner} />
);
}
-const unboundStyles = {
- textStyle: {
- color: 'headerChevron',
- fontSize: 16,
- marginRight: 10,
- },
-};
-
export default LinkedDevicesHeaderRightButton;

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 6:56 AM (21 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2574365
Default Alt Text
D9586.id32450.diff (2 KB)

Event Timeline