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
46 changes: 46 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,52 @@ The project uses `yarn` for dependency management and script execution.
- `examples/`: Example React Native applications using the library.
- `website/`: Documentation website.

## Example App Regeneration

- Prefer regenerating Expo example apps in a temporary directory and then copying the fresh scaffold into place, instead of mutating the existing app in place.
- Before replacing an example app, move the current app directory to `/tmp` so repo-specific code, tests, assets, and configs can be restored selectively.
- After copying a freshly generated app into `examples/`, remove the generated `.git` directory and generated `node_modules`, then reinstall from inside the repo workspace.

- `examples/basic`:
- Generate from the Expo blank TypeScript scaffold:
- `yarn create expo-app /tmp/rntl-basic-fresh --template blank-typescript --yes`
- Restore the repo-specific sample app files on top of the new scaffold:
- `App.tsx`
- `components/`
- `__tests__/`
- `theme.ts`
- `jest.config.js`
- `jest-setup.ts`
- `babel.config.js`
- `eslint.config.mjs`
- `README.md`
- `.expo-shared/assets.json` if it existed before
- Keep the fresh Expo entrypoint (`index.ts`) and update `package.json` / `app.json` to match the repo naming and scripts.

- `examples/cookbook`:
- Generate from a router-enabled Expo scaffold:
- `yarn create expo-app /tmp/rntl-cookbook-fresh --example with-router --yes`
- Restore the repo-specific cookbook files on top of the new scaffold:
- `app/`
- tutorial test directories such as `basics-tutorial/` and `basics-tutorial-react-strict-dom/`
- `theme.ts`
- `jest.config.js`
- `jest-setup.ts`
- `babel.config.js`
- `.eslintrc`, `.eslintignore`
- `README.md`
- custom assets not present in the scaffold, such as `assets/gradientRNBanner.png`
- `.expo-shared/assets.json` if it existed before
- Keep the fresh Expo Router entry setup, then reapply the cookbook-specific dependency set in `package.json` and `app.json`.

- After regenerating either example app, validate from inside the app directory:
- `yarn expo install --check`
- `yarn lint`
- `yarn typecheck`
- `yarn test --watchman=false`

- If the fresh scaffold introduces dependency-resolution churn, prefer restoring the previous `yarn.lock` first and then running `yarn install`, rather than re-resolving the whole dependency tree from scratch.

## PR draft workflow:

- Maintain `PR.txt` at the repository root using the structure from `.github/pull_request_template.md`.
Expand Down
47 changes: 36 additions & 11 deletions examples/basic/.gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
# General Node.js
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files

# dependencies
node_modules/
.expo/
dist/
npm-debug.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/

# Yarn 4.x
.pnp.*
Expand All @@ -20,6 +12,39 @@ web-build/
!.yarn/sdks
!.yarn/versions

# Expo
.expo/
dist/
web-build/
expo-env.d.ts

# Native
.kotlin/
*.orig.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision

# Metro
.metro-health-check*

# debug
npm-debug.*
yarn-debug.*
yarn-error.*

# macOS
.DS_Store
*.pem

# local env files
.env*.local

# typescript
*.tsbuildinfo

# generated native folders
/ios
/android
13 changes: 6 additions & 7 deletions examples/basic/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,22 @@
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"newArchEnabled": true,
"splash": {
"image": "./assets/splash.png",
"image": "./assets/splash-icon.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
}
"backgroundColor": "#ffffff"
},
"edgeToEdgeEnabled": true,
"predictiveBackGestureEnabled": false
},
"web": {
"favicon": "./assets/favicon.png"
Expand Down
Binary file added examples/basic/assets/splash-icon.png
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/basic/assets/splash.png
Binary file not shown.
9 changes: 8 additions & 1 deletion examples/basic/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ import tseslint from 'typescript-eslint';

export default [
{
ignores: ['node_modules/**', 'jest-setup.ts'],
ignores: [
'node_modules/**',
'.expo/**',
'dist/**',
'web-build/**',
'expo-env.d.ts',
'jest-setup.ts',
],
},
...tseslint.configs.recommended,
{
Expand Down
8 changes: 8 additions & 0 deletions examples/basic/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { registerRootComponent } from 'expo';

import App from './App';

// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);
24 changes: 13 additions & 11 deletions examples/basic/package.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
{
"main": "node_modules/expo/AppEntry.js",
"name": "rntl-example-basic",
"version": "1.0.0",
"main": "index.ts",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject",
"test": "jest",
"lint": "eslint .",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"validate": "yarn expo install --check && yarn lint && yarn typecheck && yarn test --watchman=false"
},
"dependencies": {
"expo": "^54.0.32",
"expo": "~54.0.33",
"expo-status-bar": "~3.0.9",
"react": "19.1.0",
"react-dom": "19.1.0",
"react-native": "0.81.5",
"react-native-safe-area-context": "^5.6.2",
"react-native-web": "^0.21.0"
"react-native-web": "^0.21.2"
},
"devDependencies": {
"@babel/core": "^7.24.0",
"@babel/core": "^7.29.0",
"@testing-library/react-native": "^14.0.0-beta.0",
"@types/jest": "^29.5.12",
"@types/react": "~19.1.10",
"eslint": "9.39.2",
"eslint-plugin-testing-library": "^7.1.1",
"jest": "^29.7.0",
"eslint": "^10.2.0",
"eslint-plugin-testing-library": "^7.16.2",
"jest": "~29.7.0",
"test-renderer": "0.14.0",
"typescript": "~5.9.2",
"typescript-eslint": "^8.0.0"
"typescript-eslint": "^8.58.1"
},
"private": true,
"packageManager": "yarn@4.0.1"
"packageManager": "yarn@4.11.0"
}
Loading
Loading