diff --git a/.changeset/tender-buttons-judge.md b/.changeset/tender-buttons-judge.md
new file mode 100644
index 0000000000..acd36791b4
--- /dev/null
+++ b/.changeset/tender-buttons-judge.md
@@ -0,0 +1,5 @@
+---
+'@storybook/addon-ondevice-actions': patch
+---
+
+fix actions logs not themed
diff --git a/packages/ondevice-actions/package.json b/packages/ondevice-actions/package.json
index 5ffa7d97e8..1f5fea339a 100644
--- a/packages/ondevice-actions/package.json
+++ b/packages/ondevice-actions/package.json
@@ -28,6 +28,7 @@
"check:types": "tsc --noEmit"
},
"dependencies": {
+ "@storybook/react-native-theming": "^10.3.0-next.2",
"fast-deep-equal": "^3.1.3"
},
"devDependencies": {
diff --git a/packages/ondevice-actions/src/components/ActionLogger/Inspect.tsx b/packages/ondevice-actions/src/components/ActionLogger/Inspect.tsx
index 1dd5ca0695..9eb3c471fa 100644
--- a/packages/ondevice-actions/src/components/ActionLogger/Inspect.tsx
+++ b/packages/ondevice-actions/src/components/ActionLogger/Inspect.tsx
@@ -1,19 +1,39 @@
import React, { useState } from 'react';
-import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
-
-const theme = {
- OBJECT_NAME_COLOR: 'rgb(136, 19, 145)',
- OBJECT_VALUE_NULL_COLOR: 'rgb(128, 128, 128)',
- OBJECT_VALUE_UNDEFINED_COLOR: 'rgb(128, 128, 128)',
- OBJECT_VALUE_REGEXP_COLOR: 'rgb(196, 26, 22)',
- OBJECT_VALUE_STRING_COLOR: 'rgb(196, 26, 22)',
- OBJECT_VALUE_SYMBOL_COLOR: 'rgb(196, 26, 22)',
- OBJECT_VALUE_NUMBER_COLOR: 'rgb(28, 0, 207)',
- OBJECT_VALUE_BOOLEAN_COLOR: 'rgb(28, 0, 207)',
- OBJECT_VALUE_FUNCTION_PREFIX_COLOR: 'rgb(13, 34, 170)',
-
- ARROW_COLOR: '#859499',
-};
+import { View, StyleSheet, TouchableOpacity } from 'react-native';
+import { styled } from '@storybook/react-native-theming';
+
+const DefaultText = styled.Text(({ theme }) => ({
+ color: theme.color.defaultText,
+}));
+
+const ObjectNameText = styled.Text(({ theme }) => ({
+ color: theme.color.secondary,
+}));
+
+const MutedText = styled.Text(({ theme }) => ({
+ color: theme.textMutedColor,
+}));
+
+const StringText = styled.Text(({ theme }) => ({
+ color: theme.color.orange,
+}));
+
+const NumberText = styled.Text(({ theme }) => ({
+ color: theme.color.green,
+}));
+
+const BooleanText = styled.Text(({ theme }) => ({
+ color: theme.color.seafoam,
+}));
+
+const FunctionText = styled.Text(({ theme }) => ({
+ color: theme.color.purple,
+}));
+
+const ArrowText = styled.Text<{ visible: boolean }>(({ theme, visible }) => ({
+ color: visible ? theme.textMutedColor : 'transparent',
+ paddingRight: 8,
+}));
interface InspectProps {
name?: string;
@@ -32,15 +52,9 @@ const Inspect = ({ name, value }: InspectProps) => {
}
}, [canExpand]);
- const toggle = (
-
- {expanded ? '▼' : '▶'}
-
- );
+ const toggle = {expanded ? '▼' : '▶'};
- const nameComponent = name ? (
- {name}
- ) : null;
+ const nameComponent = name ? {name} : null;
if (Array.isArray(value)) {
if (name) {
@@ -49,7 +63,7 @@ const Inspect = ({ name, value }: InspectProps) => {
{toggle}
{nameComponent}
- {`: ${value.length === 0 ? '[]' : expanded ? '[' : '[...]'}`}
+ {`: ${value.length === 0 ? '[]' : expanded ? '[' : '[...]'}`}
{expanded ? (
@@ -59,7 +73,7 @@ const Inspect = ({ name, value }: InspectProps) => {
))}
- ]
+ ]
) : null}
@@ -68,13 +82,13 @@ const Inspect = ({ name, value }: InspectProps) => {
}
return (
<>
- [
+ [
{value.map((v, i) => (
))}
- ]
+ ]
>
);
}
@@ -85,7 +99,7 @@ const Inspect = ({ name, value }: InspectProps) => {
{toggle}
{nameComponent}
- {`: ${Object.keys(value).length === 0 ? '{}' : expanded ? '{' : '{...}'}`}
+ {`: ${Object.keys(value).length === 0 ? '{}' : expanded ? '{' : '{...}'}`}
{expanded ? (
@@ -95,7 +109,7 @@ const Inspect = ({ name, value }: InspectProps) => {
))}
- {'}'}
+ {'}'}
) : null}
@@ -104,13 +118,13 @@ const Inspect = ({ name, value }: InspectProps) => {
}
return (
<>
- {'{'}
+ {'{'}
{Object.entries(value).map(([key, v]) => (
))}
- {'}'}
+ {'}'}
>
);
}
@@ -119,7 +133,7 @@ const Inspect = ({ name, value }: InspectProps) => {
{toggle}
{nameComponent}
- :
+ :
);
@@ -129,35 +143,25 @@ const Inspect = ({ name, value }: InspectProps) => {
function Value({ value }: { value: any }) {
if (value === null) {
- return null;
+ return null;
}
if (value === undefined) {
- return undefined;
+ return undefined;
}
if (value instanceof RegExp) {
- return (
-
- {`/${value.source}/${value.flags}`}
-
- );
+ return {`/${value.source}/${value.flags}`};
}
switch (typeof value) {
case 'string':
- return (
- {JSON.stringify(value)}
- );
+ return {JSON.stringify(value)};
case 'number':
- return (
- {JSON.stringify(value)}
- );
+ return {JSON.stringify(value)};
case 'boolean':
- return (
- {JSON.stringify(value)}
- );
+ return {JSON.stringify(value)};
case 'function':
- return [Function];
+ return [Function];
default:
- return {JSON.stringify(value)};
+ return {JSON.stringify(value)};
}
}
diff --git a/packages/ondevice-actions/src/components/ActionLogger/index.tsx b/packages/ondevice-actions/src/components/ActionLogger/index.tsx
index 41890370fd..8da0f192e3 100644
--- a/packages/ondevice-actions/src/components/ActionLogger/index.tsx
+++ b/packages/ondevice-actions/src/components/ActionLogger/index.tsx
@@ -1,7 +1,12 @@
import { ActionDisplay } from 'storybook/actions';
-import { Button, ScrollView, StyleSheet, Text, View } from 'react-native';
+import { Button, ScrollView, StyleSheet, View } from 'react-native';
+import { styled } from '@storybook/react-native-theming';
import Inspect from './Inspect';
+const CountText = styled.Text(({ theme }) => ({
+ color: theme.color.defaultText,
+}));
+
interface ActionLoggerProps {
actions: ActionDisplay[];
onClear: () => void;
@@ -13,7 +18,7 @@ export const ActionLogger = ({ actions, onClear }: ActionLoggerProps) => (
{actions.map((action: ActionDisplay) => (
- {action.count > 1 ? {action.count} : null}
+ {action.count > 1 ? {action.count} : null}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 9e9b8f7e45..1f812a7e0e 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -228,6 +228,9 @@ importers:
packages/ondevice-actions:
dependencies:
+ '@storybook/react-native-theming':
+ specifier: ^10.3.0-next.2
+ version: link:../react-native-theming
fast-deep-equal:
specifier: ^3.1.3
version: 3.1.3