Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
nodejs 20.9.0
yarn 1.22.19
nodejs 22.17.0
Comment thread
kylemcd marked this conversation as resolved.
yarn 1.22.22
4 changes: 2 additions & 2 deletions examples/client-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0",
"@testing-library/user-event": "^14.5.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"scripts": {
"dev": "vite --port 3001",
Expand Down
5 changes: 5 additions & 0 deletions examples/expo-example/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": ["expo", "plugin:prettier/recommended"],
"ignorePatterns": ["dist/*"],
"root": true
}
4 changes: 4 additions & 0 deletions examples/expo-example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ node_modules/
.expo/
dist/
web-build/
expo-env.d.ts

# Native
.kotlin/
*.orig.*
*.jks
*.p8
Expand All @@ -33,3 +35,5 @@ yarn-error.*

# typescript
*.tsbuildinfo

app-example
55 changes: 37 additions & 18 deletions examples/expo-example/README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,50 @@
# Knock + Expo example app
# Welcome to your Expo app 👋

This example app uses [Knock](https://knock.app) to power in-app notifications. It uses the [Knock Expo SDK](../../packages/expo) and [Expo](https://docs.expo.dev/).
This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app).

> Not using Expo? See our [Knock + React Native example app](../react-native-example/README.md).
## Get started

## Running locally
1. Install dependencies

1. Install dependencies from the root of the monorepo.
```bash
npm install
```

```sh
yarn
```
2. Start the app

2. Make sure the packages have been built by running `yarn build:packages`
```bash
npx expo start
```

3. Configure the environment variables. Copy `.env.sample` to `.env.development.local` and add the relevant API keys and channel id from your Knock dashboard.
In the output, you'll find options to open the app in a

4. Set up your development environment to run native apps depending on your operating system and the platform you'd like to run the example on. See the [Expo docs](https://docs.expo.dev/guides/local-app-development/) for more information.
- [development build](https://docs.expo.dev/develop/development-builds/introduction/)
- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)
- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)
- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo

5. Run the example app. Optionally, specify which platform you'd like to run on
You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction).

```sh
yarn start
## Get a fresh project

# Or run the app on iOS
yarn ios
When you're ready, run:

# Or run the app on Android
yarn android
```bash
npm run reset-project
```

This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing.

## Learn more

To learn more about developing your project with Expo, look at the following resources:

- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides).
- [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.

## Join the community

Join our community of developers creating universal apps.

- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute.
- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions.
47 changes: 25 additions & 22 deletions examples/expo-example/app.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,43 @@
{
"expo": {
"name": "@knocklabs/expo-example",
"slug": "@knocklabs/expo-example",
Comment thread
kylemcd marked this conversation as resolved.
"name": "expo-example",
"slug": "expo-example",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"icon": "./assets/images/icon.png",
"scheme": "expoexample",
"userInterfaceStyle": "automatic",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"assetBundlePatterns": ["**/*"],
"newArchEnabled": true,
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"foregroundImage": "./assets/images/adaptive-icon.png",
"backgroundColor": "#ffffff"
}
},
"edgeToEdgeEnabled": true
},
"web": {
"favicon": "./assets/favicon.png"
"bundler": "metro",
"output": "static",
"favicon": "./assets/images/favicon.png"
},
"extra": {
"eas": {
"projectId": "YOUR_EAS_PROJECT_ID",
"userInterfaceStyle": "automatic",
"ios": {
"userInterfaceStyle": "automatic"
},
"android": {
"userInterfaceStyle": "automatic"
"plugins": [
"expo-router",
[
"expo-splash-screen",
{
"image": "./assets/images/splash-icon.png",
"imageWidth": 200,
"resizeMode": "contain",
"backgroundColor": "#ffffff"
}
}
]
],
"experiments": {
"typedRoutes": true,
"reactCanary": true
}
}
}
5 changes: 5 additions & 0 deletions examples/expo-example/app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Stack } from "expo-router";

export default function RootLayout() {
return <Stack />;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import {
KnockProvider,
NotificationIconButton,
} from "@knocklabs/expo";
import { StatusBar } from "expo-status-bar";
import React, { useCallback, useState } from "react";
import { useCallback, useState } from "react";
import { StyleSheet, View } from "react-native";

import NotificationFeedContainer from "./NotificationFeedContainer";
import NotificationFeedContainer from "@/components/NotificationFeedContainer";

const App: React.FC = () => {
export default function HomeScreen() {
const [isNotificationFeedOpen, setIsNotificationFeedOpen] = useState(false);

const onTopActionButtonTap = useCallback(() => {
setIsNotificationFeedOpen(!isNotificationFeedOpen);
}, [isNotificationFeedOpen]);
Expand All @@ -30,7 +30,6 @@ const App: React.FC = () => {
feedId={process.env.EXPO_PUBLIC_KNOCK_FEED_CHANNEL_ID}
>
<View style={styles.container}>
<StatusBar style="auto" />
{!isNotificationFeedOpen && (
<NotificationIconButton
onClick={onTopActionButtonTap}
Expand All @@ -49,9 +48,7 @@ const App: React.FC = () => {
</KnockExpoPushNotificationProvider>
</KnockProvider>
);
};

export default App;
}

const styles = StyleSheet.create({
container: {
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed examples/expo-example/assets/splash.png
Binary file not shown.
6 changes: 0 additions & 6 deletions examples/expo-example/babel.config.js

This file was deleted.

44 changes: 33 additions & 11 deletions examples/expo-example/package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,49 @@
{
"name": "@knocklabs/expo-example",
"version": "0.1.37",
"main": "src/index.ts",
"main": "expo-router/entry",
"version": "1.0.0",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"format": "prettier \"src/**/*.{js,ts,tsx}\" --write",
"format:check": "prettier \"src/**/*.{js,ts,tsx}\" --check"
"lint": "expo lint"
},
"dependencies": {
"@expo/vector-icons": "^14.1.0",
"@knocklabs/expo": "workspace:^",
"expo": ">=52.0.35",
"expo-constants": ">=17.1.5",
"expo-device": ">=7.0.3",
"expo-notifications": ">=0.29.13",
"expo-status-bar": "~2.0.1",
"react": "^18.2.0",
"react-native": "^0.73.4"
"@react-navigation/bottom-tabs": "^7.3.10",
"@react-navigation/elements": "^2.3.8",
"@react-navigation/native": "^7.1.6",
"expo": "~53.0.17",
"expo-blur": "~14.1.5",
"expo-constants": "~17.1.7",
"expo-font": "~13.3.2",
"expo-haptics": "~14.1.4",
"expo-image": "~2.3.2",
"expo-linking": "~7.1.7",
"expo-router": "~5.1.3",
"expo-splash-screen": "~0.30.10",
"expo-status-bar": "~2.2.3",
"expo-symbols": "~0.4.5",
"expo-system-ui": "~5.0.10",
"expo-web-browser": "~14.2.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-native": "^0.79.2",
"react-native-gesture-handler": "^2.27.1",
"react-native-reanimated": "~3.17.4",
"react-native-safe-area-context": "5.4.0",
"react-native-screens": "~4.11.1",
"react-native-web": "~0.20.0",
"react-native-webview": "13.13.5"
},
"devDependencies": {
"@babel/core": "^7.26.0",
"@types/react": "^19.1.8",
"eslint": "^8.56.0",
"eslint-config-expo": "~9.2.0",
"eslint-plugin-prettier": "^5.5.1",
"typescript": "^5.8.3"
},
"private": true
Expand Down
8 changes: 0 additions & 8 deletions examples/expo-example/src/index.ts

This file was deleted.

17 changes: 13 additions & 4 deletions examples/expo-example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
{
"extends": "expo/tsconfig.base",
"compilerOptions": {
"jsx": "react"
"strict": true,
"paths": {
"@/*": [
"./*"
]
}
},
"extends": "expo/tsconfig.base",
"include": ["src"],
"exclude": ["node_modules"]
"include": [
"**/*.ts",
"**/*.tsx",
".expo/types/**/*.ts",
"expo-env.d.ts"
]
}
8 changes: 4 additions & 4 deletions examples/guide-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
"dependencies": {
"@knocklabs/client": "workspace:^",
"@knocklabs/react": "workspace:^",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-router": "^7.6.1"
},
"devDependencies": {
"@eslint/js": "^9.9.0",
"@types/react": "^18.3.6",
"@types/react-dom": "^18.2.15",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@vitejs/plugin-react": "^4.5.1",
"eslint": "^8.56.0",
"eslint-plugin-react-hooks": "^5.2.0",
Expand Down
8 changes: 4 additions & 4 deletions examples/ms-teams-connect-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
"@knocklabs/react": "0.7.20",
"jsonwebtoken": "^9.0.2",
"next": "15.3.3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@types/jsonwebtoken": "^9.0.9",
"@types/node": "^22",
"@types/react": "^18.3.6",
"@types/react-dom": "^18.2.15",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"eslint": "^8.56.0",
"eslint-config-next": "15.3.5",
"typescript": "^5.8.3"
Expand Down
8 changes: 4 additions & 4 deletions examples/nextjs-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"lucide-react": "^0.525.0",
"next": "15.3.3",
"next-seo": "^6.8.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-icons": "^5.4.0",
"sonner": "^2.0.5",
"swr": "^2.3.3",
Expand All @@ -42,8 +42,8 @@
"@next/eslint-plugin-next": "^15.3.1",
"@types/eslint": "^8.44.7",
"@types/node": "^22",
"@types/react": "^18.3.6",
"@types/react-dom": "^18.2.15",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@types/uuid": "^10.0.0",
"eslint": "^8.56.0",
"typescript": "^5.8.3"
Expand Down
6 changes: 3 additions & 3 deletions examples/react-native-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"@knocklabs/react-native": "workspace:^",
"@react-native-firebase/app": "^22.1.0",
"@react-native-firebase/messaging": "^22.2.0",
"react": "^18.2.0",
"react-native": "^0.73.4",
"react": "^19.0.0",
"react-native": "^0.79.2",
"react-native-config": "^1.5.5",
"react-native-svg": "^15.12.0"
},
Expand All @@ -22,7 +22,7 @@
"@react-native/babel-preset": "0.79.1",
"@react-native/metro-config": "0.79.2",
"@react-native/typescript-config": "0.80.0",
"@types/react": "^18.3.6",
"@types/react": "^19.1.8",
"@types/react-test-renderer": "^19.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.56.0",
Expand Down
Loading