alinz/react-native-share-extension

react-native 0.61 modal not render js

eladni101 opened this issue · 0 comments

I have a problem with react native 0.61 when I try to share the modal is up is empty. 
I use pods to link the library.
I attach here what I did. 
I will be glad for help :) 

Share.js

import React, { Component } from 'react'
import ShareExtension from 'rn-extensions-share'

import {
Text,
View,
TouchableOpacity,
AppRegistry
} from 'react-native'

export default class Share extends Component {
constructor(props, context) {
super(props, context)
this.state = {
isOpen: true,
type: '',
value: ''
}
}

async componentDidMount() {
try {
const { type, value } = await ShareExtension.data()
this.setState({
type,
value
})
} catch(e) {
console.log('errrr', e)
}
}

onClose = () => ShareExtension.close()

closing = () => this.setState({ isOpen: false });

render() {
return (

    <View style={{ alignItems: 'center', justifyContent:'center', flex: 1 }}>
      <View style={{ borderColor: 'green', borderWidth: 1, backgroundColor: 'red', height: 200, width: 300 }}>
        <TouchableOpacity onPress={this.closing}>
          <Text>Close</Text>
          <Text>type: { this.state.type }</Text>
          <Text>value: { this.state.value }</Text>
        </TouchableOpacity>
      </View>
    </View>
);

}
}

`

index.js

import { AppRegistry, I18nManager } from 'react-native';
import App from './src/App';
import React from 'react';
import { Provider } from "react-redux";
import { name as appName } from './app.json';
import { YellowBox } from 'react-native';
import { store } from "./src/reducers";
import Share from './Share';
I18nManager.allowRTL(false);
const RNRedux = () => (



);
// for react-native v0.57+:
YellowBox.ignoreWarnings(['Remote debugger']);

// react-native v0.56 or below:
// console.ignoredYellowBox = ['Remote debugger'];

AppRegistry.registerComponent(appName, () => RNRedux);
AppRegistry.registerComponent('Share', () => Share);`

PodFile

`platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'myapp' do
pod 'Firebase/Core', '> 5.19.0'
pod 'Firebase/Messaging', '
> 5.19.0'
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

target 'myappTests' do
inherit! :search_paths
# Pods for testing
end

use_native_modules!
end

target 'MyShareEx' do
pod 'Firebase/Core', '> 5.19.0'
pod 'Firebase/Messaging', '
> 5.19.0'
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

use_native_modules!
end

target 'myapp-tvOS' do

target 'myapp-tvOSTests' do
inherit! :search_paths
# Pods for testing
end

end

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
end
end
end
`

MyShareEx.m

`#import <Foundation/Foundation.h>
#import "ReactNativeShareExtension.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <React/RCTLog.h>

@interface MyShareEx : ReactNativeShareExtension
@EnD

@implementation MyShareEx

RCT_EXPORT_MODULE();

  • (UIView*) shareView {
    NSURL *jsCodeLocation;

#if DEBUG
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"Share" fallbackResource:nil];
#else
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/share.bundle?platform=ios&dev=true"];
// Change localhost to your network Ip for your Device Debugging
#endif

RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"Share"
initialProperties:nil
launchOptions:nil];
rootView.backgroundColor = [UIColor whiteColor];

// Uncomment for console output in Xcode console for release mode on device:
// RCTSetLogThreshold(RCTLogLevelInfo - 1);

return rootView;
}

@EnD
`