create-crossbind 2.0.0-beta.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +63 -0
  3. package/package.json +47 -0
  4. package/src/index.js +182 -0
  5. package/src/manifest.json +14 -0
  6. package/src/utils.js +8 -0
  7. package/templates/backend-nodejs-wasm/CHANGELOG.md +34 -0
  8. package/templates/backend-nodejs-wasm/README.md +32 -0
  9. package/templates/backend-nodejs-wasm/crossbind.config.mjs +14 -0
  10. package/templates/backend-nodejs-wasm/package.json +25 -0
  11. package/templates/backend-nodejs-wasm/src/index.js +5 -0
  12. package/templates/backend-nodejs-wasm/src/index.mjs +5 -0
  13. package/templates/backend-nodejs-wasm/src/native/native.cpp +9 -0
  14. package/templates/backend-nodejs-wasm/src/native/native.h +12 -0
  15. package/templates/cloud-cloudflare-worker/CHANGELOG.md +27 -0
  16. package/templates/cloud-cloudflare-worker/Readme.md +46 -0
  17. package/templates/cloud-cloudflare-worker/crossbind.config.mjs +9 -0
  18. package/templates/cloud-cloudflare-worker/e2e/crossbind.spec.cjs +7 -0
  19. package/templates/cloud-cloudflare-worker/index.js +10 -0
  20. package/templates/cloud-cloudflare-worker/package.json +38 -0
  21. package/templates/cloud-cloudflare-worker/playwright.dev.config.cjs +48 -0
  22. package/templates/cloud-cloudflare-worker/src/native/native.cpp +5 -0
  23. package/templates/cloud-cloudflare-worker/src/native/native.h +11 -0
  24. package/templates/cloud-cloudflare-worker/wrangler.toml +3 -0
  25. package/templates/lib-cmake/CHANGELOG.md +20 -0
  26. package/templates/lib-cmake/CMakeLists.txt +16 -0
  27. package/templates/lib-cmake/README.md +51 -0
  28. package/templates/lib-cmake/crossbind.config.js +9 -0
  29. package/templates/lib-cmake/package.json +16 -0
  30. package/templates/lib-cmake/src/native/crossbind-lib-samplebasic-cmake/samplebasiccmake.h +11 -0
  31. package/templates/lib-cmake/src/native/samplebasiccmake.cpp +5 -0
  32. package/templates/lib-prebuilt/AGENTS.md +78 -0
  33. package/templates/lib-prebuilt/CHANGELOG.md +20 -0
  34. package/templates/lib-prebuilt/README.md +81 -0
  35. package/templates/lib-prebuilt/crossbind-example-lib-prebuilt-matrix.podspec +21 -0
  36. package/templates/lib-prebuilt/crossbind.config.js +13 -0
  37. package/templates/lib-prebuilt/package.json +36 -0
  38. package/templates/lib-prebuilt/playground/Matrix.js +19 -0
  39. package/templates/lib-prebuilt/playground/index.html +74 -0
  40. package/templates/lib-prebuilt/src/native/Matrix.cpp +17 -0
  41. package/templates/lib-prebuilt/src/native/Matrix.h +12 -0
  42. package/templates/lib-source/CHANGELOG.md +20 -0
  43. package/templates/lib-source/README.md +51 -0
  44. package/templates/lib-source/crossbind.config.js +8 -0
  45. package/templates/lib-source/package.json +12 -0
  46. package/templates/lib-source/src/native/crossbind-lib-samplebasic/samplebasic.h +13 -0
  47. package/templates/mobile-reactnative-cli/.bundle/config +2 -0
  48. package/templates/mobile-reactnative-cli/.eslintrc.js +4 -0
  49. package/templates/mobile-reactnative-cli/.prettierrc.js +7 -0
  50. package/templates/mobile-reactnative-cli/AGENTS.md +89 -0
  51. package/templates/mobile-reactnative-cli/CHANGELOG.md +38 -0
  52. package/templates/mobile-reactnative-cli/Gemfile +20 -0
  53. package/templates/mobile-reactnative-cli/README.md +55 -0
  54. package/templates/mobile-reactnative-cli/__tests__/App.test.tsx +13 -0
  55. package/templates/mobile-reactnative-cli/android/app/build.gradle +119 -0
  56. package/templates/mobile-reactnative-cli/android/app/debug.keystore +0 -0
  57. package/templates/mobile-reactnative-cli/android/app/proguard-rules.pro +10 -0
  58. package/templates/mobile-reactnative-cli/android/app/src/debug/AndroidManifest.xml +9 -0
  59. package/templates/mobile-reactnative-cli/android/app/src/main/AndroidManifest.xml +27 -0
  60. package/templates/mobile-reactnative-cli/android/app/src/main/java/dev/crossbind/sampleReactNativeCLI/MainActivity.kt +22 -0
  61. package/templates/mobile-reactnative-cli/android/app/src/main/java/dev/crossbind/sampleReactNativeCLI/MainApplication.kt +27 -0
  62. package/templates/mobile-reactnative-cli/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  63. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  64. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  65. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  66. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  67. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  68. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  69. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  70. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  71. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  72. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  73. package/templates/mobile-reactnative-cli/android/app/src/main/res/values/strings.xml +3 -0
  74. package/templates/mobile-reactnative-cli/android/app/src/main/res/values/styles.xml +9 -0
  75. package/templates/mobile-reactnative-cli/android/build.gradle +21 -0
  76. package/templates/mobile-reactnative-cli/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  77. package/templates/mobile-reactnative-cli/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  78. package/templates/mobile-reactnative-cli/android/gradle.properties +44 -0
  79. package/templates/mobile-reactnative-cli/android/gradlew +248 -0
  80. package/templates/mobile-reactnative-cli/android/gradlew.bat +98 -0
  81. package/templates/mobile-reactnative-cli/android/settings.gradle +6 -0
  82. package/templates/mobile-reactnative-cli/app.json +4 -0
  83. package/templates/mobile-reactnative-cli/babel.config.js +3 -0
  84. package/templates/mobile-reactnative-cli/ci/crossbind-snapshot/cache.json +12 -0
  85. package/templates/mobile-reactnative-cli/crossbind.config.mjs +10 -0
  86. package/templates/mobile-reactnative-cli/index.js +9 -0
  87. package/templates/mobile-reactnative-cli/ios/.xcode.env +11 -0
  88. package/templates/mobile-reactnative-cli/ios/Podfile +42 -0
  89. package/templates/mobile-reactnative-cli/ios/crossbindSampleReactNativeCLI/AppDelegate.swift +48 -0
  90. package/templates/mobile-reactnative-cli/ios/crossbindSampleReactNativeCLI/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  91. package/templates/mobile-reactnative-cli/ios/crossbindSampleReactNativeCLI/Images.xcassets/Contents.json +6 -0
  92. package/templates/mobile-reactnative-cli/ios/crossbindSampleReactNativeCLI/Info.plist +60 -0
  93. package/templates/mobile-reactnative-cli/ios/crossbindSampleReactNativeCLI/LaunchScreen.storyboard +47 -0
  94. package/templates/mobile-reactnative-cli/ios/crossbindSampleReactNativeCLI/PrivacyInfo.xcprivacy +37 -0
  95. package/templates/mobile-reactnative-cli/ios/crossbindSampleReactNativeCLI.xcodeproj/project.pbxproj +494 -0
  96. package/templates/mobile-reactnative-cli/ios/crossbindSampleReactNativeCLI.xcodeproj/xcshareddata/xcschemes/crossbindSampleReactNativeCLI.xcscheme +88 -0
  97. package/templates/mobile-reactnative-cli/ios/crossbindSampleReactNativeCLI.xcworkspace/contents.xcworkspacedata +10 -0
  98. package/templates/mobile-reactnative-cli/jest.config.js +3 -0
  99. package/templates/mobile-reactnative-cli/maestro.yaml +4 -0
  100. package/templates/mobile-reactnative-cli/metro.config.js +17 -0
  101. package/templates/mobile-reactnative-cli/package.json +68 -0
  102. package/templates/mobile-reactnative-cli/src/App.tsx +53 -0
  103. package/templates/mobile-reactnative-cli/src/native/native.cpp +9 -0
  104. package/templates/mobile-reactnative-cli/src/native/native.h +12 -0
  105. package/templates/mobile-reactnative-cli/tsconfig.json +16 -0
  106. package/templates/mobile-reactnative-expo/README.md +34 -0
  107. package/templates/mobile-reactnative-expo/app.json +51 -0
  108. package/templates/mobile-reactnative-expo/assets/expo.icon/Assets/expo-symbol 2.svg +3 -0
  109. package/templates/mobile-reactnative-expo/assets/expo.icon/Assets/grid.png +0 -0
  110. package/templates/mobile-reactnative-expo/assets/expo.icon/icon.json +40 -0
  111. package/templates/mobile-reactnative-expo/assets/images/android-icon-background.png +0 -0
  112. package/templates/mobile-reactnative-expo/assets/images/android-icon-foreground.png +0 -0
  113. package/templates/mobile-reactnative-expo/assets/images/android-icon-monochrome.png +0 -0
  114. package/templates/mobile-reactnative-expo/assets/images/expo-badge-white.png +0 -0
  115. package/templates/mobile-reactnative-expo/assets/images/expo-badge.png +0 -0
  116. package/templates/mobile-reactnative-expo/assets/images/expo-logo.png +0 -0
  117. package/templates/mobile-reactnative-expo/assets/images/favicon.png +0 -0
  118. package/templates/mobile-reactnative-expo/assets/images/icon.png +0 -0
  119. package/templates/mobile-reactnative-expo/assets/images/logo-glow.png +0 -0
  120. package/templates/mobile-reactnative-expo/assets/images/react-logo.png +0 -0
  121. package/templates/mobile-reactnative-expo/assets/images/react-logo@2x.png +0 -0
  122. package/templates/mobile-reactnative-expo/assets/images/react-logo@3x.png +0 -0
  123. package/templates/mobile-reactnative-expo/assets/images/splash-icon.png +0 -0
  124. package/templates/mobile-reactnative-expo/assets/images/tabIcons/explore.png +0 -0
  125. package/templates/mobile-reactnative-expo/assets/images/tabIcons/explore@2x.png +0 -0
  126. package/templates/mobile-reactnative-expo/assets/images/tabIcons/explore@3x.png +0 -0
  127. package/templates/mobile-reactnative-expo/assets/images/tabIcons/home.png +0 -0
  128. package/templates/mobile-reactnative-expo/assets/images/tabIcons/home@2x.png +0 -0
  129. package/templates/mobile-reactnative-expo/assets/images/tabIcons/home@3x.png +0 -0
  130. package/templates/mobile-reactnative-expo/assets/images/tutorial-web.png +0 -0
  131. package/templates/mobile-reactnative-expo/crossbind.config.mjs +10 -0
  132. package/templates/mobile-reactnative-expo/maestro.yaml +4 -0
  133. package/templates/mobile-reactnative-expo/metro.config.js +13 -0
  134. package/templates/mobile-reactnative-expo/package-lock.json +9433 -0
  135. package/templates/mobile-reactnative-expo/package.json +82 -0
  136. package/templates/mobile-reactnative-expo/scripts/reset-project.js +113 -0
  137. package/templates/mobile-reactnative-expo/src/app/_layout.tsx +16 -0
  138. package/templates/mobile-reactnative-expo/src/app/explore.tsx +181 -0
  139. package/templates/mobile-reactnative-expo/src/app/index.tsx +110 -0
  140. package/templates/mobile-reactnative-expo/src/components/animated-icon.module.css +6 -0
  141. package/templates/mobile-reactnative-expo/src/components/animated-icon.tsx +132 -0
  142. package/templates/mobile-reactnative-expo/src/components/animated-icon.web.tsx +108 -0
  143. package/templates/mobile-reactnative-expo/src/components/app-tabs.tsx +33 -0
  144. package/templates/mobile-reactnative-expo/src/components/app-tabs.web.tsx +116 -0
  145. package/templates/mobile-reactnative-expo/src/components/external-link.tsx +25 -0
  146. package/templates/mobile-reactnative-expo/src/components/hint-row.tsx +35 -0
  147. package/templates/mobile-reactnative-expo/src/components/themed-text.tsx +73 -0
  148. package/templates/mobile-reactnative-expo/src/components/themed-view.tsx +16 -0
  149. package/templates/mobile-reactnative-expo/src/components/ui/collapsible.tsx +65 -0
  150. package/templates/mobile-reactnative-expo/src/components/web-badge.tsx +44 -0
  151. package/templates/mobile-reactnative-expo/src/constants/theme.ts +65 -0
  152. package/templates/mobile-reactnative-expo/src/global.css +9 -0
  153. package/templates/mobile-reactnative-expo/src/hooks/use-color-scheme.ts +1 -0
  154. package/templates/mobile-reactnative-expo/src/hooks/use-color-scheme.web.ts +21 -0
  155. package/templates/mobile-reactnative-expo/src/hooks/use-theme.ts +14 -0
  156. package/templates/mobile-reactnative-expo/src/native/native.cpp +9 -0
  157. package/templates/mobile-reactnative-expo/src/native/native.h +12 -0
  158. package/templates/mobile-reactnative-expo/tsconfig.json +20 -0
  159. package/templates/web-react-rspack/CHANGELOG.md +35 -0
  160. package/templates/web-react-rspack/README.md +38 -0
  161. package/templates/web-react-rspack/crossbind.config.mjs +13 -0
  162. package/templates/web-react-rspack/e2e/crossbind.spec.cjs +7 -0
  163. package/templates/web-react-rspack/index.html +11 -0
  164. package/templates/web-react-rspack/package.json +44 -0
  165. package/templates/web-react-rspack/playwright.dev.config.cjs +48 -0
  166. package/templates/web-react-rspack/playwright.prod.config.cjs +52 -0
  167. package/templates/web-react-rspack/rspack.config.mjs +78 -0
  168. package/templates/web-react-rspack/src/App.css +41 -0
  169. package/templates/web-react-rspack/src/App.jsx +19 -0
  170. package/templates/web-react-rspack/src/index.css +70 -0
  171. package/templates/web-react-rspack/src/main.jsx +10 -0
  172. package/templates/web-react-rspack/src/native/native.cpp +9 -0
  173. package/templates/web-react-rspack/src/native/native.h +12 -0
  174. package/templates/web-react-vite/CHANGELOG.md +34 -0
  175. package/templates/web-react-vite/README.md +38 -0
  176. package/templates/web-react-vite/crossbind.config.js +13 -0
  177. package/templates/web-react-vite/e2e/crossbind.spec.cjs +7 -0
  178. package/templates/web-react-vite/eslint.config.js +38 -0
  179. package/templates/web-react-vite/index.html +13 -0
  180. package/templates/web-react-vite/package.json +44 -0
  181. package/templates/web-react-vite/playwright.dev.config.cjs +48 -0
  182. package/templates/web-react-vite/playwright.prod.config.cjs +52 -0
  183. package/templates/web-react-vite/public/vite.svg +1 -0
  184. package/templates/web-react-vite/src/App.css +42 -0
  185. package/templates/web-react-vite/src/App.jsx +21 -0
  186. package/templates/web-react-vite/src/assets/react.svg +1 -0
  187. package/templates/web-react-vite/src/index.css +68 -0
  188. package/templates/web-react-vite/src/main.jsx +10 -0
  189. package/templates/web-react-vite/src/native/native.cpp +9 -0
  190. package/templates/web-react-vite/src/native/native.h +12 -0
  191. package/templates/web-react-vite/vite.config.js +8 -0
  192. package/templates/web-svelte-vite/CHANGELOG.md +34 -0
  193. package/templates/web-svelte-vite/README.md +38 -0
  194. package/templates/web-svelte-vite/crossbind.config.js +13 -0
  195. package/templates/web-svelte-vite/e2e/crossbind.spec.cjs +7 -0
  196. package/templates/web-svelte-vite/index.html +13 -0
  197. package/templates/web-svelte-vite/jsconfig.json +32 -0
  198. package/templates/web-svelte-vite/package.json +35 -0
  199. package/templates/web-svelte-vite/playwright.dev.config.cjs +48 -0
  200. package/templates/web-svelte-vite/playwright.prod.config.cjs +52 -0
  201. package/templates/web-svelte-vite/public/vite.svg +1 -0
  202. package/templates/web-svelte-vite/src/App.svelte +12 -0
  203. package/templates/web-svelte-vite/src/app.css +79 -0
  204. package/templates/web-svelte-vite/src/main.js +9 -0
  205. package/templates/web-svelte-vite/src/native/native.cpp +9 -0
  206. package/templates/web-svelte-vite/src/native/native.h +12 -0
  207. package/templates/web-svelte-vite/src/vite-env.d.ts +2 -0
  208. package/templates/web-svelte-vite/svelte.config.js +7 -0
  209. package/templates/web-svelte-vite/vite.config.js +8 -0
  210. package/templates/web-vanilla/CHANGELOG.md +34 -0
  211. package/templates/web-vanilla/README.md +32 -0
  212. package/templates/web-vanilla/crossbind.config.mjs +14 -0
  213. package/templates/web-vanilla/e2e/crossbind.spec.cjs +7 -0
  214. package/templates/web-vanilla/index.html +37 -0
  215. package/templates/web-vanilla/package.json +29 -0
  216. package/templates/web-vanilla/playwright.prod.config.cjs +52 -0
  217. package/templates/web-vanilla/serve.json +17 -0
  218. package/templates/web-vanilla/src/native/native.cpp +9 -0
  219. package/templates/web-vanilla/src/native/native.h +12 -0
  220. package/templates/web-vue-vite/CHANGELOG.md +34 -0
  221. package/templates/web-vue-vite/README.md +38 -0
  222. package/templates/web-vue-vite/crossbind.config.js +13 -0
  223. package/templates/web-vue-vite/e2e/crossbind.spec.cjs +7 -0
  224. package/templates/web-vue-vite/index.html +13 -0
  225. package/templates/web-vue-vite/package.json +35 -0
  226. package/templates/web-vue-vite/playwright.dev.config.cjs +48 -0
  227. package/templates/web-vue-vite/playwright.prod.config.cjs +52 -0
  228. package/templates/web-vue-vite/public/vite.svg +1 -0
  229. package/templates/web-vue-vite/serve.json +17 -0
  230. package/templates/web-vue-vite/src/App.vue +14 -0
  231. package/templates/web-vue-vite/src/main.js +5 -0
  232. package/templates/web-vue-vite/src/native/native.cpp +9 -0
  233. package/templates/web-vue-vite/src/native/native.h +12 -0
  234. package/templates/web-vue-vite/src/style.css +38 -0
  235. package/templates/web-vue-vite/vite.config.js +18 -0
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@crossbind/example-mobile-reactnative-expo",
3
+ "private": true,
4
+ "main": "expo-router/entry",
5
+ "version": "0.0.0",
6
+ "description": "crossbind Expo sample",
7
+ "homepage": "https://github.com/crossbind/crossbind/tree/main/examples/mobile-reactnative-expo#readme",
8
+ "repository": "https://github.com/crossbind/crossbind.git",
9
+ "license": "MIT",
10
+ "scripts": {
11
+ "start": "expo start",
12
+ "reset-project": "node ./scripts/reset-project.js",
13
+ "android": "expo run:android",
14
+ "ios": "expo run:ios",
15
+ "web": "expo start --web",
16
+ "lint": "expo lint",
17
+ "run:ios": "expo run:ios --no-bundler --configuration Release",
18
+ "run:android": "expo run:android --no-bundler --variant release",
19
+ "maestro:ios": "maestro --device \"$(xcrun simctl list devices booted | sed -n 's/.*(\\([0-9A-F-]\\{36\\}\\)) (Booted).*/\\1/p' | head -1)\" test ./maestro.yaml",
20
+ "maestro:android": "maestro --device \"$(adb devices | sed -n '2p' | cut -f1)\" test ./maestro.yaml",
21
+ "e2e:ios": "npm run run:ios && npm run maestro:ios",
22
+ "e2e:android": "npm run run:android && npm run maestro:android"
23
+ },
24
+ "dependencies": {
25
+ "@crossbind/core-embind-jsi": "2.0.0-beta.50",
26
+ "@crossbind/plugin-react-native": "2.0.0-beta.50",
27
+ "@crossbind/plugin-react-native-ios-helper": "2.0.0-beta.50",
28
+ "@crossbind/example-lib-prebuilt-matrix": "2.0.0-beta.50",
29
+ "hermes-compiler": "*",
30
+ "expo": "^56.0.5",
31
+ "expo-constants": "~56.0.16",
32
+ "expo-device": "~56.0.4",
33
+ "expo-font": "~56.0.5",
34
+ "expo-glass-effect": "~56.0.4",
35
+ "expo-image": "~56.0.9",
36
+ "expo-linking": "~56.0.12",
37
+ "expo-router": "~56.2.7",
38
+ "expo-splash-screen": "~56.0.10",
39
+ "expo-status-bar": "~56.0.4",
40
+ "expo-symbols": "~56.0.5",
41
+ "expo-system-ui": "~56.0.5",
42
+ "expo-web-browser": "~56.0.5",
43
+ "react": "19.2.3",
44
+ "react-dom": "19.2.3",
45
+ "react-native": "0.85.3",
46
+ "react-native-gesture-handler": "~2.31.2",
47
+ "react-native-reanimated": "4.3.1",
48
+ "react-native-safe-area-context": "~5.8.0",
49
+ "react-native-screens": "4.25.2",
50
+ "react-native-web": "~0.21.2",
51
+ "react-native-worklets": "0.8.3"
52
+ },
53
+ "devDependencies": {
54
+ "@types/react": "~19.2.18",
55
+ "typescript": "~6.0.3",
56
+ "@crossbind/typescript-config": "2.0.0-beta.50",
57
+ "@crossbind/plugin-metro": "2.0.0-beta.50"
58
+ },
59
+ "overrides": {
60
+ "uuid": "11.1.1",
61
+ "replace": {
62
+ "minimatch": "3.1.4"
63
+ },
64
+ "brace-expansion@5": "^5.0.9",
65
+ "shell-quote": "^1.10.0",
66
+ "js-yaml@4": "^4.3.1",
67
+ "nanoid@3": "^3.3.18",
68
+ "postcss": "^8.5.26",
69
+ "ws@7": "^7.5.13",
70
+ "@babel/core@7": "^7.29.7"
71
+ },
72
+ "keywords": [
73
+ "crossbind-sample",
74
+ "react-native",
75
+ "expo",
76
+ "bind",
77
+ "c++",
78
+ "android",
79
+ "ios",
80
+ "mobile"
81
+ ]
82
+ }
@@ -0,0 +1,113 @@
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 /src and /scripts directories to /example based on user input and creates a new /src/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 = ["src", "scripts"];
15
+ const exampleDir = "example";
16
+ const newAppDir = "src/app";
17
+ const exampleDirPath = path.join(root, exampleDir);
18
+
19
+ const indexContent = `import { Text, View, StyleSheet } from "react-native";
20
+
21
+ export default function Index() {
22
+ return (
23
+ <View style={styles.container}>
24
+ <Text>Edit src/app/index.tsx to edit this screen.</Text>
25
+ </View>
26
+ );
27
+ }
28
+
29
+ const styles = StyleSheet.create({
30
+ container: {
31
+ flex: 1,
32
+ alignItems: "center",
33
+ justifyContent: "center",
34
+ },
35
+ });
36
+ `;
37
+
38
+ const layoutContent = `import { Stack } from "expo-router";
39
+
40
+ export default function RootLayout() {
41
+ return <Stack />;
42
+ }
43
+ `;
44
+
45
+ const rl = readline.createInterface({
46
+ input: process.stdin,
47
+ output: process.stdout,
48
+ });
49
+
50
+ const moveDirectories = async (userInput) => {
51
+ try {
52
+ if (userInput === "y") {
53
+ // Create the app-example directory
54
+ await fs.promises.mkdir(exampleDirPath, { recursive: true });
55
+ console.log(`📁 /${exampleDir} directory created.`);
56
+ }
57
+
58
+ // Move old directories to new app-example directory or delete them
59
+ for (const dir of oldDirs) {
60
+ const oldDirPath = path.join(root, dir);
61
+ if (fs.existsSync(oldDirPath)) {
62
+ if (userInput === "y") {
63
+ const newDirPath = path.join(root, exampleDir, dir);
64
+ await fs.promises.rename(oldDirPath, newDirPath);
65
+ console.log(`➡️ /${dir} moved to /${exampleDir}/${dir}.`);
66
+ } else {
67
+ await fs.promises.rm(oldDirPath, { recursive: true, force: true });
68
+ console.log(`❌ /${dir} deleted.`);
69
+ }
70
+ } else {
71
+ console.log(`➡️ /${dir} does not exist, skipping.`);
72
+ }
73
+ }
74
+
75
+ // Create new /src/app directory
76
+ const newAppDirPath = path.join(root, newAppDir);
77
+ await fs.promises.mkdir(newAppDirPath, { recursive: true });
78
+ console.log("\n📁 New /src/app directory created.");
79
+
80
+ // Create index.tsx
81
+ const indexPath = path.join(newAppDirPath, "index.tsx");
82
+ await fs.promises.writeFile(indexPath, indexContent);
83
+ console.log("📄 src/app/index.tsx created.");
84
+
85
+ // Create _layout.tsx
86
+ const layoutPath = path.join(newAppDirPath, "_layout.tsx");
87
+ await fs.promises.writeFile(layoutPath, layoutContent);
88
+ console.log("📄 src/app/_layout.tsx created.");
89
+
90
+ console.log("\n✅ Project reset complete. Next steps:");
91
+ console.log(
92
+ `1. Run \`npx expo start\` to start a development server.\n2. Edit src/app/index.tsx to edit the main screen.\n3. Put all your application code in /src, only screens and layout files should be in /src/app.${userInput === "y"
93
+ ? `\n4. Delete the /${exampleDir} directory when you're done referencing it.`
94
+ : ""
95
+ }`
96
+ );
97
+ } catch (error) {
98
+ console.error(`❌ Error during script execution: ${error.message}`);
99
+ }
100
+ };
101
+
102
+ rl.question(
103
+ "Do you want to move existing files to /example instead of deleting them? (Y/n): ",
104
+ (answer) => {
105
+ const userInput = answer.trim().toLowerCase() || "y";
106
+ if (userInput === "y" || userInput === "n") {
107
+ moveDirectories(userInput).finally(() => rl.close());
108
+ } else {
109
+ console.log("❌ Invalid input. Please enter 'Y' or 'N'.");
110
+ rl.close();
111
+ }
112
+ }
113
+ );
@@ -0,0 +1,16 @@
1
+ import { DarkTheme, DefaultTheme, ThemeProvider } from 'expo-router/react-navigation';
2
+ import React from 'react';
3
+ import { useColorScheme } from 'react-native';
4
+
5
+ import { AnimatedSplashOverlay } from '@/components/animated-icon';
6
+ import AppTabs from '@/components/app-tabs';
7
+
8
+ export default function TabLayout() {
9
+ const colorScheme = useColorScheme();
10
+ return (
11
+ <ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
12
+ <AnimatedSplashOverlay />
13
+ <AppTabs />
14
+ </ThemeProvider>
15
+ );
16
+ }
@@ -0,0 +1,181 @@
1
+ import { Image } from 'expo-image';
2
+ import { SymbolView } from 'expo-symbols';
3
+ import React from 'react';
4
+ import { Platform, Pressable, ScrollView, StyleSheet } from 'react-native';
5
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
6
+
7
+ import { ExternalLink } from '@/components/external-link';
8
+ import { ThemedText } from '@/components/themed-text';
9
+ import { ThemedView } from '@/components/themed-view';
10
+ import { Collapsible } from '@/components/ui/collapsible';
11
+ import { WebBadge } from '@/components/web-badge';
12
+ import { BottomTabInset, MaxContentWidth, Spacing } from '@/constants/theme';
13
+ import { useTheme } from '@/hooks/use-theme';
14
+
15
+ export default function TabTwoScreen() {
16
+ const safeAreaInsets = useSafeAreaInsets();
17
+ const insets = {
18
+ ...safeAreaInsets,
19
+ bottom: safeAreaInsets.bottom + BottomTabInset + Spacing.three,
20
+ };
21
+ const theme = useTheme();
22
+
23
+ const contentPlatformStyle = Platform.select({
24
+ android: {
25
+ paddingTop: insets.top,
26
+ paddingLeft: insets.left,
27
+ paddingRight: insets.right,
28
+ paddingBottom: insets.bottom,
29
+ },
30
+ web: {
31
+ paddingTop: Spacing.six,
32
+ paddingBottom: Spacing.four,
33
+ },
34
+ });
35
+
36
+ return (
37
+ <ScrollView
38
+ style={[styles.scrollView, { backgroundColor: theme.background }]}
39
+ contentInset={insets}
40
+ contentContainerStyle={[styles.contentContainer, contentPlatformStyle]}>
41
+ <ThemedView style={styles.container}>
42
+ <ThemedView style={styles.titleContainer}>
43
+ <ThemedText type="subtitle">Explore</ThemedText>
44
+ <ThemedText style={styles.centerText} themeColor="textSecondary">
45
+ This starter app includes example{'\n'}code to help you get started.
46
+ </ThemedText>
47
+
48
+ <ExternalLink href="https://docs.expo.dev" asChild>
49
+ <Pressable style={({ pressed }) => pressed && styles.pressed}>
50
+ <ThemedView type="backgroundElement" style={styles.linkButton}>
51
+ <ThemedText type="link">Expo documentation</ThemedText>
52
+ <SymbolView
53
+ tintColor={theme.text}
54
+ name={{ ios: 'arrow.up.right.square', android: 'link', web: 'link' }}
55
+ size={12}
56
+ />
57
+ </ThemedView>
58
+ </Pressable>
59
+ </ExternalLink>
60
+ </ThemedView>
61
+
62
+ <ThemedView style={styles.sectionsWrapper}>
63
+ <Collapsible title="File-based routing">
64
+ <ThemedText type="small">
65
+ This app has two screens: <ThemedText type="code">src/app/index.tsx</ThemedText> and{' '}
66
+ <ThemedText type="code">src/app/explore.tsx</ThemedText>
67
+ </ThemedText>
68
+ <ThemedText type="small">
69
+ The layout file in <ThemedText type="code">src/app/_layout.tsx</ThemedText> sets up
70
+ the tab navigator.
71
+ </ThemedText>
72
+ <ExternalLink href="https://docs.expo.dev/router/introduction">
73
+ <ThemedText type="linkPrimary">Learn more</ThemedText>
74
+ </ExternalLink>
75
+ </Collapsible>
76
+
77
+ <Collapsible title="Android, iOS, and web support">
78
+ <ThemedView type="backgroundElement" style={styles.collapsibleContent}>
79
+ <ThemedText type="small">
80
+ You can open this project on Android, iOS, and the web. To open the web version,
81
+ press <ThemedText type="smallBold">w</ThemedText> in the terminal running this
82
+ project.
83
+ </ThemedText>
84
+ <Image
85
+ source={require('@/assets/images/tutorial-web.png')}
86
+ style={styles.imageTutorial}
87
+ />
88
+ </ThemedView>
89
+ </Collapsible>
90
+
91
+ <Collapsible title="Images">
92
+ <ThemedText type="small">
93
+ For static images, you can use the <ThemedText type="code">@2x</ThemedText> and{' '}
94
+ <ThemedText type="code">@3x</ThemedText> suffixes to provide files for different
95
+ screen densities.
96
+ </ThemedText>
97
+ <Image source={require('@/assets/images/react-logo.png')} style={styles.imageReact} />
98
+ <ExternalLink href="https://reactnative.dev/docs/images">
99
+ <ThemedText type="linkPrimary">Learn more</ThemedText>
100
+ </ExternalLink>
101
+ </Collapsible>
102
+
103
+ <Collapsible title="Light and dark mode components">
104
+ <ThemedText type="small">
105
+ This template has light and dark mode support. The{' '}
106
+ <ThemedText type="code">useColorScheme()</ThemedText> hook lets you inspect what the
107
+ user&apos;s current color scheme is, and so you can adjust UI colors accordingly.
108
+ </ThemedText>
109
+ <ExternalLink href="https://docs.expo.dev/develop/user-interface/color-themes/">
110
+ <ThemedText type="linkPrimary">Learn more</ThemedText>
111
+ </ExternalLink>
112
+ </Collapsible>
113
+
114
+ <Collapsible title="Animations">
115
+ <ThemedText type="small">
116
+ This template includes an example of an animated component. The{' '}
117
+ <ThemedText type="code">src/components/ui/collapsible.tsx</ThemedText> component uses
118
+ the powerful <ThemedText type="code">react-native-reanimated</ThemedText> library to
119
+ animate opening this hint.
120
+ </ThemedText>
121
+ </Collapsible>
122
+ </ThemedView>
123
+ {Platform.OS === 'web' && <WebBadge />}
124
+ </ThemedView>
125
+ </ScrollView>
126
+ );
127
+ }
128
+
129
+ const styles = StyleSheet.create({
130
+ scrollView: {
131
+ flex: 1,
132
+ },
133
+ contentContainer: {
134
+ flexDirection: 'row',
135
+ justifyContent: 'center',
136
+ },
137
+ container: {
138
+ maxWidth: MaxContentWidth,
139
+ flexGrow: 1,
140
+ },
141
+ titleContainer: {
142
+ gap: Spacing.three,
143
+ alignItems: 'center',
144
+ paddingHorizontal: Spacing.four,
145
+ paddingVertical: Spacing.six,
146
+ },
147
+ centerText: {
148
+ textAlign: 'center',
149
+ },
150
+ pressed: {
151
+ opacity: 0.7,
152
+ },
153
+ linkButton: {
154
+ flexDirection: 'row',
155
+ paddingHorizontal: Spacing.four,
156
+ paddingVertical: Spacing.two,
157
+ borderRadius: Spacing.five,
158
+ justifyContent: 'center',
159
+ gap: Spacing.one,
160
+ alignItems: 'center',
161
+ },
162
+ sectionsWrapper: {
163
+ gap: Spacing.five,
164
+ paddingHorizontal: Spacing.four,
165
+ paddingTop: Spacing.three,
166
+ },
167
+ collapsibleContent: {
168
+ alignItems: 'center',
169
+ },
170
+ imageTutorial: {
171
+ width: '100%',
172
+ aspectRatio: 296 / 171,
173
+ borderRadius: Spacing.three,
174
+ marginTop: Spacing.two,
175
+ },
176
+ imageReact: {
177
+ width: 100,
178
+ height: 100,
179
+ alignSelf: 'center',
180
+ },
181
+ });
@@ -0,0 +1,110 @@
1
+ import * as Device from 'expo-device';
2
+ import { useState, useEffect } from 'react';
3
+ import { Platform, StyleSheet } from 'react-native';
4
+ import { SafeAreaView } from 'react-native-safe-area-context';
5
+
6
+ import { AnimatedIcon } from '@/components/animated-icon';
7
+ import { HintRow } from '@/components/hint-row';
8
+ import { ThemedText } from '@/components/themed-text';
9
+ import { ThemedView } from '@/components/themed-view';
10
+ import { WebBadge } from '@/components/web-badge';
11
+ import { BottomTabInset, MaxContentWidth, Spacing } from '@/constants/theme';
12
+
13
+ import { initNative, Native } from '../native/native.h';
14
+
15
+ function getDevMenuHint() {
16
+ if (Platform.OS === 'web') {
17
+ return <ThemedText type="small">use browser devtools</ThemedText>;
18
+ }
19
+ if (Device.isDevice) {
20
+ return (
21
+ <ThemedText type="small">
22
+ shake device or press <ThemedText type="code">m</ThemedText> in terminal
23
+ </ThemedText>
24
+ );
25
+ }
26
+ const shortcut = Platform.OS === 'android' ? 'cmd+m (or ctrl+m)' : 'cmd+d';
27
+ return (
28
+ <ThemedText type="small">
29
+ press <ThemedText type="code">{shortcut}</ThemedText>
30
+ </ThemedText>
31
+ );
32
+ }
33
+
34
+ export default function HomeScreen() {
35
+ const [message, setMessage] = useState('compiling ...');
36
+
37
+ useEffect(() => {
38
+ initNative().then((a) => {
39
+ console.log(a, a.Crossbind);
40
+ setMessage(Native.sample());
41
+ });
42
+ }, []);
43
+
44
+ return (
45
+ <ThemedView style={styles.container}>
46
+ <SafeAreaView style={styles.safeArea}>
47
+ <ThemedView style={styles.heroSection}>
48
+ <AnimatedIcon />
49
+ <ThemedText type="title" style={styles.title}>
50
+ Matrix multiplier with c++ &nbsp;&nbsp;=&gt;&nbsp;&nbsp; {message}
51
+ </ThemedText>
52
+ </ThemedView>
53
+
54
+ <ThemedText type="code" style={styles.code}>
55
+ get started
56
+ </ThemedText>
57
+
58
+ <ThemedView type="backgroundElement" style={styles.stepContainer}>
59
+ <HintRow
60
+ title="Try editing"
61
+ hint={<ThemedText type="code">src/app/index.tsx</ThemedText>}
62
+ />
63
+ <HintRow title="Dev tools" hint={getDevMenuHint()} />
64
+ <HintRow
65
+ title="Fresh start"
66
+ hint={<ThemedText type="code">npm run reset-project</ThemedText>}
67
+ />
68
+ </ThemedView>
69
+
70
+ {Platform.OS === 'web' && <WebBadge />}
71
+ </SafeAreaView>
72
+ </ThemedView>
73
+ );
74
+ }
75
+
76
+ const styles = StyleSheet.create({
77
+ container: {
78
+ flex: 1,
79
+ justifyContent: 'center',
80
+ flexDirection: 'row',
81
+ },
82
+ safeArea: {
83
+ flex: 1,
84
+ paddingHorizontal: Spacing.four,
85
+ alignItems: 'center',
86
+ gap: Spacing.three,
87
+ paddingBottom: BottomTabInset + Spacing.three,
88
+ maxWidth: MaxContentWidth,
89
+ },
90
+ heroSection: {
91
+ alignItems: 'center',
92
+ justifyContent: 'center',
93
+ flex: 1,
94
+ paddingHorizontal: Spacing.four,
95
+ gap: Spacing.four,
96
+ },
97
+ title: {
98
+ textAlign: 'center',
99
+ },
100
+ code: {
101
+ textTransform: 'uppercase',
102
+ },
103
+ stepContainer: {
104
+ gap: Spacing.three,
105
+ alignSelf: 'stretch',
106
+ paddingHorizontal: Spacing.three,
107
+ paddingVertical: Spacing.four,
108
+ borderRadius: Spacing.four,
109
+ },
110
+ });
@@ -0,0 +1,6 @@
1
+ .expoLogoBackground {
2
+ background-image: linear-gradient(180deg, #3c9ffe, #0274df);
3
+ border-radius: 40px;
4
+ width: 128px;
5
+ height: 128px;
6
+ }
@@ -0,0 +1,132 @@
1
+ import { Image } from 'expo-image';
2
+ import { useState } from 'react';
3
+ import { Dimensions, StyleSheet, View } from 'react-native';
4
+ import Animated, { Easing, Keyframe } from 'react-native-reanimated';
5
+ import { scheduleOnRN } from 'react-native-worklets';
6
+
7
+ const INITIAL_SCALE_FACTOR = Dimensions.get('screen').height / 90;
8
+ const DURATION = 600;
9
+
10
+ export function AnimatedSplashOverlay() {
11
+ const [visible, setVisible] = useState(true);
12
+
13
+ if (!visible) return null;
14
+
15
+ const splashKeyframe = new Keyframe({
16
+ 0: {
17
+ transform: [{ scale: INITIAL_SCALE_FACTOR }],
18
+ opacity: 1,
19
+ },
20
+ 20: {
21
+ opacity: 1,
22
+ },
23
+ 70: {
24
+ opacity: 0,
25
+ easing: Easing.elastic(0.7),
26
+ },
27
+ 100: {
28
+ opacity: 0,
29
+ transform: [{ scale: 1 }],
30
+ easing: Easing.elastic(0.7),
31
+ },
32
+ });
33
+
34
+ return (
35
+ <Animated.View
36
+ entering={splashKeyframe.duration(DURATION).withCallback((finished) => {
37
+ 'worklet';
38
+ if (finished) {
39
+ scheduleOnRN(setVisible, false);
40
+ }
41
+ })}
42
+ style={styles.backgroundSolidColor}
43
+ />
44
+ );
45
+ }
46
+
47
+ const keyframe = new Keyframe({
48
+ 0: {
49
+ transform: [{ scale: INITIAL_SCALE_FACTOR }],
50
+ },
51
+ 100: {
52
+ transform: [{ scale: 1 }],
53
+ easing: Easing.elastic(0.7),
54
+ },
55
+ });
56
+
57
+ const logoKeyframe = new Keyframe({
58
+ 0: {
59
+ transform: [{ scale: 1.3 }],
60
+ opacity: 0,
61
+ },
62
+ 40: {
63
+ transform: [{ scale: 1.3 }],
64
+ opacity: 0,
65
+ easing: Easing.elastic(0.7),
66
+ },
67
+ 100: {
68
+ opacity: 1,
69
+ transform: [{ scale: 1 }],
70
+ easing: Easing.elastic(0.7),
71
+ },
72
+ });
73
+
74
+ const glowKeyframe = new Keyframe({
75
+ 0: {
76
+ transform: [{ rotateZ: '0deg' }],
77
+ },
78
+ 100: {
79
+ transform: [{ rotateZ: '7200deg' }],
80
+ },
81
+ });
82
+
83
+ export function AnimatedIcon() {
84
+ return (
85
+ <View style={styles.iconContainer}>
86
+ <Animated.View entering={glowKeyframe.duration(60 * 1000 * 4)} style={styles.glow}>
87
+ <Image style={styles.glow} source={require('@/assets/images/logo-glow.png')} />
88
+ </Animated.View>
89
+
90
+ <Animated.View entering={keyframe.duration(DURATION)} style={styles.background} />
91
+ <Animated.View style={styles.imageContainer} entering={logoKeyframe.duration(DURATION)}>
92
+ <Image style={styles.image} source={require('@/assets/images/expo-logo.png')} />
93
+ </Animated.View>
94
+ </View>
95
+ );
96
+ }
97
+
98
+ const styles = StyleSheet.create({
99
+ imageContainer: {
100
+ justifyContent: 'center',
101
+ alignItems: 'center',
102
+ },
103
+ glow: {
104
+ width: 201,
105
+ height: 201,
106
+ position: 'absolute',
107
+ },
108
+ iconContainer: {
109
+ justifyContent: 'center',
110
+ alignItems: 'center',
111
+ width: 128,
112
+ height: 128,
113
+ zIndex: 100,
114
+ },
115
+ image: {
116
+ position: 'absolute',
117
+ width: 76,
118
+ height: 71,
119
+ },
120
+ background: {
121
+ borderRadius: 40,
122
+ experimental_backgroundImage: `linear-gradient(180deg, #3C9FFE, #0274DF)`,
123
+ width: 128,
124
+ height: 128,
125
+ position: 'absolute',
126
+ },
127
+ backgroundSolidColor: {
128
+ ...StyleSheet.absoluteFillObject,
129
+ backgroundColor: '#208AEF',
130
+ zIndex: 1000,
131
+ },
132
+ });