Cannot make custom component
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- react-native, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Start by tracing the custom component example in the issue through Restyle's createRestyleComponent and createVariant implementation, then run the relevant tests or reproduce it in the fixture app. The report gives no test or file path; done means the documented custom-component use case works without the funcsMap error.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Current behavior
Getting an error with custom component (heads up- NOT typescript due to company regs)
Uncaught Error
funcsMap[key] is not a function
Source
38 |
var
mappedProps
=
funcsMap[key](props
,
options)
;
39 |
// eslint-disable-next-line guard-for-in
>
40 |
for
(
var
mappedKey
in
mappedProps) {
|
^
41 |
styles[mappedKey]
=
mappedProps[mappedKey]
;
42 |
}
43 |
}
This is the component (a basic page header)
import {Platform, StyleSheet, View, Text} from "react-native";
import {createRestyleComponent, createVariant} from "@shopify/restyle";
import {BoxRestyle} from "./theme";
const WebHeaderContainer = createRestyleComponent(
[
createVariant({
themeKey: 'pageHeadVariants',
defaults: {
},
}),
],
BoxRestyle,
);
export default function WebHeader() {
if (Platform.OS !== 'web') return null;
return <WebHeaderContainer id='web-header'>
<Text>Restyle Web Header</Text>
</WebHeaderContainer>
}
// ----- theme
import {createTheme} from '@shopify/restyle';
const palette = {
sacramentoGreen: '#083D33',
bangladeshGreen: '#15664F',
persianGreen: '#01B694',
grannySmithYellow: '#01B694',
perlAqua: '#85CFC4',
black: '#000000',
white: '#FFFFFF',
gray_xxxl: 'rgba(0,0,0,0.95)',
gray_xxl: 'rgba(0,0,0,0.85)',
gray_xl: 'rgba(0,0,0,0.75)',
gray_l: 'rgba(0,0,0,0.66)',
gray_m: 'rgba(0,0,0,0.5)',
gray_s: 'rgba(0,0,0,0.33)',
gray_xs: 'rgba(0,0,0,0.25)',
gray_xxs: 'rgba(0,0,0,0.25)',
gray_xxxs: 'rgba(0,0,0,0.05)',
};
const theme = createTheme({
colors: {
mainBackground: palette.white,
cardPrimaryBackground: palette.bangladeshGreen,
pageHeaderBackgroundColor: palette.gray_xxxs,
pageHeaderTintColor: palette.black,
...palette
},
spacing: {
xs: 4,
s: 8,
m: 16,
l: 24,
xl: 32,
xxl: 48
},
pageHeadVariants: {
defaults: {
width: '100%',
height: '90px',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
flexDirection: 'column',
backgroundColor: 'pageHeaderBackgroundColor',
},
},
textVariants: {
header: {
fontFamily: 'PoppinsExtraBold',
fontWeight: '800',
fontSize: 34,
},
body: {
fontFamily: 'Roboto',
fontWeight: '400',
fontSize: 16,
lineHeight: 24,
},
defaults: {
// We can define a default text variant here.
},
},
});
export default theme;
Expected behavior
the component works as documented in site...
To Reproduce
Platform:
Web / Expo
- iOS
- Android
Environment
"@shopify/restyle": "^2.4.4",
- Ngôn ngữ chính
- TypeScript
- Star
- 3.4k
- Fork
- 154
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Shopify/restyle
-
Reanimated 4.4.x animated components conflict with Restyle themeCó thể đã có người làm @KAMRONBEK đã nhận 131 ngày trước. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 15/100
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
Tất cả issue của Shopify/restyle
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
testing-library/jest-dom#749 ·
-
Duplicate "./pack-settings" export in packages/workflows/package.json makes `bun install` failĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
zed-industries/delta-claude#50 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
CDLUC3/dmptool-doc#660 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
stripe/stripe-terminal-react-native#1162 ·
Maintainer thường phản hồi trong vòng 1 ngày