ReactNative Demo - Dimensions 的使用

r囧r小猫 2022-09-23 13:59 240阅读 0赞
  1. import React, {
  2. Component
  3. } from 'react';
  4. import {
  5. AppRegistry,
  6. StyleSheet,
  7. Text,
  8. View,
  9. Image,
  10. DrawerLayoutAndroid,
  11. ListView,
  12. PixelRatio,
  13. TextInput,
  14. Dimensions,
  15. } from 'react-native';
  16. class AwesomeProject extends Component {
  17. render() {
  18. return (
  19. <View style={styles.container}>
  20. <View style={styles.child} />
  21. </View>
  22. );
  23. }
  24. }
  25. class Search extends Component{
  26. render(){
  27. return(
  28. <View style={[styles.flex,styles.flexDirection]}>
  29. <View style={[styles.flex,styles.input]}>
  30. <TextInput></TextInput>
  31. </View>
  32. <View style={styles.btn}>
  33. <Text style={styles.search}>搜索</Text>
  34. </View>
  35. </View>
  36. );
  37. }
  38. }
  39. const styles = StyleSheet.create({
  40. flex: {
  41. flex:1,
  42. },
  43. flexDirection :{
  44. flexDirection:'row',
  45. },
  46. topStatus : {
  47. marginTop : 25,
  48. } ,
  49. input:{
  50. height:45,
  51. borderColor:'red',
  52. borderWidth: 1,
  53. marginLeft:10,
  54. borderRadius:5,
  55. paddingLeft:10,
  56. },
  57. btn:{
  58. height:45,
  59. width:45,
  60. marginLeft:-5,
  61. marginRight:5,
  62. backgroundColor:'#23BEFF',
  63. alignItems:'center',
  64. justifyContent:'center',
  65. },
  66. search:{
  67. color:'#fff',
  68. fontWeight:'bold',
  69. fontSize:15,
  70. },
  71. container: {
  72. backgroundColor:'green',
  73. flex: 1,
  74. },
  75. child: {
  76. flex: 1,
  77. backgroundColor: 'blue',
  78. transform: [
  79. {
  80. perspective: 850
  81. },
  82. {
  83. translateX: -Dimensions.get('window').width * 0.24
  84. },
  85. {
  86. rotateY: '60deg'
  87. },
  88. ],
  89. }
  90. });
  91. AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);

发表评论

表情:
评论列表 (有 0 条评论,240人围观)

还没有评论,来说两句吧...

相关阅读