TypeError: funcsMap[propKey] is not a function when using createText()
Đá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
Hướng nghiên cứu
Start by reproducing the supplied TypeScript example with createText(), Title, and the v2.0.0-to-v2.1.0 upgrade, then compare the behavior between those versions. The issue is done when Title renders with its Restyle props in v2.1.0 without the funcsMap TypeError, while the existing plain Text behavior remains unaffected.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The code below works as expected with v2.0.0 of Restyle, but when I upgrade to v2.1.0 I get the following error.
TypeError: funcsMap[propKey] is not a function. (In 'funcsMap[propKey](props, {
theme: theme,
dimensions: dimensions
})', 'funcsMap[propKey]' is undefined)
After some digging through my code, it appears that if I remove my <Title> component, this error goes away. So there's some issue with createText() perhaps?
I looked through the changelog for 2.0.0 → 2.1.0 but don't see anything obvious? If I replace my <Title> component with a plain <Text> component, it also works (but of course I lose the Restyle features).
import { createBox, createText } from '@shopify/restyle';
import React, {
forwardRef,
useImperativeHandle,
useRef,
useState,
} from 'react';
import { TouchableWithoutFeedback } from 'react-native';
import { Theme } from '~/theme/index';
import TextInput from './TextInput';
const InputWrapper = createBox<Theme>();
const OuterWrapper = createBox<Theme>();
const OutlineView = createBox<Theme>();
const Wrapper = createBox<Theme>();
const Title = createText<Theme>();
const SignInTextInput = (
{
title,
...rest
}: {
onChangeText: () => void;
title: string;
value: string;
},
ref: React.Ref<any>,
) => {
const [isFocused, setIsFocused] = useState(false);
const inputRef = useRef<any>();
const focusInput = () => {
inputRef.current?.focus();
};
useImperativeHandle(ref, () => ({
focus: () => {
focusInput();
},
}));
return (
<TouchableWithoutFeedback onPress={focusInput}>
<OuterWrapper>
<OutlineView
backgroundColor={
isFocused ? 'cardPrimaryBackground' : 'mainBackground'
}
bottom={-2}
left={-2}
position="absolute"
right={-2}
style={{
borderRadius: 10,
}}
top={-2}
/>
<Wrapper
backgroundColor="mainBackground"
borderColor="cardPrimaryBackground"
borderWidth={1}
padding="s"
style={{
borderRadius: 7.5,
}}
>
<Title color="cardPrimaryBackground" fontSize={12}>
{title}
</Title>
<InputWrapper flexDirection="row">
<TextInput
{...rest}
onBlur={() => setIsFocused(false)}
onFocus={() => setIsFocused(true)}
ref={inputRef}
/>
</InputWrapper>
</Wrapper>
</OuterWrapper>
</TouchableWithoutFeedback>
);
};
export default forwardRef(SignInTextInput);
- 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
-
Cannot make custom componentĐang mở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