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 API - issue with `watchKeys` function callback #28213

Closed
Simek opened this issue Mar 2, 2020 · 1 comment
Closed

Settings API - issue with `watchKeys` function callback #28213

Simek opened this issue Mar 2, 2020 · 1 comment

Comments

@Simek
Copy link
Contributor

@Simek Simek commented Mar 2, 2020

Description:

This issue was reported a while ago and become "stale": #21607

I was working on the updates and Snack example for the Settings API website page (refs.: facebook/react-native-website#1579) and I have stumble upon a problem. It seems like Settings.watchKeys function callback isn't fired properly.

I have studied the source code (https://github.com/facebook/react-native/blob/1151c096dab17e5d9a6ac05b61aacecd4305f3db/Libraries/Settings/Settings.ios.js) to confirm that I have done everything right, but there is still a possibility of an issue in my code since I was never earlier working with this API.

Nonetheless Settings.set and Settings.get method seems to work properly. After pressing one of the buttons and than changing example in the editor App preview will be refreshed and stored value will be updated correctly.

React Native version:

expo 36.0.0

Steps To Reproduce

  1. Setup Settings.watchKeys with a callback.
  2. Change key value using Settings.set.
  3. Callback isn't fired.

Expected Results

watchKeys function should fire callback on value change.

Snack, code example, screenshot, or link to a repository:

https://snack.expo.io/@simek/settings-api

@Simek

This comment has been minimized.

Copy link
Contributor Author

@Simek Simek commented Mar 27, 2020

As referenced PRs says:

watchKeys() by design ignores internal set() calls and fires callback only on changes performed outside of React Native code.

This means that this issue is invalid.

@Simek Simek closed this Mar 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.