11 | Solito Example App
12 |
16 |
17 |
18 |
19 |
20 |
21 | >
22 | )
23 | }
24 |
25 | export default MyApp
26 |
--------------------------------------------------------------------------------
/apps/next/pages/_document.tsx:
--------------------------------------------------------------------------------
1 | export { default } from "@expo/next-adapter/document"
2 |
--------------------------------------------------------------------------------
/apps/next/pages/home.tsx:
--------------------------------------------------------------------------------
1 | import { HomeScreen } from 'app/features/home/screen'
2 |
3 | export default HomeScreen
4 |
--------------------------------------------------------------------------------
/apps/next/pages/index.tsx:
--------------------------------------------------------------------------------
1 | import { LoginScreen } from 'app/features/auth/LoginScreen'
2 |
3 | export default LoginScreen
4 |
--------------------------------------------------------------------------------
/apps/next/pages/terms.tsx:
--------------------------------------------------------------------------------
1 | import { TermsScreen } from 'app/features/auth/TermsScreen'
2 |
3 | export default TermsScreen
4 |
--------------------------------------------------------------------------------
/apps/next/pages/user/[id].tsx:
--------------------------------------------------------------------------------
1 | import { UserDetailScreen } from 'app/features/user/detail-screen'
2 |
3 | export default UserDetailScreen
4 |
--------------------------------------------------------------------------------
/apps/next/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/flexbox/react-native-nextjs-monorepo/9ad217ac45ac2bf06e6cbe8c074cad9dc4fb09ed/apps/next/public/favicon.ico
--------------------------------------------------------------------------------
/apps/next/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/apps/next/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "node",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true
17 | },
18 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
19 | "exclude": ["node_modules"]
20 | }
21 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "solito-blank",
3 | "private": true,
4 | "workspaces": [
5 | "apps/*",
6 | "packages/*"
7 | ],
8 | "devDependencies": {
9 | "@types/react": "^17.0.39",
10 | "@types/react-native": "^0.67.2",
11 | "eslint": "8.10.0",
12 | "turbo": "^1.1.6",
13 | "typescript": "^4.6.2"
14 | },
15 | "scripts": {
16 | "native": "cd apps/expo && expo start",
17 | "web": "cd apps/next && yarn next"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/packages/app/features/auth/AuthContext.tsx:
--------------------------------------------------------------------------------
1 |
2 | import type { FunctionComponent } from "react";
3 | import React, { createContext, useContext, useState } from "react";
4 |
5 | interface AuthContextProps {
6 | user: boolean;
7 | setUser: (user: boolean) => void;
8 | }
9 |
10 | const AuthContext = createContext(
11 | {} as AuthContextProps
12 | );
13 |
14 | export const AuthenticationProvider: FunctionComponent = ({ children }) => {
15 | const [user, setUser] = useState(false);
16 |
17 | return (
18 |
19 | {children}
20 |
21 | );
22 | };
23 |
24 | export const useAuthentication = () => useContext(AuthContext);
25 |
--------------------------------------------------------------------------------
/packages/app/features/auth/LoginScreen.tsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react'
2 | import { StyleSheet, TouchableOpacity, Text, View, Platform } from 'react-native'
3 | import { Button, Colors, TextInput } from 'react-native-paper'
4 | import { useRouter } from 'solito/router'
5 | import { useAuthentication } from './AuthContext'
6 |
7 | export const LoginScreen = () => {
8 | const [email, setEmail] = useState('')
9 | const [password, setPassword] = useState('')
10 | const [isVisble, setIsVisible] = useState(true)
11 |
12 | const { push } = useRouter()
13 |
14 | const navigateToTerms = () => {
15 | push('/terms/')
16 | }
17 |
18 | const { setUser } = useAuthentication()
19 | function handleLogin() {
20 | setUser(true)
21 | if(Platform.OS ==='web'){
22 | push('/home')
23 | }
24 | }
25 |
26 | function toggleSecureIcon() {
27 | setIsVisible(!isVisble)
28 | }
29 |
30 | return (
31 |
32 |
33 | setEmail(value)}
37 | />
38 | setPassword(value)}
43 | right={
44 |
48 | }
49 | />
50 |
57 |
58 |
59 | by login you accept the Terms and Conditions.
60 |
61 |
62 |
63 |
64 | )
65 | }
66 |
67 | const styles = StyleSheet.create({
68 | content: {
69 | padding: 16,
70 | },
71 | submitButton: {
72 | marginVertical: 32,
73 | marginHorizontal: 16,
74 | backgroundColor: Colors.purple500,
75 | },
76 | tocText: {
77 | textAlign: 'center',
78 | fontSize: 14,
79 | color: Colors.grey500,
80 | },
81 | })
82 |
--------------------------------------------------------------------------------
/packages/app/features/auth/TermsScreen.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { View, Text, Image, ScrollView } from "react-native";
3 | import { Appbar, Colors, Title } from "react-native-paper";
4 | import { useRouter } from "solito/router";
5 |
6 | export function TermsScreen() {
7 | const { back } = useRouter()
8 |
9 | function goBack() {
10 | back()
11 | }
12 |
13 | return (
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | This Terms of Service, including all supplemental terms as amended
22 | from time to time, governs your use of the online game, service, or
23 | web site known as Star Wars: The Old Republic ("TOR" and the "TOR
24 | Services") operated by BioWare Austin LLC, its subsidiaries and
25 | affiliates (collectively, "BioWare"). Please read the Supplemental
26 | Terms which are contained in links to this Terms of Service or at the
27 | bottom of this document. Supplemental Terms and TOR Privacy Policy and
28 | other Terms are an integral part of this Terms of Service and
29 | incorporated in this document by reference. You can find the Terms of
30 | Service at the "Terms of Service" link at the bottom of the TOR
31 | website from which you may also print a copy for your records.
32 |
33 | 1. Account
34 |
35 | A TOR Account ("Account") may be required to access and use TOR
36 | Services. If you have questions about Account registration, please
37 | contact us by visiting http://www.swtor.com/support. To create a TOR
38 | Account, you must have an email address, and provide truthful and
39 | accurate information. TOR Accounts are available only to adults, or in
40 | their discretion, their minor child. If you are a minor, your parent
41 | or guardian must complete the registration process, in which case he
42 | or she takes full responsibility for all obligations under this Terms
43 | of Service. TOR Accounts will not be allowed for minors under thirteen
44 | (13) years of age, regardless of permission and/or registration by
45 | such minor's parent or guardian. You must be eligible to use the TOR
46 | Service for which you are registering. Some TOR Services may require
47 | creation of a ["User Name" or "Persona"]. [User names or Personas] are
48 | tied to your Account. You may not use a ["User Name" or "Persona"]
49 | that is used by someone else, is vulgar or offensive, or otherwise
50 | violates the Terms of Service. You are solely responsible for all
51 | activity on your Account. Your Account may be terminated if someone
52 | else uses it to engage in activity that violates the Terms of Service
53 | or is otherwise improper or illegal. You should not reveal your
54 | Account password to others. BioWare and LucasArts will not ask you to
55 | reveal your password, or ever initiate any contact with you asking for
56 | your password reminder words.
57 |
58 | 2. Service
59 |
60 | Some TOR Services require payment of a fee. You must have an Account
61 | and pay the subscription or other fees to participate in these
62 | activities. Information about subscription and other fees for TOR
63 | Services is published in the relevant pages at
64 | http://www.swtor.com/support.
65 |
66 | 3. Privacy
67 |
68 | Your privacy is important to us. Please read the TOR Privacy Policy
69 | carefully for information relating to TOR collection and use of
70 | personal information. You may access the TOR Privacy Policy by
71 | visiting “Privacy Policy” at
72 | http://www.swtor.com/legalnotices/privacypolicy. When you connect to
73 | TOR Service, we may retrieve information from the computer used to log
74 | onto the TOR Service. The information we collect may include
75 | information about the computer's hardware system and any data related
76 | to the computer's operation of the TOR Software or use of TOR
77 | Services. We will not collect any personal information about you,
78 | however, without your knowledge and consent as stated in our Privacy
79 | Policy at http://www.swtor.com/legalnotices/privacypolicy.
80 |
81 | 4. Content
82 |
83 | "Content" on TOR Services may include software, technology, text,
84 | artwork, music, sound, and other audio visual material, and the design
85 | and appearance of our websites. Content may be provided by third
86 | parties, including other users of TOR Services. BioWare and LucasArts
87 | do not pre-screen all Content and does not endorse, approve, or
88 | prescreen any Content that you and other users may contribute to TOR
89 | Services. You bear the entire risk of the completeness, accuracy or
90 | usefulness of Content found on TOR Services. BioWare and LucasArts
91 | reserves the right to remove Content that is objectionable to us for
92 | any reason. The decision to remove Content is in BioWare's and
93 | LucasArts' sole and final discretion. To the maximum extent permitted
94 | by applicable law, BioWare and LucasArts does not assume any
95 | responsibility or liability for Content that is generated by third
96 | parties or for the failure or delay in removing any such Content.
97 |
98 |
104 |
105 | May the force be with you
106 |
107 |
108 | );
109 | }
110 |
--------------------------------------------------------------------------------
/packages/app/features/home/screen.tsx:
--------------------------------------------------------------------------------
1 | import { Text, useSx, View, H1, P, Row, A } from 'dripsy'
2 | import { TextLink } from 'solito/link'
3 | import { MotiLink } from 'solito/moti'
4 |
5 | export function HomeScreen() {
6 | const sx = useSx()
7 |
8 | return (
9 |
12 |
Welcome to Solito.
13 |
14 |
15 | Here is a basic starter to show you how you can navigate from one
16 | screen to another. This screen uses the same code on Next.js and React
17 | Native.
18 |