Skip to content
This repository has been archived by the owner on Sep 3, 2022. It is now read-only.

react native sim data doesn’t work in ejected project #14

Open
arash-brz opened this issue Feb 23, 2020 · 1 comment
Open

react native sim data doesn’t work in ejected project #14

arash-brz opened this issue Feb 23, 2020 · 1 comment

Comments

@arash-brz
Copy link

unfortunately react-native-sim-data doesnt work in ejected project.
I Try this module in a new react native project and it works fine.
But when try to use It in ejected project It returns null.
with this code

  <Button title="permission" onPress={()=>{   PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.READ_PHONE_STATE);}}></Button>
          <Button title="sss" onPress={()=>{  var x=RNSimData.getSimInfo().deviceId0;
  if(x!=null)alert(x); else alert('nooooo');}}></Button>

first Butoon for getting permission and second one for getting device Id But it returns:

null is not an Object(evaluating _reactnativesimdata getinfo()…)

@devzsms
Copy link

devzsms commented Mar 25, 2020

You need to add
include ':react-native-sim-data'project(':react-native-sim-data').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sim-data/android')

to your settings.gradle

and
implementation project(':react-native-sim-data')
to your build.gradle inside dependencies(){}

and last
add this to the Mainactivity
import eu.sigrlami.rnsimdata.RNSimDataReactPackage;

still in Mainactivity add this this new RNSimDataReactPackage(),
inside protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList(

just like another modules does
maybe this help

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants