react-native-roku 0.0.0-stage → 0.2.0-preview.3
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 +328 -0
- package/CONTRIBUTING.md +34 -0
- package/LICENSE +21 -0
- package/NOTICE.md +10 -0
- package/README.md +66 -2
- package/bin/react-native-roku.mjs +91 -0
- package/build/assets.cjs +311 -0
- package/build/assets.d.cts +50 -0
- package/build/compatibility.d.mts +40 -0
- package/build/compatibility.mjs +272 -0
- package/build/dev.d.mts +34 -0
- package/build/dev.mjs +297 -0
- package/build/devWorkspace.d.mts +11 -0
- package/build/devWorkspace.mjs +86 -0
- package/build/device.d.mts +47 -0
- package/build/device.mjs +310 -0
- package/build/environment.d.mts +29 -0
- package/build/environment.mjs +144 -0
- package/build/esbuild.d.mts +5 -0
- package/build/esbuild.mjs +118 -0
- package/build/fontVariants.d.mts +27 -0
- package/build/fontVariants.mjs +424 -0
- package/build/frontend.d.mts +52 -0
- package/build/frontend.mjs +75 -0
- package/build/identity.mjs +45 -0
- package/build/index.d.mts +22 -0
- package/build/index.mjs +87 -0
- package/build/intl.mjs +121 -0
- package/build/metro.cjs +38 -0
- package/build/metro.d.cts +37 -0
- package/build/metroFrontend.mjs +222 -0
- package/build/metroMetadata.mjs +119 -0
- package/build/metroModules.mjs +397 -0
- package/build/metroRefresh.d.mts +64 -0
- package/build/metroRefresh.mjs +346 -0
- package/build/metroTransformer.cjs +146 -0
- package/build/nativeTextMemo.mjs +296 -0
- package/build/nativewind.d.mts +9 -0
- package/build/nativewind.mjs +92 -0
- package/build/project.d.mts +111 -0
- package/build/project.mjs +615 -0
- package/build/reactCompiler.mjs +113 -0
- package/build/reactProfile.cjs +35 -0
- package/build/refreshRuntime.mjs +187 -0
- package/build/refreshSourceMap.mjs +53 -0
- package/build/release.mjs +99 -0
- package/build/resolution.d.mts +3 -0
- package/build/resolution.mjs +25 -0
- package/build/surfaces.d.mts +1 -0
- package/build/surfaces.mjs +42 -0
- package/build/testing/node.d.mts +29 -0
- package/build/testing/node.mjs +106 -0
- package/build/yoga.d.mts +8 -0
- package/build/yoga.mjs +186 -0
- package/compatibility/public-api.json +327 -0
- package/compatibility/registry.json +2258 -0
- package/config/release.json +15 -0
- package/config/toolchain.json +34 -0
- package/docs/compatibility.md +813 -0
- package/docs/getting-started.md +460 -0
- package/docs/maintenance.md +368 -0
- package/docs/qualification.md +241 -0
- package/docs/standalone-testing.md +56 -0
- package/examples/hello-roku/README.md +35 -0
- package/examples/hello-roku/package.template.json +31 -0
- package/examples/hello-roku/pnpm-workspace.yaml +11 -0
- package/examples/hello-roku/roku.config.json +22 -0
- package/examples/hello-roku/src/App.tsx +54 -0
- package/examples/hello-roku/src/Catalog.tsx +200 -0
- package/examples/hello-roku/src/assets.d.ts +16 -0
- package/examples/hello-roku/src/catalog-cover.png +0 -0
- package/examples/hello-roku/tsconfig.json +1 -0
- package/examples/hello-roku/tsconfig.react.json +1 -0
- package/native/components/RNRAppControl.brs +215 -0
- package/native/components/RNRAppControl.xml +13 -0
- package/native/components/RNRDeviceFacts.brs +19 -0
- package/native/components/RNRDeviceFacts.xml +9 -0
- package/native/components/RNRDeviceFactsTask.brs +74 -0
- package/native/components/RNRDeviceFactsTask.xml +9 -0
- package/native/components/RNRTextRaster.brs +15 -0
- package/native/components/RNRTextRaster.xml +9 -0
- package/native/components/RNRTextRasterTask.brs +77 -0
- package/native/components/RNRTextRasterTask.xml +9 -0
- package/native/manifest.json +7 -0
- package/package.json +183 -3
- package/src/animation/clock.ts +10 -0
- package/src/animation/derivedValue.ts +163 -0
- package/src/animation/legacyAnimated.ts +255 -0
- package/src/animation/reanimated.ts +243 -0
- package/src/animation/sharedValue.ts +285 -0
- package/src/animation/worklets.ts +23 -0
- package/src/application/AppRegistry.ts +31 -0
- package/src/application/mountApplication.ts +136 -0
- package/src/graphics/BitmapLayer.tsx +68 -0
- package/src/graphics/RoundedBorder.tsx +116 -0
- package/src/graphics/TextRasterCache.ts +259 -0
- package/src/graphics/gradient.ts +37 -0
- package/src/graphics/inlineRaster.ts +85 -0
- package/src/graphics/png.ts +77 -0
- package/src/graphics/rasterPixels.ts +89 -0
- package/src/graphics/surfaces.ts +105 -0
- package/src/graphics/textRaster.types.ts +60 -0
- package/src/graphics/textRasterGeometry.ts +116 -0
- package/src/host/host.types.ts +57 -0
- package/src/index.ts +22 -0
- package/src/interop/nativewind.ts +2 -0
- package/src/layout/FontResources.ts +252 -0
- package/src/layout/affine.ts +89 -0
- package/src/layout/flexLayout.ts +398 -0
- package/src/layout/fontFaces.d.mts +19 -0
- package/src/layout/fontFaces.mjs +85 -0
- package/src/layout/fontVariants.d.mts +2 -0
- package/src/layout/fontVariants.mjs +8 -0
- package/src/layout/inlineParagraph.ts +158 -0
- package/src/layout/inlineText.ts +68 -0
- package/src/layout/layoutReuse.ts +117 -0
- package/src/layout/nativeNodeFields.ts +179 -0
- package/src/layout/preparedFields.ts +78 -0
- package/src/layout/textLayout.ts +138 -0
- package/src/layout/transform.ts +113 -0
- package/src/media/SceneGraphAudio.ts +161 -0
- package/src/media/SceneGraphVideo.ts +167 -0
- package/src/media/audioSession.ts +84 -0
- package/src/media/index.ts +2 -0
- package/src/media/videoErrorDetails.ts +40 -0
- package/src/media/videoSession.ts +136 -0
- package/src/navigation/RouterStore.ts +244 -0
- package/src/navigation/expoRouter.ts +115 -0
- package/src/react-native/NativeInput.ts +494 -0
- package/src/react-native/NativeSystemState.ts +95 -0
- package/src/react-native/accessibility.ts +265 -0
- package/src/react-native/activityIndicator.ts +72 -0
- package/src/react-native/compilerPressable.ts +26 -0
- package/src/react-native/createNativeRoot.ts +2126 -0
- package/src/react-native/directionalFocus.ts +55 -0
- package/src/react-native/environment.ts +275 -0
- package/src/react-native/flatList.ts +1001 -0
- package/src/react-native/flatListViewability.ts +231 -0
- package/src/react-native/focusEvents.ts +85 -0
- package/src/react-native/image.ts +247 -0
- package/src/react-native/index.ts +54 -0
- package/src/react-native/interactionManager.ts +76 -0
- package/src/react-native/keyboard.ts +60 -0
- package/src/react-native/linearGradient.ts +94 -0
- package/src/react-native/modal.tsx +148 -0
- package/src/react-native/nativeHostContext.ts +80 -0
- package/src/react-native/nativeModules.ts +86 -0
- package/src/react-native/nativeRoot.types.ts +22 -0
- package/src/react-native/nativeViewHandle.ts +191 -0
- package/src/react-native/nativewindPressable.ts +38 -0
- package/src/react-native/panResponder.ts +73 -0
- package/src/react-native/primitives.ts +685 -0
- package/src/react-native/safeArea.ts +76 -0
- package/src/react-native/scrollView.ts +289 -0
- package/src/react-native/styleInterop.ts +8 -0
- package/src/react-native/styleSheet.ts +54 -0
- package/src/react-native/textInput.ts +334 -0
- package/src/react-native/unsupported.ts +25 -0
- package/src/renderer/SceneRoot.ts +1006 -0
- package/src/scene/SdkDeviceFacts.ts +151 -0
- package/src/scene/SdkDeviceServices.ts +72 -0
- package/src/scene/SdkSceneGraph.ts +124 -0
- package/src/scene/SdkTextEntry.ts +321 -0
- package/src/scene/SdkTextMetrics.ts +136 -0
- package/src/scene/SdkTextRasterTransport.ts +191 -0
- package/src/scene/SdkWebTransport.ts +122 -0
- package/src/scene/createRokuHost.ts +213 -0
- package/src/scene/sceneGraph.types.ts +38 -0
- package/src/services/DeviceServices.ts +53 -0
- package/src/services/RegistryStorage.ts +85 -0
- package/src/services/RokuKeySession.ts +29 -0
- package/src/services/asyncStorage.ts +23 -0
- package/src/services/base64.ts +52 -0
- package/src/services/crypto.ts +18 -0
- package/src/services/expoConstants.ts +11 -0
- package/src/services/expoLinking.ts +12 -0
- package/src/services/expoStatusBar.ts +4 -0
- package/src/services/installWebRuntime.ts +105 -0
- package/src/services/intlEnglish.ts +54 -0
- package/src/services/languageRuntime.ts +65 -0
- package/src/services/nativeTimers.ts +96 -0
- package/src/services/secureStore.ts +23 -0
- package/src/services/textEntryRequest.ts +22 -0
- package/src/services/utf8.ts +57 -0
- package/src/services/webRuntime.ts +346 -0
- package/src/testing/CanvasResources.ts +141 -0
- package/src/testing/CanvasSceneGraph.ts +496 -0
- package/src/testing/CanvasTextEntry.ts +237 -0
- package/src/testing/PreviewTextObservations.ts +82 -0
- package/src/testing/RecordingSceneGraph.ts +136 -0
- package/src/types/normalize-colors.d.ts +4 -0
- package/src/vector/dynamicSvg.tsx +226 -0
- package/src/vector/svg.ts +222 -0
- package/src/vector/svg.types.ts +4 -0
- package/src/vector/svgElements.ts +58 -0
- package/src/vector/svgKey.d.mts +4 -0
- package/src/vector/svgKey.mjs +16 -0
- package/src/vector/svgPath.ts +157 -0
- package/src/vector/svgPixels.ts +133 -0
- package/tsconfig.consumer.json +29 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createElement, forwardRef, useRef, useState, type ComponentType } from "react";
|
|
2
|
+
import type { NativePressableProps } from "./primitives";
|
|
3
|
+
import type { NativeViewHandle } from "./nativeViewHandle";
|
|
4
|
+
|
|
5
|
+
/** Evaluate callback styles before the pinned interop engine resolves class and inline precedence. */
|
|
6
|
+
export function withPressableStyleCallbacks(Interop: ComponentType<NativePressableProps>) {
|
|
7
|
+
const CallbackStyles = forwardRef<NativeViewHandle, NativePressableProps>((props, ref) => {
|
|
8
|
+
const state = useRef({ pressed: false, focused: false, hovered: false }),
|
|
9
|
+
[, invalidate] = useState(0);
|
|
10
|
+
const publish = (next: Partial<typeof state.current>) => {
|
|
11
|
+
state.current = { ...state.current, ...next };
|
|
12
|
+
if (typeof props.style === "function") invalidate((value) => value + 1);
|
|
13
|
+
};
|
|
14
|
+
return createElement(Interop, {
|
|
15
|
+
...props,
|
|
16
|
+
ref,
|
|
17
|
+
style: typeof props.style === "function" ? props.style(state.current) : props.style,
|
|
18
|
+
onFocus: (event) => {
|
|
19
|
+
publish({ focused: true });
|
|
20
|
+
props.onFocus?.(event);
|
|
21
|
+
},
|
|
22
|
+
onBlur: (event) => {
|
|
23
|
+
publish({ focused: false, pressed: false });
|
|
24
|
+
props.onBlur?.(event);
|
|
25
|
+
},
|
|
26
|
+
onPressIn: (event) => {
|
|
27
|
+
publish({ pressed: true });
|
|
28
|
+
props.onPressIn?.(event);
|
|
29
|
+
},
|
|
30
|
+
onPressOut: (event) => {
|
|
31
|
+
publish({ pressed: false });
|
|
32
|
+
props.onPressOut?.(event);
|
|
33
|
+
},
|
|
34
|
+
} as NativePressableProps);
|
|
35
|
+
});
|
|
36
|
+
CallbackStyles.displayName = "RokuNativeWindPressable";
|
|
37
|
+
return CallbackStyles;
|
|
38
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
type Event = {
|
|
2
|
+
nativeEvent: {
|
|
3
|
+
pageX?: number;
|
|
4
|
+
pageY?: number;
|
|
5
|
+
locationX?: number;
|
|
6
|
+
locationY?: number;
|
|
7
|
+
timestamp?: number;
|
|
8
|
+
touches?: readonly unknown[];
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
interface Gesture {
|
|
12
|
+
stateID: number;
|
|
13
|
+
moveX: number;
|
|
14
|
+
moveY: number;
|
|
15
|
+
x0: number;
|
|
16
|
+
y0: number;
|
|
17
|
+
dx: number;
|
|
18
|
+
dy: number;
|
|
19
|
+
vx: number;
|
|
20
|
+
vy: number;
|
|
21
|
+
numberActiveTouches: number;
|
|
22
|
+
}
|
|
23
|
+
type Config = Readonly<Record<string, ((event: Event, gesture: Gesture) => unknown) | undefined>>;
|
|
24
|
+
let sequence = 0;
|
|
25
|
+
/** Pure responder normalization. It does not advertise a native touch source on Roku. */
|
|
26
|
+
export const PanResponder = Object.freeze({
|
|
27
|
+
create(config: Config) {
|
|
28
|
+
let at = 0,
|
|
29
|
+
gesture: Gesture = {
|
|
30
|
+
stateID: ++sequence,
|
|
31
|
+
moveX: 0,
|
|
32
|
+
moveY: 0,
|
|
33
|
+
x0: 0,
|
|
34
|
+
y0: 0,
|
|
35
|
+
dx: 0,
|
|
36
|
+
dy: 0,
|
|
37
|
+
vx: 0,
|
|
38
|
+
vy: 0,
|
|
39
|
+
numberActiveTouches: 0,
|
|
40
|
+
};
|
|
41
|
+
const update = (event: Event, start = false) => {
|
|
42
|
+
const x = event.nativeEvent.pageX ?? event.nativeEvent.locationX ?? 0,
|
|
43
|
+
y = event.nativeEvent.pageY ?? event.nativeEvent.locationY ?? 0,
|
|
44
|
+
now = event.nativeEvent.timestamp ?? Date.now(),
|
|
45
|
+
elapsed = now - at;
|
|
46
|
+
if (start) gesture = { ...gesture, x0: x, y0: y, dx: 0, dy: 0, vx: 0, vy: 0 };
|
|
47
|
+
gesture = {
|
|
48
|
+
...gesture,
|
|
49
|
+
vx: elapsed > 0 ? (x - gesture.moveX) / elapsed : 0,
|
|
50
|
+
vy: elapsed > 0 ? (y - gesture.moveY) / elapsed : 0,
|
|
51
|
+
moveX: x,
|
|
52
|
+
moveY: y,
|
|
53
|
+
dx: x - gesture.x0,
|
|
54
|
+
dy: y - gesture.y0,
|
|
55
|
+
numberActiveTouches: event.nativeEvent.touches?.length ?? 1,
|
|
56
|
+
};
|
|
57
|
+
at = now;
|
|
58
|
+
};
|
|
59
|
+
const handlers: Record<string, (event: Event) => unknown> = {};
|
|
60
|
+
for (const [name, callback] of Object.entries(config))
|
|
61
|
+
if (callback) {
|
|
62
|
+
const mapped = name.replace("PanResponder", "Responder");
|
|
63
|
+
handlers[mapped] = (event) => {
|
|
64
|
+
update(event, name === "onStartShouldSetPanResponder" || name === "onPanResponderGrant");
|
|
65
|
+
const result = callback(event, gesture);
|
|
66
|
+
if (name === "onPanResponderRelease" || name === "onPanResponderTerminate")
|
|
67
|
+
gesture.numberActiveTouches = 0;
|
|
68
|
+
return result;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return { panHandlers: handlers };
|
|
72
|
+
},
|
|
73
|
+
});
|