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.

Darkmode Card onPress error with 4.0.x

See original GitHub issue

Current behaviour

With darkmode enabled, when clicking on a Card component with onPress prop set, I get the following error:

Error: Style property 'backgroundColor' is not supported by native animated module, js engine: hermes

Expected behaviour

The onPress function should be executed and the Card background should be animated to become lighter.

Code sample

Just create any project rendering a card with the following props:

<Card
   onPress={() => console.log("cc")}
>
   <Text>Hello</Text>
</Card>

Link to a Snack example

Screenshots (if applicable)

Screenshot_20200717-164154 Screenshot_20200717_164322

What have you tried

Tried switching to light mode, no issue. Tried to go back to 3.11.1, no issue.

Your Environment

software version
ios or android android (did not try iOS)
react-native 0.63.1
react-native-paper 4.0.1 and 4.0.0
react-native-vector-icons 7.0.0
node 12.18.2
npm or yarn npm 6.14.5
expo sdk N/A
JS engine Hermes

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
wortkotzecommented, Jul 20, 2020

If you use ...DarkTheme, mode: "exact",

then also everything is fine but not without exact mode

3reactions
PedroBerncommented, Aug 8, 2020

Need to reopen this

#2068 looks like solving the issue, but it still breaks if:

1: Currently on light theme 2: Press a card, for example, that opens a menu 3: The user quickly change mind and click a “toggle dark theme switch with adaptive mode”

What is happening is:

The Card component is still with the elevation animation running with dark: false, but suddenly the dark: true and the animation breaks. Just as if we tried to start the animation with the dark: true in the first place (partial solution by #2068).

The problem is here in the Surface. At this line the elevation is using native driver with the dark theme (in this very specific case of running animation while toggling the theme).

@Trancever can you reopen?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Designing a UI with custom theming using react-native-paper
Expanding on the “card” motifs that debuted in Google Now, Material Design uses more grid-based layouts, responsive animations and ...
Read more >
Button - NativeBase
The Button component triggers an event or an action. Examples can be submitting forms and deleting a data point. Show Code.
Read more >
Handling Hover, Focus, and Other States - Tailwind CSS
Remove top/bottom padding when first/last child --> <li class="flex py-4 first:pt-0 ... Hover over the card to see both text elements change color ......
Read more >
Material Symbols and Icons - Google Fonts
running_with_errorsRunning With Errors ... credit_card_offCredit Card Off ssid_chartSsid Chart mediationMediation ... nest_wake_on_pressNest Wake On Press
Read more >
Dark Mode - Human Interface Guidelines - Apple Developer
Dark Mode is a systemwide appearance setting that uses a dark color palette to provide a comfortable viewing experience tailored for low-light environments....
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