question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[0.62.0-rc.1] Vibration.vibrate has unspecified nullability on iOS

See original GitHub issue

Description:

  • Vibration.vibrate() errors on iOS on 0.62.0-rc.1. Looks like something to do with TurboModules.

  • Error: Argument 0 (NSNumber) of Vibration.vibrate has unspecified nullability but React requires that all NSNumber arguments are explicitly marked as ‘nonnull’ to ensure compatibility with Android.

React Native version:

System:
    OS: macOS Mojave 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz
    Memory: 1014.98 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 13.6.0 - /usr/local/bin/node
    npm: 6.13.4 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
  IDEs:
    Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.0-rc.1 => 0.62.0-rc.1 
  npmGlobalPackages:
    react-native-cli: 2.0.1

Steps To Reproduce

Vibration.vibrate(1);

Expected Results

Error-free vibration.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
brunobar79commented, Feb 5, 2020

@hramos I can reproduce on v0.62 rc1 and it doesn’t matter if I call it with a number as a param or without parameter, which makes sense because of it’s being called without params for iOS here

IMG_3758

@trevyn is right about this being related to TurboModules. The problem is that numbers are not supported as nullable arguments in functions,

Just submitted a PR to fix the issue: https://github.com/facebook/react-native/pull/27951

8reactions
dsernstcommented, Apr 1, 2020

Still seeing this in react-native@0.62.0 in iOS.

To reproduce on a fresh build:

import React from 'react'
import { Vibration, Button } from 'react-native'

const Example = () => <Button onPress={() => Vibration.vibrate()} title="Push me to crash" />
)

Results in:

Expected:

Would expect this simple Vibration.vibrate() call to work, per the first example from the docs.


Looks like the suggested PR (https://github.com/facebook/react-native/pull/27951) has status Waiting on Facebook?

Is there anything we can do to help? 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

Customize iPhone for vibration sensitivities - Apple Support
If you have a sensitivity or intolerance to vibrations, you can customize iPhone to suit your needs. Set vibration options for specific alerts:...
Read more >
How to make iPhone vibrate using Swift? - ios - Stack Overflow
import AudioToolbox AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);. But that is not working for me. ios · iphone · swift · vibration.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found