TypeError: funcsMap[propKey] is not a function when using createText()
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- react-native, typescript
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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);
- Lingua principale
- TypeScript
- Stelle
- 3.4k
- Fork
- 154
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Shopify/restyle
-
Reanimated 4.4.x animated components conflict with Restyle themeForse già presa @KAMRONBEK l’ha presa 131 giorni fa. Apertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 15/100
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
-
Cannot make custom componentApertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
Tutte le issue di Shopify/restyle
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
testing-library/jest-dom#749 ·
-
Duplicate "./pack-settings" export in packages/workflows/package.json makes `bun install` failAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
zed-industries/delta-claude#50 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
CDLUC3/dmptool-doc#660 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
stripe/stripe-terminal-react-native#1162 ·
I maintainer di solito rispondono entro 1 giorno