Error on react-native-share

Hello !

I just moved to EAS CI.
I installed the package react-native-share, then create a build with EAS, started the dev client.
When I try to use the library, I get this error :

TypeError: null is not an object (evaluating '_reactNative.NativeModules.RNShare.FACEBOOK')

Workflow : Managed

eas.json :

{
	"cli": {
		"version": ">= 0.43.0"
	},
	"build": {
		"development": {
			"developmentClient": true,
			"distribution": "internal",
			"env": {
				"APP_VARIANT": "development"
			}
		},
		"preview": {
			"distribution": "internal"
		},
		"production": {}
	},
	"submit": {
		"production": {}
	}
}

Hi @marc-hbb

Can you post the code where you’re importing and using RN Share?

import React from 'react';
import { View, StyleSheet, Image } from 'react-native';
import { LogoWhiteSvg } from "_assets/svg";
import { SignButtons } from './components';
import Share from 'react-native-share';


export const Intro = ({ navigation }) => {

    return (
        <>
            <Image
                resizeMode="cover"
                style={{ ...StyleSheet.absoluteFill, width: "100%", height: "100%" }}
                source={require("_assets/images/dances/intro.gif")}
            />
            <View style={{ ...StyleSheet.absoluteFill, backgroundColor: "black", opacity: 0.4, }} />

            {/* LOGO */}
            <View style={{ flex: 0.4, justifyContent: 'center', alignItems: 'center', }}>
                <LogoWhiteSvg />
            </View>


            {/* CTA */}
            <SignButtons navigation={navigation} />

            {/* <LogWithButtons /> */}

        </>
    )
}


Just by importing the module, I got this error

More on this error :

TypeError: null is not an object (evaluating '_reactNative.NativeModules.RNShare.FACEBOOK')
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
at node_modules/@react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError
at node_modules/metro-runtime/src/polyfills/require.js:203:6 in guardedLoadModule
at http://172.20.10.2:8081/App.bundle?platform=ios&dev=true&hot=false&strict=false&minify=false:368423:3 in global code

The symptoms are as if you’re trying to use Expo Go or a dev client that was built before you installed react-native-share.

I’ve updated my test app to Expo SDK 45 and rebuilt the Simulator dev client:

https://expo.dev/artifacts/eas/45nX6p39rAVXX1VqG5gitA.tar.gz

Here’s the repository that I built this from:

Try downloading and extracting that and then dragging the RNShare.app to your Simulator to install it. Then open it and try to connect to your dev server from your app (assuming you’re also using SDK 45.)
Otherwise clone my test app, install the dependencies, run expo start and try connecting to it from my dev client.

Do you still get the same errors? Does it work?

Thanks for the answer I will check it !
Small question, how is that working on a simulator ? I thought you couldn’t get any social media since there’s no app store on it

Just tried on my device, it’s working !

1 Like