Browse Source

1.提交切换学龄按钮组件
2.修改点击半隐藏改为无动作
3.增加待修改注释

zhangmengjie 6 years ago
parent
commit
e801b51f42
2 changed files with 94 additions and 5 deletions
  1. 7 5
      pages/components/Header.js
  2. 87 0
      pages/components/RevisionAge.js

+ 7 - 5
pages/components/Header.js

@@ -12,6 +12,7 @@ import {
   DeviceEventEmitter
 } from "react-native";
 
+/** 因没有图,所以Image先用颜色代替,有图可替换 */
 const instructions = Platform.select({
   ios: "Press Cmd+R to reload,\n" + "Cmd+D or shake for dev menu",
   android:
@@ -25,7 +26,7 @@ var height = Dimensions.get("window").height;
 export default class Header extends Component<Props> {
   render() {
     return (
-      <TouchableOpacity onPress={this.props.onPress}>
+      <TouchableOpacity activeOpacity={1} onPress={this.props.onPress}>
         <View
           style={{
             width: this.props.width,
@@ -84,14 +85,15 @@ export default class Header extends Component<Props> {
                 }}
               >
                 <Image
-                  source={{
-                    uri: this.props.uri
-                  }}
+                  // source={{
+                  //   uri: this.props.uri
+                  // }}
                   style={{
                     alignItems: "center",
                     justifyContent: "center",
                     width: 20,
-                    height: 20
+                    height: 20,
+                    backgroundColor: "blue"
                   }}
                 />
                 <Text

+ 87 - 0
pages/components/RevisionAge.js

@@ -0,0 +1,87 @@
+import React, { Component } from "react";
+import {
+  Platform,
+  StyleSheet,
+  Text,
+  View,
+  Image,
+  TouchableOpacity,
+  ImageBackground,
+  Button,
+  Dimensions,
+  DeviceEventEmitter
+} from "react-native";
+
+const instructions = Platform.select({
+  ios: "Press Cmd+R to reload,\n" + "Cmd+D or shake for dev menu",
+  android:
+    "Double tap R on your keyboard to reload,\n" +
+    "Shake or press menu button for dev menu"
+});
+
+/** 因没有图,所以Image先用颜色代替,有图可替换 */
+type Props = {};
+var width = Dimensions.get("window").width;
+var height = Dimensions.get("window").height;
+export default class RevisionAge extends Component<Props> {
+  render() {
+    return (
+      <TouchableOpacity activeOpacity={1} onPress={this.props.onPress}>
+        <View
+          style={{
+            width: this.props.width,
+            height: this.props.height,
+            flexDirection: "row",
+            backgroundColor: "white",
+            alignItems: "center",
+            justifyContent: "center",
+            borderRadius: 30
+          }}
+        >
+          <View style={{ flex: 1 }} />
+          <View
+            style={{
+              flex: 4,
+              flexDirection: "row",
+              alignItems: "center",
+              justifyContent: "center"
+            }}
+          >
+            <Image
+              // source={{
+              //   uri:
+              //      "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1295208965,3056573814&fm=26&gp=0.jpg"
+              // }}
+              style={{
+                width: 20,
+                height: 20,
+                backgroundColor: "blue"
+              }}
+            />
+            <Text
+              style={{
+                fontSize: 18,
+                marginLeft: 10,
+                fontWeight: "bold",
+                color: "#151515"
+              }}
+            >
+              {this.props.textss}
+            </Text>
+          </View>
+        </View>
+      </TouchableOpacity>
+    );
+  }
+}
+/**
+
+      使用方法
+    <RevisionAge
+          width={150}
+          height={50}
+          textss="学前"
+          onPress={() => this.toWebPage("这里写json......")}
+        />
+
+ */