diff --git a/native/account/logged-out-modal.react.js b/native/account/logged-out-modal.react.js --- a/native/account/logged-out-modal.react.js +++ b/native/account/logged-out-modal.react.js @@ -49,6 +49,7 @@ type NavigationRoute, LoggedOutModalRouteName, RegistrationRouteName, + QRCodeSignInNavigatorRouteName, } from '../navigation/route-names.js'; import { useSelector } from '../redux/redux-utils.js'; import { usePersistedStateLoaded } from '../selectors/app-state-selectors.js'; @@ -572,7 +573,7 @@ if (__DEV__) { signInButtons.push( { + this.props.navigation.navigate(QRCodeSignInNavigatorRouteName); + }; + onPressRegister = () => { this.keyboardHeightValue.setValue(-1); this.setMode('register'); diff --git a/native/navigation/root-navigator.react.js b/native/navigation/root-navigator.react.js --- a/native/navigation/root-navigator.react.js +++ b/native/navigation/root-navigator.react.js @@ -44,6 +44,7 @@ InviteLinkNavigatorRouteName, CommunityCreationRouteName, RolesNavigatorRouteName, + QRCodeSignInNavigatorRouteName, } from './route-names.js'; import LoggedOutModal from '../account/logged-out-modal.react.js'; import RegistrationNavigator from '../account/registration/registration-navigator.react.js'; @@ -59,6 +60,7 @@ import CommunityCreationNavigator from '../community-creation/community-creation-navigator.react.js'; import InviteLinksNavigator from '../invite-links/invite-links-navigator.react.js'; import CustomServerModal from '../profile/custom-server-modal.react.js'; +import QRCodeSignInNavigator from '../qr-code/qr-code-sign-in-navigator.react.js'; import RolesNavigator from '../roles/roles-navigator.react.js'; enableScreens(); @@ -205,6 +207,11 @@ component={RegistrationNavigator} options={disableGesturesScreenOptions} /> + > = RouteProp; -export const accountModals = [LoggedOutModalRouteName, RegistrationRouteName]; +export const accountModals = [ + LoggedOutModalRouteName, + RegistrationRouteName, + QRCodeSignInNavigatorRouteName, +]; export const scrollBlockingModals = [ ImageModalRouteName, diff --git a/native/qr-code/qr-code-screen.react.js b/native/qr-code/qr-code-screen.react.js new file mode 100644 --- /dev/null +++ b/native/qr-code/qr-code-screen.react.js @@ -0,0 +1,86 @@ +// @flow + +import * as React from 'react'; +import { View, Text } from 'react-native'; +import QRCode from 'react-native-qrcode-svg'; + +import type { QRCodeSignInNavigationProp } from './qr-code-sign-in-navigator.react.js'; +import type { NavigationRoute } from '../navigation/route-names.js'; +import { useStyles } from '../themes/colors.js'; + +type QRCodeScreenProps = { + +navigation: QRCodeSignInNavigationProp<'QRCodeScreen'>, + +route: NavigationRoute<'QRCodeScreen'>, +}; + +// eslint-disable-next-line no-unused-vars +function QRCodeScreen(props: QRCodeScreenProps): React.Node { + const styles = useStyles(unboundStyles); + return ( + + Log in to Comm + + Open the Comm app on your phone and scan the QR code below + + + + How to find the scanner: + + Go to + Profile + + + Select + Linked devices + + + Click + Add + on the top right + + + + ); +} + +const unboundStyles = { + container: { + flex: 1, + alignItems: 'center', + marginTop: 125, + }, + heading: { + fontSize: 24, + color: 'panelForegroundLabel', + paddingBottom: 12, + }, + headingSubtext: { + fontSize: 12, + color: 'panelForegroundLabel', + paddingBottom: 30, + }, + instructionsBox: { + alignItems: 'center', + width: 300, + marginTop: 40, + padding: 15, + borderColor: 'panelForegroundLabel', + borderWidth: 2, + borderRadius: 8, + }, + instructionsTitle: { + fontSize: 12, + color: 'panelForegroundLabel', + paddingBottom: 15, + }, + instructionsStep: { + fontSize: 12, + padding: 1, + color: 'panelForegroundLabel', + }, + instructionsBold: { + fontWeight: 'bold', + }, +}; + +export default QRCodeScreen; diff --git a/native/qr-code/qr-code-sign-in-navigator.react.js b/native/qr-code/qr-code-sign-in-navigator.react.js new file mode 100644 --- /dev/null +++ b/native/qr-code/qr-code-sign-in-navigator.react.js @@ -0,0 +1,77 @@ +// @flow + +import { + createStackNavigator, + type StackNavigationProp, + type StackNavigationHelpers, +} from '@react-navigation/stack'; +import * as React from 'react'; +import { SafeAreaView } from 'react-native-safe-area-context'; + +import QRCodeScreen from './qr-code-screen.react.js'; +import type { RootNavigationProp } from '../navigation/root-navigator.react.js'; +import { + type ScreenParamList, + type QRCodeSignInParamList, + QRCodeScreenRouteName, +} from '../navigation/route-names.js'; +import { useStyles, useColors } from '../themes/colors.js'; + +const safeAreaEdges = ['bottom']; + +export type QRCodeSignInNavigationProp< + RouteName: $Keys, +> = StackNavigationProp; + +const QRCodeSignInStack = createStackNavigator< + ScreenParamList, + QRCodeSignInParamList, + StackNavigationHelpers, +>(); + +type QRCodeSignInNavigatorProps = { + +navigation: RootNavigationProp<'QRCodeSignInNavigator'>, + ... +}; + +// eslint-disable-next-line no-unused-vars +function QRCodeSignInNavigator(props: QRCodeSignInNavigatorProps): React.Node { + const styles = useStyles(unboundStyles); + const colors = useColors(); + + const screenOptions = React.useMemo( + () => ({ + headerTransparent: true, + headerBackTitleVisible: false, + headerTitle: '', + headerTintColor: colors.panelForegroundLabel, + headerLeftContainerStyle: { + paddingLeft: 12, + }, + }), + [colors.panelForegroundLabel], + ); + + return ( + + + + + + ); +} + +const unboundStyles = { + safeArea: { + flex: 1, + backgroundColor: 'modalBackground', + }, + headerLeftStyle: { + paddingLeft: 12, + }, +}; + +export default QRCodeSignInNavigator;