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

Settings.watchKeys(...) callback not fired when Settings.set() is used #21607

Closed
3 tasks
benzman81 opened this issue Oct 9, 2018 · 5 comments
Closed
3 tasks
Labels
Bug Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@benzman81
Copy link

Environment

React Native Environment Info:
System:
OS: macOS 10.14
CPU: x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 57.88 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.11.3 - /usr/local/bin/node
npm: 5.6.0 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
IDEs:
Xcode: 10.0/10A255 - /usr/bin/xcodebuild
npmPackages:
react: 16.5.0 => 16.5.0
react-native: 0.57.0 => 0.57.0
npmGlobalPackages:
react-native-app-id: 0.0.5
react-native-cli: 2.0.1

Description

When registering a callback via Settings.watchKeys, then it is never called if a value for a watched key is changed via Settings.set(). Only if I add a Settings.bundle to Xcode and change the Value via the iOS Settings app, then the callback is called.

Reproducible Demo

Simply register a callback on "foo" via Settings.watchKeys and call Settings.set{foo:"new Value"} later. The callback will not be called.

@stale
Copy link

stale bot commented Jan 20, 2019

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 "For Discussion" or "Good first issue" 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 Jan 20, 2019
@benzman81
Copy link
Author

For Discussion

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 20, 2019
@hramos hramos removed the 🔶APIs label Jan 24, 2019
@hramos hramos removed the Bug Report label Feb 6, 2019
@TroX-oO
Copy link

TroX-oO commented Apr 17, 2019

Hello, I've been through the same issue, and i've checked the ios native implementation. It is clearly written that no update should be triggered when a value is set with the method Settings.set()

RCT_EXPORT_METHOD(setValues:(NSDictionary *)values)

I don't know why it is implemented like this, but it seems to be the expected behaviour.
It is a bit surprising that the documentation does not mention this case however.

https://facebook.github.io/react-native/docs/settings

As a workaround, instead of counting on the watchkeys, I will trigger an action as well as setting my property in UserDefaults.

@stale
Copy link

stale bot commented Aug 2, 2019

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 Aug 2, 2019
@stale
Copy link

stale bot commented Aug 9, 2019

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 Aug 9, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Aug 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug 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

4 participants