فهرست منبع

1.修改标题组件并增加点击事件以及传参

zhangmengjie 6 سال پیش
والد
کامیت
0ede615072
1فایلهای تغییر یافته به همراه13 افزوده شده و 3 حذف شده
  1. 13 3
      pages/components/CourseTitle.js

+ 13 - 3
pages/components/CourseTitle.js

@@ -28,6 +28,7 @@ export default class CourseTitle extends Component<Props> {
     return (
       <View
         style={{
+          backgroundColor: "withe",
           width: this.props.width,
           height: this.props.height,
           flexDirection: "row"
@@ -37,19 +38,28 @@ export default class CourseTitle extends Component<Props> {
           <TouchableOpacity
             //返回
             activeOpacity={1}
-            onPress={() => this.props.navigation.goBack()}
+            onPress={this.props.backPress}
           >
             <Image style={{ width: 20, height: 20, backgroundColor: "blue" }} />
           </TouchableOpacity>
         </View>
         <View style={{ flex: 5 }}>
-          <Text>{this.props.title}</Text>
+          <Text
+            style={{
+              width: "100%",
+              fontSize: 18,
+              fontWeight: "bold",
+              textAlign: "center"
+            }}
+          >
+            {this.props.title}
+          </Text>
         </View>
         <View style={{ flex: 1 }}>
           <TouchableOpacity
             //分享
             activeOpacity={1}
-            onPress={() => this.props.navigation.goBack()}
+            onPress={this.props.sharedpress}
           >
             <Image style={{ width: 20, height: 20, backgroundColor: "blue" }} />
           </TouchableOpacity>