Skip to content

Commit 5f77cb7

Browse files
authored
docs: mark InteractionManager as deprecated (#4810)
1 parent 1f31b0d commit 5f77cb7

File tree

6 files changed

+42
-18
lines changed

6 files changed

+42
-18
lines changed

docs/interactionmanager.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
---
22
id: interactionmanager
3-
title: InteractionManager
3+
title: 🗑️ InteractionManager
44
---
55

66
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';
77

8+
:::warning Deprecated
9+
Use the [`setImmediate`](timers) instead.
10+
:::
11+
812
InteractionManager allows long-running work to be scheduled after any interactions/animations have completed. In particular, this allows JavaScript animations to run smoothly.
913

1014
Applications can schedule tasks to run after interactions with the following:

docs/timers.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Timers are an important part of an application and React Native implements the [
77

88
## Timers
99

10-
- setTimeout, clearTimeout
11-
- setInterval, clearInterval
12-
- setImmediate, clearImmediate
13-
- requestAnimationFrame, cancelAnimationFrame
10+
- `setTimeout` and `clearTimeout`
11+
- `setInterval` and `clearInterval`
12+
- `setImmediate` and `clearImmediate`
13+
- `requestAnimationFrame` and `cancelAnimationFrame`
1414

1515
`requestAnimationFrame(fn)` is not the same as `setTimeout(fn, 0)` - the former will fire after all the frames have flushed, whereas the latter will fire as quickly as possible (over 1000x per second on a iPhone 5S).
1616

@@ -25,6 +25,10 @@ Please correct this by running ``adb shell "date `date +%m%d%H%M%Y.%S%3N`"`` on
2525

2626
## InteractionManager
2727

28+
:::warning Deprecated
29+
The `InteractionManager` behavior has been changed to be the same as `setImmediate`, which should be used instead.
30+
:::
31+
2832
One reason why well-built native apps feel so smooth is by avoiding expensive operations during interactions and animations. In React Native, we currently have a limitation that there is only a single JS execution thread, but you can use `InteractionManager` to make sure long-running work is scheduled to start after any interactions/animations have completed.
2933

3034
Applications can schedule tasks to run after interactions with the following:
@@ -43,7 +47,7 @@ Compare this to other scheduling alternatives:
4347

4448
The touch handling system considers one or more active touches to be an 'interaction' and will delay `runAfterInteractions()` callbacks until all touches have ended or been cancelled.
4549

46-
InteractionManager also allows applications to register animations by creating an interaction 'handle' on animation start, and clearing it upon completion:
50+
`InteractionManager` also allows applications to register animations by creating an interaction 'handle' on animation start, and clearing it upon completion:
4751

4852
```tsx
4953
const handle = InteractionManager.createInteractionHandle();

website/versioned_docs/version-0.80/interactionmanager.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
---
22
id: interactionmanager
3-
title: InteractionManager
3+
title: 🗑️ InteractionManager
44
---
55

66
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';
77

8+
:::warning Deprecated
9+
Use the [`setImmediate`](timers) instead.
10+
:::
11+
812
InteractionManager allows long-running work to be scheduled after any interactions/animations have completed. In particular, this allows JavaScript animations to run smoothly.
913

1014
Applications can schedule tasks to run after interactions with the following:

website/versioned_docs/version-0.80/timers.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Timers are an important part of an application and React Native implements the [
77

88
## Timers
99

10-
- setTimeout, clearTimeout
11-
- setInterval, clearInterval
12-
- setImmediate, clearImmediate
13-
- requestAnimationFrame, cancelAnimationFrame
10+
- `setTimeout` and `clearTimeout`
11+
- `setInterval` and `clearInterval`
12+
- `setImmediate` and `clearImmediate`
13+
- `requestAnimationFrame` and `cancelAnimationFrame`
1414

1515
`requestAnimationFrame(fn)` is not the same as `setTimeout(fn, 0)` - the former will fire after all the frames have flushed, whereas the latter will fire as quickly as possible (over 1000x per second on a iPhone 5S).
1616

@@ -25,6 +25,10 @@ Please correct this by running ``adb shell "date `date +%m%d%H%M%Y.%S%3N`"`` on
2525

2626
## InteractionManager
2727

28+
:::warning Deprecated
29+
The `InteractionManager` behavior has been changed to be the same as `setImmediate`, which should be used instead.
30+
:::
31+
2832
One reason why well-built native apps feel so smooth is by avoiding expensive operations during interactions and animations. In React Native, we currently have a limitation that there is only a single JS execution thread, but you can use `InteractionManager` to make sure long-running work is scheduled to start after any interactions/animations have completed.
2933

3034
Applications can schedule tasks to run after interactions with the following:
@@ -43,7 +47,7 @@ Compare this to other scheduling alternatives:
4347

4448
The touch handling system considers one or more active touches to be an 'interaction' and will delay `runAfterInteractions()` callbacks until all touches have ended or been cancelled.
4549

46-
InteractionManager also allows applications to register animations by creating an interaction 'handle' on animation start, and clearing it upon completion:
50+
`InteractionManager` also allows applications to register animations by creating an interaction 'handle' on animation start, and clearing it upon completion:
4751

4852
```tsx
4953
const handle = InteractionManager.createInteractionHandle();

website/versioned_docs/version-0.81/interactionmanager.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
---
22
id: interactionmanager
3-
title: InteractionManager
3+
title: 🗑️ InteractionManager
44
---
55

66
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';
77

8+
:::warning Deprecated
9+
Use the [`setImmediate`](timers) instead.
10+
:::
11+
812
InteractionManager allows long-running work to be scheduled after any interactions/animations have completed. In particular, this allows JavaScript animations to run smoothly.
913

1014
Applications can schedule tasks to run after interactions with the following:

website/versioned_docs/version-0.81/timers.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Timers are an important part of an application and React Native implements the [
77

88
## Timers
99

10-
- setTimeout, clearTimeout
11-
- setInterval, clearInterval
12-
- setImmediate, clearImmediate
13-
- requestAnimationFrame, cancelAnimationFrame
10+
- `setTimeout` and `clearTimeout`
11+
- `setInterval` and `clearInterval`
12+
- `setImmediate` and `clearImmediate`
13+
- `requestAnimationFrame` and `cancelAnimationFrame`
1414

1515
`requestAnimationFrame(fn)` is not the same as `setTimeout(fn, 0)` - the former will fire after all the frames have flushed, whereas the latter will fire as quickly as possible (over 1000x per second on a iPhone 5S).
1616

@@ -25,6 +25,10 @@ Please correct this by running ``adb shell "date `date +%m%d%H%M%Y.%S%3N`"`` on
2525

2626
## InteractionManager
2727

28+
:::warning Deprecated
29+
The `InteractionManager` behavior has been changed to be the same as `setImmediate`, which should be used instead.
30+
:::
31+
2832
One reason why well-built native apps feel so smooth is by avoiding expensive operations during interactions and animations. In React Native, we currently have a limitation that there is only a single JS execution thread, but you can use `InteractionManager` to make sure long-running work is scheduled to start after any interactions/animations have completed.
2933

3034
Applications can schedule tasks to run after interactions with the following:
@@ -43,7 +47,7 @@ Compare this to other scheduling alternatives:
4347

4448
The touch handling system considers one or more active touches to be an 'interaction' and will delay `runAfterInteractions()` callbacks until all touches have ended or been cancelled.
4549

46-
InteractionManager also allows applications to register animations by creating an interaction 'handle' on animation start, and clearing it upon completion:
50+
`InteractionManager` also allows applications to register animations by creating an interaction 'handle' on animation start, and clearing it upon completion:
4751

4852
```tsx
4953
const handle = InteractionManager.createInteractionHandle();

0 commit comments

Comments
 (0)