作者 周泳恩

init

正在显示 54 个修改的文件 包含 1833 行增加0 行删除
  1 +
  2 +[android]
  3 + target = Google Inc.:Google APIs:23
  4 +
  5 +[maven_repositories]
  6 + central = https://repo1.maven.org/maven2
  1 +module.exports = {
  2 + root: true,
  3 + extends: '@react-native-community',
  4 +};
  1 +[ignore]
  2 +; We fork some components by platform
  3 +.*/*[.]android.js
  4 +
  5 +; Ignore "BUCK" generated dirs
  6 +<PROJECT_ROOT>/\.buckd/
  7 +
  8 +; Ignore polyfills
  9 +node_modules/react-native/Libraries/polyfills/.*
  10 +
  11 +; These should not be required directly
  12 +; require from fbjs/lib instead: require('fbjs/lib/warning')
  13 +node_modules/warning/.*
  14 +
  15 +; Flow doesn't support platforms
  16 +.*/Libraries/Utilities/LoadingView.js
  17 +
  18 +[untyped]
  19 +.*/node_modules/@react-native-community/cli/.*/.*
  20 +
  21 +[include]
  22 +
  23 +[libs]
  24 +node_modules/react-native/interface.js
  25 +node_modules/react-native/flow/
  26 +
  27 +[options]
  28 +emoji=true
  29 +
  30 +esproposal.optional_chaining=enable
  31 +esproposal.nullish_coalescing=enable
  32 +
  33 +module.file_ext=.js
  34 +module.file_ext=.json
  35 +module.file_ext=.ios.js
  36 +
  37 +munge_underscores=true
  38 +
  39 +module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
  40 +module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
  41 +
  42 +suppress_type=$FlowIssue
  43 +suppress_type=$FlowFixMe
  44 +suppress_type=$FlowFixMeProps
  45 +suppress_type=$FlowFixMeState
  46 +
  47 +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
  48 +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
  49 +suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
  50 +
  51 +[lints]
  52 +sketchy-null-number=warn
  53 +sketchy-null-mixed=warn
  54 +sketchy-number=warn
  55 +untyped-type-import=warn
  56 +nonstrict-import=warn
  57 +deprecated-type=warn
  58 +unsafe-getters-setters=warn
  59 +unnecessary-invariant=warn
  60 +signature-verification-failure=warn
  61 +deprecated-utility=error
  62 +
  63 +[strict]
  64 +deprecated-type
  65 +nonstrict-import
  66 +sketchy-null
  67 +unclear-type
  68 +unsafe-getters-setters
  69 +untyped-import
  70 +untyped-type-import
  71 +
  72 +[version]
  73 +^0.122.0
  1 +*.pbxproj -text
  1 +# OSX
  2 +#
  3 +.DS_Store
  4 +
  5 +# Xcode
  6 +#
  7 +build/
  8 +*.pbxuser
  9 +!default.pbxuser
  10 +*.mode1v3
  11 +!default.mode1v3
  12 +*.mode2v3
  13 +!default.mode2v3
  14 +*.perspectivev3
  15 +!default.perspectivev3
  16 +xcuserdata
  17 +*.xccheckout
  18 +*.moved-aside
  19 +DerivedData
  20 +*.hmap
  21 +*.ipa
  22 +*.xcuserstate
  23 +
  24 +# Android/IntelliJ
  25 +#
  26 +build/
  27 +.idea
  28 +.gradle
  29 +local.properties
  30 +*.iml
  31 +
  32 +# node.js
  33 +#
  34 +node_modules/
  35 +npm-debug.log
  36 +yarn-error.log
  37 +
  38 +# BUCK
  39 +buck-out/
  40 +\.buckd/
  41 +*.keystore
  42 +!debug.keystore
  43 +
  44 +# fastlane
  45 +#
  46 +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
  47 +# screenshots whenever they are needed.
  48 +# For more information about the recommended setup visit:
  49 +# https://docs.fastlane.tools/best-practices/source-control/
  50 +
  51 +*/fastlane/report.xml
  52 +*/fastlane/Preview.html
  53 +*/fastlane/screenshots
  54 +
  55 +# Bundle artifact
  56 +*.jsbundle
  57 +
  58 +# CocoaPods
  59 +/ios/Pods/
  1 +module.exports = {
  2 + bracketSpacing: false,
  3 + jsxBracketSameLine: true,
  4 + singleQuote: true,
  5 + trailingComma: 'all',
  6 +};
  1 +/**
  2 + * Sample React Native App
  3 + * https://github.com/facebook/react-native
  4 + *
  5 + * @format
  6 + * @flow strict-local
  7 + */
  8 +
  9 +import React from 'react';
  10 +import {
  11 + SafeAreaView,
  12 + StyleSheet,
  13 + ScrollView,
  14 + View,
  15 + Text,
  16 + StatusBar,
  17 +} from 'react-native';
  18 +
  19 +import {
  20 + Header,
  21 + LearnMoreLinks,
  22 + Colors,
  23 + DebugInstructions,
  24 + ReloadInstructions,
  25 +} from 'react-native/Libraries/NewAppScreen';
  26 +
  27 +const App: () => React$Node = () => {
  28 + return (
  29 + <>
  30 + <StatusBar barStyle="dark-content" />
  31 + <SafeAreaView>
  32 + <ScrollView
  33 + contentInsetAdjustmentBehavior="automatic"
  34 + style={styles.scrollView}>
  35 + <Header />
  36 + {global.HermesInternal == null ? null : (
  37 + <View style={styles.engine}>
  38 + <Text style={styles.footer}>Engine: Hermes</Text>
  39 + </View>
  40 + )}
  41 + <View style={styles.body}>
  42 + <View style={styles.sectionContainer}>
  43 + <Text style={styles.sectionTitle}>Step One</Text>
  44 + <Text style={styles.sectionDescription}>
  45 + Edit <Text style={styles.highlight}>App.js</Text> to change this
  46 + screen and then come back to see your edits.
  47 + </Text>
  48 + </View>
  49 + <View style={styles.sectionContainer}>
  50 + <Text style={styles.sectionTitle}>See Your Changes</Text>
  51 + <Text style={styles.sectionDescription}>
  52 + <ReloadInstructions />
  53 + </Text>
  54 + </View>
  55 + <View style={styles.sectionContainer}>
  56 + <Text style={styles.sectionTitle}>Debug</Text>
  57 + <Text style={styles.sectionDescription}>
  58 + <DebugInstructions />
  59 + </Text>
  60 + </View>
  61 + <View style={styles.sectionContainer}>
  62 + <Text style={styles.sectionTitle}>Learn More</Text>
  63 + <Text style={styles.sectionDescription}>
  64 + Read the docs to discover what to do next:
  65 + </Text>
  66 + </View>
  67 + <LearnMoreLinks />
  68 + </View>
  69 + </ScrollView>
  70 + </SafeAreaView>
  71 + </>
  72 + );
  73 +};
  74 +
  75 +const styles = StyleSheet.create({
  76 + scrollView: {
  77 + backgroundColor: Colors.lighter,
  78 + },
  79 + engine: {
  80 + position: 'absolute',
  81 + right: 0,
  82 + },
  83 + body: {
  84 + backgroundColor: Colors.white,
  85 + },
  86 + sectionContainer: {
  87 + marginTop: 32,
  88 + paddingHorizontal: 24,
  89 + },
  90 + sectionTitle: {
  91 + fontSize: 24,
  92 + fontWeight: '600',
  93 + color: Colors.black,
  94 + },
  95 + sectionDescription: {
  96 + marginTop: 8,
  97 + fontSize: 18,
  98 + fontWeight: '400',
  99 + color: Colors.dark,
  100 + },
  101 + highlight: {
  102 + fontWeight: '700',
  103 + },
  104 + footer: {
  105 + color: Colors.dark,
  106 + fontSize: 12,
  107 + fontWeight: '600',
  108 + padding: 4,
  109 + paddingRight: 12,
  110 + textAlign: 'right',
  111 + },
  112 +});
  113 +
  114 +export default App;
  1 +/**
  2 + * @format
  3 + */
  4 +
  5 +import 'react-native';
  6 +import React from 'react';
  7 +import App from '../App';
  8 +
  9 +// Note: test renderer must be required after react-native.
  10 +import renderer from 'react-test-renderer';
  11 +
  12 +it('renders correctly', () => {
  13 + renderer.create(<App />);
  14 +});
  1 +# To learn about Buck see [Docs](https://buckbuild.com/).
  2 +# To run your application with Buck:
  3 +# - install Buck
  4 +# - `npm start` - to start the packager
  5 +# - `cd android`
  6 +# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
  7 +# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
  8 +# - `buck install -r android/app` - compile, install and run application
  9 +#
  10 +
  11 +lib_deps = []
  12 +
  13 +for jarfile in glob(['libs/*.jar']):
  14 + name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
  15 + lib_deps.append(':' + name)
  16 + prebuilt_jar(
  17 + name = name,
  18 + binary_jar = jarfile,
  19 + )
  20 +
  21 +for aarfile in glob(['libs/*.aar']):
  22 + name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
  23 + lib_deps.append(':' + name)
  24 + android_prebuilt_aar(
  25 + name = name,
  26 + aar = aarfile,
  27 + )
  28 +
  29 +android_library(
  30 + name = "all-libs",
  31 + exported_deps = lib_deps,
  32 +)
  33 +
  34 +android_library(
  35 + name = "app-code",
  36 + srcs = glob([
  37 + "src/main/java/**/*.java",
  38 + ]),
  39 + deps = [
  40 + ":all-libs",
  41 + ":build_config",
  42 + ":res",
  43 + ],
  44 +)
  45 +
  46 +android_build_config(
  47 + name = "build_config",
  48 + package = "com.myreactdemo",
  49 +)
  50 +
  51 +android_resource(
  52 + name = "res",
  53 + package = "com.myreactdemo",
  54 + res = "src/main/res",
  55 +)
  56 +
  57 +android_binary(
  58 + name = "app",
  59 + keystore = "//android/keystores:debug",
  60 + manifest = "src/main/AndroidManifest.xml",
  61 + package_type = "debug",
  62 + deps = [
  63 + ":app-code",
  64 + ],
  65 +)
  1 +apply plugin: "com.android.application"
  2 +
  3 +import com.android.build.OutputFile
  4 +
  5 +/**
  6 + * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
  7 + * and bundleReleaseJsAndAssets).
  8 + * These basically call `react-native bundle` with the correct arguments during the Android build
  9 + * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
  10 + * bundle directly from the development server. Below you can see all the possible configurations
  11 + * and their defaults. If you decide to add a configuration block, make sure to add it before the
  12 + * `apply from: "../../node_modules/react-native/react.gradle"` line.
  13 + *
  14 + * project.ext.react = [
  15 + * // the name of the generated asset file containing your JS bundle
  16 + * bundleAssetName: "index.android.bundle",
  17 + *
  18 + * // the entry file for bundle generation
  19 + * entryFile: "index.android.js",
  20 + *
  21 + * // whether to bundle JS and assets in debug mode
  22 + * bundleInDebug: false,
  23 + *
  24 + * // whether to bundle JS and assets in release mode
  25 + * bundleInRelease: true,
  26 + *
  27 + * // whether to bundle JS and assets in another build variant (if configured).
  28 + * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
  29 + * // The configuration property can be in the following formats
  30 + * // 'bundleIn${productFlavor}${buildType}'
  31 + * // 'bundleIn${buildType}'
  32 + * // bundleInFreeDebug: true,
  33 + * // bundleInPaidRelease: true,
  34 + * // bundleInBeta: true,
  35 + *
  36 + * // whether to disable dev mode in custom build variants (by default only disabled in release)
  37 + * // for example: to disable dev mode in the staging build type (if configured)
  38 + * devDisabledInStaging: true,
  39 + * // The configuration property can be in the following formats
  40 + * // 'devDisabledIn${productFlavor}${buildType}'
  41 + * // 'devDisabledIn${buildType}'
  42 + *
  43 + * // the root of your project, i.e. where "package.json" lives
  44 + * root: "../../",
  45 + *
  46 + * // where to put the JS bundle asset in debug mode
  47 + * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
  48 + *
  49 + * // where to put the JS bundle asset in release mode
  50 + * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
  51 + *
  52 + * // where to put drawable resources / React Native assets, e.g. the ones you use via
  53 + * // require('./image.png')), in debug mode
  54 + * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
  55 + *
  56 + * // where to put drawable resources / React Native assets, e.g. the ones you use via
  57 + * // require('./image.png')), in release mode
  58 + * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
  59 + *
  60 + * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
  61 + * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
  62 + * // date; if you have any other folders that you want to ignore for performance reasons (gradle
  63 + * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
  64 + * // for example, you might want to remove it from here.
  65 + * inputExcludes: ["android/**", "ios/**"],
  66 + *
  67 + * // override which node gets called and with what additional arguments
  68 + * nodeExecutableAndArgs: ["node"],
  69 + *
  70 + * // supply additional arguments to the packager
  71 + * extraPackagerArgs: []
  72 + * ]
  73 + */
  74 +
  75 +project.ext.react = [
  76 + entryFile: "index.js"
  77 +]
  78 +
  79 +apply from: "../../node_modules/react-native/react.gradle"
  80 +
  81 +/**
  82 + * Set this to true to create two separate APKs instead of one:
  83 + * - An APK that only works on ARM devices
  84 + * - An APK that only works on x86 devices
  85 + * The advantage is the size of the APK is reduced by about 4MB.
  86 + * Upload all the APKs to the Play Store and people will download
  87 + * the correct one based on the CPU architecture of their device.
  88 + */
  89 +def enableSeparateBuildPerCPUArchitecture = false
  90 +
  91 +/**
  92 + * Run Proguard to shrink the Java bytecode in release builds.
  93 + */
  94 +def enableProguardInReleaseBuilds = false
  95 +
  96 +android {
  97 + compileSdkVersion 23
  98 + buildToolsVersion "23.0.1"
  99 +
  100 + defaultConfig {
  101 + applicationId "com.myreactdemo"
  102 + minSdkVersion 16
  103 + targetSdkVersion 22
  104 + versionCode 1
  105 + versionName "1.0"
  106 + ndk {
  107 + abiFilters "armeabi-v7a", "x86"
  108 + }
  109 + }
  110 + splits {
  111 + abi {
  112 + reset()
  113 + enable enableSeparateBuildPerCPUArchitecture
  114 + universalApk false // If true, also generate a universal APK
  115 + include "armeabi-v7a", "x86"
  116 + }
  117 + }
  118 + buildTypes {
  119 + release {
  120 + minifyEnabled enableProguardInReleaseBuilds
  121 + proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
  122 + }
  123 + }
  124 + // applicationVariants are e.g. debug, release
  125 + applicationVariants.all { variant ->
  126 + variant.outputs.each { output ->
  127 + // For each separate APK per architecture, set a unique version code as described here:
  128 + // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
  129 + def versionCodes = ["armeabi-v7a":1, "x86":2]
  130 + def abi = output.getFilter(OutputFile.ABI)
  131 + if (abi != null) { // null for the universal-debug, universal-release variants
  132 + output.versionCodeOverride =
  133 + versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
  134 + }
  135 + }
  136 + }
  137 +}
  138 +
  139 +dependencies {
  140 + compile fileTree(dir: "libs", include: ["*.jar"])
  141 + compile "com.android.support:appcompat-v7:23.0.1"
  142 + compile "com.facebook.react:react-native:+" // From node_modules
  143 +}
  144 +
  145 +// Run this once to be able to run the application with BUCK
  146 +// puts all compile dependencies into folder libs for BUCK to use
  147 +task copyDownloadableDepsToLibs(type: Copy) {
  148 + from configurations.compile
  149 + into 'libs'
  150 +}
  1 +# Add project specific ProGuard rules here.
  2 +# By default, the flags in this file are appended to flags specified
  3 +# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
  4 +# You can edit the include path and order by changing the proguardFiles
  5 +# directive in build.gradle.
  6 +#
  7 +# For more details, see
  8 +# http://developer.android.com/guide/developing/tools/proguard.html
  9 +
  10 +# Add any project specific keep options here:
  11 +
  12 +# If your project uses WebView with JS, uncomment the following
  13 +# and specify the fully qualified class name to the JavaScript interface
  14 +# class:
  15 +#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
  16 +# public *;
  17 +#}
  18 +
  19 +# Disabling obfuscation is useful if you collect stack traces from production crashes
  20 +# (unless you are using a system that supports de-obfuscate the stack traces).
  21 +-dontobfuscate
  22 +
  23 +# React Native
  24 +
  25 +# Keep our interfaces so they can be used by other ProGuard rules.
  26 +# See http://sourceforge.net/p/proguard/bugs/466/
  27 +-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
  28 +-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
  29 +-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
  30 +
  31 +# Do not strip any method/class that is annotated with @DoNotStrip
  32 +-keep @com.facebook.proguard.annotations.DoNotStrip class *
  33 +-keep @com.facebook.common.internal.DoNotStrip class *
  34 +-keepclassmembers class * {
  35 + @com.facebook.proguard.annotations.DoNotStrip *;
  36 + @com.facebook.common.internal.DoNotStrip *;
  37 +}
  38 +
  39 +-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
  40 + void set*(***);
  41 + *** get*();
  42 +}
  43 +
  44 +-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
  45 +-keep class * extends com.facebook.react.bridge.NativeModule { *; }
  46 +-keepclassmembers,includedescriptorclasses class * { native <methods>; }
  47 +-keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; }
  48 +-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
  49 +-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
  50 +
  51 +-dontwarn com.facebook.react.**
  52 +
  53 +# TextLayoutBuilder uses a non-public Android constructor within StaticLayout.
  54 +# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details.
  55 +-dontwarn android.text.StaticLayout
  56 +
  57 +# okhttp
  58 +
  59 +-keepattributes Signature
  60 +-keepattributes *Annotation*
  61 +-keep class okhttp3.** { *; }
  62 +-keep interface okhttp3.** { *; }
  63 +-dontwarn okhttp3.**
  64 +
  65 +# okio
  66 +
  67 +-keep class sun.misc.Unsafe { *; }
  68 +-dontwarn java.nio.file.*
  69 +-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
  70 +-dontwarn okio.**
  1 +<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  2 + package="com.myreactdemo"
  3 + android:versionCode="1"
  4 + android:versionName="1.0">
  5 +
  6 + <uses-permission android:name="android.permission.INTERNET" />
  7 + <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
  8 +
  9 + <uses-sdk
  10 + android:minSdkVersion="16"
  11 + android:targetSdkVersion="22" />
  12 +
  13 + <application
  14 + android:name=".MainApplication"
  15 + android:allowBackup="true"
  16 + android:label="@string/app_name"
  17 + android:icon="@mipmap/ic_launcher"
  18 + android:theme="@style/AppTheme">
  19 + <activity
  20 + android:name=".MainActivity"
  21 + android:label="@string/app_name"
  22 + android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
  23 + android:windowSoftInputMode="adjustResize">
  24 + <intent-filter>
  25 + <action android:name="android.intent.action.MAIN" />
  26 + <category android:name="android.intent.category.LAUNCHER" />
  27 + </intent-filter>
  28 + </activity>
  29 + <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
  30 +
  31 + <activity android:name=".MyActivity"
  32 + android:configChanges="orientation"></activity>
  33 + </application>
  34 +
  35 +</manifest>
  1 +package com.myreactdemo;
  2 +
  3 +import com.facebook.react.ReactActivity;
  4 +
  5 +public class MainActivity extends ReactActivity {
  6 +
  7 + /**
  8 + * Returns the name of the main component registered from JavaScript.
  9 + * This is used to schedule rendering of the component.
  10 + */
  11 + @Override
  12 + protected String getMainComponentName() {
  13 + return "MyReactDemo";
  14 + }
  15 +
  16 +
  17 +}
  1 +package com.myreactdemo;
  2 +
  3 +import android.app.Application;
  4 +
  5 +import com.facebook.react.ReactApplication;
  6 +import com.facebook.react.ReactNativeHost;
  7 +import com.facebook.react.ReactPackage;
  8 +import com.facebook.react.shell.MainReactPackage;
  9 +import com.facebook.soloader.SoLoader;
  10 +
  11 +import java.util.Arrays;
  12 +import java.util.List;
  13 +
  14 +public class MainApplication extends Application implements ReactApplication {
  15 +
  16 + private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
  17 + @Override
  18 + public boolean getUseDeveloperSupport() {
  19 + return BuildConfig.DEBUG;
  20 + }
  21 +
  22 + @Override
  23 + protected List<ReactPackage> getPackages() {
  24 + return Arrays.<ReactPackage>asList(
  25 + new MainReactPackage(),
  26 + new MyReactPackage()
  27 + );
  28 + }
  29 +
  30 + @Override
  31 + protected String getJSMainModuleName() {
  32 + return "index.android";
  33 + }
  34 + };
  35 +
  36 + @Override
  37 + public ReactNativeHost getReactNativeHost() {
  38 + return mReactNativeHost;
  39 + }
  40 +
  41 + @Override
  42 + public void onCreate() {
  43 + super.onCreate();
  44 + SoLoader.init(this, /* native exopackage */ false);
  45 +
  46 + }
  47 +}
  1 +package com.myreactdemo;
  2 +
  3 +import android.app.Activity;
  4 +import android.os.Bundle;
  5 +import android.view.Gravity;
  6 +import android.view.View;
  7 +import android.view.ViewGroup;
  8 +import android.widget.Button;
  9 +import android.widget.LinearLayout;
  10 +import android.widget.RelativeLayout;
  11 +import android.widget.TextView;
  12 +import android.widget.Toast;
  13 +import android.content.Intent;
  14 +import com.myreactdemo.util.ThemeUtile;
  15 +
  16 +/**
  17 + * 1、 原生页面与RN 跳转交互
  18 + * 2、 黑白主题切换
  19 + */
  20 +
  21 +public class MyActivity extends Activity implements View.OnClickListener {
  22 +
  23 +
  24 + @Override
  25 + protected void onCreate(Bundle savedInstanceState) {
  26 + super.onCreate(savedInstanceState);
  27 + ThemeUtile.changeTheme(this);
  28 + setContentView(createView());
  29 + }
  30 +
  31 + private View createView() {
  32 + LinearLayout ll= new LinearLayout(this);
  33 + ll.setGravity(Gravity.CENTER);
  34 + ll.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
  35 + // 设置文字
  36 + TextView mTextView = new TextView(this);
  37 + mTextView.setText("hello world");
  38 +// TypedValue typedValue = new TypedValue();
  39 +// getTheme().resolveAttribute(R.attr.Text_bg_Color, typedValue, true);
  40 +// mTextView.setBackgroundColor(typedValue.resourceId);
  41 +
  42 + //设置按钮
  43 + Button mButton =new Button(this);
  44 + mButton.setText(R.string.change_theme);
  45 + mButton.setOnClickListener(this);
  46 +
  47 +
  48 + LinearLayout.LayoutParams mLayoutParams = new LinearLayout.LayoutParams(
  49 + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
  50 +
  51 + // 在父类布局中添加它,及布局样式
  52 + ll.addView(mTextView, mLayoutParams);
  53 + ll.addView(mButton, mLayoutParams);
  54 +
  55 +
  56 + return ll;
  57 +
  58 + }
  59 +
  60 +
  61 + @Override
  62 + public void onClick(View v) {
  63 +// if (ThemeUtile.night) {
  64 +// ThemeUtile.night = false;
  65 +// } else {
  66 +// ThemeUtile.night = true;
  67 +// }
  68 +// recreate();
  69 +
  70 +
  71 +
  72 + //name相当于一个key,content是返回的内容
  73 +
  74 + //结束当前页面
  75 + finish();
  76 +
  77 +
  78 + //出现问题:由于在当前屏幕值重新设置主题,会导致重新调用onCreate()方法导致闪屏
  79 +
  80 + /**
  81 + * 解决方案1:
  82 + * 可以在一个新开的Activity中通过ThemeUtile.night变量重新设置主题,但不调用recreate()方法切换主题,
  83 + * 而是“手动”设置需要改变的属性,在退出该Activity时,使用Intent回到之前的界面,
  84 + * 并 intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_NEW_TASK);
  85 + * ,使之前的Activity全部出栈,重新创建一个新的Activity,执行onCreate()方法,从而改变主题。
  86 + * 虽然不是很优雅,但是完成了不闪屏切换Android App主题。
  87 + */
  88 + }
  89 +}
  90 +
  91 +
  1 +package com.myreactdemo;
  2 +
  3 +import android.app.Activity;
  4 +import android.content.Intent;
  5 +import android.text.TextUtils;
  6 +
  7 +import com.facebook.react.bridge.Callback;
  8 +import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
  9 +import com.facebook.react.bridge.ReactApplicationContext;
  10 +import com.facebook.react.bridge.ReactContextBaseJavaModule;
  11 +import com.facebook.react.bridge.ReactMethod;
  12 +
  13 +/**
  14 + * 原生Activity与React交互——模块
  15 + */
  16 +
  17 +public class MyIntentModule extends ReactContextBaseJavaModule {
  18 +
  19 + public MyIntentModule(ReactApplicationContext reactContext) {
  20 + super(reactContext);
  21 + }
  22 +
  23 + @Override
  24 + public String getName() {
  25 + return "IntentMoudle";
  26 + }
  27 + //注意:记住getName方法中的命名名称,JS中调用需要
  28 +
  29 + @ReactMethod
  30 + public void gotoNative( String params){
  31 + try{
  32 +
  33 + Activity currentActivity = getCurrentActivity();
  34 + if(null!=currentActivity){
  35 + Class toActivity = Class.forName("com.myreactdemo.MyActivity");
  36 + Intent intent = new Intent(currentActivity,toActivity);
  37 + intent.putExtra("params", params);
  38 + currentActivity.startActivity(intent);
  39 + }
  40 + }catch(Exception e){
  41 + throw new JSApplicationIllegalArgumentException(
  42 + "不能打开Activity : "+e.getMessage());
  43 + }
  44 + }
  45 +
  46 + @ReactMethod
  47 + public void dataToJS(Callback successBack, Callback errorBack){
  48 + try{
  49 + Activity currentActivity = getCurrentActivity();
  50 + String result = currentActivity.getIntent().getStringExtra("data");
  51 + if (TextUtils.isEmpty(result)){
  52 + result = "没有数据";
  53 + }
  54 + successBack.invoke(result);
  55 + }catch (Exception e){
  56 + errorBack.invoke(e.getMessage());
  57 + }
  58 + }
  59 +
  60 +
  61 + @ReactMethod
  62 + public void backJS()
  63 + {
  64 + try{
  65 + Activity currentActivity = getCurrentActivity();
  66 + if(null!=currentActivity){
  67 + currentActivity.finish();
  68 + }
  69 +
  70 + }catch (Exception e){
  71 + throw new JSApplicationIllegalArgumentException(
  72 + "不能返回js : "+e.getMessage());
  73 + }
  74 + }
  75 +//注意:startActivityFromJS、dataToJS方法添加RN注解(@ReactMethod),否则该方法将不被添加到RN中
  76 +}
  1 +package com.myreactdemo;
  2 +
  3 +import com.facebook.react.ReactPackage;
  4 +import com.facebook.react.bridge.NativeModule;
  5 +import com.facebook.react.bridge.ReactApplicationContext;
  6 +import com.facebook.react.uimanager.ViewManager;
  7 +
  8 +import java.util.Arrays;
  9 +import java.util.Collections;
  10 +import java.util.List;
  11 +
  12 +/**
  13 + * 注册模块
  14 + */
  15 +
  16 +public class MyReactPackage implements ReactPackage {
  17 + @Override
  18 + public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  19 + return Arrays.<NativeModule>asList(new MyIntentModule(reactContext));
  20 + }
  21 + @Override
  22 + public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
  23 + return Collections.emptyList();
  24 + }
  25 +}
  1 +package com.myreactdemo.util;
  2 +
  3 +import android.app.Activity;
  4 +
  5 +import com.myreactdemo.R;
  6 +
  7 +/**
  8 + * 切换主题——工具
  9 + */
  10 +
  11 +public class ThemeUtile {
  12 +
  13 + public static boolean night = false;
  14 +
  15 +
  16 + public static void changeTheme(Activity activity){
  17 + if (ThemeUtile.night){
  18 + activity.setTheme(R.style.APPThemeNight);
  19 + }else{
  20 + activity.setTheme(R.style.AppTheme);
  21 + }
  22 + }
  23 +}
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent">
  5 +
  6 + <TextView
  7 + android:layout_width="wrap_content"
  8 + android:layout_height="wrap_content"
  9 + android:background="?attr/Text_bg_Color"
  10 + android:layout_centerInParent="true"
  11 + android:text="Hello Theme"/>
  12 +
  13 +
  14 +
  15 + <Button
  16 + android:layout_width="wrap_content"
  17 + android:layout_height="wrap_content"
  18 + android:text="@string/change_theme"
  19 + android:onClick="onClickNight"/>
  20 +</RelativeLayout>
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<resources>
  3 + <attr name="Text_bg_Color" format="color|reference"/>
  4 +</resources>
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<resources>
  3 + <color name="AppThemeColor">#fe2d4a</color>
  4 + <color name="colorGray">#21B0DF</color>
  5 +</resources>
  1 +<resources>
  2 + <string name="app_name">MyReactDemo</string>
  3 +
  4 + <string name="change_theme">返回js页面</string>
  5 +</resources>
  1 +<resources>
  2 +
  3 + <!-- Base application theme. -->
  4 + <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
  5 + <!-- Customize your theme here. -->
  6 + <item name="colorPrimary">@color/AppThemeColor</item>
  7 + <item name="colorPrimaryDark">@color/AppThemeColor</item>
  8 + <item name="colorAccent">@color/AppThemeColor</item>
  9 + <item name="android:colorBackground">@color/colorGray</item>
  10 + <item name="android:textColor">@color/AppThemeColor</item>
  11 + </style>
  12 +
  13 + <style name="APPThemeNight" parent="Theme.AppCompat.Light.NoActionBar">
  14 + <item name="colorPrimary">@color/colorGray</item>
  15 + <item name="colorPrimaryDark">@color/colorGray</item>
  16 + <item name="colorAccent">@color/colorGray</item>
  17 + <item name="android:textColor">@color/colorGray</item>
  18 + <item name="android:background">#f5f5f5</item>
  19 + </style>
  20 +</resources>
  1 +// Top-level build file where you can add configuration options common to all sub-projects/modules.
  2 +
  3 +buildscript {
  4 + repositories {
  5 + jcenter()
  6 + maven {
  7 + url 'https://maven.google.com/'
  8 + name 'Google'
  9 + }
  10 + }
  11 + dependencies {
  12 + classpath 'com.android.tools.build:gradle:2.2.3'
  13 +
  14 + // NOTE: Do not place your application dependencies here; they belong
  15 + // in the individual module build.gradle files
  16 + }
  17 +}
  18 +
  19 +allprojects {
  20 + repositories {
  21 + mavenLocal()
  22 + jcenter()
  23 + maven {
  24 + // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
  25 + url "$rootDir/../node_modules/react-native/android"
  26 + }
  27 + maven {
  28 + url 'https://maven.google.com/'
  29 + name 'Google'
  30 + }
  31 + }
  32 +}
  1 +# Project-wide Gradle settings.
  2 +
  3 +# IDE (e.g. Android Studio) users:
  4 +# Gradle settings configured through the IDE *will override*
  5 +# any settings specified in this file.
  6 +
  7 +# For more details on how to configure your build environment visit
  8 +# http://www.gradle.org/docs/current/userguide/build_environment.html
  9 +
  10 +# Specifies the JVM arguments used for the daemon process.
  11 +# The setting is particularly useful for tweaking memory settings.
  12 +# Default value: -Xmx10248m -XX:MaxPermSize=256m
  13 +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
  14 +
  15 +# When configured, Gradle will run in incubating parallel mode.
  16 +# This option should only be used with decoupled projects. More details, visit
  17 +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
  18 +# org.gradle.parallel=true
  19 +
  20 +android.useDeprecatedNdk=true
  1 +distributionBase=GRADLE_USER_HOME
  2 +distributionPath=wrapper/dists
  3 +zipStoreBase=GRADLE_USER_HOME
  4 +zipStorePath=wrapper/dists
  5 +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
  1 +#!/usr/bin/env bash
  2 +
  3 +##############################################################################
  4 +##
  5 +## Gradle start up script for UN*X
  6 +##
  7 +##############################################################################
  8 +
  9 +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
  10 +DEFAULT_JVM_OPTS=""
  11 +
  12 +APP_NAME="Gradle"
  13 +APP_BASE_NAME=`basename "$0"`
  14 +
  15 +# Use the maximum available, or set MAX_FD != -1 to use that value.
  16 +MAX_FD="maximum"
  17 +
  18 +warn ( ) {
  19 + echo "$*"
  20 +}
  21 +
  22 +die ( ) {
  23 + echo
  24 + echo "$*"
  25 + echo
  26 + exit 1
  27 +}
  28 +
  29 +# OS specific support (must be 'true' or 'false').
  30 +cygwin=false
  31 +msys=false
  32 +darwin=false
  33 +case "`uname`" in
  34 + CYGWIN* )
  35 + cygwin=true
  36 + ;;
  37 + Darwin* )
  38 + darwin=true
  39 + ;;
  40 + MINGW* )
  41 + msys=true
  42 + ;;
  43 +esac
  44 +
  45 +# For Cygwin, ensure paths are in UNIX format before anything is touched.
  46 +if $cygwin ; then
  47 + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  48 +fi
  49 +
  50 +# Attempt to set APP_HOME
  51 +# Resolve links: $0 may be a link
  52 +PRG="$0"
  53 +# Need this for relative symlinks.
  54 +while [ -h "$PRG" ] ; do
  55 + ls=`ls -ld "$PRG"`
  56 + link=`expr "$ls" : '.*-> \(.*\)$'`
  57 + if expr "$link" : '/.*' > /dev/null; then
  58 + PRG="$link"
  59 + else
  60 + PRG=`dirname "$PRG"`"/$link"
  61 + fi
  62 +done
  63 +SAVED="`pwd`"
  64 +cd "`dirname \"$PRG\"`/" >&-
  65 +APP_HOME="`pwd -P`"
  66 +cd "$SAVED" >&-
  67 +
  68 +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
  69 +
  70 +# Determine the Java command to use to start the JVM.
  71 +if [ -n "$JAVA_HOME" ] ; then
  72 + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
  73 + # IBM's JDK on AIX uses strange locations for the executables
  74 + JAVACMD="$JAVA_HOME/jre/sh/java"
  75 + else
  76 + JAVACMD="$JAVA_HOME/bin/java"
  77 + fi
  78 + if [ ! -x "$JAVACMD" ] ; then
  79 + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
  80 +
  81 +Please set the JAVA_HOME variable in your environment to match the
  82 +location of your Java installation."
  83 + fi
  84 +else
  85 + JAVACMD="java"
  86 + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
  87 +
  88 +Please set the JAVA_HOME variable in your environment to match the
  89 +location of your Java installation."
  90 +fi
  91 +
  92 +# Increase the maximum file descriptors if we can.
  93 +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
  94 + MAX_FD_LIMIT=`ulimit -H -n`
  95 + if [ $? -eq 0 ] ; then
  96 + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
  97 + MAX_FD="$MAX_FD_LIMIT"
  98 + fi
  99 + ulimit -n $MAX_FD
  100 + if [ $? -ne 0 ] ; then
  101 + warn "Could not set maximum file descriptor limit: $MAX_FD"
  102 + fi
  103 + else
  104 + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
  105 + fi
  106 +fi
  107 +
  108 +# For Darwin, add options to specify how the application appears in the dock
  109 +if $darwin; then
  110 + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
  111 +fi
  112 +
  113 +# For Cygwin, switch paths to Windows format before running java
  114 +if $cygwin ; then
  115 + APP_HOME=`cygpath --path --mixed "$APP_HOME"`
  116 + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
  117 +
  118 + # We build the pattern for arguments to be converted via cygpath
  119 + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
  120 + SEP=""
  121 + for dir in $ROOTDIRSRAW ; do
  122 + ROOTDIRS="$ROOTDIRS$SEP$dir"
  123 + SEP="|"
  124 + done
  125 + OURCYGPATTERN="(^($ROOTDIRS))"
  126 + # Add a user-defined pattern to the cygpath arguments
  127 + if [ "$GRADLE_CYGPATTERN" != "" ] ; then
  128 + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
  129 + fi
  130 + # Now convert the arguments - kludge to limit ourselves to /bin/sh
  131 + i=0
  132 + for arg in "$@" ; do
  133 + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
  134 + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
  135 +
  136 + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
  137 + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
  138 + else
  139 + eval `echo args$i`="\"$arg\""
  140 + fi
  141 + i=$((i+1))
  142 + done
  143 + case $i in
  144 + (0) set -- ;;
  145 + (1) set -- "$args0" ;;
  146 + (2) set -- "$args0" "$args1" ;;
  147 + (3) set -- "$args0" "$args1" "$args2" ;;
  148 + (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
  149 + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
  150 + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
  151 + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
  152 + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
  153 + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
  154 + esac
  155 +fi
  156 +
  157 +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
  158 +function splitJvmOpts() {
  159 + JVM_OPTS=("$@")
  160 +}
  161 +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
  162 +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
  163 +
  164 +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
  1 +@if "%DEBUG%" == "" @echo off
  2 +@rem ##########################################################################
  3 +@rem
  4 +@rem Gradle startup script for Windows
  5 +@rem
  6 +@rem ##########################################################################
  7 +
  8 +@rem Set local scope for the variables with windows NT shell
  9 +if "%OS%"=="Windows_NT" setlocal
  10 +
  11 +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
  12 +set DEFAULT_JVM_OPTS=
  13 +
  14 +set DIRNAME=%~dp0
  15 +if "%DIRNAME%" == "" set DIRNAME=.
  16 +set APP_BASE_NAME=%~n0
  17 +set APP_HOME=%DIRNAME%
  18 +
  19 +@rem Find java.exe
  20 +if defined JAVA_HOME goto findJavaFromJavaHome
  21 +
  22 +set JAVA_EXE=java.exe
  23 +%JAVA_EXE% -version >NUL 2>&1
  24 +if "%ERRORLEVEL%" == "0" goto init
  25 +
  26 +echo.
  27 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
  28 +echo.
  29 +echo Please set the JAVA_HOME variable in your environment to match the
  30 +echo location of your Java installation.
  31 +
  32 +goto fail
  33 +
  34 +:findJavaFromJavaHome
  35 +set JAVA_HOME=%JAVA_HOME:"=%
  36 +set JAVA_EXE=%JAVA_HOME%/bin/java.exe
  37 +
  38 +if exist "%JAVA_EXE%" goto init
  39 +
  40 +echo.
  41 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
  42 +echo.
  43 +echo Please set the JAVA_HOME variable in your environment to match the
  44 +echo location of your Java installation.
  45 +
  46 +goto fail
  47 +
  48 +:init
  49 +@rem Get command-line arguments, handling Windowz variants
  50 +
  51 +if not "%OS%" == "Windows_NT" goto win9xME_args
  52 +if "%@eval[2+2]" == "4" goto 4NT_args
  53 +
  54 +:win9xME_args
  55 +@rem Slurp the command line arguments.
  56 +set CMD_LINE_ARGS=
  57 +set _SKIP=2
  58 +
  59 +:win9xME_args_slurp
  60 +if "x%~1" == "x" goto execute
  61 +
  62 +set CMD_LINE_ARGS=%*
  63 +goto execute
  64 +
  65 +:4NT_args
  66 +@rem Get arguments from the 4NT Shell from JP Software
  67 +set CMD_LINE_ARGS=%$
  68 +
  69 +:execute
  70 +@rem Setup the command line
  71 +
  72 +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
  73 +
  74 +@rem Execute Gradle
  75 +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
  76 +
  77 +:end
  78 +@rem End local scope for the variables with windows NT shell
  79 +if "%ERRORLEVEL%"=="0" goto mainEnd
  80 +
  81 +:fail
  82 +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
  83 +rem the _cmd.exe /c_ return code!
  84 +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
  85 +exit /b 1
  86 +
  87 +:mainEnd
  88 +if "%OS%"=="Windows_NT" endlocal
  89 +
  90 +:omega
  1 +keystore(
  2 + name = "debug",
  3 + properties = "debug.keystore.properties",
  4 + store = "debug.keystore",
  5 + visibility = [
  6 + "PUBLIC",
  7 + ],
  8 +)
  1 +key.store=debug.keystore
  2 +key.alias=androiddebugkey
  3 +key.store.password=android
  4 +key.alias.password=android
  1 +rootProject.name = 'MyReactDemo'
  2 +
  3 +include ':app'
  1 +{
  2 + "name": "react_native_view_vodeAd",
  3 + "displayName": "react_native_view_vodeAd"
  4 +}
  1 +module.exports = {
  2 + presets: ['module:metro-react-native-babel-preset'],
  3 +};
  1 +/**
  2 + * @format
  3 + */
  4 +
  5 +import {AppRegistry} from 'react-native';
  6 +import App from './App';
  7 +import {name as appName} from './app.json';
  8 +
  9 +AppRegistry.registerComponent(appName, () => App);
  1 +// !$*UTF8*$!
  2 +{
  3 + archiveVersion = 1;
  4 + classes = {
  5 + };
  6 + objectVersion = 50;
  7 + objects = {
  8 +
  9 +/* Begin PBXBuildFile section */
  10 + 8416B7EA251AEBEB0056934D /* VodeAdController.h in Headers */ = {isa = PBXBuildFile; fileRef = 8416B7E8251AEBEB0056934D /* VodeAdController.h */; };
  11 + 8416B7EB251AEBEB0056934D /* VodeAdController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8416B7E9251AEBEB0056934D /* VodeAdController.m */; };
  12 + 8416B7EE251AECAD0056934D /* VodeAdSdk.h in Headers */ = {isa = PBXBuildFile; fileRef = 8416B7EC251AECAD0056934D /* VodeAdSdk.h */; };
  13 + 8416B7EF251AECAD0056934D /* VodeAdSdk.m in Sources */ = {isa = PBXBuildFile; fileRef = 8416B7ED251AECAD0056934D /* VodeAdSdk.m */; };
  14 + 845A6731251AE8DD00A58073 /* RNVodeAd.m in Sources */ = {isa = PBXBuildFile; fileRef = 845A6730251AE8DD00A58073 /* RNVodeAd.m */; };
  15 + 845A6732251AE8DD00A58073 /* RNVodeAd.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 845A672F251AE8DD00A58073 /* RNVodeAd.h */; };
  16 + 845A6739251AE93C00A58073 /* RNVodeAd.h in Headers */ = {isa = PBXBuildFile; fileRef = 845A672F251AE8DD00A58073 /* RNVodeAd.h */; };
  17 + 845A673C251AE9F600A58073 /* ADDelegta.h in Headers */ = {isa = PBXBuildFile; fileRef = 845A673A251AE9F600A58073 /* ADDelegta.h */; };
  18 + 845A673D251AE9F600A58073 /* ADDelegta.m in Sources */ = {isa = PBXBuildFile; fileRef = 845A673B251AE9F600A58073 /* ADDelegta.m */; };
  19 +/* End PBXBuildFile section */
  20 +
  21 +/* Begin PBXCopyFilesBuildPhase section */
  22 + 845A672A251AE8DD00A58073 /* CopyFiles */ = {
  23 + isa = PBXCopyFilesBuildPhase;
  24 + buildActionMask = 2147483647;
  25 + dstPath = "include/$(PRODUCT_NAME)";
  26 + dstSubfolderSpec = 16;
  27 + files = (
  28 + 845A6732251AE8DD00A58073 /* RNVodeAd.h in CopyFiles */,
  29 + );
  30 + runOnlyForDeploymentPostprocessing = 0;
  31 + };
  32 +/* End PBXCopyFilesBuildPhase section */
  33 +
  34 +/* Begin PBXFileReference section */
  35 + 8416B7E8251AEBEB0056934D /* VodeAdController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VodeAdController.h; sourceTree = "<group>"; };
  36 + 8416B7E9251AEBEB0056934D /* VodeAdController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VodeAdController.m; sourceTree = "<group>"; };
  37 + 8416B7EC251AECAD0056934D /* VodeAdSdk.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VodeAdSdk.h; sourceTree = "<group>"; };
  38 + 8416B7ED251AECAD0056934D /* VodeAdSdk.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VodeAdSdk.m; sourceTree = "<group>"; };
  39 + 845A672C251AE8DD00A58073 /* libRNVodeAd.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNVodeAd.a; sourceTree = BUILT_PRODUCTS_DIR; };
  40 + 845A672F251AE8DD00A58073 /* RNVodeAd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNVodeAd.h; sourceTree = "<group>"; };
  41 + 845A6730251AE8DD00A58073 /* RNVodeAd.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNVodeAd.m; sourceTree = "<group>"; };
  42 + 845A673A251AE9F600A58073 /* ADDelegta.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ADDelegta.h; sourceTree = "<group>"; };
  43 + 845A673B251AE9F600A58073 /* ADDelegta.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ADDelegta.m; sourceTree = "<group>"; };
  44 +/* End PBXFileReference section */
  45 +
  46 +/* Begin PBXFrameworksBuildPhase section */
  47 + 845A6729251AE8DD00A58073 /* Frameworks */ = {
  48 + isa = PBXFrameworksBuildPhase;
  49 + buildActionMask = 2147483647;
  50 + files = (
  51 + );
  52 + runOnlyForDeploymentPostprocessing = 0;
  53 + };
  54 +/* End PBXFrameworksBuildPhase section */
  55 +
  56 +/* Begin PBXGroup section */
  57 + 845A6723251AE8DD00A58073 = {
  58 + isa = PBXGroup;
  59 + children = (
  60 + 845A672E251AE8DD00A58073 /* RNVodeAd */,
  61 + 845A672D251AE8DD00A58073 /* Products */,
  62 + );
  63 + sourceTree = "<group>";
  64 + };
  65 + 845A672D251AE8DD00A58073 /* Products */ = {
  66 + isa = PBXGroup;
  67 + children = (
  68 + 845A672C251AE8DD00A58073 /* libRNVodeAd.a */,
  69 + );
  70 + name = Products;
  71 + sourceTree = "<group>";
  72 + };
  73 + 845A672E251AE8DD00A58073 /* RNVodeAd */ = {
  74 + isa = PBXGroup;
  75 + children = (
  76 + 845A672F251AE8DD00A58073 /* RNVodeAd.h */,
  77 + 845A6730251AE8DD00A58073 /* RNVodeAd.m */,
  78 + 845A673A251AE9F600A58073 /* ADDelegta.h */,
  79 + 845A673B251AE9F600A58073 /* ADDelegta.m */,
  80 + 8416B7E8251AEBEB0056934D /* VodeAdController.h */,
  81 + 8416B7E9251AEBEB0056934D /* VodeAdController.m */,
  82 + 8416B7EC251AECAD0056934D /* VodeAdSdk.h */,
  83 + 8416B7ED251AECAD0056934D /* VodeAdSdk.m */,
  84 + );
  85 + path = RNVodeAd;
  86 + sourceTree = "<group>";
  87 + };
  88 +/* End PBXGroup section */
  89 +
  90 +/* Begin PBXHeadersBuildPhase section */
  91 + 845A6738251AE93500A58073 /* Headers */ = {
  92 + isa = PBXHeadersBuildPhase;
  93 + buildActionMask = 2147483647;
  94 + files = (
  95 + 845A673C251AE9F600A58073 /* ADDelegta.h in Headers */,
  96 + 8416B7EA251AEBEB0056934D /* VodeAdController.h in Headers */,
  97 + 8416B7EE251AECAD0056934D /* VodeAdSdk.h in Headers */,
  98 + 845A6739251AE93C00A58073 /* RNVodeAd.h in Headers */,
  99 + );
  100 + runOnlyForDeploymentPostprocessing = 0;
  101 + };
  102 +/* End PBXHeadersBuildPhase section */
  103 +
  104 +/* Begin PBXNativeTarget section */
  105 + 845A672B251AE8DD00A58073 /* RNVodeAd */ = {
  106 + isa = PBXNativeTarget;
  107 + buildConfigurationList = 845A6735251AE8DD00A58073 /* Build configuration list for PBXNativeTarget "RNVodeAd" */;
  108 + buildPhases = (
  109 + 845A6738251AE93500A58073 /* Headers */,
  110 + 845A6728251AE8DD00A58073 /* Sources */,
  111 + 845A6729251AE8DD00A58073 /* Frameworks */,
  112 + 845A672A251AE8DD00A58073 /* CopyFiles */,
  113 + );
  114 + buildRules = (
  115 + );
  116 + dependencies = (
  117 + );
  118 + name = RNVodeAd;
  119 + productName = RNVodeAd;
  120 + productReference = 845A672C251AE8DD00A58073 /* libRNVodeAd.a */;
  121 + productType = "com.apple.product-type.library.static";
  122 + };
  123 +/* End PBXNativeTarget section */
  124 +
  125 +/* Begin PBXProject section */
  126 + 845A6724251AE8DD00A58073 /* Project object */ = {
  127 + isa = PBXProject;
  128 + attributes = {
  129 + LastUpgradeCheck = 1130;
  130 + ORGANIZATIONNAME = admin;
  131 + TargetAttributes = {
  132 + 845A672B251AE8DD00A58073 = {
  133 + CreatedOnToolsVersion = 11.3.1;
  134 + };
  135 + };
  136 + };
  137 + buildConfigurationList = 845A6727251AE8DD00A58073 /* Build configuration list for PBXProject "RNVodeAd" */;
  138 + compatibilityVersion = "Xcode 9.3";
  139 + developmentRegion = en;
  140 + hasScannedForEncodings = 0;
  141 + knownRegions = (
  142 + en,
  143 + Base,
  144 + );
  145 + mainGroup = 845A6723251AE8DD00A58073;
  146 + productRefGroup = 845A672D251AE8DD00A58073 /* Products */;
  147 + projectDirPath = "";
  148 + projectRoot = "";
  149 + targets = (
  150 + 845A672B251AE8DD00A58073 /* RNVodeAd */,
  151 + );
  152 + };
  153 +/* End PBXProject section */
  154 +
  155 +/* Begin PBXSourcesBuildPhase section */
  156 + 845A6728251AE8DD00A58073 /* Sources */ = {
  157 + isa = PBXSourcesBuildPhase;
  158 + buildActionMask = 2147483647;
  159 + files = (
  160 + 845A6731251AE8DD00A58073 /* RNVodeAd.m in Sources */,
  161 + 845A673D251AE9F600A58073 /* ADDelegta.m in Sources */,
  162 + 8416B7EB251AEBEB0056934D /* VodeAdController.m in Sources */,
  163 + 8416B7EF251AECAD0056934D /* VodeAdSdk.m in Sources */,
  164 + );
  165 + runOnlyForDeploymentPostprocessing = 0;
  166 + };
  167 +/* End PBXSourcesBuildPhase section */
  168 +
  169 +/* Begin XCBuildConfiguration section */
  170 + 845A6733251AE8DD00A58073 /* Debug */ = {
  171 + isa = XCBuildConfiguration;
  172 + buildSettings = {
  173 + ALWAYS_SEARCH_USER_PATHS = NO;
  174 + CLANG_ANALYZER_NONNULL = YES;
  175 + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
  176 + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
  177 + CLANG_CXX_LIBRARY = "libc++";
  178 + CLANG_ENABLE_MODULES = YES;
  179 + CLANG_ENABLE_OBJC_ARC = YES;
  180 + CLANG_ENABLE_OBJC_WEAK = YES;
  181 + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
  182 + CLANG_WARN_BOOL_CONVERSION = YES;
  183 + CLANG_WARN_COMMA = YES;
  184 + CLANG_WARN_CONSTANT_CONVERSION = YES;
  185 + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
  186 + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
  187 + CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
  188 + CLANG_WARN_EMPTY_BODY = YES;
  189 + CLANG_WARN_ENUM_CONVERSION = YES;
  190 + CLANG_WARN_INFINITE_RECURSION = YES;
  191 + CLANG_WARN_INT_CONVERSION = YES;
  192 + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
  193 + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
  194 + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
  195 + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
  196 + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
  197 + CLANG_WARN_STRICT_PROTOTYPES = YES;
  198 + CLANG_WARN_SUSPICIOUS_MOVE = YES;
  199 + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
  200 + CLANG_WARN_UNREACHABLE_CODE = YES;
  201 + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
  202 + COPY_PHASE_STRIP = NO;
  203 + DEBUG_INFORMATION_FORMAT = dwarf;
  204 + ENABLE_STRICT_OBJC_MSGSEND = YES;
  205 + ENABLE_TESTABILITY = YES;
  206 + GCC_C_LANGUAGE_STANDARD = gnu11;
  207 + GCC_DYNAMIC_NO_PIC = NO;
  208 + GCC_NO_COMMON_BLOCKS = YES;
  209 + GCC_OPTIMIZATION_LEVEL = 0;
  210 + GCC_PREPROCESSOR_DEFINITIONS = (
  211 + "DEBUG=1",
  212 + "$(inherited)",
  213 + );
  214 + GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
  215 + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
  216 + GCC_WARN_UNDECLARED_SELECTOR = YES;
  217 + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
  218 + GCC_WARN_UNUSED_FUNCTION = YES;
  219 + GCC_WARN_UNUSED_VARIABLE = YES;
  220 + IPHONEOS_DEPLOYMENT_TARGET = 13.2;
  221 + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
  222 + MTL_FAST_MATH = YES;
  223 + ONLY_ACTIVE_ARCH = YES;
  224 + SDKROOT = iphoneos;
  225 + };
  226 + name = Debug;
  227 + };
  228 + 845A6734251AE8DD00A58073 /* Release */ = {
  229 + isa = XCBuildConfiguration;
  230 + buildSettings = {
  231 + ALWAYS_SEARCH_USER_PATHS = NO;
  232 + CLANG_ANALYZER_NONNULL = YES;
  233 + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
  234 + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
  235 + CLANG_CXX_LIBRARY = "libc++";
  236 + CLANG_ENABLE_MODULES = YES;
  237 + CLANG_ENABLE_OBJC_ARC = YES;
  238 + CLANG_ENABLE_OBJC_WEAK = YES;
  239 + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
  240 + CLANG_WARN_BOOL_CONVERSION = YES;
  241 + CLANG_WARN_COMMA = YES;
  242 + CLANG_WARN_CONSTANT_CONVERSION = YES;
  243 + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
  244 + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
  245 + CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
  246 + CLANG_WARN_EMPTY_BODY = YES;
  247 + CLANG_WARN_ENUM_CONVERSION = YES;
  248 + CLANG_WARN_INFINITE_RECURSION = YES;
  249 + CLANG_WARN_INT_CONVERSION = YES;
  250 + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
  251 + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
  252 + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
  253 + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
  254 + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
  255 + CLANG_WARN_STRICT_PROTOTYPES = YES;
  256 + CLANG_WARN_SUSPICIOUS_MOVE = YES;
  257 + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
  258 + CLANG_WARN_UNREACHABLE_CODE = YES;
  259 + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
  260 + COPY_PHASE_STRIP = NO;
  261 + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
  262 + ENABLE_NS_ASSERTIONS = NO;
  263 + ENABLE_STRICT_OBJC_MSGSEND = YES;
  264 + GCC_C_LANGUAGE_STANDARD = gnu11;
  265 + GCC_NO_COMMON_BLOCKS = YES;
  266 + GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
  267 + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
  268 + GCC_WARN_UNDECLARED_SELECTOR = YES;
  269 + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
  270 + GCC_WARN_UNUSED_FUNCTION = YES;
  271 + GCC_WARN_UNUSED_VARIABLE = YES;
  272 + IPHONEOS_DEPLOYMENT_TARGET = 13.2;
  273 + MTL_ENABLE_DEBUG_INFO = NO;
  274 + MTL_FAST_MATH = YES;
  275 + SDKROOT = iphoneos;
  276 + VALIDATE_PRODUCT = YES;
  277 + };
  278 + name = Release;
  279 + };
  280 + 845A6736251AE8DD00A58073 /* Debug */ = {
  281 + isa = XCBuildConfiguration;
  282 + buildSettings = {
  283 + CODE_SIGN_STYLE = Automatic;
  284 + DEVELOPMENT_TEAM = GTAPNGWX9A;
  285 + OTHER_LDFLAGS = "-ObjC";
  286 + PRODUCT_NAME = "$(TARGET_NAME)";
  287 + SKIP_INSTALL = YES;
  288 + TARGETED_DEVICE_FAMILY = "1,2";
  289 + };
  290 + name = Debug;
  291 + };
  292 + 845A6737251AE8DD00A58073 /* Release */ = {
  293 + isa = XCBuildConfiguration;
  294 + buildSettings = {
  295 + CODE_SIGN_STYLE = Automatic;
  296 + DEVELOPMENT_TEAM = GTAPNGWX9A;
  297 + OTHER_LDFLAGS = "-ObjC";
  298 + PRODUCT_NAME = "$(TARGET_NAME)";
  299 + SKIP_INSTALL = YES;
  300 + TARGETED_DEVICE_FAMILY = "1,2";
  301 + };
  302 + name = Release;
  303 + };
  304 +/* End XCBuildConfiguration section */
  305 +
  306 +/* Begin XCConfigurationList section */
  307 + 845A6727251AE8DD00A58073 /* Build configuration list for PBXProject "RNVodeAd" */ = {
  308 + isa = XCConfigurationList;
  309 + buildConfigurations = (
  310 + 845A6733251AE8DD00A58073 /* Debug */,
  311 + 845A6734251AE8DD00A58073 /* Release */,
  312 + );
  313 + defaultConfigurationIsVisible = 0;
  314 + defaultConfigurationName = Release;
  315 + };
  316 + 845A6735251AE8DD00A58073 /* Build configuration list for PBXNativeTarget "RNVodeAd" */ = {
  317 + isa = XCConfigurationList;
  318 + buildConfigurations = (
  319 + 845A6736251AE8DD00A58073 /* Debug */,
  320 + 845A6737251AE8DD00A58073 /* Release */,
  321 + );
  322 + defaultConfigurationIsVisible = 0;
  323 + defaultConfigurationName = Release;
  324 + };
  325 +/* End XCConfigurationList section */
  326 + };
  327 + rootObject = 845A6724251AE8DD00A58073 /* Project object */;
  328 +}
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<Workspace
  3 + version = "1.0">
  4 + <FileRef
  5 + location = "self:RNVodeAd.xcodeproj">
  6 + </FileRef>
  7 +</Workspace>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>IDEDidComputeMac32BitWarning</key>
  6 + <true/>
  7 +</dict>
  8 +</plist>
  1 +//
  2 +// ADDelegta.h
  3 +// RNVodeAd
  4 +//
  5 +// Created by admin on 2020/9/23.
  6 +// Copyright © 2020 admin. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +
  12 +
  13 +@interface ADDelegta : UIResponder<UIApplicationDelegate>
  14 +@property (strong, nonatomic) UIWindow *window;
  15 ++ (instancetype)sharedAppDelegate;
  16 +@end
  17 +
  1 +//
  2 +// ADDelegta.m
  3 +// RNVodeAd
  4 +//
  5 +// Created by admin on 2020/9/23.
  6 +// Copyright © 2020 admin. All rights reserved.
  7 +//
  8 +
  9 +#import "ADDelegta.h"
  10 +
  11 +@implementation ADDelegta
  12 ++ (instancetype)sharedAppDelegate
  13 +{
  14 + return (ADDelegta*)[UIApplication sharedApplication].delegate;
  15 +}
  16 +@end
  1 +//
  2 +// RNVodeAd.h
  3 +// RNVodeAd
  4 +//
  5 +// Created by admin on 2020/9/23.
  6 +// Copyright © 2020 admin. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +@interface RNVodeAd : NSObject
  12 +
  13 +@end
  1 +//
  2 +// RNVodeAd.m
  3 +// RNVodeAd
  4 +//
  5 +// Created by admin on 2020/9/23.
  6 +// Copyright © 2020 admin. All rights reserved.
  7 +//
  8 +
  9 +#import "RNVodeAd.h"
  10 +
  11 +@implementation RNVodeAd
  12 +
  13 +@end
  1 +//
  2 +// VodeAdController.h
  3 +// RNVodeAd
  4 +//
  5 +// Created by admin on 2020/9/23.
  6 +// Copyright © 2020 admin. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +
  12 +
  13 +@interface VodeAdController : UIViewController
  14 +@property NSObject* param;
  15 +@end
  16 +
  17 +
  1 +//
  2 +// VodeAdController.m
  3 +// RNVodeAd
  4 +//
  5 +// Created by admin on 2020/9/23.
  6 +// Copyright © 2020 admin. All rights reserved.
  7 +//
  8 +
  9 +#import "VodeAdController.h"
  10 +
  11 +@interface VodeAdController ()
  12 +
  13 +@end
  14 +
  15 +@implementation VodeAdController
  16 +
  17 +- (void)viewDidLoad {
  18 + [super viewDidLoad];
  19 + self.view.backgroundColor = [UIColor redColor];
  20 + // Do any additional setup after loading the view.
  21 +}
  22 +
  23 +/*
  24 +#pragma mark - Navigation
  25 +
  26 +// In a storyboard-based application, you will often want to do a little preparation before navigation
  27 +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  28 + // Get the new view controller using [segue destinationViewController].
  29 + // Pass the selected object to the new view controller.
  30 +}
  31 +*/
  32 +
  33 +@end
  1 +//
  2 +// VodeAdSdk.h
  3 +// RNVodeAd
  4 +//
  5 +// Created by admin on 2020/9/23.
  6 +// Copyright © 2020 admin. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +#import <React/RCTBridgeModule.h>
  11 +
  12 +
  13 +@interface VodeAdSdk : NSObject<RCTBridgeModule>
  14 +@property UIViewController* rootVc;
  15 +@end
  16 +
  17 +
  1 +//
  2 +// VodeAdSdk.m
  3 +// RNVodeAd
  4 +//
  5 +// Created by admin on 2020/9/23.
  6 +// Copyright © 2020 admin. All rights reserved.
  7 +//
  8 +
  9 +#import "VodeAdSdk.h"
  10 +#import "ADDelegta.h"
  11 +#import "VodeAdController.h"
  12 +@implementation VodeAdSdk
  13 ++ (instancetype)shareInstance {
  14 + static VodeAdSdk *instance;
  15 + static dispatch_once_t onceToken;
  16 + dispatch_once(&onceToken, ^{
  17 + instance = [[VodeAdSdk alloc] init];
  18 +
  19 + });
  20 + return instance;
  21 +}
  22 +
  23 +RCT_EXPORT_MODULE(IntentMoudle)
  24 +RCT_EXPORT_METHOD(init:(NSDictionary *)options)
  25 +{
  26 +
  27 +}
  28 +RCT_EXPORT_METHOD(gotoNative:(NSDictionary*)param)
  29 +{
  30 + self.rootVc = [ADDelegta sharedAppDelegate].window.rootViewController;
  31 + VodeAdController* vvc = [VodeAdController new];
  32 + vvc.param = param;
  33 + [ADDelegta sharedAppDelegate].window.rootViewController = vvc;
  34 + [[ADDelegta sharedAppDelegate].window makeKeyAndVisible];
  35 +}
  36 +RCT_EXPORT_METHOD(backJS)
  37 +{
  38 +
  39 + [ADDelegta sharedAppDelegate].window.rootViewController = self.rootVc;
  40 + [[ADDelegta sharedAppDelegate].window makeKeyAndVisible];
  41 +}
  42 +
  43 +
  44 +
  45 +@end
  1 +/**
  2 + * Metro configuration for React Native
  3 + * https://github.com/facebook/react-native
  4 + *
  5 + * @format
  6 + */
  7 +
  8 +module.exports = {
  9 + transformer: {
  10 + getTransformOptions: async () => ({
  11 + transform: {
  12 + experimentalImportSupport: false,
  13 + inlineRequires: false,
  14 + },
  15 + }),
  16 + },
  17 +};
  1 +{
  2 + "name": "react_native_view_vodeAd",
  3 + "version": "0.0.1",
  4 + "private": true,
  5 + "scripts": {
  6 + "android": "react-native run-android",
  7 + "ios": "react-native run-ios",
  8 + "start": "react-native start",
  9 + "test": "jest",
  10 + "lint": "eslint ."
  11 + },
  12 + "dependencies": {
  13 + "react": "16.13.1",
  14 + "react-native": "0.63.2"
  15 + },
  16 + "devDependencies": {
  17 + "@babel/core": "^7.11.6",
  18 + "@babel/runtime": "^7.11.2",
  19 + "@react-native-community/eslint-config": "^2.0.0",
  20 + "babel-jest": "^26.3.0",
  21 + "eslint": "^7.9.0",
  22 + "jest": "^26.4.2",
  23 + "metro-react-native-babel-preset": "^0.63.0",
  24 + "react-test-renderer": "16.13.1"
  25 + },
  26 + "jest": {
  27 + "preset": "react-native"
  28 + }
  29 +}
此 diff 太大无法显示。