Skip to content

Commit

Permalink
m
Browse files Browse the repository at this point in the history
m
  • Loading branch information
coolnameismy committed Oct 1, 2017
1 parent cb2bbaa commit 166a57c
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
7 changes: 5 additions & 2 deletions react-native/react-Native 常见的坑.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## render方法中不能使用双斜杠注释html的内容
## render方法中的jsx不能使用双斜杠注释html的内容

## 控件的边框
有的控件在ios中可以使用border设置边框,但在Android中却没有边框效果,比如Text控件

## rn开启js调试后,导航栏跳转不起作用
## rn开启js调试后,导航栏跳转不起作用

## return返回jsx时,必须return和括号必须靠紧,如: `return(....`

20 changes: 18 additions & 2 deletions react-native/样式/获取屏幕大小.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@


````js
import {Dimensions} from 'react-native';
var React = require('Dimensions');

console.log(Dimensions.get("window"));
//结果:{width: 375, scale: 2, height: 667}
````
````


在css中使用

````
const styles = StyleSheet.create({
textView: {
......
width:Dimensions.get('window').width,
},
{
}
});
`````
3 changes: 2 additions & 1 deletion react-native/组件/组件的生命周期.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@ componentWillUnmount | 1| 否



[React Native 中组件的生命周期](http://www.race604.com/react-native-component-lifecycle/)
[React Native 中组件的生命周期](http://www.race604.com/react-native-component-lifecycle/)
[react 生命周期](https://facebook.github.io/react/docs/react-component.html)
21 changes: 21 additions & 0 deletions react-native/键盘回退.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## 键盘回退

````javascript

<TextInput style={styles.textInput}
ref='pwd'
placeholder='输入WIFI密码'
placeholderTextColor='#999'
secureTextEntry={this.state.secureTextEntry}
>
</TextInput>

<TouchableOpacity
style={styles.show_pwd_warp}
onPress={() => this.refs.pwd.blur()}
>
</TouchableOpacity>

````

说明:第一个textInput使用了ref定义了名称为pwd,通过touTouchableOpacity点击调用了this.refs.pwd.blur()方法,让文本框失去焦点,从而回退键盘

0 comments on commit 166a57c

Please sign in to comment.