diff --git a/native/navigation/header-right-text-button.react.js b/native/navigation/header-right-text-button.react.js new file mode 100644 index 000000000..5f4459f02 --- /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 ( + + {label} + + ); +} + +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 index 70f2d8ede..e01f12af4 100644 --- a/native/profile/linked-devices-header-right-button.react.js +++ b/native/profile/linked-devices-header-right-button.react.js @@ -1,44 +1,32 @@ // @flow 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(() => { if (deviceIsEmulator) { Alert.alert( 'Unsupported device', "You can't access the QR code scanner on a simulator.", [{ text: 'OK' }], { cancelable: false }, ); return; } navigate(SecondaryDeviceQRCodeScannerRouteName); }, [navigate]); return ( - - Add - + ); } -const unboundStyles = { - textStyle: { - color: 'headerChevron', - fontSize: 16, - marginRight: 10, - }, -}; - export default LinkedDevicesHeaderRightButton;