Reputation: 99
I am working on an application in react native, and was taking a look at some tutorials for creating a 'share extension' within the app. I see on npm react-native-share-extension how to create the extension within the project in xcode, and create a new component with a second AppRegistry (shown from npm example).
//index.ios.js
import React from 'react'
import { AppRegistry } from 'react-native'
import App from './app.ios'
import Share from './share.ios'
AppRegistry.registerComponent('Sample1', () => App)
AppRegistry.registerComponent('MyShareEx', () => Share)
Does anyone know if the share component would have access to the data stored by the main app in AsyncStorage? (i.e my login token)
Thanks!
Upvotes: 3
Views: 1684
Reputation: 103
I would recommend to use native share extension since share extension have limited memory limit. It causes memory issue if you invoke react app from extenion.
Upvotes: 0
Reputation: 4972
You need to use App Groups. That is where you can store shared data.
There is a plugin for React Native that works very well for iOS. I'm using it myself.
Check out: https://www.npmjs.com/package/react-native-shared-group-preferences
Upvotes: 1