Hi!
In my project with Expo SDK 37, the main core of the app is the native Vibration api (Vibration.vibrate
).
I know that iOS can’t handle an integer vibration pattern, so I made it as an array, [100]
.
Now, when I call Vibration.vibrate([100])
, or even with the repeated version, Vibration.vibrate([100], true)
, that doesn’t seem to work, on iOS, while works on my Android device.
I don’t have an iOS device to test, but a week ago I asked to a friend of mine to test on his iPhone 6S my app with the Expo client, and vibration wasn’t working.
For what I can see, Appetize emulators can’t tell me in any way if the device is vibrating or not, even when runned in Expo snacks.
Also, I don’t own an iOS device, so, I can’t test iOS device perfectly and replicate it.
But, I had the crazy idea to activate Accelerometer on Expo snacks using expo-sensors, and, when runned on an Android device emulated with Appetize.io, Vibration.vibrate([100])
triggers the Accelerometer’s vibration; the same goes for my physical Android device; Appetize’s emulated iOS device, instead, doesn’t.
I can’t rely on this test and trust it 100%, but, anyway, that does seem to confirm that vibration doesn’t work on iOS devices.
Why though? Did I do something wrong? Maybe Vibration API is not accessible anymore on newer iOS versions?
Right now I’m testing it in a very, very, easy snack.
/* bla bla bla various imports */
import { Vibration, } from 'react-native';
export default class App extends React.Component {
constructor() {
super();
}
makeVibration() {
Vibration.vibrate([100]);
}
render() {
return (
<View style={styles.container}>
<TouchableHighlight onPress={this.makeVibration}>
<Text style={styles.paragraph}>Press here to test vibration.</Text>
</TouchableHighlight>
</View>
);
}
}
/* bla bla bla various styling */
Maybe can someone replicate it on his iOS device and test the snack? Vibration example - Snack here it is, a simple fork of another old vibration testing snack.
Also, does anyone know a way I can test iOS vibration on an emulator, without owning a Mac or an iOS device? Appetize doesn’t seem to give relevant informations about vibration.