Commit 2cfe774
Ios: complete iOS vibration pattern supports (js)
Summary:
This is a revised follow up version from facebook#8574 ( originally implemented in `objc` )
This PR change the implementation in JS suggested by javache
**motivation**
To supports vibration pattern like android.
The [iOS vibration implementation link](http://stackoverflow.com/questions/12966467/are-there-apis-for-custom-vibrations-in-ios/13047464#13047464) mentioned by skv-headless at facebook#6061 (comment), which will not be accepted by apple since that implementation uses a private API. Thus, I use pure public API `NSTimer` to implement it.
**Note**
Since vibration time on iOS is not configurable, there are slightly differences with android.
for example:
**Android Usage:**
`Vibration.vibrate([0, 500, 200, 500])`
==> V(0.5s) --wait(0.2s)--> V(0.5s)
`Vibration.vibrate([300, 500, 200, 500])`
==> --wait(0.3s)--> V(0.5s) --wait(0.2s)--> V(0.5s)
**iOS Usage:**
if first argument is 0, it will not be included in pattern array.
( vibration
Closes facebook#9233
Differential Revision: D3775085
Pulled By: javache
fbshipit-source-id: 370495857d5581399de32d2bed1ea1bcce193e9d1 parent b01feb4 commit 2cfe774
File tree
2 files changed
+91
-10
lines changed- Examples/UIExplorer/js
- Libraries/Vibration
2 files changed
+91
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
38 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
39 | 72 | | |
40 | 73 | | |
41 | 74 | | |
| |||
51 | 84 | | |
52 | 85 | | |
53 | 86 | | |
54 | | - | |
| 87 | + | |
55 | 88 | | |
56 | 89 | | |
57 | 90 | | |
58 | 91 | | |
59 | | - | |
| 92 | + | |
60 | 93 | | |
61 | 94 | | |
62 | 95 | | |
| |||
65 | 98 | | |
66 | 99 | | |
67 | 100 | | |
68 | | - | |
| 101 | + | |
69 | 102 | | |
70 | 103 | | |
71 | 104 | | |
72 | 105 | | |
73 | | - | |
| 106 | + | |
74 | 107 | | |
75 | 108 | | |
76 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
27 | 39 | | |
28 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
29 | 76 | | |
30 | 77 | | |
31 | 78 | | |
| |||
37 | 84 | | |
38 | 85 | | |
39 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
40 | 90 | | |
41 | 91 | | |
42 | 92 | | |
43 | | - | |
| 93 | + | |
44 | 94 | | |
45 | 95 | | |
46 | 96 | | |
47 | 97 | | |
48 | 98 | | |
49 | 99 | | |
50 | 100 | | |
51 | | - | |
52 | | - | |
53 | 101 | | |
54 | 102 | | |
55 | 103 | | |
56 | | - | |
| 104 | + | |
57 | 105 | | |
58 | 106 | | |
59 | 107 | | |
| |||
0 commit comments