Open davidbarker opened 2 years ago
same issue only with Text = createText
+1
If this can help anyone, I've had the same issue (that funcsMap[propKey] is not a function
error), and after some digging I found that it was caused by fontVariant
property, and after removing it, it's working again. Note that I was having an older version of shopify/restyle: 1.6.1.
, and this happened after upgrade to 2.1.0
.
Have you guys check if your <ThemeProvider />
is properly set ?
Same issue here and yes the ThemeProvider was set. But look like all is fix when you add that to your theme
hello guys! ive got the same issue here when I add variant='header' to my Text component, any help please
version :"@shopify/restyle": "^1.4.0"
Text component : import {createText} from '@shopify/restyle'; import {Theme} from './theme';
export const Text = createText
theme : import * as React from 'react'; import { ThemeProvider as ReThemeProvider, TextProps, BoxProps, useTheme as useRTheme, } from '@shopify/restyle';
type BaseThemeType = typeof BaseTheme & {
textVariants: {[key: string]: TextProps
},
header: {
fontWeight: 'bold',
fontSize: 34,
lineHeight: 42.5,
color: 'span',
},
}, // buttonVariants: {}, // navigation: {}, }); export type Theme = typeof theme;
export const ThemeProvider = ({children}: {children: React.ReactNode}) => (
);
export const useTheme = () => useRTheme
On my side I figure it out by removing transform
style property in some of my variants in textVariant.
Is there any way to get types on textVariants and the like? Or at least a better error message? This keeps biting me as it can be hard to track down which property is incorrect (typo, etc.).
Hi! Same error for me, I just created an expo project and add restyle.
I'm using the theme suggested by documentation and createText, nothing else.
There are updates on this issue? Thanks in advance
Same issue here and yes the ThemeProvider was set. But look like all is fix when you add that to your theme
I add defaults in my textVariants but I doesn't work I have the error "undefined is not a function" when I add variant props in Text component like
Do not forget to wrap the component you're testing with the <ThemeProvider />
.
Instead of just using render
, you can create a wrapper like this:
and use it like this
Pessoal, no meu caso, o problema estava no expo router, e como tinha definido um arquivo App.tsx fora do src/app
The code below works as expected with
v2.0.0
of Restyle, but when I upgrade tov2.1.0
I get the following error.After some digging through my code, it appears that if I remove my
<Title>
component, this error goes away. So there's some issue withcreateText()
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).