@openpeepshq/rn-components 0.3.5 → 0.3.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/README.md +2 -2
- package/metro/resolve-asset-source.js +19 -0
- package/metro.js +20 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -14,9 +14,9 @@ pnpm add @openpeepshq/rn-components
|
|
|
14
14
|
|
|
15
15
|
Wrap your app with **`OpenpeepsProvider`** from `@openpeepshq/rn-components` (and a credentials store + `baseUrl`) so `useOpenpeeps()` and theme code work. This re-exports the web provider from `@openpeepshq/react` with React Native `AppState` foreground handling wired in — do not import `OpenpeepsProvider` from `@openpeepshq/react` in native apps.
|
|
16
16
|
|
|
17
|
-
Configure **NativeWind** / Tailwind in the app (include this package in Tailwind `content`), load `src/global.css` from your entry, and supply **`react-native-config`** (or compatible env) for `BASE_URL` and related keys
|
|
17
|
+
Configure **NativeWind** / Tailwind in the app (include this package in Tailwind `content`), load `src/global.css` from your entry, and supply **`react-native-config`** (or compatible env) for `BASE_URL` and related keys.
|
|
18
18
|
|
|
19
|
-
Wrap Metro with **`withOpenPeepsMetro`** (outside `withNativeWind`) so css-interop observables defer on React 19. Hosts should not patch `react-native-css-interop`.
|
|
19
|
+
Wrap Metro with **`withOpenPeepsMetro`** (outside `withNativeWind`) so css-interop observables defer on React 19 and `react-native-sound` 0.11.x can `require()` RN 0.80+ `resolveAssetSource`. Hosts should not patch `react-native-css-interop` or `react-native-sound`.
|
|
20
20
|
|
|
21
21
|
```js
|
|
22
22
|
const { withNativeWind } = require('nativewind/metro');
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* RN >= 0.80 ships `Libraries/Image/resolveAssetSource` as ESM
|
|
5
|
+
* (`export default`). CJS `require()` then returns `{ default: fn }`
|
|
6
|
+
* instead of the function. `react-native-sound` 0.11.x calls the require
|
|
7
|
+
* result directly. Unwrap here so hosts do not patch that package.
|
|
8
|
+
*
|
|
9
|
+
* 0.12+ has this fix upstream but drops old-arch natives and has RN 0.82+
|
|
10
|
+
* Android codegen issues; community apps stay on 0.11.2 + this shim.
|
|
11
|
+
*/
|
|
12
|
+
const resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
|
|
13
|
+
|
|
14
|
+
module.exports =
|
|
15
|
+
typeof resolveAssetSource === 'function'
|
|
16
|
+
? resolveAssetSource
|
|
17
|
+
: resolveAssetSource && typeof resolveAssetSource.default === 'function'
|
|
18
|
+
? resolveAssetSource.default
|
|
19
|
+
: resolveAssetSource;
|
package/metro.js
CHANGED
|
@@ -11,11 +11,21 @@ const patchedObservable = path.join(
|
|
|
11
11
|
const CSS_INTEROP_OBSERVABLE_RE =
|
|
12
12
|
/[/\\]react-native-css-interop[/\\]dist[/\\]runtime[/\\]observable\.js$/;
|
|
13
13
|
|
|
14
|
+
const SOUND_PACKAGE_RE = /[/\\]react-native-sound[/\\]/;
|
|
15
|
+
|
|
16
|
+
const patchedResolveAssetSource = path.join(
|
|
17
|
+
__dirname,
|
|
18
|
+
'metro',
|
|
19
|
+
'resolve-asset-source.js',
|
|
20
|
+
);
|
|
21
|
+
|
|
14
22
|
/**
|
|
15
23
|
* Metro wrapper for OpenPeeps community apps.
|
|
16
24
|
*
|
|
17
25
|
* Substitutes css-interop's synchronous observable with a React 19-safe
|
|
18
|
-
* `queueMicrotask` implementation
|
|
26
|
+
* `queueMicrotask` implementation, and unwraps RN 0.80+ ESM
|
|
27
|
+
* `resolveAssetSource` for `react-native-sound` 0.11.x, so hosts do not
|
|
28
|
+
* patch `node_modules`.
|
|
19
29
|
*
|
|
20
30
|
* Apply this *outside* other Metro wrappers so their `resolveRequest`
|
|
21
31
|
* still runs:
|
|
@@ -29,6 +39,15 @@ const withOpenPeepsMetro = (config) => {
|
|
|
29
39
|
resolver: {
|
|
30
40
|
...config.resolver,
|
|
31
41
|
resolveRequest: (context, moduleName, platform) => {
|
|
42
|
+
if (
|
|
43
|
+
moduleName === 'react-native/Libraries/Image/resolveAssetSource' &&
|
|
44
|
+
SOUND_PACKAGE_RE.test(context.originModulePath || '')
|
|
45
|
+
) {
|
|
46
|
+
return {
|
|
47
|
+
filePath: patchedResolveAssetSource,
|
|
48
|
+
type: 'sourceFile',
|
|
49
|
+
};
|
|
50
|
+
}
|
|
32
51
|
const result = previous
|
|
33
52
|
? previous(context, moduleName, platform)
|
|
34
53
|
: context.resolveRequest(context, moduleName, platform);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpeepshq/rn-components",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "React Native community screens and shared UI (extracted from the Black Ambition app) for the OpenPeeps stack.",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"validator": "^13.15.23",
|
|
142
142
|
"zustand": "^5.0.3",
|
|
143
143
|
"@openpeepshq/common": "^0.2.0",
|
|
144
|
-
"@openpeepshq/react": "^0.3.
|
|
144
|
+
"@openpeepshq/react": "^0.3.1"
|
|
145
145
|
},
|
|
146
146
|
"devDependencies": {
|
|
147
147
|
"@babel/core": "^7.26.7",
|