question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[1.7.0] useRestyle hook is not working anymore

See original GitHub issue

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: https://github.com/Shopify/restyle/commit/cdf1520943c7e8af8762d0cae33e88c9760e60c6

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ildfreelancercommented, Feb 27, 2022

In order to fix it:

1/ I have to check omitPropertiesMap !== undefined due to the commit :https://github.com/Shopify/restyle/blob/b137e2f057a5b255c903c30e9721058dc7ec23d5/src/hooks/useRestyle.ts#L19 2/ also export composeRestyleFunctions into index.ts at root 3/ change

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

to

 const { style } = useRestyle(composeRestyleFunctions([color]), rest)
1reaction
sbalaycommented, Mar 7, 2022

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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Layoutprops is not getting applied while using useRestyle hook
import React from 'react'; import { createVariant, createRestyleComponent, VariantProps, backgroundColor, BackgroundColorProps, useRestyle, spacing, ...
Read more >
@shopify/restyle - npm Package Health Analysis | Snyk
Is @shopify/restyle safe to use? The npm package @shopify/restyle was scanned for known vulnerabilities and missing license, and no issues were found. Thus...
Read more >
TypeError: (0 , _react.useEffect) is not a function - Stack Overflow
useState) is not a function in another file where I use React hooks. I want to solve the problem not implement a workaround....
Read more >
Shopify restyle Issues - Giters
Create text variant defaults is not working. ... Type issues with restyle component props ... [1.7.0] useRestyle hook is not working anymore.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found