Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
trevyn opened this issue Jan 31, 2020 · 9 comments
Closed

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

trevyn opened this issue Jan 31, 2020 · 9 comments
Labels
API: Vibration DX Issues concerning how the developer experience can be improved. Platform: iOS iOS applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@trevyn
Copy link

trevyn commented Jan 31, 2020

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.

@trevyn trevyn changed the title [0.62.0-rc.1] Vibration.vibrate has unspecified nullability [0.62.0-rc.1] Vibration.vibrate has unspecified nullability on iOS Jan 31, 2020
@hramos
Copy link
Contributor

hramos commented Jan 31, 2020

According to the docs, specifying a duration in vibrate(duration) on iOS should have no effect. Can you remove the argument and see if that solves the error?

Even in that case, I think this could be handled better. I'll flag this with the team.

@hramos hramos added API: Vibration DX Issues concerning how the developer experience can be improved. Platform: iOS iOS applications. and removed Needs: Triage 🔍 labels Jan 31, 2020
@react-native-bot

This comment has been minimized.

@react-native-bot react-native-bot added the Needs: Issue Template This issue does not make use of the Issue Template, and may be missing necessary information. label Jan 31, 2020
@hramos hramos removed the Needs: Issue Template This issue does not make use of the Issue Template, and may be missing necessary information. label Jan 31, 2020
@react-native-bot react-native-bot added the Needs: Issue Template This issue does not make use of the Issue Template, and may be missing necessary information. label Jan 31, 2020
@trevyn
Copy link
Author

trevyn commented Jan 31, 2020

@hramos Correct that the value of the duration parameter is ignored on iOS, but the docs also say that it is required. And indeed, calling without any arguments rightfully complains about the lack of arguments.

The docs also make it sound like vibrate(Array) should have a meaning on iOS, but it looks completely unimplemented. No idea if this is a regression or not.

@hramos
Copy link
Contributor

hramos commented Jan 31, 2020

I'm looking at RNTester, in Vibration example, where I added an example that calls Vibration.vibrate(3). I couldn't get an error to show up. No red screen, nothing in the Xcode console. Where are you seeing the error? If I can repro this, I might be able to fix the spec.

Docs do seem out of date as RCTVibration shows vibration by pattern is not implemented on iOS.

@hramos hramos removed the Needs: Issue Template This issue does not make use of the Issue Template, and may be missing necessary information. label Jan 31, 2020
@brunobar79
Copy link
Contributor

@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: #27951

@dsernst
Copy link

dsernst commented 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 (#27951) has status Waiting on Facebook?

Is there anything we can do to help? 🙂

@mateusmirandaalmeida
Copy link

Mesmo problema aqui

@stale
Copy link

stale bot commented Jul 4, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jul 4, 2020
@stale
Copy link

stale bot commented Jul 12, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Jul 12, 2020
@facebook facebook locked as resolved and limited conversation to collaborators Oct 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API: Vibration DX Issues concerning how the developer experience can be improved. Platform: iOS iOS applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

6 participants