私は簡単なビンゴゲームを構築して、React-Nativeを使ってiOSとAndroidで作業を完了しています。私は過去にJavaとPythonでの経験を持つJSの新人です。私の偏見は、前述の言語によく知られている構文を持つES6構文を使用することです。ES6の構文を使って「React Native」の「予期しないトークン、(44:33)」のトラブルシューティング方法
私はここで貼り付けているファイルで識別できない構文エラーが発生しています(これはそのファイルの完全なコードです)。このファイルのiOSエミュレータからのエラーは次のとおりです。
予期しないトークンです。 (44:33)
私は(44:33)は44行目33を意味すると信じています。私は44行目をAtomで次のように見ています。
_createPlayerTabs(playerCount) {
私はGoogleで多くの研究として行っている、Facebookはネイティブのサイトを反応し、ここでは可能性としてではなく、Googleはトークンの正当な検索:(としてセミコロンを認識しないので、それは非常に困難をされている。私は「疑いますメートルPythonやJavaのようなそのJS関数を仮定に基づいて、エラーのいくつかの並べ替えを行うことが、特定のエラーがあるか、私が作ってるんだ概念的なものを誤って何の皆さんが提供できるすべてのヘルプをいただければ幸いです。
'use strict'
import React from 'react';
import {
View,
Text,
StyleSheet,
TextInput,
TouchableOpacity,
Picker,
} from 'react-native';
import {
Actions,
} from 'react-native-router-flux';
import {
TabViewAnimated,
TabBarTop,
} from 'react-native-tab-view';
import GlobalStyles from '../../styles/GlobalStyles';
import BingoBoard from '../../components/BingoBoard';
class Player extends React.Component {
constructor(props){
super(props);
this.state = {
index: 0,
routes: this._createPlayerTabs(this.props.players),
};
}
_setupPlayers(playerCount, boardSize, winCondition) {
players = []
for (var x = 1; x <= playerCount; x++) {
tempBoard = new BingoBoard(boardSize, winCondition);
players.push('Player '.concat(x.toString()) : {
name: "",
board: tempBoard,
});
}
_createPlayerTabs(playerCount) {
playerList = [];
for (var x = 1; x <= playerCount; x++) {
playerList.push({
key: x.toString(),
title: "Player ".concat(x.toString()),
});
}
return playerList;
}
_renderScene({ route }) {
return
<View style={[GlobalStyles.container, {paddingTop: 500}]}>
<Text>
{route.title}
</Text>
</View>;
}
_renderHeader(props) {
return <TabBarTop {...props} />;
}
_handleChangeTab = (index) => {
this.setState({ index });
}
render() {
return(
<View style={GlobalStyles.container}>
<TabViewAnimated
style={GlobalStyles.container}
navigationState={this.state}
renderScene={this._renderScene}
renderHeader={this._renderHeader}
onRequestChangeTab={this._handleChangeTab}/>
<View style={GlobalStyles.bottomBar}>
<TouchableOpacity onPress={() => (
Actions.activechore({this.state.players})
)}>
<Text style={GlobalStyles.h2}>
Next
</Text>
</TouchableOpacity>
</View>
</View>
);
}
}
export default Player;