Shopify / restyle

A type-enforced system for building UI components in React Native with TypeScript.

Home Page:https://shopify.github.io/restyle/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[1.7.0] useRestyle hook is not working anymore

ildfreelancer opened this issue · comments

After upgrading from v1.6.2, useRestyle stops working

Sample code:

 const { style } = useRestyle([color], rest) 

Above code is working on v1.6.2, but throw the error on v1.7.0

TypeError: undefined is not an object (evaluating 'omitPropertiesMap[key]')

I noticed that the composeRestyleFunctions is not imported into index.ts file

Related commits: cdf1520

In order to fix it:

1/ I have to check omitPropertiesMap !== undefined due to the commit :

if (omitPropertiesMap[key as keyof TProps]) {

2/ also export composeRestyleFunctions into index.ts at root
3/ change

 const { style } = useRestyle([color], rest) 

to

 const { style } = useRestyle(composeRestyleFunctions([color]), rest)

I ran into the same issue on 1.6.3. Solved it by downgrading to 1.6.1 until this is fixed.

had the same issue with v1.7.0 downgraded to v1.6.2

v1.7.0 has those same breaking changes for us too

It wasn't fixed in v1.8.0

Hey, this is definitely broken. Thanks for reporting and sorry for the inconvenience.

I'll have a fix released during next week. In the mean time you can stick to v1.6.2.

This should be fixed in v2.0.0, here's a quick doc that describes the required migration changes: https://github.com/Shopify/restyle/blob/master/docs/MIGRATING_TO_V2.md

Feel free to reopen this issue if you find any related issue. We will unpublish v1.7.0 and v1.8.0 as they are minor bumps that contain breaking changes (or release v1.7.1 and v1.8.1 if we realise it's too late to unpublish).