This repository has been archived by the owner on Feb 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add withTouchProps and withMouseDownProps example
- Loading branch information
Fernando Via Canel
committed
Jun 5, 2017
1 parent
a089a9c
commit e6114da
Showing
4 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from 'react' | ||
import { withMouseDownProps } from '../' | ||
|
||
export default withMouseDownProps({ pressed: true })(function Pressable({ pressed, ...props }) { | ||
return ( | ||
<article {...props}> | ||
<h1>withMouseDownProps</h1> | ||
<code> | ||
<pre | ||
style={{ | ||
color: 'lightgreen', | ||
backgroundColor: 'black', | ||
padding: 10, | ||
overflowX: 'scroll', | ||
}} | ||
>{`import React from 'react' | ||
import { withMouseDownProps } from '@klarna/higher-order-components' | ||
export default withMouseDownProps({ pressed: true })(function Pressable({ pressed, ...props }) { | ||
return ( | ||
<article {...props}> | ||
<h1>withMouseDownProps</h1> | ||
{pressed ? 'pressed!' : 'press anywhere to see it change'} | ||
</article> | ||
) | ||
})`}</pre> | ||
</code> | ||
{pressed ? 'pressed!' : 'press anywhere to see it change'} | ||
</article> | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from 'react' | ||
import { withTouchProps } from '../' | ||
|
||
export default withTouchProps({ touched: true })(function Touchable({ touched, ...props }) { | ||
return ( | ||
<article {...props}> | ||
<h1>withTouchProps</h1> | ||
<code> | ||
<pre | ||
style={{ | ||
color: 'lightgreen', | ||
backgroundColor: 'black', | ||
padding: 10, | ||
overflowX: 'scroll', | ||
}} | ||
>{`import React from 'react' | ||
import { withTouchProps } from '@klarna/higher-order-components' | ||
export default withTouchProps({ touched: true })(function Touchable({ touched, ...props }) { | ||
return ( | ||
<article {...props}> | ||
<h1>withTouchProps</h1> | ||
{touched ? 'touched!' : 'tap anywhere to see it change'} | ||
</article> | ||
) | ||
})`}</pre> | ||
</code> | ||
{touched ? 'touched!' : 'tap anywhere to see it change'} | ||
</article> | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters