Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Unexpected labeled statement – React Native

I’m creating a react native app and have a component that only return values, but it give me an error Unexpected labeled statement which I think is the reason my app crashes when I run npx react-native start.

import {Dimensions} from 'react-native';

export default function () {
  MAX_WIDTH: Dimensions.get('screen').width;
  MAX_HEIGHT: Dimensions.get('screen').height;
  GAP_SIZE: 300;
}

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

If all you want to do is return some data then what you can do is create an object, assign the values to it and export it as the default like this:

import {Dimensions} from 'react-native';

const Data = {
    MAX_WIDTH: Dimensions.get('screen').width,
    MAX_HEIGHT: Dimensions.get('screen').height,
    GAP_SIZE: 300,
}

export default Data;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading