React Native JSX error: элементы должны быть заключены в тег - PullRequest
0 голосов
/ 30 сентября 2018

Я не знаю, почему я получаю следующую ошибку с моего симулятора:

Adjacent JSX elements must be wrapped in an enclosing tag

Код:

render() {
    return (
    <View>
    <TextInput
        underlineColorAndroid={'transparent'}
        style={styles.searchInput}
        placeholder='Enter Part Name(s)'
    />

    <TextInput
        underlineColorAndroid={'transparent'}
        style={styles.searchInput}
        placeholder='Enter Basic Number(s)'
    />

    <Button
        onPress={this._onBackPressed}
        title='Go'
    </Button>

    </View>
    );
}

1 Ответ

0 голосов
/ 30 сентября 2018

Начало View-тега (начало узла) отсутствует.Также на кнопке отсутствует «>»

render() (
  <View> // this one were missing
    <TextInput
      underlineColorAndroid={'transparent'}
      style={styles.searchInput}
      placeholder='Enter Basic Number(s)'
    />

    <Button
      onPress={this._onBackPressed}
      title='Go'
    > // this one were missing
    </Button>

 </View>
)

Здесь вы можете прочитать больше на справочных страницах JSX: https://reactjs.org/docs/jsx-in-depth.html

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...