Open
Description
This issue was originally created by @jongirard as facebook/react-native#20821.
- [ √ ] Review the documentation: https://facebook.github.io/react-native
- [ √ ] Search for existing issues: https://github.com/facebook/react-native/issues
- [ √ ] Use the latest React Native release: https://github.com/facebook/react-native/releases
(Related issue marked as fixed but problem still exists: facebook/react-native#9105)
Environment
System:
OS: macOS High Sierra 10.13.5
CPU: x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 29.44 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.5.0 - /usr/local/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 6.1.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
IDEs:
Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
npmPackages:
react: 16.4.1 => 16.4.1
react-native: 0.56.0 => 0.56.0
npmGlobalPackages:
react-native-cli: 2.0.1
Description
As per the React Native documentation, PushNotificationIOS.requestPermissions
method should return a promise to wait for user input, but nothing is ever returned. I've also tried adding an event listener in componentWillMount
like PushNotificationIOS.addEventListener('register', (token) => {});
which also does not resolve the requestPermissions promise.
Reproducible Demo
PushNotificationIOS.requestPermissions().then((permissions) => console.log(permissions));
Activity
rafaellincoln commentedon Feb 21, 2019
@jongirard Can you test again please?
jsamr commentedon Mar 22, 2019
@rafaellincoln I could reproduce.
Other reproductions:
facebook/react-native#20821
facebook/react-native#18523
facebook/react-native#13012
facebook/react-native#9105
Attempted fixes:
facebook/react-native#13263
facebook/react-native#8622
chr4ss1 commentedon Apr 19, 2019
If you'd like the requestPermissions to return something for sure, you need to ensure that
A) you take care of the case where 'register' event never happens
B) have fail-safe timeout which triggers after 7 seconds of no promise return.