Open tonyseing opened 2 years ago
@tonyseing I just bumped into this same error. Did you happen to find a solution?
@timgremore I added a mock in my jest tests. Found this solution in another issue ticket here but it suited my case perfectly for the timebeing:
jest.mock('@shopify/restyle', () => { const RealModule = jest.requireActual('@shopify/restyle'); const RN = jest.requireActual('react-native'); RealModule.createText = () => RN.Text; RealModule.createBox = () => RN.View; RealModule.createRestyleComponent = (f, c) => c || RN.View; return RealModule;
@tonyseing This ended up being an invalid style prop (background
where backgroundColor
was expected) for me.
@timgremore thanks for the tip! I'll give this another look-see
On my side I figure it out by removing transform
style property in some of my variants in textVariant.
Is this still an issue? If so, could you provide full reproduction steps?
For me helped answer from this closed ticket: https://github.com/Shopify/restyle/issues/102#issuecomment-878444264
For me, I was moving the RestyleThemeProvider
on top of another ThemeProvider
.
Example:
import {ThemeProvider as RestyleThemeProvider} from '@shopify/restyle';
import {ThemeProvider as AnotherThemeProvider} from 'another-theme-provider';
<RestyleThemeProvider>
<AnotherThemeProvider>
// code here
</AnotherThemeProvider>
</RestyleThemeProvider>
I'm writing a jest test case that renders a Text component created from the following line of code:
export const Text = createText<IotTheme>();
I receive a resulting error: