@storybook/addon-ondevice-controls
Version:
Display storybook controls on your device.
18 lines (17 loc) • 940 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const react_native_theming_1 = require("@storybook/react-native-theming");
const types_1 = __importDefault(require("./types"));
const InvalidTypeText = react_native_theming_1.styled.Text(({ theme }) => ({
color: theme.color.negative,
}));
const InvalidType = ({ arg }) => ((0, jsx_runtime_1.jsxs)(InvalidTypeText, { children: ["Invalid type: ", arg.type] }));
const PropField = ({ onChange, arg, isPristine }) => {
const InputType = types_1.default[arg.type];
return InputType ? ((0, jsx_runtime_1.jsx)(InputType, { arg: arg, isPristine: isPristine, onChange: onChange })) : ((0, jsx_runtime_1.jsx)(InvalidType, { arg: arg }));
};
exports.default = PropField;