Using React Native Settings API

I have an app that needs to use the React Native Settings API to get NSUserDefaults.
After reading Settings API broken in Expo the only insight I got was ‘modify the podfile’. This was extremely generic so here is my solution:

  • Install React-Native-User-Defaults.
  • After linking libraries, I learned that the module needs to linked in the podfile. Here’s the code to get it linked without using react-native cli:

pod ‘RCTUserDefaults’, :path => ‘…/node_modules/react-native-user-defaults’

That’s it, I was able to use react-native-user-defaults to get and set NSUserDefaults.

Hope this helps anyone looking to utilize the React-Native Settings API.