首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JavaScript -添加镜像: React原生XCode

JavaScript -添加镜像: React原生XCode
EN

Stack Overflow用户
提问于 2016-04-04 22:48:46
回答 1查看 327关注 0票数 0

我想知道如何在其中插入图像??

我也想知道这是在css上实现的javascript还是在javascript中实现的css?

它是由React Native自动生成的,作为默认的应用程序初学者包,我们刚刚开始掌握基础知识……

代码语言:javascript
复制
import React, {
  AppRegistry,
  Component,
  StyleSheet,
  Text,
  View
} from 'react-native';


class VLDB extends Component {
  render() {
    return (
      <View style={styles.container}>
      <Text style = {styles.welcome}>
      VLDB SQL Cheat Sheet!
      </Text>
        <Text style={styles.welcome}>
          Welcome to the SQL Cheat Sheet!
        </Text>
        <Text style={styles.instructions}>
          To get started, edit index.ios.js
        </Text>
        <Text style={styles.instructions}>
          Press Cmd+R to reload,{'\n'}
          Cmd+D or shake for dev menu
        </Text>
      </View>
    );
  }
}


const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});


AppRegistry.registerComponent('VLDB', () => VLDB);

干杯,卢克。

EN

回答 1

Stack Overflow用户

发布于 2016-04-04 23:03:10

要向其中添加图像,首先需要在图像组件中导入

代码语言:javascript
复制
import React, {
  AppRegistry,
  Component,
  Image,
  StyleSheet,
  Text,
  View
} from 'react-native';

然后,通过引用本地捆绑的映像或远程映像来添加the documentation中描述的映像,如下所示……

代码语言:javascript
复制
class VLDB extends Component {
  render() {
    return (
      <View style={styles.container}>
         <Image
            style={styles.icon}
            source={require('./myIcon.png')}
          />
         <Image
            style={styles.logo}
            source={{uri: 'http://facebook.github.io/react/img/logo_og.png'}}
          />
      <Text style = {styles.welcome}>
      VLDB SQL Cheat Sheet!
      </Text>
        <Text style={styles.welcome}>
          Welcome to the SQL Cheat Sheet!
        </Text>
        <Text style={styles.instructions}>
          To get started, edit index.ios.js
        </Text>
        <Text style={styles.instructions}>
          Press Cmd+R to reload,{'\n'}
          Cmd+D or shake for dev menu
        </Text>
      </View>
    );
  }
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36405922

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档