Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RN #14

Open
TokenYangForever opened this issue Nov 15, 2017 · 0 comments
Open

RN #14

TokenYangForever opened this issue Nov 15, 2017 · 0 comments

Comments

@TokenYangForever
Copy link
Owner

TokenYangForever commented Nov 15, 2017


  • 样式相关:
  • button组件无法直接设置其宽高,需要用一个View包起来。
  • margin写法与css有区别
    React-Native 样式指南

  • RN有处理点击的组件,RN也有专门针对IOS/Android的组件,点击事件onPress

  • RN中可从多种地方引入图片:混合App的图片、网络图片、项目目录下的图片,第三种方式可以不设定宽高。


  • Android环境搭建的一些问题(坑!!!):
  1. java不要装9.0+,Android-studio会识别不了路径
  2. Android SDK 要装25.0+的,不然会提示版本过低报错,然而教程(甚至是fb官网上)还是写的装23.0
  3. 模拟器,先用as打开模拟器,再执行react-native run-android
  4. 启动run-*时,package-server要使用8081端口,确保这个端口没有被占用否则不会run packager server

  • 默认情况下,iOS会阻止所有非https的请求。
  • 写样式需要调用StyleSheet.create,命名要使用驼峰法
const styles = StyleSheet.create({
  bigblue: {
    color: 'blue',
    fontWeight: 'bold',
    fontSize: 30,
  },
  red: {
    color: 'red',
  },
});
  • 元素宽高,指定固定的width\height,无单位
<View style={{width: 50, height: 50, backgroundColor: 'powderblue'}} />
  • TextInput组件
    需要订阅它的onChangeText事件来读取用户的输入。注意,从TextInput里取值这就是目前唯一的做法。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant