├── .gitignore
├── LICENSE
├── README.md
├── app.json
├── app
├── +not-found.tsx
├── _layout.tsx
├── index.tsx
└── onboarding
│ ├── _layout.tsx
│ ├── step-1.tsx
│ ├── step-2.tsx
│ ├── step-3.tsx
│ └── welcome.tsx
├── assets
└── images
│ ├── adaptive-icon.png
│ ├── favicon.png
│ ├── icon.png
│ ├── partial-react-logo.png
│ ├── react-logo.png
│ ├── react-logo3x.png
│ ├── react-logo@2x.png
│ └── splash-icon.png
├── components
├── ThemedText.tsx
├── ThemedView.tsx
└── ui
│ └── OnBoardingLayout.tsx
├── constants
└── Colors.ts
├── eas.json
├── hooks
├── useColorScheme.ts
├── useColorScheme.web.ts
└── useThemeColor.ts
├── package-lock.json
├── package.json
├── scripts
└── reset-project.js
├── styles
└── index.ts
└── tsconfig.json
/.gitignore:
--------------------------------------------------------------------------------
1 | # Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
2 |
3 | # dependencies
4 | node_modules/
5 |
6 | # Expo
7 | .expo/
8 | dist/
9 | web-build/
10 | expo-env.d.ts
11 |
12 | # Native
13 | *.orig.*
14 | *.jks
15 | *.p8
16 | *.p12
17 | *.key
18 | *.mobileprovision
19 |
20 | # Metro
21 | .metro-health-check*
22 |
23 | # debug
24 | npm-debug.*
25 | yarn-debug.*
26 | yarn-error.*
27 |
28 | # macOS
29 | .DS_Store
30 | *.pem
31 |
32 | # local env files
33 | .env*.local
34 |
35 | # typescript
36 | *.tsbuildinfo
37 |
38 | app-example
39 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2025 Solarin
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Welcome to your Expo app 👋
2 |
3 | This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app).
4 |
5 | ## Get started
6 |
7 | 1. Install dependencies
8 |
9 | ```bash
10 | npm install
11 | ```
12 |
13 | 2. Start the app
14 |
15 | ```bash
16 | npx expo start
17 | ```
18 |
19 | In the output, you'll find options to open the app in a
20 |
21 | - [development build](https://docs.expo.dev/develop/development-builds/introduction/)
22 | - [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)
23 | - [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)
24 | - [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo
25 |
26 | You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction).
27 |
28 | ## Get a fresh project
29 |
30 | When you're ready, run:
31 |
32 | ```bash
33 | npm run reset-project
34 | ```
35 |
36 | This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing.
37 |
38 | ## Learn more
39 |
40 | To learn more about developing your project with Expo, look at the following resources:
41 |
42 | - [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides).
43 | - [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web.
44 |
45 | ## Join the community
46 |
47 | Join our community of developers creating universal apps.
48 |
49 | - [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute.
50 | - [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions.
51 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "expo": {
3 | "name": "react-native-onboarding",
4 | "slug": "react-native-onboarding",
5 | "version": "1.0.0",
6 | "orientation": "portrait",
7 | "icon": "./assets/images/icon.png",
8 | "scheme": "myapp",
9 | "userInterfaceStyle": "automatic",
10 | "newArchEnabled": true,
11 | "ios": {
12 | "supportsTablet": true
13 | },
14 | "android": {
15 | "adaptiveIcon": {
16 | "foregroundImage": "./assets/images/adaptive-icon.png",
17 | "backgroundColor": "#ffffff"
18 | },
19 | "package": "com.solarin.reactnativeonboarding"
20 | },
21 | "web": {
22 | "bundler": "metro",
23 | "output": "static",
24 | "favicon": "./assets/images/favicon.png"
25 | },
26 | "plugins": [
27 | "expo-router",
28 | [
29 | "expo-splash-screen",
30 | {
31 | "image": "./assets/images/splash-icon.png",
32 | "imageWidth": 200,
33 | "resizeMode": "contain",
34 | "backgroundColor": "#ffffff"
35 | }
36 | ]
37 | ],
38 | "experiments": {
39 | "typedRoutes": true
40 | },
41 | "extra": {
42 | "router": {
43 | "origin": false
44 | },
45 | "eas": {
46 | "projectId": "8f3a7a93-0a82-4b5f-a4e7-5c9652baa925"
47 | }
48 | },
49 | "owner": "solarin"
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/app/+not-found.tsx:
--------------------------------------------------------------------------------
1 | import { Link, Stack } from 'expo-router';
2 | import { StyleSheet } from 'react-native';
3 |
4 | import { ThemedText } from '@/components/ThemedText';
5 | import { ThemedView } from '@/components/ThemedView';
6 |
7 | export default function NotFoundScreen() {
8 | return (
9 | <>
10 |
11 |
12 | This screen doesn't exist.
13 |
14 | Go to home screen!
15 |
16 |
17 | >
18 | );
19 | }
20 |
21 | const styles = StyleSheet.create({
22 | container: {
23 | flex: 1,
24 | alignItems: 'center',
25 | justifyContent: 'center',
26 | padding: 20,
27 | },
28 | link: {
29 | marginTop: 15,
30 | paddingVertical: 15,
31 | },
32 | });
33 |
--------------------------------------------------------------------------------
/app/_layout.tsx:
--------------------------------------------------------------------------------
1 | import {
2 | DarkTheme,
3 | DefaultTheme,
4 | ThemeProvider,
5 | } from "@react-navigation/native";
6 | import * as NavigationBar from "expo-navigation-bar";
7 | import { Stack } from "expo-router";
8 | import * as SplashScreen from "expo-splash-screen";
9 | import { StatusBar } from "expo-status-bar";
10 | import { useEffect } from "react";
11 | import "react-native-reanimated";
12 | import { useColorScheme } from "@/hooks/useColorScheme";
13 | import { ThemedView } from "@/components/ThemedView";
14 | import {
15 | useFonts,
16 | Roboto_400Regular,
17 | Roboto_500Medium,
18 | Roboto_700Bold,
19 | Roboto_900Black,
20 | } from "@expo-google-fonts/roboto";
21 | import { Platform } from "react-native";
22 |
23 | export default function RootLayout() {
24 | const colorScheme = useColorScheme();
25 |
26 | let [fontsLoaded] = useFonts({
27 | Roboto_400Regular,
28 | Roboto_500Medium,
29 | Roboto_700Bold,
30 | Roboto_900Black,
31 | });
32 |
33 | useEffect(() => {
34 | const setNavBar = async () => {
35 | try {
36 | // ensures splash screen is visible during setup
37 | await SplashScreen.preventAutoHideAsync();
38 | // enables edge-to-edge mode
39 | await NavigationBar.setPositionAsync("absolute");
40 | // transparent backgrounds to see through
41 | await NavigationBar.setBackgroundColorAsync("#ffffff00");
42 | } catch (e) {
43 | console.warn("Error setting navigation bar:", e);
44 | } finally {
45 | if (fontsLoaded) {
46 | // hide splash screen once setup and fonts are complete
47 | await SplashScreen.hideAsync();
48 | }
49 | }
50 | };
51 | if (Platform.OS === "android") {
52 | setNavBar();
53 | }
54 | }, [fontsLoaded]);
55 |
56 | return (
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | );
66 | }
67 |
--------------------------------------------------------------------------------
/app/index.tsx:
--------------------------------------------------------------------------------
1 | import { Redirect } from "expo-router";
2 |
3 | export default function Index() {
4 | return ;
5 | }
6 |
--------------------------------------------------------------------------------
/app/onboarding/_layout.tsx:
--------------------------------------------------------------------------------
1 | import { Stack } from "expo-router";
2 | import React from "react";
3 |
4 | const OPTION_CONFIG = {
5 | presentation: "transparentModal" as const,
6 | animation: "none" as const,
7 | };
8 |
9 | export default function Layout() {
10 | return (
11 |
12 |
13 |
14 |
15 |
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/app/onboarding/step-1.tsx:
--------------------------------------------------------------------------------
1 | import { ThemedText } from "@/components/ThemedText";
2 | import { OnBoardingLayout } from "@/components/ui/OnBoardingLayout";
3 | import { useThemeColor } from "@/hooks/useThemeColor";
4 | import React from "react";
5 | import { Image } from "expo-image";
6 | import { View } from "react-native";
7 | import { generalStyles } from "@/styles";
8 |
9 | export default function OnboardingStepOne() {
10 | const primary1 = useThemeColor({}, "primary1");
11 | return (
12 |
13 |
14 |
19 |
20 |
21 | React Native Onboarding
22 |
23 |
24 |
25 |
26 | );
27 | }
28 |
--------------------------------------------------------------------------------
/app/onboarding/step-2.tsx:
--------------------------------------------------------------------------------
1 | import { OnBoardingLayout } from "@/components/ui/OnBoardingLayout";
2 | import { useThemeColor } from "@/hooks/useThemeColor";
3 | import { generalStyles } from "@/styles";
4 | import React from "react";
5 | import { View, Text, Dimensions } from "react-native";
6 |
7 | export default function OnboardingStepTwo() {
8 | const primary1 = useThemeColor({}, "primary1");
9 | const primary2 = useThemeColor({}, "primary2");
10 |
11 | return (
12 |
17 |
18 |
19 |
20 | Expo Router Navigation
21 |
22 |
23 | Handles screen transitions smoothly in the onboarding flow.
24 |
25 |
26 |
27 |
28 | );
29 | }
30 |
--------------------------------------------------------------------------------
/app/onboarding/step-3.tsx:
--------------------------------------------------------------------------------
1 | import { ThemedText } from "@/components/ThemedText";
2 | import { OnBoardingLayout } from "@/components/ui/OnBoardingLayout";
3 | import { useThemeColor } from "@/hooks/useThemeColor";
4 | import { generalStyles } from "@/styles";
5 | import React from "react";
6 | import { View, Text, Dimensions } from "react-native";
7 |
8 | export default function OnboardingStepTwo() {
9 | const bg = useThemeColor({}, "background");
10 | const text = useThemeColor({}, "text");
11 | const primary2 = useThemeColor({}, "primary2");
12 |
13 | return (
14 |
21 |
22 |
23 |
24 | Seamless Animations
25 |
26 |
27 | Bringing your onboarding to life with smooth transitions.
28 |
29 |
30 |
31 |
32 | );
33 | }
34 |
--------------------------------------------------------------------------------
/app/onboarding/welcome.tsx:
--------------------------------------------------------------------------------
1 | import { ThemedText } from "@/components/ThemedText";
2 | import { OnBoardingLayout } from "@/components/ui/OnBoardingLayout";
3 | import { useThemeColor } from "@/hooks/useThemeColor";
4 | import { generalStyles } from "@/styles";
5 | import React from "react";
6 | import { View, Dimensions } from "react-native";
7 |
8 | export default function OnboardingStepTwo() {
9 | const bg = useThemeColor({}, "background");
10 |
11 | return (
12 |
13 |
14 |
15 |
24 | You're In!
25 |
26 |
33 | Everything's ready. Start building with React Native now.
34 |
35 |
36 |
37 |
38 | );
39 | }
40 |
--------------------------------------------------------------------------------
/assets/images/adaptive-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Solarin-Johnson/react-native-onboarding/0e15bf710b82783fe2aea7a9b6a2b7520fbfb688/assets/images/adaptive-icon.png
--------------------------------------------------------------------------------
/assets/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Solarin-Johnson/react-native-onboarding/0e15bf710b82783fe2aea7a9b6a2b7520fbfb688/assets/images/favicon.png
--------------------------------------------------------------------------------
/assets/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Solarin-Johnson/react-native-onboarding/0e15bf710b82783fe2aea7a9b6a2b7520fbfb688/assets/images/icon.png
--------------------------------------------------------------------------------
/assets/images/partial-react-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Solarin-Johnson/react-native-onboarding/0e15bf710b82783fe2aea7a9b6a2b7520fbfb688/assets/images/partial-react-logo.png
--------------------------------------------------------------------------------
/assets/images/react-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Solarin-Johnson/react-native-onboarding/0e15bf710b82783fe2aea7a9b6a2b7520fbfb688/assets/images/react-logo.png
--------------------------------------------------------------------------------
/assets/images/react-logo3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Solarin-Johnson/react-native-onboarding/0e15bf710b82783fe2aea7a9b6a2b7520fbfb688/assets/images/react-logo3x.png
--------------------------------------------------------------------------------
/assets/images/react-logo@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Solarin-Johnson/react-native-onboarding/0e15bf710b82783fe2aea7a9b6a2b7520fbfb688/assets/images/react-logo@2x.png
--------------------------------------------------------------------------------
/assets/images/splash-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Solarin-Johnson/react-native-onboarding/0e15bf710b82783fe2aea7a9b6a2b7520fbfb688/assets/images/splash-icon.png
--------------------------------------------------------------------------------
/components/ThemedText.tsx:
--------------------------------------------------------------------------------
1 | import { Text, type TextProps, StyleSheet } from 'react-native';
2 |
3 | import { useThemeColor } from '@/hooks/useThemeColor';
4 |
5 | export type ThemedTextProps = TextProps & {
6 | lightColor?: string;
7 | darkColor?: string;
8 | type?: 'default' | 'title' | 'defaultSemiBold' | 'subtitle' | 'link';
9 | };
10 |
11 | export function ThemedText({
12 | style,
13 | lightColor,
14 | darkColor,
15 | type = 'default',
16 | ...rest
17 | }: ThemedTextProps) {
18 | const color = useThemeColor({ light: lightColor, dark: darkColor }, 'text');
19 |
20 | return (
21 |
33 | );
34 | }
35 |
36 | const styles = StyleSheet.create({
37 | default: {
38 | fontSize: 16,
39 | lineHeight: 24,
40 | },
41 | defaultSemiBold: {
42 | fontSize: 16,
43 | lineHeight: 24,
44 | fontWeight: '600',
45 | },
46 | title: {
47 | fontSize: 32,
48 | fontWeight: 'bold',
49 | lineHeight: 32,
50 | },
51 | subtitle: {
52 | fontSize: 20,
53 | fontWeight: 'bold',
54 | },
55 | link: {
56 | lineHeight: 30,
57 | fontSize: 16,
58 | color: '#0a7ea4',
59 | },
60 | });
61 |
--------------------------------------------------------------------------------
/components/ThemedView.tsx:
--------------------------------------------------------------------------------
1 | import { View, type ViewProps } from 'react-native';
2 |
3 | import { useThemeColor } from '@/hooks/useThemeColor';
4 |
5 | export type ThemedViewProps = ViewProps & {
6 | lightColor?: string;
7 | darkColor?: string;
8 | };
9 |
10 | export function ThemedView({ style, lightColor, darkColor, ...otherProps }: ThemedViewProps) {
11 | const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor }, 'background');
12 |
13 | return ;
14 | }
15 |
--------------------------------------------------------------------------------
/components/ui/OnBoardingLayout.tsx:
--------------------------------------------------------------------------------
1 | import { useThemeColor } from "@/hooks/useThemeColor";
2 | import React, { useEffect, useState } from "react";
3 | import {
4 | StyleSheet,
5 | Text,
6 | Pressable,
7 | useWindowDimensions,
8 | BackHandler,
9 | } from "react-native";
10 | import FontAwesome6 from "@expo/vector-icons/FontAwesome6";
11 | import { router, useFocusEffect } from "expo-router";
12 | import Animated, {
13 | useAnimatedStyle,
14 | useDerivedValue,
15 | useSharedValue,
16 | withDelay,
17 | withSpring,
18 | withTiming,
19 | } from "react-native-reanimated";
20 | import { useNavigationState } from "@react-navigation/native";
21 |
22 | type ValidPaths =
23 | | "/"
24 | | "/onboarding/step-1"
25 | | "/onboarding/step-2"
26 | | "/onboarding/step-3"
27 | | "/onboarding/welcome";
28 | interface OnBoardingLayoutProps {
29 | children: React.ReactNode;
30 | bgColor?: string;
31 | nextBgColor?: string;
32 | nextTextColor?: string;
33 | nextText?: string;
34 | nextHref?: ValidPaths;
35 | complete?: boolean;
36 | }
37 |
38 | const SPRING_CONFIG = {
39 | mass: 0.75,
40 | damping: 12,
41 | stiffness: 120,
42 | overshootClamping: false,
43 | restDisplacementThreshold: 0.01,
44 | restSpeedThreshold: 2,
45 | };
46 |
47 | export const OnBoardingLayout: React.FC = ({
48 | children,
49 | nextBgColor,
50 | bgColor,
51 | nextTextColor,
52 | nextText = "NEXT",
53 | nextHref,
54 | complete,
55 | }) => {
56 | const bg = useThemeColor({}, "background");
57 | const text = useThemeColor({}, "text");
58 | const backgroundColor = bgColor ? bgColor : bg;
59 | const nexBgColor = nextBgColor ? nextBgColor : text + "90";
60 | const nextColor = nextTextColor ? nextTextColor : bg;
61 | const [goingBack, setGoingBack] = useState(false);
62 | const { width } = useWindowDimensions();
63 | const scale = useSharedValue(1);
64 | const screenStack = useNavigationState((state) => state.routes);
65 | const initial = screenStack.length === 1; // Added to know if it's the first screen
66 |
67 | const normalScale = useDerivedValue(() => {
68 | return Math.min(1, scale.value - 1);
69 | });
70 |
71 | const dynamic_duration = initial
72 | ? 0
73 | : goingBack
74 | ? 650
75 | : Math.min(550, Math.max(width, 800));
76 |
77 | const TIMING_CONFIG_DYNAMIC = React.useMemo(
78 | () => ({
79 | duration: dynamic_duration,
80 | }),
81 | [dynamic_duration]
82 | );
83 |
84 | const TIMING_CONFIG = React.useMemo(
85 | () => ({
86 | duration: initial ? 0 : 600,
87 | }),
88 | [initial]
89 | );
90 |
91 | useEffect(() => {
92 | scale.value = Math.max(8, width / 80);
93 | }, [width]);
94 |
95 | const animatedStyle = useAnimatedStyle(() => ({
96 | transform: [{ scale: withTiming(scale.value, TIMING_CONFIG_DYNAMIC) }],
97 | }));
98 |
99 | const btnAnimatedStyle = useAnimatedStyle(() => ({
100 | transform: [{ scale: withTiming(normalScale.value, TIMING_CONFIG) }],
101 | }));
102 |
103 | const contentAnimatedStyle = useAnimatedStyle(() => ({
104 | transform: [
105 | {
106 | scale: goingBack
107 | ? withTiming(
108 | initial ? 1 : Math.max(0, normalScale.value),
109 | TIMING_CONFIG
110 | )
111 | : withSpring(
112 | initial ? 1 : Math.max(0, normalScale.value),
113 | SPRING_CONFIG
114 | ),
115 | },
116 | ],
117 | opacity: goingBack
118 | ? withTiming(0)
119 | : withDelay(120, withTiming(normalScale.value, TIMING_CONFIG)),
120 | }));
121 |
122 | const handleBack = React.useCallback(() => {
123 | if (initial || complete) return true;
124 | if (goingBack) return true; // Prevent multiple back actions
125 |
126 | setGoingBack(true);
127 | scale.value = 1;
128 |
129 | setTimeout(() => {
130 | setGoingBack(false);
131 | router.back();
132 | }, TIMING_CONFIG_DYNAMIC.duration);
133 |
134 | return true;
135 | }, [initial, complete, goingBack, scale, TIMING_CONFIG_DYNAMIC.duration]);
136 |
137 | useFocusEffect(() => {
138 | const backHandler = BackHandler.addEventListener(
139 | "hardwareBackPress",
140 | handleBack
141 | );
142 | return () => backHandler.remove();
143 | });
144 |
145 | return (
146 |
147 |
148 |
157 |
158 | {children}
159 |
160 | {nextHref && (
161 |
171 | router.push(nextHref)}
173 | style={styles.nextBtn}
174 | >
175 |
176 | {nextText}
177 |
178 |
184 |
185 |
186 | )}
187 |
188 |
189 | );
190 | };
191 |
192 | const styles = StyleSheet.create({
193 | container: {
194 | flex: 1,
195 | overflow: "hidden",
196 | },
197 | content: {
198 | flex: 1,
199 | paddingHorizontal: 20,
200 | transformOrigin: "140% 60%",
201 | maxWidth: 400,
202 | width: "100%",
203 | alignSelf: "center",
204 | },
205 | next: {
206 | position: "absolute",
207 | bottom: -20,
208 | right: -45,
209 | width: 200,
210 | aspectRatio: 1,
211 | borderRadius: "50%",
212 | paddingBottom: 10,
213 | paddingRight: 10,
214 | transformOrigin: "bottom right",
215 | },
216 | nextBtn: {
217 | flex: 1,
218 | flexDirection: "row",
219 | justifyContent: "center",
220 | alignItems: "center",
221 | },
222 | nextText: {
223 | paddingRight: 6,
224 | fontSize: 18,
225 | fontWeight: "600",
226 | fontFamily: "Roboto_700Bold",
227 | },
228 | overlay: {
229 | position: "absolute",
230 | bottom: -20,
231 | right: -45,
232 | width: 200,
233 | aspectRatio: 1,
234 | transformOrigin: "bottom right",
235 | borderRadius: "50%",
236 | borderBottomRightRadius: 0,
237 | },
238 | });
239 |
--------------------------------------------------------------------------------
/constants/Colors.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Below are the colors that are used in the app. The colors are defined in the light and dark mode.
3 | * There are many other ways to style your app. For example, [Nativewind](https://www.nativewind.dev/), [Tamagui](https://tamagui.dev/), [unistyles](https://reactnativeunistyles.vercel.app), etc.
4 | */
5 |
6 | const tintColorLight = "#0a7ea4";
7 | const tintColorDark = "#fff";
8 |
9 | const DEFAULTS = {
10 | primary1: "#8AADBC",
11 | primary2: "#EBD9BF",
12 | };
13 |
14 | export const Colors = {
15 | light: {
16 | text: "#11181C",
17 | background: "#fff",
18 | tint: tintColorLight,
19 | ...DEFAULTS,
20 | },
21 | dark: {
22 | text: "#ECEDEE",
23 | background: "#151718",
24 | tint: tintColorDark,
25 | ...DEFAULTS,
26 | },
27 | };
28 |
--------------------------------------------------------------------------------
/eas.json:
--------------------------------------------------------------------------------
1 | {
2 | "cli": {
3 | "version": ">= 15.0.10",
4 | "appVersionSource": "remote"
5 | },
6 | "build": {
7 | "development": {
8 | "developmentClient": true,
9 | "distribution": "internal"
10 | },
11 | "preview": {
12 | "distribution": "internal"
13 | },
14 | "production": {
15 | "autoIncrement": true
16 | }
17 | },
18 | "submit": {
19 | "production": {}
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/hooks/useColorScheme.ts:
--------------------------------------------------------------------------------
1 | export { useColorScheme } from 'react-native';
2 |
--------------------------------------------------------------------------------
/hooks/useColorScheme.web.ts:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from 'react';
2 | import { useColorScheme as useRNColorScheme } from 'react-native';
3 |
4 | /**
5 | * To support static rendering, this value needs to be re-calculated on the client side for web
6 | */
7 | export function useColorScheme() {
8 | const [hasHydrated, setHasHydrated] = useState(false);
9 |
10 | useEffect(() => {
11 | setHasHydrated(true);
12 | }, []);
13 |
14 | const colorScheme = useRNColorScheme();
15 |
16 | if (hasHydrated) {
17 | return colorScheme;
18 | }
19 |
20 | return 'light';
21 | }
22 |
--------------------------------------------------------------------------------
/hooks/useThemeColor.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Learn more about light and dark modes:
3 | * https://docs.expo.dev/guides/color-schemes/
4 | */
5 |
6 | import { Colors } from '@/constants/Colors';
7 | import { useColorScheme } from '@/hooks/useColorScheme';
8 |
9 | export function useThemeColor(
10 | props: { light?: string; dark?: string },
11 | colorName: keyof typeof Colors.light & keyof typeof Colors.dark
12 | ) {
13 | const theme = useColorScheme() ?? 'light';
14 | const colorFromProps = props[theme];
15 |
16 | if (colorFromProps) {
17 | return colorFromProps;
18 | } else {
19 | return Colors[theme][colorName];
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-onboarding",
3 | "main": "expo-router/entry",
4 | "version": "1.0.0",
5 | "scripts": {
6 | "start": "expo start",
7 | "reset-project": "node ./scripts/reset-project.js",
8 | "android": "expo run:android",
9 | "ios": "expo run:ios",
10 | "web": "expo start --web",
11 | "test": "jest --watchAll",
12 | "lint": "expo lint"
13 | },
14 | "jest": {
15 | "preset": "jest-expo"
16 | },
17 | "dependencies": {
18 | "@expo-google-fonts/roboto": "^0.2.3",
19 | "@expo/vector-icons": "^14.0.2",
20 | "@react-navigation/bottom-tabs": "^7.2.0",
21 | "@react-navigation/native": "^7.0.14",
22 | "expo": "~52.0.36",
23 | "expo-blur": "~14.0.3",
24 | "expo-constants": "~17.0.6",
25 | "expo-font": "~13.0.3",
26 | "expo-haptics": "~14.0.1",
27 | "expo-image": "~2.0.6",
28 | "expo-linking": "~7.0.5",
29 | "expo-navigation-bar": "~4.0.8",
30 | "expo-router": "~4.0.17",
31 | "expo-splash-screen": "~0.29.22",
32 | "expo-status-bar": "~2.0.1",
33 | "expo-symbols": "~0.2.2",
34 | "expo-system-ui": "~4.0.8",
35 | "expo-web-browser": "~14.0.2",
36 | "react": "18.3.1",
37 | "react-dom": "18.3.1",
38 | "react-native": "0.76.7",
39 | "react-native-gesture-handler": "~2.20.2",
40 | "react-native-reanimated": "~3.16.1",
41 | "react-native-safe-area-context": "4.12.0",
42 | "react-native-screens": "~4.4.0",
43 | "react-native-web": "~0.19.13",
44 | "react-native-webview": "13.12.5",
45 | "expo-dev-client": "~5.0.12"
46 | },
47 | "devDependencies": {
48 | "@babel/core": "^7.25.2",
49 | "@types/jest": "^29.5.12",
50 | "@types/react": "~18.3.12",
51 | "@types/react-test-renderer": "^18.3.0",
52 | "jest": "^29.2.1",
53 | "jest-expo": "~52.0.5",
54 | "react-test-renderer": "18.3.1",
55 | "typescript": "^5.3.3"
56 | },
57 | "private": true
58 | }
59 |
--------------------------------------------------------------------------------
/scripts/reset-project.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /**
4 | * This script is used to reset the project to a blank state.
5 | * It deletes or moves the /app, /components, /hooks, /scripts, and /constants directories to /app-example based on user input and creates a new /app directory with an index.tsx and _layout.tsx file.
6 | * You can remove the `reset-project` script from package.json and safely delete this file after running it.
7 | */
8 |
9 | const fs = require("fs");
10 | const path = require("path");
11 | const readline = require("readline");
12 |
13 | const root = process.cwd();
14 | const oldDirs = ["app", "components", "hooks", "constants", "scripts"];
15 | const exampleDir = "app-example";
16 | const newAppDir = "app";
17 | const exampleDirPath = path.join(root, exampleDir);
18 |
19 | const indexContent = `import { Text, View } from "react-native";
20 |
21 | export default function Index() {
22 | return (
23 |
30 | Edit app/index.tsx to edit this screen.
31 |
32 | );
33 | }
34 | `;
35 |
36 | const layoutContent = `import { Stack } from "expo-router";
37 |
38 | export default function RootLayout() {
39 | return ;
40 | }
41 | `;
42 |
43 | const rl = readline.createInterface({
44 | input: process.stdin,
45 | output: process.stdout,
46 | });
47 |
48 | const moveDirectories = async (userInput) => {
49 | try {
50 | if (userInput === "y") {
51 | // Create the app-example directory
52 | await fs.promises.mkdir(exampleDirPath, { recursive: true });
53 | console.log(`📁 /${exampleDir} directory created.`);
54 | }
55 |
56 | // Move old directories to new app-example directory or delete them
57 | for (const dir of oldDirs) {
58 | const oldDirPath = path.join(root, dir);
59 | if (fs.existsSync(oldDirPath)) {
60 | if (userInput === "y") {
61 | const newDirPath = path.join(root, exampleDir, dir);
62 | await fs.promises.rename(oldDirPath, newDirPath);
63 | console.log(`➡️ /${dir} moved to /${exampleDir}/${dir}.`);
64 | } else {
65 | await fs.promises.rm(oldDirPath, { recursive: true, force: true });
66 | console.log(`❌ /${dir} deleted.`);
67 | }
68 | } else {
69 | console.log(`➡️ /${dir} does not exist, skipping.`);
70 | }
71 | }
72 |
73 | // Create new /app directory
74 | const newAppDirPath = path.join(root, newAppDir);
75 | await fs.promises.mkdir(newAppDirPath, { recursive: true });
76 | console.log("\n📁 New /app directory created.");
77 |
78 | // Create index.tsx
79 | const indexPath = path.join(newAppDirPath, "index.tsx");
80 | await fs.promises.writeFile(indexPath, indexContent);
81 | console.log("📄 app/index.tsx created.");
82 |
83 | // Create _layout.tsx
84 | const layoutPath = path.join(newAppDirPath, "_layout.tsx");
85 | await fs.promises.writeFile(layoutPath, layoutContent);
86 | console.log("📄 app/_layout.tsx created.");
87 |
88 | console.log("\n✅ Project reset complete. Next steps:");
89 | console.log(
90 | `1. Run \`npx expo start\` to start a development server.\n2. Edit app/index.tsx to edit the main screen.${
91 | userInput === "y"
92 | ? `\n3. Delete the /${exampleDir} directory when you're done referencing it.`
93 | : ""
94 | }`
95 | );
96 | } catch (error) {
97 | console.error(`❌ Error during script execution: ${error.message}`);
98 | }
99 | };
100 |
101 | rl.question(
102 | "Do you want to move existing files to /app-example instead of deleting them? (Y/n): ",
103 | (answer) => {
104 | const userInput = answer.trim().toLowerCase() || "y";
105 | if (userInput === "y" || userInput === "n") {
106 | moveDirectories(userInput).finally(() => rl.close());
107 | } else {
108 | console.log("❌ Invalid input. Please enter 'Y' or 'N'.");
109 | rl.close();
110 | }
111 | }
112 | );
113 |
--------------------------------------------------------------------------------
/styles/index.ts:
--------------------------------------------------------------------------------
1 | import { StyleSheet } from "react-native";
2 |
3 | export const generalStyles = StyleSheet.create({
4 | text: {
5 | fontFamily: "Roboto_700Bold",
6 | },
7 | title: {
8 | fontSize: 25,
9 | textAlign: "center",
10 | lineHeight: 36,
11 | },
12 | container: {
13 | flex: 1,
14 | alignItems: "center",
15 | justifyContent: "center",
16 | gap: 20,
17 | },
18 | image: {
19 | width: 150,
20 | aspectRatio: 1,
21 | },
22 | textContainer: {
23 | flex: 0.4,
24 | paddingHorizontal: 5,
25 | width: "100%",
26 | gap: 12,
27 | },
28 | titleBold: {
29 | fontSize: 42,
30 | lineHeight: 54,
31 | textAlign: "left",
32 | },
33 | description: {
34 | fontSize: 16,
35 | opacity: 0.8,
36 | lineHeight: 24,
37 | },
38 | });
39 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "expo/tsconfig.base",
3 | "compilerOptions": {
4 | "strict": true,
5 | "paths": {
6 | "@/*": [
7 | "./*"
8 | ]
9 | }
10 | },
11 | "include": [
12 | "**/*.ts",
13 | "**/*.tsx",
14 | ".expo/types/**/*.ts",
15 | "expo-env.d.ts"
16 | ]
17 | }
18 |
--------------------------------------------------------------------------------