Showing
3 changed files
with
68 additions
and
5 deletions
| @@ -15,6 +15,7 @@ import Mine from "./src/pages/Mine/index"; | @@ -15,6 +15,7 @@ import Mine from "./src/pages/Mine/index"; | ||
| 15 | import Login from "./src/pages/Login"; | 15 | import Login from "./src/pages/Login"; |
| 16 | import AllProduct from "./src/pages/Home/allProduct"; | 16 | import AllProduct from "./src/pages/Home/allProduct"; |
| 17 | import CommonWebView from "./src/Components/CommonWebView"; | 17 | import CommonWebView from "./src/Components/CommonWebView"; |
| 18 | +import CommonImageView from "./src/Components/CommonImageView"; | ||
| 18 | import Details from "./src/pages/InsuranceCircle/details"; | 19 | import Details from "./src/pages/InsuranceCircle/details"; |
| 19 | 20 | ||
| 20 | // 底部导航栏配置,但也只是作为一个页面,加载到StackNavigator成为第一个页面 | 21 | // 底部导航栏配置,但也只是作为一个页面,加载到StackNavigator成为第一个页面 |
| @@ -87,6 +88,7 @@ const ProtectGod = StackNavigator( | @@ -87,6 +88,7 @@ const ProtectGod = StackNavigator( | ||
| 87 | navigationOptions: { headerTitle: "全部产品" } | 88 | navigationOptions: { headerTitle: "全部产品" } |
| 88 | }, | 89 | }, |
| 89 | CommonWebView: { screen: CommonWebView }, | 90 | CommonWebView: { screen: CommonWebView }, |
| 91 | + CommonImageView: { screen: CommonImageView }, | ||
| 90 | Details: { screen: Details } | 92 | Details: { screen: Details } |
| 91 | },{ | 93 | },{ |
| 92 | navigationOptions: { | 94 | navigationOptions: { |
src/Components/CommonImageView.js
0 → 100644
| 1 | +import React, { Component } from "react"; | ||
| 2 | +import { | ||
| 3 | + StyleSheet, | ||
| 4 | + WebView, | ||
| 5 | + View, | ||
| 6 | + Image, | ||
| 7 | + Dimensions, | ||
| 8 | + ScrollView | ||
| 9 | +} from "react-native"; | ||
| 10 | +import { StackNavigator, TabNavigator } from "react-navigation"; | ||
| 11 | + | ||
| 12 | +export default class CommonImageView extends Component { | ||
| 13 | + constructor(props) { | ||
| 14 | + super(props); | ||
| 15 | + } | ||
| 16 | + render() { | ||
| 17 | + console.log("Image index", this.props.navigation.state.params.index); | ||
| 18 | + const index = this.props.navigation.state.params.index; | ||
| 19 | + return ( | ||
| 20 | + <View style={styles.container}> | ||
| 21 | + <ScrollView> | ||
| 22 | + {index == 0 ? ( | ||
| 23 | + <Image | ||
| 24 | + style={styles.imgOne} | ||
| 25 | + resizeMode="contain" | ||
| 26 | + source={require("../assets/home/product_long_1.jpg")} | ||
| 27 | + /> | ||
| 28 | + ) : ( | ||
| 29 | + <Image | ||
| 30 | + style={styles.imgTwo} | ||
| 31 | + resizeMode="contain" | ||
| 32 | + source={require("../assets/home/product_long_2.jpg")} | ||
| 33 | + /> | ||
| 34 | + )} | ||
| 35 | + </ScrollView> | ||
| 36 | + </View> | ||
| 37 | + ); | ||
| 38 | + } | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +const styles = StyleSheet.create({ | ||
| 42 | + container: { | ||
| 43 | + // paddingTop: 64, | ||
| 44 | + justifyContent: "flex-start", | ||
| 45 | + // alignItems: "stretch", | ||
| 46 | + backgroundColor: "#EFEFEF", | ||
| 47 | + // paddingLeft: 10, | ||
| 48 | + // paddingRight: 10 | ||
| 49 | + }, | ||
| 50 | + imgOne: { | ||
| 51 | + width: Dimensions.get("window").width, | ||
| 52 | + // height: Dimensions.get("window").width * 640 / 3118, | ||
| 53 | + height: Dimensions.get("window").width * 3118 / 640, | ||
| 54 | + }, | ||
| 55 | + imgTwo: { | ||
| 56 | + width: Dimensions.get("window").width, | ||
| 57 | + // height: Dimensions.get("window").width * 690 / 1651, | ||
| 58 | + height: Dimensions.get("window").width * 1651 / 690, | ||
| 59 | + } | ||
| 60 | +}); |
| @@ -10,6 +10,7 @@ import { | @@ -10,6 +10,7 @@ import { | ||
| 10 | } from "react-native"; | 10 | } from "react-native"; |
| 11 | import { StackNavigator, TabNavigator } from 'react-navigation'; | 11 | import { StackNavigator, TabNavigator } from 'react-navigation'; |
| 12 | import CommonWebView from "../../Components/CommonWebView"; | 12 | import CommonWebView from "../../Components/CommonWebView"; |
| 13 | +import CommonImageView from "../../Components/CommonImageView"; | ||
| 13 | 14 | ||
| 14 | export default class AllProduct extends Component { | 15 | export default class AllProduct extends Component { |
| 15 | 16 | ||
| @@ -20,15 +21,15 @@ export default class AllProduct extends Component { | @@ -20,15 +21,15 @@ export default class AllProduct extends Component { | ||
| 20 | { | 21 | { |
| 21 | title: "平安e生保2017版-100万(有社保含新农合)", | 22 | title: "平安e生保2017版-100万(有社保含新农合)", |
| 22 | time: "刚刚", | 23 | time: "刚刚", |
| 23 | - url: "http://hankschan.legendh5.com/h5/b8302dac-0563-478c-ff82-ba8ab20c1cb3.html", | 24 | + // url: "http://hankschan.legendh5.com/h5/b8302dac-0563-478c-ff82-ba8ab20c1cb3.html", |
| 24 | - // url: require("../../assets/home/product_long_1.jpg"), | 25 | + url: require("../../assets/home/product_long_1.jpg"), |
| 25 | imgurl: require("../../assets/home/product_1.png") | 26 | imgurl: require("../../assets/home/product_1.png") |
| 26 | }, | 27 | }, |
| 27 | { | 28 | { |
| 28 | title: "泰康在线“住院宝”必备版(0-49周岁)", | 29 | title: "泰康在线“住院宝”必备版(0-49周岁)", |
| 29 | time: "刚刚", | 30 | time: "刚刚", |
| 30 | - url: "http://hankschan.legendh5.com/h5/f782ab69-6515-3e70-025a-5da78f1f745f.html", | 31 | + // url: "http://hankschan.legendh5.com/h5/f782ab69-6515-3e70-025a-5da78f1f745f.html", |
| 31 | - // url: require("../../assets/home/product_long_1.jpg"), | 32 | + url: require("../../assets/home/product_long_2.jpg"), |
| 32 | imgurl: require("../../assets/home/product_2.png") | 33 | imgurl: require("../../assets/home/product_2.png") |
| 33 | }, | 34 | }, |
| 34 | ] | 35 | ] |
| @@ -49,7 +50,7 @@ export default class AllProduct extends Component { | @@ -49,7 +50,7 @@ export default class AllProduct extends Component { | ||
| 49 | <TouchableOpacity | 50 | <TouchableOpacity |
| 50 | style={styles.itemContainer} | 51 | style={styles.itemContainer} |
| 51 | key={index} | 52 | key={index} |
| 52 | - onPress={() => navigate("CommonWebview", { item: item })} | 53 | + onPress={() => navigate("CommonImageView", { index: index })} |
| 53 | > | 54 | > |
| 54 | <Image style={styles.itemImgWrapper} source={item.imgurl} /> | 55 | <Image style={styles.itemImgWrapper} source={item.imgurl} /> |
| 55 | <View style={styles.itemRightWrapper}> | 56 | <View style={styles.itemRightWrapper}> |
-
Please register or login to post a comment