convert expo project into vanilla react native

I need som features that not supported in expo.how Can i convert my expo project into vanilla react native?
without expo needed

You absolutely can! Just run expo eject and select the “bare” option :+1:

We have documentation surrounding the bare workflow here - https://docs.expo.io/versions/v36.0.0/bare/exploring-bare-workflow/

1 Like

thanks charlie,
is ejected project needs expo client to run?

Hi

No. The Expo client is not needed after you have ejected. Although, if you want to use the Expo client during development it is still possible with some caveats:

https://docs.expo.io/versions/v36.0.0/bare/using-expo-client/

In case you are unaware, your app does not need the Expo client to run even if you do not eject, as long as you build a standalone app:

https://docs.expo.io/versions/v36.0.0/distribution/building-standalone-apps/

You should only need to eject if you need to get around the limitations of the Managed Workflow. (The last point there is not really a reason to eject in my opinion because you can still build a standalone Managed app yourself if you need to without having to eject. They do mention that in the text, but you might miss it if you’re just reading the headings.)

EDIT: I see you said you need some features not provided by Expo, so of course you would need to eject in that case, but you might still want to use the Expo client during development.

2 Likes

Is that possible to use react-native-sim-data in expo?
I installed it by :npm install react-native-sim-data
then
import { PermissionsAndroid} rom ‘react-native’
and
import RNSimData from ‘react-native-sim-data’;
and finally

async  requestCameraPermission() {
    try {
      const granted = await PermissionsAndroid.request(
        PermissionsAndroid.PERMISSIONS.READ_PHONE_STATE,
        {
          'title': 'Cool Photo App Camera Permission',
          'message': 'Cool Photo App needs access to your camera ' +
                     'so you can take awesome pictures.'
        }

        
      )


      if (granted === PermissionsAndroid.RESULTS.GRANTED) {
      
        alert('Granted');
        //alert('as');
        console.log("You can use the camera")
      } else {
        alert('asds');
        console.log("Camera permission denied")
      }
    } catch (err) {
      alert('asds');
      console.warn(err)
    }
  }

Is that right solution?

Unfortunately react-native-sim-data apparently includes native code and is not already included in Expo, so you would need to eject in order to use it.

Could you elaborate on what you are trying to do? The code you posted does not seem to use react-native-sim-data.

1 Like

depending on what you need that for you could use expo-cellular instead https://docs.expo.io/versions/latest/sdk/cellular/

1 Like

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()…)

An Expo project that has been ejected to the Bare workflow is a React Native project.

Can you carefully compare the code you are using in the “new react native project” to the code you are using in the ejected Expo project to see if there are any differences? Also compare the import statements.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.