1

刚开始使用本机反应,我无法使按钮正常工作 按钮 1 按预期工作,但按钮 2 嵌套并且不工作

``` import { StyleSheet, View, Text, Button, TouchableHighlight } from "react-native"; 从“react-native-easy-grid”导入 { Col, Row, Grid };

sayHi = from => {
    alert(from + " was clicked");
  };

  render() {
    return (
      <View style={styles.container}>
        <Button
          title="BUTTON 1"
          accessibilityLabel="THIS IS BUTTON 1"
          onPress={() => {
            this.sayHi("Button 1");
          }}
        />
        <Grid>
          <Col>
            <Text> col 1</Text>
            <TouchableHighlight
              style={{
                height: 40,
                width: 100
              }}
              onPress={() => {
                this.sayHi("highlight");
              }}
              underlayColor="red"
            >
              <Button
                title="BUTTON 2"
                accessibilityLabel="THIS IS BUTTON 2"
                onPress={() => {
                  this.sayHi("Button 2");
                }}
              />
            </TouchableHighlight>
          </Col>
          <Col>
          </Col>
        </Grid>
      </View>
    );
4

0 回答 0