[Next] style prop of pressable is not receiving pressed argument when className is used
See original GitHub issueDescribe the bug
The style
prop of Pressable can be a function which takes an object with pressed
value to return different style depending on state is pressed or not. It works fine if style
props is used without className
, but if both style
and className
are used then the pressed
argument is not working anymore.
To Reproduce Steps to reproduce the behavior:
- use Pressable component
- use
style
prop to style it differently depending if pressed - add
className
to Pressable - Pressable no longer show different style depening if pressed
Expected behavior
className
does not affect style
Repo https://github.com/itsramiel/nativewind-pressable/tree/repro/style-pressable
Issue Analytics
- State:
- Created 10 months ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Using styled components with Typescript, prop does not exist?
The styled component will have to specify the prop to pass to the component like styled("h2")<IProps> . You can read more about the...
Read more >Pressable has unchangeable delay for opacity effect (onPressIn)
I am having the same problem. TouchableOpacity is not using Pressable but Pressabilitty API (The same one TouchableOpacity use). That said, ...
Read more >How To Customize React Components with Props
In this tutorial, you'll create custom components by passing props to your component. Props are arguments that you provide to a JSX element....
Read more >The React Handbook – Learn React for Beginners
The React Handbook follows the 80/20 rule: learn in 20% of the time the 80% of a topic. I find this approach gives...
Read more >React interactivity: Events and state - Learn web development
The camel-cased nature of onClick is important — JSX will not recognize onclick (again, it is already used in JavaScript for a specific ......
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 Free
Top 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
Closing this issue, as it has been added to the feature request project
Alright interesting. I was not aware of the modifiers and it will most likely solve my use case, but in my opinion I think the
style
prop should still maintain its original behavior of receiving the pressed boolean.