You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importcom.blueprintalpha.rnandroidshare.RNAndroidSharePackage; // <--- importpublicclassMainActivityextendsActivityimplementsDefaultHardwareBackBtnHandler {
......
@OverrideprotectedList<ReactPackage> getPackages() {
returnArrays.<ReactPackage>asList(
newMainReactPackage(),
newRNAndroidSharePackage(this) // <------ add this line to your MainActivity class
);
}
......
}
Now implement into your code
varReact=require('react-native')var{
View,
Text,
TouchableHighlight,
Image,}=ReactvarAndroidShare=require('react-native-android-share');varShareButton=React.createClass({// this will open the share tray_showShareActionSheet(story){varobject={subject: 'Story Title',text: 'Message Body'};AndroidShare.openChooserWithOptions(object,'Share Story');},// render a simple buttonrender(){return(<TouchableHighlightunderlayColor='rgba(0,0,0,0)'resizeMode='cover'onPress={()=>this._showShareActionSheet(this.props.story)}><Imagesource={require("../images/share.png")}width={45}height={45}style={{height:45,width:45}}/></TouchableHighlight>);},});module.exports=ShareButton;
TODO
right now, module basically returns an empty view. need to either make this a component OR just a file with classes in it.