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
6
6
7
7
Pressable is a Core Component wrapper that can detect various stages of press interactions on any of it's defined children.
8
8
9
- ⚠️ Current ` Pressable ` is deprecated, prefer ` Pressable_ ` that offers interaction states (eg: ` pressed ` state).
10
-
11
9
## How it works
12
10
13
11
On an element wrapped by ` Pressable ` :
@@ -19,32 +17,18 @@ You can read more about this [on the official Pressable documentation](https://r
19
17
20
18
## Example
21
19
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
-
36
20
``` rescript
37
21
open ReactNative
38
22
39
23
@react.component
40
24
let make = () =>
41
- <Pressable_
25
+ <Pressable
42
26
onPress={_ => Js.log("Pressed")}
43
27
style={({pressed}) => {
44
28
open Style
45
29
style(~backgroundColor=pressed ? "rgb(210, 230, 255)" : "white", ())
46
30
}}>
47
31
{({pressed}) =>
48
32
<Text> {(pressed ? "Pressed!" : "Press Me")->React.string} </Text>}
49
- </Pressable_ >
33
+ </Pressable >
50
34
```
You can’t perform that action at this time.
0 commit comments