From 5ee9b31be503c4ade97e66e260a6aabbaa9d3b00 Mon Sep 17 00:00:00 2001 From: ceceppa Date: Thu, 9 Jul 2026 18:10:35 +0100 Subject: [PATCH 1/2] fix broken core --- .changeset/missing-config-json-and-types.md | 10 ++++++++++ README.md | 11 +++++++++++ packages/core/ios/ReactNativeAmaModule.swift | 3 +-- packages/core/package.json | 8 +++++++- 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 .changeset/missing-config-json-and-types.md diff --git a/.changeset/missing-config-json-and-types.md b/.changeset/missing-config-json-and-types.md new file mode 100644 index 00000000..765fd9a2 --- /dev/null +++ b/.changeset/missing-config-json-and-types.md @@ -0,0 +1,10 @@ +--- +'@react-native-ama/core': patch +--- + +fix: packaging bugs breaking real external installs (all pre-date this fix, invisible in the monorepo since the source files are always present on disk there regardless of npm's `files` allowlist): + +- **Critical**: the native module didn't work at all for any external consumer — `ios/`, `android/`, and `expo-module.config.json` were never listed in `package.json`'s `files` array, so no native source and no Expo autolinking manifest were ever published. Consumers hit `Error: Cannot find native module 'ReactNativeAma'` at runtime, since there was nothing for Expo's autolinking to discover or compile in. Added all three to `files` (excluding local `android/build` Gradle artifacts via a `!android/build` negation). +- **Critical**: once the native module could be found, calling `AMAProvider`/`start()` crashed the app on iOS with a JSI assertion failure (`Assertion failed: (runtime.isArray(*this))`). iOS's `Function("start")` declared its parameter as `[Any]` (array), but JS calls `start({...})` with a single object — Android's equivalent already correctly declared `Map?`. Fixed iOS to declare `[String: Any]?`, matching both Android and the rest of iOS's own functions (e.g. `highlight`'s explicit typed params). +- Metro bundling failed with `Unable to resolve "./../../ama.config.json"` for any consumer, since `ama.config.json` (the package's own bundled default config, required directly from `src/internals/config.ts`) was never listed in `files` either. +- Editor autocomplete for imports from `@react-native-ama/core` didn't work in consuming projects, since the package relied entirely on the conditional `exports` map for type resolution with no top-level `types` field as a fallback — editors/tsconfigs that don't fully resolve conditional exports types couldn't find any type info at all. Added a top-level `"types": "./dist/index.d.ts"`. diff --git a/README.md b/README.md index 9939b3b6..99d9d88d 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,17 @@ export const App = () => { }; ``` +### Expo Go is not supported + +AMA registers a native module (iOS Swift / Android Kotlin), so it cannot run inside **Expo Go** — Expo Go is a fixed, pre-built sandbox that only supports Expo's own bundled native modules and can't load arbitrary third-party native code. You'll need a [development build](https://docs.expo.dev/develop/development-builds/introduction/) instead: + +```sh +npx expo install expo-dev-client +npx expo run:ios # or npx expo run:android +``` + +`npx expo start` will then target your dev build rather than Expo Go. + ### Playground You can use the playground app within this repository to see how AMA checks work in practice. diff --git a/packages/core/ios/ReactNativeAmaModule.swift b/packages/core/ios/ReactNativeAmaModule.swift index 2661c7f7..0b6c2f7b 100644 --- a/packages/core/ios/ReactNativeAmaModule.swift +++ b/packages/core/ios/ReactNativeAmaModule.swift @@ -30,8 +30,7 @@ public class ReactNativeAmaModule: Module { Events("onAmaNodes", "onUIInteraction") - Function("start") { (arguments: [Any]) in - let options = arguments.first as? [String: Any] + Function("start") { (options: [String: Any]?) in let uiCheck = options?["ui"] as? Bool ?? false uiCheckDelay = options?["delay"] as? Int ?? uiCheckDelay gap = options?["gap"] as? CGFloat ?? gap diff --git a/packages/core/package.json b/packages/core/package.json index 0e92dcfd..7130564f 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -3,6 +3,7 @@ "version": "2.0.0-beta.1", "description": "Accessible Mobile App Library for React Native", "sideEffects": false, + "types": "./dist/index.d.ts", "exports": { ".": { "types": "./dist/index.d.ts", @@ -44,7 +45,12 @@ }, "files": [ "src", - "dist" + "dist", + "ama.config.json", + "expo-module.config.json", + "ios", + "android", + "!android/build" ], "scripts": { "build": "rm -rf dist && ../../node_modules/.bin/tsc -p ./tsconfig.build.json", From 040b5afcc6a9a3e8b704ed2e732aca4c821c49ad Mon Sep 17 00:00:00 2001 From: ceceppa Date: Sun, 12 Jul 2026 18:00:54 +0100 Subject: [PATCH 2/2] fix broken packages --- packages/forms/src/Form.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 packages/forms/src/Form.ts diff --git a/packages/forms/src/Form.ts b/packages/forms/src/Form.ts new file mode 100644 index 00000000..95f2bbde --- /dev/null +++ b/packages/forms/src/Form.ts @@ -0,0 +1,30 @@ +import React from 'react'; +import { + Form as FormProvider, + type FormActions, + type FormProps, +} from './components/Form'; +import { FormField, type FormFieldProps } from './components/FormField'; +import { + FormSubmit, + type FormSubmitProps, + type FormSubmitRenderProps, +} from './components/FormSubmit'; + +type FormComponent = typeof FormProvider & { + Submit: (props: FormSubmitProps) => React.ReactElement; + Field: typeof FormField; +}; + +const Form = FormProvider as unknown as FormComponent; +Form.Submit = FormSubmit; +Form.Field = FormField; + +export { + Form, + type FormProps, + type FormActions, + type FormFieldProps, + type FormSubmitProps, + type FormSubmitRenderProps, +};