1

我正在使用最新版本的 react-native (0.60.4) 从本地基础获取带有 Icon 组件的白屏。

这是我的代码

<Item floatingLabel error={hasError} style={styles.inputElement}>
          <Icon name="ios-menu" style={{ fontSize: 20, color: "red" }} />
          <Label style={styles.placeHolderStyle}>{placeHolder}</Label>
          <Input
            secureTextEntry={hasSecureTextEntry}
            style={styles.inputPaddingLeft}
            onChangeText={text => this.props.onChangeText(text, key)}
            value={value}
          />
        </Item> 

如果我删除 <Icon name="ios-menu" style={{ fontSize: 20, color: "red" }} />标签,它工作正常。

此外,上面的代码适用于旧版本的 react-native(0.55.4)

4

1 回答 1

0

你可能是Icon从错误的包中导入的。我试过你的代码,它工作得很好。

输出

演示

代码

import React, { Component } from 'react';
import { Container, Header, Content, Icon,Item,Label,Input } from 'native-base';
export default class App extends Component {
  render() {
    return (
      <Container>
        <Header />
        <Content>
          <Item error="false">
          <Icon name="ios-menu" style={{ fontSize: 20, color: "red" }} />
          <Label>This is some placeholder</Label>
          <Input
          />
        </Item> 
        </Content>
      </Container>
    );
  }
}

在线运行

您可以使用此链接在线运行上述演示

于 2019-07-29T17:09:08.520 回答