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
10 changes: 10 additions & 0 deletions .changeset/missing-config-json-and-types.md
Original file line number Diff line number Diff line change
@@ -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<String, Any?>?`. 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"`.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions packages/core/ios/ReactNativeAmaModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
30 changes: 30 additions & 0 deletions packages/forms/src/Form.ts
Original file line number Diff line number Diff line change
@@ -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,
};
Loading