Darkmode Card onPress error with 4.0.x
See original GitHub issueCurrent 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>
Screenshots (if applicable)
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:
- Created 3 years ago
- Reactions:1
- Comments:17 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you use
...DarkTheme, mode: "exact",
then also everything is fine but not without exact mode
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 thedark: true
and the animation breaks. Just as if we tried to start the animation with thedark: 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?