admin管理员组

文章数量:1393889

An error Unexpected token, expected } suddenly appeared without a clear cause.

Line 136:7 is right where it says master: {

const styles = StyleSheet.create({
	master: {
		flex: 1,
		justifyContent: 'center',
		flexDirection: 'row',
		alignItems: 'center',
		flexWrap: 'wrap'
	}
});

An error Unexpected token, expected } suddenly appeared without a clear cause.

Line 136:7 is right where it says master: {

const styles = StyleSheet.create({
	master: {
		flex: 1,
		justifyContent: 'center',
		flexDirection: 'row',
		alignItems: 'center',
		flexWrap: 'wrap'
	}
});

It was working fine before. I have tried:

rm -rf node_modules && npm install
npm start -- --reset-cache

No changes from either of those.

Share Improve this question edited Nov 23, 2018 at 11:33 B--rian 5,88011 gold badges47 silver badges100 bronze badges asked Mar 7, 2017 at 21:20 softdownfeatherssoftdownfeathers 2291 gold badge2 silver badges13 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 8

This error was due to a missing </> in my render method.

in my case the error was

unexpected token , expected ","

. the reason was in the stylesheet, used = in place of :

color = colors.white instead of color: colors.white

In my case, ComponentDidUpdate was after the render() method.

本文标签: javascriptReact Native Syntax Error Unexpected Tokenexpected Stack Overflow