ค้นหาเว็บไซต์
ฉันกำลังพยายามใช้ Storybook ร่วมกับ expo และ react-native-web ทุกครั้งที่ฉันพยายามใช้โมดูลของ expo ฉันจะได้รับข้อผิดพลาดดังต่อไปนี้
ERROR in ./node_modules/expo-linear-gradient/build/LinearGradient.js Module not found: Error: Can't resolve './NativeLinearGradient' in '/Fleyver/front/node_modules/expo-linear-gradient/build' @ ./node_modules/expo-linear-gradient/build/LinearGradient.js 1:1373-1406ไฟล์ที่มันไม่สามารถแก้ไขได้มีหลายส่วนขยายสำหรับ .web.ts, .ios.ts แล
อ่านต่อไป →เมื่อพยายามเรียกใช้งานโครงการ storybook + RN + Typescript หลังจากทำตามทั้งสอง
และ
ฉันได้รับ:
ModuleParseError: Module parse failed: Unexpected token (10:12) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders| นำเข้า {dontSetMe} จาก './utils/shims'; | นำเข้า DraggableCore จาก './DraggableCore';
import type {ControlPositi
อ่านต่อไป →
ฉันได้รับข้อผิดพลาดดังต่อไปนี้เมื่อ storybook ของฉันรีโหลดแบบร้อน มันทำงานได้สมบูรณ์แบบเมื่อโหลดครั้งแรก:
TypeError: Cannot read property 'hooks' of undefined at StoryStore.cleanHooks (http://localhost:9009/vendors~main.0e777466815571a0333e.bundle.js:6197:22) at renderMain (http://localhost:9009/vendors~main.0e777 อ่านต่อไป →
ฉันกำลังสร้างคอมโพเนนต์ Checkbox โดยใช้ React, Typescript, Storybook และ Styled-Components หลังจากทำตามบทแนะนำนี้: building-a-checkbox-component-with-react-and-styled-components ฉันต้องปรับโค้ดบางส่วนเนื่องจากฉันกำลังใช้ FunctionComponent แต่ฉันประสบปัญหากับตัวจัดการการเปลี่ยนแปลง (change handler) ฉันไม่สามารถ
อ่านต่อไป →
ฉันแค่ไม่เข้าใจว่าทำไมมันถึงเกิดขึ้น ฉันพยายามแก้มันมาหลายสัปดาห์และสุดท้ายก็กลับไปใช้จาวาสคริปต์ในเรื่องราวของฉัน
นี่คือตัวสาขาที่ทำให้เกิดบั๊ก นี่คือโปรเจกต์ทั้งหมด ภายในที่ ./examples คุณจะเห็นแอปตัวอย่างที่รันด้วย react-react-app พร้อมกับ typescript และ storybook ภายในคุณจะเห็น src/stories/Xarrow.stories.tsx ซึ่งเมื่อรัน yarn storybook จะเกิด Parsing error: Missing semicolon. เหมือนกับที่ฉันลองใส่ typescript ลงในไฟล์ javascript
อ่านต่อไป →ฉันค่อนข้างใหม่กับ Docker และวันนี้ฉันได้ลองทำให้ monorepo ของ lerna ของเรามาอยู่ใน Docker โดยใช้การตั้งค่าต่อไปนี้:
ไฟล์ด็อกเกอร์
FROM node:14.13.1-alpine Add node modules bin to path ENV PATH /app/node_modules/.bin:$PATH ENV PATH /app/packages/core/node_modules/.bin:$PATH WORKDIR /app Install app deps COPY ./ ./ RUN yarn install RUN yarn bootstrap RUN cd packages/core && yarn install && cd ./node_modules/react && yarn link && cd ../../ อ่านต่อไป →
ฉันกำลังพยายามทำให้สำเร็จสิ่งนี้:
แต่ด้วยเรื่องราวของฉันที่ถูกแบ่งออกเป็นไฟล์ mdx และ tsx
จนถึงตอนนี้ ไฟล์ mdx ของฉันดูเหมือนดังนี้:
import { Meta, Story, Canvas, Preview, Props, ArgsTable } from '@storybook/addon-docs'; import { Button, Icons } from '../..'; <!-- Components --> export const ButtonWithou อ่านต่อไป →ฉันกำลังเขียน Storybook สำหรับองค์ประกอบลูกซึ่งองค์ประกอบพ่อแม่จะจัดการสถานะ ตัวอย่างเช่น value (string) และ onChange (func) ถูกส่งผ่าน props ฉันมีทั้งสอง props ที่ถูกส่ง แต่ฉันไม่แน่ใจว่าจะอัปเดตสถานะในไฟล์ storybook อย่างไร
textfield.tsx
import React, { FC, HTMLProps } from 'react'; type FirstNameTextFieldProps = HTMLProps<HTMLInputElement> const FirstNameTextField: FC<FirstNameTextFieldProps> = ({ ...restOfProps }) => ( อ่านต่อไป →
บริบท & รหัส
เราขยายปุ่มของเราแบบนี้:
export type ButtonProps<P = Record<string, unknown>> = P & { children: ReactNode | string onClick?: () => void className?: string disabled?: boolean secondary?: boolean } const Button = <P extends Reco อ่านต่อไป →ฉันเพิ่งย้ายโปรเจกต์ CRA ของฉันไปยัง Next.js ฉันเคยใช้ Storybook ในโปรเจกต์นั้น ดังนั้นจึงต้องแก้ไขการตั้งค่าหลายอย่าง แต่ยังคงมีปัญหาเกี่ยวกับ TypeScript อยู่
นี่คือตัวอย่างของไฟล์เรื่องราวของฉัน
import { ComponentStory, ComponentMeta } from '@storybook/react'; import Index from 'pages/profile'; export default { title: 'Views/Profile', component: Index, } as ComponentMeta<typeof Index>; export const IndexTemplate: ComponentStory<typeof Index> = (args) = อ่านต่อไป →