File tree Expand file tree Collapse file tree 1 file changed +2
-18
lines changed
Expand file tree Collapse file tree 1 file changed +2
-18
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,6 @@ officialDoc: https://reactnative.dev/docs/pressable
66
77Pressable is a Core Component wrapper that can detect various stages of press interactions on any of it's defined children.
88
9- ⚠️ Current ` Pressable ` is deprecated, prefer ` Pressable_ ` that offers interaction states (eg: ` pressed ` state).
10-
119## How it works
1210
1311On an element wrapped by ` Pressable ` :
@@ -19,32 +17,18 @@ You can read more about this [on the official Pressable documentation](https://r
1917
2018## Example
2119
22- Current Pressable (deprecated because doesn't provide pressed state).
23-
24- ``` rescript
25- open ReactNative
26-
27- @react.component
28- let make = () =>
29- <Pressable onPress={_ => Js.log("Pressed")}>
30- <Text> {"Press Me"->React.string} </Text>
31- </Pressable>
32- ```
33-
34- Next Pressable (with interactionState)
35-
3620``` rescript
3721open ReactNative
3822
3923@react.component
4024let make = () =>
41- <Pressable_
25+ <Pressable
4226 onPress={_ => Js.log("Pressed")}
4327 style={({pressed}) => {
4428 open Style
4529 style(~backgroundColor=pressed ? "rgb(210, 230, 255)" : "white", ())
4630 }}>
4731 {({pressed}) =>
4832 <Text> {(pressed ? "Pressed!" : "Press Me")->React.string} </Text>}
49- </Pressable_ >
33+ </Pressable >
5034```
You can’t perform that action at this time.
0 commit comments