@rootnative/web-expo 0.0.0-alpha.4 → 0.0.0-alpha.6

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.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,27 @@ Each version works only with the same version of `@rootnative/web`. The package
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.0.0-alpha.6] - 2026-11-18
10
+
11
+ Expo Router runs on `@rootnative/web`, with single-page and static output.
12
+
13
+ ### Added
14
+
15
+ - **Expo Router runs**, with `web.output: 'single'` and `'static'`: tabs, a stack, links, the back button, and a URL that opens a screen directly. With `'static'`, each route renders on the server through `AppRegistry.getApplication`, with the three style sheets of `@rootnative/web`, and the page hydrates.
16
+ - **`AssetRegistry`**, as react-native-web has it: the asset registry of `@rootnative/web` as one object. The Babel preset of Expo sends `import { AssetRegistry } from 'react-native'` to it, and `expo-asset` imports it in a server render. Before, the server bundle of Expo Router failed on the missing file.
17
+ - **`DeviceEventEmitter` and `NativeEventEmitter`**, as react-native-web has them. Each `NativeEventEmitter` puts its listeners on the shared `DeviceEventEmitter`, and only JavaScript emits events. `@expo/log-box`, the error overlay of Expo Router, makes a `NativeEventEmitter` when it loads, and the stub threw an error there.
18
+ - **`UIManager`, `NativeModules`, and `LogBox`**, as react-native-web has them. `expo-constants` reads `NativeModules` when it loads, and the stub threw an error there. `NativeModules` has no native module, `LogBox` does nothing, and `UIManager` measures and updates an element with the host methods of `@rootnative/web`.
19
+
20
+ ### Changed
21
+
22
+ - **`Animated` and `Easing` load from `@rootnative/web` `0.0.0-alpha.6`.** Before, each was a stub that threw an error on use.
23
+
24
+ ## [0.0.0-alpha.5] - 2026-11-15
25
+
26
+ ### Changed
27
+
28
+ - **Uses `@rootnative/web` `0.0.0-alpha.5`,** which makes each render after the first one cheaper. This package has no change of its own. See the [changelog of `@rootnative/web`](https://github.com/rootnative/web/blob/main/packages/web/CHANGELOG.md).
29
+
9
30
  ## [0.0.0-alpha.4] - 2026-11-15
10
31
 
11
32
  ### Added
@@ -18,5 +39,7 @@ Each version works only with the same version of `@rootnative/web`. The package
18
39
  - **The two style files of react-native-web that Reanimated 4 reads**, so Reanimated animates the components of `@rootnative/web`.
19
40
  - **A stub for each name that `@rootnative/web` doesn't have yet**, such as `Animated`. The import works, and a use throws an error with the name. `expo-exports.json` lists these names under `missing`.
20
41
 
21
- [unreleased]: https://github.com/rootnative/web/compare/web@0.0.0-alpha.4...HEAD
42
+ [unreleased]: https://github.com/rootnative/web/compare/web@0.0.0-alpha.6...HEAD
43
+ [0.0.0-alpha.6]: https://github.com/rootnative/web/releases/tag/web@0.0.0-alpha.6
44
+ [0.0.0-alpha.5]: https://github.com/rootnative/web/releases/tag/web@0.0.0-alpha.5
22
45
  [0.0.0-alpha.4]: https://github.com/rootnative/web/releases/tag/web@0.0.0-alpha.4
package/README.md CHANGED
@@ -7,7 +7,7 @@ Expo's web bundler rewrites each `react-native` import to a file of react-native
7
7
  ```json
8
8
  {
9
9
  "dependencies": {
10
- "react-native-web": "npm:@rootnative/web-expo@0.0.0-alpha.4"
10
+ "react-native-web": "npm:@rootnative/web-expo@0.0.0-alpha.6"
11
11
  }
12
12
  }
13
13
  ```
@@ -16,6 +16,6 @@ This package depends on the same version of `@rootnative/web`, and works only wi
16
16
 
17
17
  ## What works
18
18
 
19
- An Expo app with no router, on the dev server and in a web export (`expo export --platform web`). Reanimated 4 animates the components, image imports load, and `react-native-svg` renders.
19
+ An Expo app, also with Expo Router, on the dev server and in a web export (`expo export --platform web`) with `web.output: 'single'` or `'static'`. Reanimated 4 animates the components, image imports load, and `react-native-svg` renders.
20
20
 
21
- The names of React Native that `@rootnative/web` doesn't have yet load as stubs, and a stub throws when your code uses it. `expo-exports.json` lists them under `missing`. Expo Router needs `Animated`, which is one of them.
21
+ The names of React Native that `@rootnative/web` doesn't have yet load as stubs, and a stub throws when your code uses it. `expo-exports.json` lists them under `missing`.
@@ -0,0 +1,6 @@
1
+ import { getAssetByID, registerAsset } from '@rootnative/web/assets-registry'
2
+
3
+ // react-native-web's `AssetRegistry` export: the asset registry as one object. The Babel preset
4
+ // of Expo sends `import { AssetRegistry } from 'react-native'` here. `expo-asset` imports it, and
5
+ // the server render of Expo Router loads `expo-asset`.
6
+ export const AssetRegistry = { getAssetByID, registerAsset }
@@ -0,0 +1,39 @@
1
+ // The event emitter of React Native. `DeviceEventEmitter` is one shared instance, and each
2
+ // `NativeEventEmitter` puts its listeners on it, as in React Native and react-native-web. The web
3
+ // has no native side, so only JavaScript emits events on it.
4
+ class EventEmitter {
5
+ #registry = new Map()
6
+
7
+ addListener(eventType, listener, context) {
8
+ if (typeof listener !== 'function') {
9
+ throw new TypeError('EventEmitter.addListener(...): 2nd argument must be a function.')
10
+ }
11
+ let listeners = this.#registry.get(eventType)
12
+ if (listeners === undefined) {
13
+ listeners = new Set()
14
+ this.#registry.set(eventType, listeners)
15
+ }
16
+ const registration = { context, listener, remove: () => listeners.delete(registration) }
17
+ listeners.add(registration)
18
+ return registration
19
+ }
20
+
21
+ // A listener that an earlier listener removes during the same emit still runs, as in React
22
+ // Native: the emit works on a copy of the list.
23
+ emit(eventType, ...args) {
24
+ const listeners = this.#registry.get(eventType)
25
+ if (listeners === undefined) return
26
+ for (const { context, listener } of Array.from(listeners)) listener.apply(context, args)
27
+ }
28
+
29
+ removeAllListeners(eventType) {
30
+ if (eventType === undefined) this.#registry.clear()
31
+ else this.#registry.delete(eventType)
32
+ }
33
+
34
+ listenerCount(eventType) {
35
+ return this.#registry.get(eventType)?.size ?? 0
36
+ }
37
+ }
38
+
39
+ export const DeviceEventEmitter = new EventEmitter()
package/dist/LogBox.js ADDED
@@ -0,0 +1,8 @@
1
+ // React Native's LogBox shows warnings and errors inside the app. On the web they go to the
2
+ // browser console, so each method does nothing, as in react-native-web.
3
+ export const LogBox = {
4
+ ignoreLogs() {},
5
+ ignoreAllLogs() {},
6
+ install() {},
7
+ uninstall() {},
8
+ }
@@ -0,0 +1,25 @@
1
+ import { DeviceEventEmitter } from './DeviceEventEmitter.js'
2
+
3
+ // React Native's `NativeEventEmitter`, as react-native-web has it on the web. The native module
4
+ // of the constructor has no use, because no native side sends events. The listeners go on the
5
+ // shared `DeviceEventEmitter`. `@expo/log-box` makes one when it loads.
6
+ export class NativeEventEmitter {
7
+ addListener(eventType, listener, context) {
8
+ return DeviceEventEmitter.addListener(eventType, listener, context)
9
+ }
10
+
11
+ emit(eventType, ...args) {
12
+ DeviceEventEmitter.emit(eventType, ...args)
13
+ }
14
+
15
+ removeAllListeners(eventType) {
16
+ if (eventType === undefined || eventType === null) {
17
+ throw new Error('`NativeEventEmitter.removeAllListener()` requires a non-null argument.')
18
+ }
19
+ DeviceEventEmitter.removeAllListeners(eventType)
20
+ }
21
+
22
+ listenerCount(eventType) {
23
+ return DeviceEventEmitter.listenerCount(eventType)
24
+ }
25
+ }
@@ -0,0 +1,6 @@
1
+ import { UIManager } from './UIManager.js'
2
+
3
+ // The web has no native modules. A library that looks one up, such as `expo-constants` with
4
+ // `NativeModules.EXDevLauncher`, gets `undefined` and takes its path for a missing module. The
5
+ // object is the one of react-native-web.
6
+ export const NativeModules = { UIManager }
@@ -0,0 +1,36 @@
1
+ import { withHostMethods } from '@rootnative/web/internal/render/hostMethods.js'
2
+
3
+ // A node is a DOM element, as `findNodeHandle` gives it. Anything else has no layout to measure.
4
+ const isElement = (node) => typeof node?.getBoundingClientRect === 'function'
5
+
6
+ // The methods of react-native-web's `UIManager`, on the host methods of `@rootnative/web`. So a
7
+ // measure calls back at once, and `updateView` writes only `style`, as `setNativeProps` does.
8
+ export const UIManager = {
9
+ blur(node) {
10
+ node?.blur?.()
11
+ },
12
+ focus(node) {
13
+ node?.focus?.()
14
+ },
15
+ measure(node, callback) {
16
+ if (isElement(node)) withHostMethods(node).measure(callback)
17
+ },
18
+ measureInWindow(node, callback) {
19
+ if (isElement(node)) withHostMethods(node).measureInWindow(callback)
20
+ },
21
+ measureLayout(node, relativeToNativeNode, onFail, onSuccess) {
22
+ if (isElement(node)) {
23
+ withHostMethods(node).measureLayout(relativeToNativeNode, onSuccess, onFail)
24
+ } else {
25
+ onFail?.()
26
+ }
27
+ },
28
+ updateView(node, props) {
29
+ if (isElement(node)) withHostMethods(node).setNativeProps(props)
30
+ },
31
+ // The web has no layout animation, so the next layout is the end of it.
32
+ configureNextLayoutAnimation(_config, onAnimationDidEnd) {
33
+ onAnimationDidEnd?.()
34
+ },
35
+ setLayoutAnimationEnabledExperimental() {},
36
+ }
@@ -1,3 +1 @@
1
- import { missing } from '../../missing.js'
2
-
3
- export default missing('Animated')
1
+ export * as default from '@rootnative/web/internal/apis/Animated/AnimatedExports.js'
@@ -0,0 +1 @@
1
+ export { AssetRegistry as default } from '../../AssetRegistry.js'
@@ -1,3 +1 @@
1
- import { missing } from '../../missing.js'
2
-
3
- export default missing('DeviceEventEmitter')
1
+ export { DeviceEventEmitter as default } from '../../DeviceEventEmitter.js'
@@ -1,3 +1 @@
1
- import { missing } from '../../missing.js'
2
-
3
- export default missing('Easing')
1
+ export { Easing as default } from '@rootnative/web/internal/apis/Easing/index.js'
@@ -1,3 +1 @@
1
- import { missing } from '../../missing.js'
2
-
3
- export default missing('LogBox')
1
+ export { LogBox as default } from '../../LogBox.js'
@@ -1,3 +1 @@
1
- import { missing } from '../../missing.js'
2
-
3
- export default missing('NativeEventEmitter')
1
+ export { NativeEventEmitter as default } from '../../NativeEventEmitter.js'
@@ -1,3 +1 @@
1
- import { missing } from '../../missing.js'
2
-
3
- export default missing('NativeModules')
1
+ export { NativeModules as default } from '../../NativeModules.js'
@@ -1,3 +1 @@
1
- import { missing } from '../../missing.js'
2
-
3
- export default missing('UIManager')
1
+ export { UIManager as default } from '../../UIManager.js'
package/dist/index.js CHANGED
@@ -1,23 +1,22 @@
1
1
  export * from '@rootnative/web'
2
2
  export { unstable_createElement as createElement } from '@rootnative/web'
3
3
  export { AppRegistry } from './AppRegistry.js'
4
- export { default as Animated } from './exports/Animated/index.js'
4
+ export { AssetRegistry } from './AssetRegistry.js'
5
+ export { DeviceEventEmitter } from './DeviceEventEmitter.js'
6
+ export { LogBox } from './LogBox.js'
7
+ export { NativeEventEmitter } from './NativeEventEmitter.js'
8
+ export { NativeModules } from './NativeModules.js'
9
+ export { UIManager } from './UIManager.js'
5
10
  export { default as CheckBox } from './exports/CheckBox/index.js'
6
- export { default as DeviceEventEmitter } from './exports/DeviceEventEmitter/index.js'
7
- export { default as Easing } from './exports/Easing/index.js'
8
11
  export { default as ImageBackground } from './exports/ImageBackground/index.js'
9
12
  export { default as InputAccessoryView } from './exports/InputAccessoryView/index.js'
10
13
  export { default as InteractionManager } from './exports/InteractionManager/index.js'
11
14
  export { default as LayoutAnimation } from './exports/LayoutAnimation/index.js'
12
- export { default as LogBox } from './exports/LogBox/index.js'
13
- export { default as NativeEventEmitter } from './exports/NativeEventEmitter/index.js'
14
- export { default as NativeModules } from './exports/NativeModules/index.js'
15
15
  export { default as Picker } from './exports/Picker/index.js'
16
16
  export { default as ProgressBar } from './exports/ProgressBar/index.js'
17
17
  export { default as SafeAreaView } from './exports/SafeAreaView/index.js'
18
18
  export { default as SectionList } from './exports/SectionList/index.js'
19
19
  export { default as Touchable } from './exports/Touchable/index.js'
20
- export { default as UIManager } from './exports/UIManager/index.js'
21
20
  export { default as VirtualizedList } from './exports/VirtualizedList/index.js'
22
21
  export { default as YellowBox } from './exports/YellowBox/index.js'
23
22
  export { default as render } from './exports/render/index.js'
package/expo-exports.json CHANGED
@@ -8,6 +8,7 @@
8
8
  "AppRegistry",
9
9
  "AppState",
10
10
  "Appearance",
11
+ "AssetRegistry",
11
12
  "BackHandler",
12
13
  "Button",
13
14
  "CheckBox",
@@ -65,23 +66,16 @@
65
66
  "useWindowDimensions"
66
67
  ],
67
68
  "missing": [
68
- "Animated",
69
69
  "CheckBox",
70
- "DeviceEventEmitter",
71
- "Easing",
72
70
  "ImageBackground",
73
71
  "InputAccessoryView",
74
72
  "InteractionManager",
75
73
  "LayoutAnimation",
76
- "LogBox",
77
- "NativeEventEmitter",
78
- "NativeModules",
79
74
  "Picker",
80
75
  "ProgressBar",
81
76
  "SafeAreaView",
82
77
  "SectionList",
83
78
  "Touchable",
84
- "UIManager",
85
79
  "VirtualizedList",
86
80
  "YellowBox",
87
81
  "render",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rootnative/web-expo",
3
- "version": "0.0.0-alpha.4",
3
+ "version": "0.0.0-alpha.6",
4
4
  "description": "Runs an Expo app on @rootnative/web, with the file layout of react-native-web",
5
5
  "license": "MIT",
6
6
  "homepage": "https://rootnative.github.io/web/",
@@ -35,7 +35,7 @@
35
35
  "test": "vitest run"
36
36
  },
37
37
  "dependencies": {
38
- "@rootnative/web": "0.0.0-alpha.4"
38
+ "@rootnative/web": "0.0.0-alpha.6"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": "^19.0.0",