diff --git a/App.js b/App.js index e4647f2..2260fd9 100644 --- a/App.js +++ b/App.js @@ -20,6 +20,8 @@ import DeviceInfo from "react-native-device-info"; import * as Animatable from 'react-native-animatable'; import Swiper from 'react-native-swiper'; import Carousel from 'react-native-snap-carousel'; +import {BoxShadow} from 'react-native-shadow'; + var testMac = 'FF:FF:FF:FF:FF:FF' var curAdIndex = 0; var errorMsg = { @@ -55,6 +57,17 @@ var animationThemes = [ third:"bounceInRight" } ] +const shadowOpt = { + width: 700/PixelRatio.get(), + height: 240/PixelRatio.get(), + color:"#000", + border:2, + radius:3, + opacity:0.5, + x:0, + y:3, + style:{marginVertical:5} +} var curTimer = null; @@ -135,7 +148,6 @@ export default class MyPage extends Component { } componentDidUpdate() { - console.log(PixelRatio.get()) /* console.log(this.refs.scrollView) if (this.refs.scrollView != undefined) { var ScrollView = this.refs.scrollView; @@ -203,7 +215,6 @@ codePushStatusDidChange(syncStatus) { // 列表滚动 updateContent() { - console.log(curAdIndex) if (adDataList.length <=0) return false; @@ -382,7 +393,7 @@ async routine() { if (this.state.adType == 2) { if (pageChangeCount<=0) { let curNum = this.state.curAdType02Index + 1; - if (curNum >= adDataList.length) { + if (curNum >= adDataBgList.length) { curNum = 0; } this.setState({ @@ -392,6 +403,7 @@ async routine() { pageChangeCount = heartConfig.pageChangeInterval } + } else if (this.state.adType == 0) { if (pageChangeCount <= 0) { //页面切换间隔 if (this.state.contentDisplayStatus && this.state.baseInfo) { @@ -545,7 +557,9 @@ setSwiperItemDom(item) { actionText = '扫码领取'; } return ( - + + + {/* */} @@ -570,7 +584,8 @@ setSwiperItemDom(item) { - + + ) } renderAdTypeSwiper() { @@ -641,7 +656,7 @@ getAdView(){ ); } else if (this.state.adType == 2) { - let curWidthNum = 1080/(PixelRatio.get()) + let curWidthNum = 700/(PixelRatio.get()) return ( // @@ -1056,7 +1071,7 @@ MyPage = CodePush(codePushOptions)(MyPage); textAlign :'left', color:"black", textAlignVertical:'center', - fontSize: 53/PixelRatio.get(), + fontSize: 42/PixelRatio.get(), }, /* contentItemTopDetailRemark:{ @@ -1101,7 +1116,7 @@ MyPage = CodePush(codePushOptions)(MyPage); contentItemTopDetailCurPriceStr02:{ backgroundColor:'transparent', - fontSize:96/PixelRatio.get(), + fontSize:72/PixelRatio.get(), fontFamily:"PingFangSC-Bold", fontWeight: "bold", textAlign :'left', @@ -1167,6 +1182,7 @@ MyPage = CodePush(codePushOptions)(MyPage); textAlign :'left', fontSize: 27/PixelRatio.get(), textDecorationLine: 'line-through', + marginTop: 14/PixelRatio.get(), color : 'gray' }, @@ -1178,6 +1194,8 @@ MyPage = CodePush(codePushOptions)(MyPage); }, adTypeSwiper02:{ + flex: 1, + alignItems: 'center', position: 'absolute', left: 0, bottom: 165/PixelRatio.get(), @@ -1194,10 +1212,10 @@ MyPage = CodePush(codePushOptions)(MyPage); }, adTypeItemImg:{ - width: 275/PixelRatio.get(), - height: 275/PixelRatio.get(), - marginLeft: 50/PixelRatio.get(), - marginTop: 30/PixelRatio.get(), + width: 200/PixelRatio.get(), + height: 200/PixelRatio.get(), + marginLeft: 8/PixelRatio.get(), + marginTop: 20/PixelRatio.get(), borderRadius:27/PixelRatio.get(), backgroundColor:'transparent' }, @@ -1215,15 +1233,15 @@ MyPage = CodePush(codePushOptions)(MyPage); contentItemTopForAd:{ flex: 1, - width: 1080/PixelRatio.get(), + width: 700/PixelRatio.get(), // width: '100%', height:'100%', - paddingLeft: 22/PixelRatio.get(), + paddingLeft: 12/PixelRatio.get(), paddingRight: 26/PixelRatio.get(), flexDirection: 'row', alignItems: 'flex-start', borderRadius: 6, - backgroundColor:'transparent', + backgroundColor:'#fff', }, onlyAdSwiperItem:{ diff --git a/android/.project b/android/.project new file mode 100644 index 0000000..f031723 --- /dev/null +++ b/android/.project @@ -0,0 +1,17 @@ + + + screenAd + Project android created by Buildship. + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.buildship.core.gradleprojectnature + + diff --git a/android/.settings/org.eclipse.buildship.core.prefs b/android/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000..e889521 --- /dev/null +++ b/android/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir= +eclipse.preferences.version=1 diff --git a/android/app/.classpath b/android/app/.classpath new file mode 100644 index 0000000..eb19361 --- /dev/null +++ b/android/app/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/android/app/.project b/android/app/.project new file mode 100644 index 0000000..ac485d7 --- /dev/null +++ b/android/app/.project @@ -0,0 +1,23 @@ + + + app + Project app created by Buildship. + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.buildship.core.gradleprojectnature + + diff --git a/android/app/.settings/org.eclipse.buildship.core.prefs b/android/app/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 0000000..b1886ad --- /dev/null +++ b/android/app/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir=.. +eclipse.preferences.version=1 diff --git a/android/app/build.gradle b/android/app/build.gradle index afcacdd..5412def 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -181,12 +181,14 @@ android { } dependencies { + implementation project(':react-native-svg') implementation project(':react-native-camera') implementation project(':react-native-device-info') implementation project(':react-native-code-push') implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" implementation "com.facebook.react:react-native:+" // From node_modules + implementation project(':react-native-svg') } // Run this once to be able to run the application with BUCK diff --git a/android/app/src/main/java/com/screenad/MainApplication.java b/android/app/src/main/java/com/screenad/MainApplication.java index 2664dc1..22ae962 100644 --- a/android/app/src/main/java/com/screenad/MainApplication.java +++ b/android/app/src/main/java/com/screenad/MainApplication.java @@ -3,6 +3,7 @@ package com.screenad; import android.app.Application; import com.facebook.react.ReactApplication; +import com.horcrux.svg.SvgPackage; import org.reactnative.camera.RNCameraPackage; import com.facebook.react.bridge.ReactApplicationContext; @@ -37,6 +38,7 @@ public class MainApplication extends Application implements ReactApplication { protected List getPackages() { return Arrays.asList( new MainReactPackage(), + new SvgPackage(), new RNCameraPackage(), new RNBuildConfigPackage(), new RNDeviceInfo(), diff --git a/android/settings.gradle b/android/settings.gradle index 399f0dc..9e732f2 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,4 +1,6 @@ rootProject.name = 'screenAd' +include ':react-native-svg' +project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android') include ':react-native-camera' project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android') include ':react-native-device-info' @@ -7,3 +9,5 @@ include ':react-native-code-push' project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app') include ':app' +include ':react-native-svg' +project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-svg/android') \ No newline at end of file diff --git a/ios/screenAd.xcodeproj/project.pbxproj b/ios/screenAd.xcodeproj/project.pbxproj index 6fad2e7..bad63e7 100644 --- a/ios/screenAd.xcodeproj/project.pbxproj +++ b/ios/screenAd.xcodeproj/project.pbxproj @@ -45,6 +45,8 @@ 59D20E8E9CD64A01B87A3AC0 /* libRNDeviceInfo-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22D705AD40EF415A95C31652 /* libRNDeviceInfo-tvOS.a */; }; D240C4819F1E4B80BB6D7BEE /* libRNCamera.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F8C0E0ED2BA401B9075C9F3 /* libRNCamera.a */; }; BA9EAC9D8E144D058AC73DD2 /* libRNFetchBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 99C586CF88164E08936AF0C0 /* libRNFetchBlob.a */; }; + B4144D9AB571435787D52BFB /* libRNSVG.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C56D91B66FA473E89F6B165 /* libRNSVG.a */; }; + C109232BD2434156AC1DB82B /* libRNSVG-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DA6B0CF8B7494E2E82C54C57 /* libRNSVG-tvOS.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -362,6 +364,9 @@ 4F8C0E0ED2BA401B9075C9F3 /* libRNCamera.a */ = {isa = PBXFileReference; name = "libRNCamera.a"; path = "libRNCamera.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; BE5C3F5DA65B4EFC83BEC512 /* RNFetchBlob.xcodeproj */ = {isa = PBXFileReference; name = "RNFetchBlob.xcodeproj"; path = "../node_modules/react-native-fetch-blob/ios/RNFetchBlob.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; 99C586CF88164E08936AF0C0 /* libRNFetchBlob.a */ = {isa = PBXFileReference; name = "libRNFetchBlob.a"; path = "libRNFetchBlob.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; + D6E9CCF6747C429FACC9C9EE /* RNSVG.xcodeproj */ = {isa = PBXFileReference; name = "RNSVG.xcodeproj"; path = "../node_modules/react-native-svg/ios/RNSVG.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; + 9C56D91B66FA473E89F6B165 /* libRNSVG.a */ = {isa = PBXFileReference; name = "libRNSVG.a"; path = "libRNSVG.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; + DA6B0CF8B7494E2E82C54C57 /* libRNSVG-tvOS.a */ = {isa = PBXFileReference; name = "libRNSVG-tvOS.a"; path = "libRNSVG-tvOS.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -395,6 +400,7 @@ FEBB7F68D5534228A6A832AD /* libRNDeviceInfo.a in Frameworks */, D240C4819F1E4B80BB6D7BEE /* libRNCamera.a in Frameworks */, BA9EAC9D8E144D058AC73DD2 /* libRNFetchBlob.a in Frameworks */, + B4144D9AB571435787D52BFB /* libRNSVG.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -412,6 +418,7 @@ 2D02E4C71E0B4AEC006451C7 /* libRCTText-tvOS.a in Frameworks */, 2D02E4C81E0B4AEC006451C7 /* libRCTWebSocket-tvOS.a in Frameworks */, 59D20E8E9CD64A01B87A3AC0 /* libRNDeviceInfo-tvOS.a in Frameworks */, + C109232BD2434156AC1DB82B /* libRNSVG-tvOS.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -590,6 +597,7 @@ C6058A0BC9054E0394045AC4 /* RNDeviceInfo.xcodeproj */, 0F57B32024664223A7D6E682 /* RNCamera.xcodeproj */, BE5C3F5DA65B4EFC83BEC512 /* RNFetchBlob.xcodeproj */, + D6E9CCF6747C429FACC9C9EE /* RNSVG.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -1219,6 +1227,8 @@ "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1226,6 +1236,7 @@ "$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", "$(SRCROOT)\..\node_modules\react-native-camera\ios/**", "$(SRCROOT)\..\node_modules\react-native-fetch-blob\ios/**", + "$(SRCROOT)\..\node_modules\react-native-svg\ios/**", ); }; name = Debug; @@ -1249,6 +1260,8 @@ "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1256,6 +1269,7 @@ "$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", "$(SRCROOT)\..\node_modules\react-native-camera\ios/**", "$(SRCROOT)\..\node_modules\react-native-fetch-blob\ios/**", + "$(SRCROOT)\..\node_modules\react-native-svg\ios/**", ); }; name = Release; @@ -1282,6 +1296,7 @@ "$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", "$(SRCROOT)\..\node_modules\react-native-camera\ios/**", "$(SRCROOT)\..\node_modules\react-native-fetch-blob\ios/**", + "$(SRCROOT)\..\node_modules\react-native-svg\ios/**", ); }; name = Debug; @@ -1307,6 +1322,7 @@ "$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", "$(SRCROOT)\..\node_modules\react-native-camera\ios/**", "$(SRCROOT)\..\node_modules\react-native-fetch-blob\ios/**", + "$(SRCROOT)\..\node_modules\react-native-svg\ios/**", ); }; name = Release; @@ -1338,6 +1354,8 @@ "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1345,6 +1363,7 @@ "$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", "$(SRCROOT)\..\node_modules\react-native-camera\ios/**", "$(SRCROOT)\..\node_modules\react-native-fetch-blob\ios/**", + "$(SRCROOT)\..\node_modules\react-native-svg\ios/**", ); }; name = Debug; @@ -1376,6 +1395,8 @@ "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1383,6 +1404,7 @@ "$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", "$(SRCROOT)\..\node_modules\react-native-camera\ios/**", "$(SRCROOT)\..\node_modules\react-native-fetch-blob\ios/**", + "$(SRCROOT)\..\node_modules\react-native-svg\ios/**", ); }; name = Release; @@ -1413,6 +1435,8 @@ "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1420,6 +1444,7 @@ "$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", "$(SRCROOT)\..\node_modules\react-native-camera\ios/**", "$(SRCROOT)\..\node_modules\react-native-fetch-blob\ios/**", + "$(SRCROOT)\..\node_modules\react-native-svg\ios/**", ); }; name = Debug; @@ -1450,6 +1475,8 @@ "$(inherited)", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1457,6 +1484,7 @@ "$(SRCROOT)\..\node_modules\react-native-device-info\ios\RNDeviceInfo", "$(SRCROOT)\..\node_modules\react-native-camera\ios/**", "$(SRCROOT)\..\node_modules\react-native-fetch-blob\ios/**", + "$(SRCROOT)\..\node_modules\react-native-svg\ios/**", ); }; name = Release; diff --git a/package.json b/package.json index b490809..1c95fe6 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,9 @@ "react-native-camera": "^1.12.0", "react-native-code-push": "^5.6.0", "react-native-device-info": "^2.1.2", + "react-native-shadow": "^1.2.2", "react-native-snap-carousel": "^3.8.0", + "react-native-svg": "^9.6.2", "react-native-swiper": "^1.5.14", "rn-fetch-blob": "^0.10.15" },