├── .editorconfig ├── .gitattributes ├── .gitignore ├── .npmignore ├── Example ├── LazyloadImageExample.js ├── LazyloadListExample.js ├── LazyloadScrollExample.js ├── MOCK_DATA.json ├── android │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ ├── react.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── reacnativelazyload │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── image.jpg ├── index.android.js ├── index.ios.js ├── ios │ ├── reacNativeLazyload.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcuserdata │ │ │ │ └── osx.xcuserdatad │ │ │ │ └── UserInterfaceState.xcuserstate │ │ ├── xcshareddata │ │ │ └── xcschemes │ │ │ │ └── reacNativeLazyload.xcscheme │ │ └── xcuserdata │ │ │ └── osx.xcuserdatad │ │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ ├── reacNativeLazyload │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ └── reacNativeLazyloadTests │ │ ├── Info.plist │ │ └── reacNativeLazyloadTests.m ├── main.js └── package.json ├── LICENSE ├── index.js ├── lib ├── Anim.js ├── LazyloadChild.js ├── LazyloadImage.js ├── LazyloadListView.js ├── LazyloadManager.js ├── LazyloadScrollView.js └── LazyloadView.js ├── package.json └── readme.md /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | charset = utf-8 9 | end_of_line = lf 10 | indent_style = space 11 | indent_size = 4 12 | trim_trailing_whitespace = true 13 | insert_final_newline = true 14 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .idea 3 | .gradle 4 | build 5 | *.iml 6 | local.properties 7 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | .idea/ 3 | -------------------------------------------------------------------------------- /Example/LazyloadImageExample.js: -------------------------------------------------------------------------------- 1 | import React, { 2 | Component 3 | } from 'react'; 4 | 5 | import { 6 | StyleSheet, 7 | Text, 8 | View, 9 | TouchableHighlight 10 | } from 'react-native'; 11 | 12 | import { 13 | LazyloadScrollView, 14 | LazyloadImage 15 | } from 'react-native-lazyload'; 16 | 17 | let image = require('./image.jpg'); 18 | 19 | class LazyloadImageExample extends Component { 20 | render() { 21 | return ( 22 | 27 | {Array.apply(null, Array(100)).map((file, i) => 30 | 36 | )} 37 | 38 | ); 39 | } 40 | } 41 | 42 | const styles = StyleSheet.create({ 43 | container: { 44 | flex: 1, 45 | backgroundColor: '#F5FCFF' 46 | }, 47 | content: { 48 | paddingTop: 20, 49 | justifyContent: 'center', 50 | alignItems: 'center' 51 | }, 52 | image: { 53 | width: 200, 54 | height: 80, 55 | borderWidth: StyleSheet.hairlineWidth, 56 | borderColor: '#ccc', 57 | marginHorizontal: 5, 58 | marginVertical: 10, 59 | borderRadius: 10, 60 | overflow: 'hidden', 61 | resizeMode: 'cover', 62 | backgroundColor: '#eee' 63 | } 64 | }); 65 | 66 | export default LazyloadImageExample; 67 | -------------------------------------------------------------------------------- /Example/LazyloadListExample.js: -------------------------------------------------------------------------------- 1 | import React, { 2 | Component 3 | } from 'react'; 4 | 5 | import { 6 | AppRegistry, 7 | StyleSheet, 8 | Text, 9 | View, 10 | ListView 11 | } from 'react-native'; 12 | 13 | import { 14 | LazyloadListView, 15 | LazyloadView 16 | } from 'react-native-lazyload'; 17 | 18 | import data from './MOCK_DATA.json'; 19 | class LazyloadListExample extends Component { 20 | constructor() { 21 | super(...arguments); 22 | let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); 23 | this.state = { 24 | dataSource: ds.cloneWithRows(data) 25 | }; 26 | } 27 | 28 | renderRow = (file) => { 29 | return 32 | 36 | 37 | {file.id} 38 | 39 | 40 | {file.first_name} {file.last_name} 41 | email: {file.email} 42 | last visit ip: {file.ip_address} 43 | 44 | 45 | {file.gender} 46 | 47 | 48 | ; 49 | }; 50 | 51 | render() { 52 | return ; 63 | } 64 | } 65 | 66 | const styles = StyleSheet.create({ 67 | container: { 68 | flex: 1, 69 | backgroundColor: '#F5FCFF' 70 | }, 71 | content: { 72 | paddingTop: 20, 73 | justifyContent: 'center', 74 | alignItems: 'center' 75 | }, 76 | view: { 77 | height: 70, 78 | width: 320, 79 | paddingVertical: 5, 80 | borderBottomWidth: StyleSheet.hairlineWidth, 81 | borderBottomColor: '#666' 82 | }, 83 | file: { 84 | width: 320, 85 | flex: 1, 86 | flexDirection: 'row' 87 | }, 88 | id: { 89 | width: 50, 90 | alignItems: 'center', 91 | justifyContent: 'center' 92 | }, 93 | idText: { 94 | fontSize: 10 95 | }, 96 | detail: { 97 | justifyContent: 'space-around', 98 | flex: 1 99 | }, 100 | name: { 101 | textAlign: 'center', 102 | lineHeight: 15, 103 | color: '#666', 104 | marginBottom: 5 105 | }, 106 | email: { 107 | fontSize: 10, 108 | color: 'blue', 109 | textDecorationColor: 'blue', 110 | textDecorationLine: 'underline', 111 | textDecorationStyle: 'solid' 112 | }, 113 | ip: { 114 | fontSize: 12, 115 | color: 'grey' 116 | }, 117 | gender: { 118 | width: 50, 119 | alignItems: 'center', 120 | justifyContent: 'center' 121 | }, 122 | genderText: { 123 | fontSize: 10 124 | }, 125 | title: { 126 | color: '#333', 127 | fontSize: 12 128 | }, 129 | male: { 130 | color: 'skyblue' 131 | }, 132 | female: { 133 | color: 'pink' 134 | } 135 | }); 136 | 137 | export default LazyloadListExample; 138 | -------------------------------------------------------------------------------- /Example/LazyloadScrollExample.js: -------------------------------------------------------------------------------- 1 | import React, { 2 | Component 3 | } from 'react'; 4 | 5 | import { 6 | AppRegistry, 7 | StyleSheet, 8 | Text, 9 | View 10 | } from 'react-native'; 11 | 12 | import { 13 | LazyloadScrollView, 14 | LazyloadView 15 | } from 'react-native-lazyload'; 16 | 17 | import data from './MOCK_DATA.json'; 18 | class LazyloadScrollExample extends Component { 19 | render() { 20 | let start = ~~(Math.random() * 900); 21 | let list = data.splice(start, 100); 22 | return ( 23 | 28 | {list.map((file, i) => 32 | 36 | 37 | {file.id} 38 | 39 | 40 | {file.first_name} {file.last_name} 41 | email: {file.email} 42 | last visit ip: {file.ip_address} 43 | 44 | 45 | {file.gender} 46 | 47 | 48 | )} 49 | 50 | ); 51 | } 52 | } 53 | 54 | const styles = StyleSheet.create({ 55 | container: { 56 | flex: 1, 57 | backgroundColor: '#F5FCFF' 58 | }, 59 | content: { 60 | paddingTop: 20, 61 | justifyContent: 'center', 62 | alignItems: 'center' 63 | }, 64 | view: { 65 | height: 70, 66 | width: 320, 67 | paddingVertical: 5, 68 | borderBottomWidth: StyleSheet.hairlineWidth, 69 | borderBottomColor: '#666' 70 | }, 71 | file: { 72 | width: 320, 73 | flex: 1, 74 | flexDirection: 'row' 75 | }, 76 | id: { 77 | width: 50, 78 | alignItems: 'center', 79 | justifyContent: 'center' 80 | }, 81 | idText: { 82 | fontSize: 10 83 | }, 84 | detail: { 85 | justifyContent: 'space-around', 86 | flex: 1 87 | }, 88 | name: { 89 | textAlign: 'center', 90 | lineHeight: 15, 91 | color: '#666', 92 | marginBottom: 5 93 | }, 94 | email: { 95 | fontSize: 10, 96 | color: 'blue', 97 | textDecorationColor: 'blue', 98 | textDecorationLine: 'underline', 99 | textDecorationStyle: 'solid' 100 | }, 101 | ip: { 102 | fontSize: 12, 103 | color: 'grey' 104 | }, 105 | gender: { 106 | width: 50, 107 | alignItems: 'center', 108 | justifyContent: 'center' 109 | }, 110 | genderText: { 111 | fontSize: 10 112 | }, 113 | title: { 114 | color: '#333', 115 | fontSize: 12 116 | }, 117 | male: { 118 | color: 'skyblue' 119 | }, 120 | female: { 121 | color: 'pink' 122 | } 123 | }); 124 | 125 | export default LazyloadScrollExample; 126 | -------------------------------------------------------------------------------- /Example/android/app/BUCK: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | # To learn about Buck see [Docs](https://buckbuild.com/). 4 | # To run your application with Buck: 5 | # - install Buck 6 | # - `npm start` - to start the packager 7 | # - `cd android` 8 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 9 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 10 | # - `buck install -r android/app` - compile, install and run application 11 | # 12 | 13 | lib_deps = [] 14 | for jarfile in glob(['libs/*.jar']): 15 | name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile) 16 | lib_deps.append(':' + name) 17 | prebuilt_jar( 18 | name = name, 19 | binary_jar = jarfile, 20 | ) 21 | 22 | for aarfile in glob(['libs/*.aar']): 23 | name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile) 24 | lib_deps.append(':' + name) 25 | android_prebuilt_aar( 26 | name = name, 27 | aar = aarfile, 28 | ) 29 | 30 | android_library( 31 | name = 'all-libs', 32 | exported_deps = lib_deps 33 | ) 34 | 35 | android_library( 36 | name = 'app-code', 37 | srcs = glob([ 38 | 'src/main/java/**/*.java', 39 | ]), 40 | deps = [ 41 | ':all-libs', 42 | ':build_config', 43 | ':res', 44 | ], 45 | ) 46 | 47 | android_build_config( 48 | name = 'build_config', 49 | package = 'com.reacnativelazyload', 50 | ) 51 | 52 | android_resource( 53 | name = 'res', 54 | res = 'src/main/res', 55 | package = 'com.reacnativelazyload', 56 | ) 57 | 58 | android_binary( 59 | name = 'app', 60 | package_type = 'debug', 61 | manifest = 'src/main/AndroidManifest.xml', 62 | keystore = '//android/keystores:debug', 63 | deps = [ 64 | ':app-code', 65 | ], 66 | ) 67 | -------------------------------------------------------------------------------- /Example/android/app/build.gradle: -------------------------------------------------------------------------------- 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 | * // the root of your project, i.e. where "package.json" lives 37 | * root: "../../", 38 | * 39 | * // where to put the JS bundle asset in debug mode 40 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 41 | * 42 | * // where to put the JS bundle asset in release mode 43 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 44 | * 45 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 46 | * // require('./image.png')), in debug mode 47 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 48 | * 49 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 50 | * // require('./image.png')), in release mode 51 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 52 | * 53 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 54 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 55 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 56 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 57 | * // for example, you might want to remove it from here. 58 | * inputExcludes: ["android/**", "ios/**"], 59 | * 60 | * // override which node gets called and with what additional arguments 61 | * nodeExecutableAndArgs: ["node"] 62 | * 63 | * // supply additional arguments to the packager 64 | * extraPackagerArgs: [] 65 | * ] 66 | */ 67 | 68 | apply from: "../../node_modules/react-native/react.gradle" 69 | 70 | /** 71 | * Set this to true to create two separate APKs instead of one: 72 | * - An APK that only works on ARM devices 73 | * - An APK that only works on x86 devices 74 | * The advantage is the size of the APK is reduced by about 4MB. 75 | * Upload all the APKs to the Play Store and people will download 76 | * the correct one based on the CPU architecture of their device. 77 | */ 78 | def enableSeparateBuildPerCPUArchitecture = false 79 | 80 | /** 81 | * Run Proguard to shrink the Java bytecode in release builds. 82 | */ 83 | def enableProguardInReleaseBuilds = false 84 | 85 | android { 86 | compileSdkVersion 23 87 | buildToolsVersion "23.0.1" 88 | 89 | defaultConfig { 90 | applicationId "com.reacnativelazyload" 91 | minSdkVersion 16 92 | targetSdkVersion 22 93 | versionCode 1 94 | versionName "1.0" 95 | ndk { 96 | abiFilters "armeabi-v7a", "x86" 97 | } 98 | } 99 | splits { 100 | abi { 101 | reset() 102 | enable enableSeparateBuildPerCPUArchitecture 103 | universalApk false // If true, also generate a universal APK 104 | include "armeabi-v7a", "x86" 105 | } 106 | } 107 | buildTypes { 108 | release { 109 | minifyEnabled enableProguardInReleaseBuilds 110 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 111 | } 112 | } 113 | // applicationVariants are e.g. debug, release 114 | applicationVariants.all { variant -> 115 | variant.outputs.each { output -> 116 | // For each separate APK per architecture, set a unique version code as described here: 117 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits 118 | def versionCodes = ["armeabi-v7a":1, "x86":2] 119 | def abi = output.getFilter(OutputFile.ABI) 120 | if (abi != null) { // null for the universal-debug, universal-release variants 121 | output.versionCodeOverride = 122 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 123 | } 124 | } 125 | } 126 | } 127 | 128 | dependencies { 129 | compile fileTree(dir: "libs", include: ["*.jar"]) 130 | compile "com.android.support:appcompat-v7:23.0.1" 131 | compile "com.facebook.react:react-native:+" // From node_modules 132 | } 133 | 134 | // Run this once to be able to run the application with BUCK 135 | // puts all compile dependencies into folder libs for BUCK to use 136 | task copyDownloadableDepsToLibs(type: Copy) { 137 | from configurations.compile 138 | into 'libs' 139 | } 140 | -------------------------------------------------------------------------------- /Example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 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 ; } 47 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } 48 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } 49 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } 50 | 51 | -dontwarn com.facebook.react.** 52 | 53 | # okhttp 54 | 55 | -keepattributes Signature 56 | -keepattributes *Annotation* 57 | -keep class okhttp3.** { *; } 58 | -keep interface okhttp3.** { *; } 59 | -dontwarn okhttp3.** 60 | 61 | # okio 62 | 63 | -keep class sun.misc.Unsafe { *; } 64 | -dontwarn java.nio.file.* 65 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 66 | -dontwarn okio.** 67 | -------------------------------------------------------------------------------- /Example/android/app/react.gradle: -------------------------------------------------------------------------------- 1 | import org.apache.tools.ant.taskdefs.condition.Os 2 | 3 | def config = project.hasProperty("react") ? project.react : []; 4 | 5 | def bundleAssetName = config.bundleAssetName ?: "index.android.bundle" 6 | def entryFile = config.entryFile ?: "index.android.js" 7 | 8 | // because elvis operator 9 | def elvisFile(thing) { 10 | return thing ? file(thing) : null; 11 | } 12 | 13 | def reactRoot = elvisFile(config.root) ?: file("../../") 14 | def inputExcludes = config.inputExcludes ?: ["android/**", "ios/**"] 15 | 16 | void runBefore(String dependentTaskName, Task task) { 17 | Task dependentTask = tasks.findByPath(dependentTaskName); 18 | if (dependentTask != null) { 19 | dependentTask.dependsOn task 20 | } 21 | } 22 | 23 | gradle.projectsEvaluated { 24 | // Grab all build types and product flavors 25 | def buildTypes = android.buildTypes.collect { type -> type.name } 26 | def productFlavors = android.productFlavors.collect { flavor -> flavor.name } 27 | 28 | // When no product flavors defined, use empty 29 | if (!productFlavors) productFlavors.add('') 30 | 31 | productFlavors.each { productFlavorName -> 32 | buildTypes.each { buildTypeName -> 33 | // Create variant and source names 34 | def sourceName = "${buildTypeName}" 35 | def targetName = "${sourceName.capitalize()}" 36 | if (productFlavorName) { 37 | sourceName = "${productFlavorName}${targetName}" 38 | } 39 | 40 | // React js bundle directories 41 | def jsBundleDirConfigName = "jsBundleDir${targetName}" 42 | def jsBundleDir = elvisFile(config."$jsBundleDirConfigName") ?: 43 | file("$buildDir/intermediates/assets/${sourceName}") 44 | 45 | def resourcesDirConfigName = "jsBundleDir${targetName}" 46 | def resourcesDir = elvisFile(config."${resourcesDirConfigName}") ?: 47 | file("$buildDir/intermediates/res/merged/${sourceName}") 48 | def jsBundleFile = file("$jsBundleDir/$bundleAssetName") 49 | 50 | // Bundle task name for variant 51 | def bundleJsAndAssetsTaskName = "bundle${targetName}JsAndAssets" 52 | 53 | def currentBundleTask = tasks.create( 54 | name: bundleJsAndAssetsTaskName, 55 | type: Exec) { 56 | group = "react" 57 | description = "bundle JS and assets for ${targetName}." 58 | 59 | // Create dirs if they are not there (e.g. the "clean" task just ran) 60 | doFirst { 61 | jsBundleDir.mkdirs() 62 | resourcesDir.mkdirs() 63 | } 64 | 65 | // Set up inputs and outputs so gradle can cache the result 66 | inputs.files fileTree(dir: reactRoot, excludes: inputExcludes) 67 | outputs.dir jsBundleDir 68 | outputs.dir resourcesDir 69 | 70 | // Set up the call to the react-native cli 71 | workingDir reactRoot 72 | 73 | // Set up dev mode 74 | def devEnabled = !targetName.toLowerCase().contains("release") 75 | if (Os.isFamily(Os.FAMILY_WINDOWS)) { 76 | commandLine "cmd", "/c", "react-native", "bundle", "--platform", "android", "--dev", "${devEnabled}", 77 | "--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir 78 | } else { 79 | commandLine "react-native", "bundle", "--platform", "android", "--dev", "${devEnabled}", 80 | "--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir 81 | } 82 | 83 | enabled config."bundleIn${targetName}" ?: targetName.toLowerCase().contains("release") 84 | } 85 | 86 | // Hook bundle${productFlavor}${buildType}JsAndAssets into the android build process 87 | currentBundleTask.dependsOn("merge${targetName}Resources") 88 | currentBundleTask.dependsOn("merge${targetName}Assets") 89 | 90 | runBefore("processArmeabi-v7a${targetName}Resources", currentBundleTask) 91 | runBefore("processX86${targetName}Resources", currentBundleTask) 92 | runBefore("processUniversal${targetName}Resources", currentBundleTask) 93 | runBefore("process${targetName}Resources", currentBundleTask) 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /Example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 12 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/android/app/src/main/java/com/reacnativelazyload/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.reacnativelazyload; 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 "reacNativeLazyload"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Example/android/app/src/main/java/com/reacnativelazyload/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.reacnativelazyload; 2 | 3 | import android.app.Application; 4 | import android.util.Log; 5 | 6 | import com.facebook.react.ReactApplication; 7 | import com.facebook.react.ReactInstanceManager; 8 | import com.facebook.react.ReactNativeHost; 9 | import com.facebook.react.ReactPackage; 10 | import com.facebook.react.shell.MainReactPackage; 11 | 12 | import java.util.Arrays; 13 | import java.util.List; 14 | 15 | public class MainApplication extends Application implements ReactApplication { 16 | 17 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 18 | @Override 19 | protected boolean getUseDeveloperSupport() { 20 | return BuildConfig.DEBUG; 21 | } 22 | 23 | @Override 24 | protected List getPackages() { 25 | return Arrays.asList( 26 | new MainReactPackage() 27 | ); 28 | } 29 | }; 30 | 31 | @Override 32 | public ReactNativeHost getReactNativeHost() { 33 | return mReactNativeHost; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magicismight/react-native-lazyload/650dc182fdae313fdd95a541c142e9694bdae683/Example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magicismight/react-native-lazyload/650dc182fdae313fdd95a541c142e9694bdae683/Example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magicismight/react-native-lazyload/650dc182fdae313fdd95a541c142e9694bdae683/Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magicismight/react-native-lazyload/650dc182fdae313fdd95a541c142e9694bdae683/Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | reacNativeLazyload 3 | 4 | -------------------------------------------------------------------------------- /Example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/android/build.gradle: -------------------------------------------------------------------------------- 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 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.3.1' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | mavenLocal() 18 | jcenter() 19 | maven { 20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 21 | url "$rootDir/../node_modules/react-native/android" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Example/android/gradle.properties: -------------------------------------------------------------------------------- 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 21 | -------------------------------------------------------------------------------- /Example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magicismight/react-native-lazyload/650dc182fdae313fdd95a541c142e9694bdae683/Example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Oct 21 11:34:03 PDT 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip 7 | -------------------------------------------------------------------------------- /Example/android/gradlew: -------------------------------------------------------------------------------- 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 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /Example/android/gradlew.bat: -------------------------------------------------------------------------------- 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 91 | -------------------------------------------------------------------------------- /Example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'reacNativeLazyload' 2 | 3 | include ':app' 4 | -------------------------------------------------------------------------------- /Example/image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magicismight/react-native-lazyload/650dc182fdae313fdd95a541c142e9694bdae683/Example/image.jpg -------------------------------------------------------------------------------- /Example/index.android.js: -------------------------------------------------------------------------------- 1 | import './main.js'; 2 | -------------------------------------------------------------------------------- /Example/index.ios.js: -------------------------------------------------------------------------------- 1 | import './main.js'; 2 | -------------------------------------------------------------------------------- /Example/ios/reacNativeLazyload.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; 11 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; 12 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; }; 13 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; }; 14 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; }; 15 | 00E356F31AD99517003FC87E /* reacNativeLazyloadTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* reacNativeLazyloadTests.m */; }; 16 | 10AF6A651D703E4100A9EBE2 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 10AF6A5B1D703E2E00A9EBE2 /* libRCTAnimation.a */; }; 17 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; }; 18 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; }; 19 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; }; 20 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 21 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; 22 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 23 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 24 | 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 25 | 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 26 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; 27 | /* End PBXBuildFile section */ 28 | 29 | /* Begin PBXContainerItemProxy section */ 30 | 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; 33 | proxyType = 2; 34 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 35 | remoteInfo = RCTActionSheet; 36 | }; 37 | 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = { 38 | isa = PBXContainerItemProxy; 39 | containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; 40 | proxyType = 2; 41 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 42 | remoteInfo = RCTGeolocation; 43 | }; 44 | 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = { 45 | isa = PBXContainerItemProxy; 46 | containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 47 | proxyType = 2; 48 | remoteGlobalIDString = 58B5115D1A9E6B3D00147676; 49 | remoteInfo = RCTImage; 50 | }; 51 | 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = { 52 | isa = PBXContainerItemProxy; 53 | containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 54 | proxyType = 2; 55 | remoteGlobalIDString = 58B511DB1A9E6C8500147676; 56 | remoteInfo = RCTNetwork; 57 | }; 58 | 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = { 59 | isa = PBXContainerItemProxy; 60 | containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; 61 | proxyType = 2; 62 | remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; 63 | remoteInfo = RCTVibration; 64 | }; 65 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { 66 | isa = PBXContainerItemProxy; 67 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 68 | proxyType = 1; 69 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A; 70 | remoteInfo = reacNativeLazyload; 71 | }; 72 | 10AF6A5A1D703E2E00A9EBE2 /* PBXContainerItemProxy */ = { 73 | isa = PBXContainerItemProxy; 74 | containerPortal = 10AF6A551D703E2E00A9EBE2 /* RCTAnimation.xcodeproj */; 75 | proxyType = 2; 76 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 77 | remoteInfo = RCTAnimation; 78 | }; 79 | 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = { 80 | isa = PBXContainerItemProxy; 81 | containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 82 | proxyType = 2; 83 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 84 | remoteInfo = RCTSettings; 85 | }; 86 | 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = { 87 | isa = PBXContainerItemProxy; 88 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 89 | proxyType = 2; 90 | remoteGlobalIDString = 3C86DF461ADF2C930047B81A; 91 | remoteInfo = RCTWebSocket; 92 | }; 93 | 146834031AC3E56700842450 /* PBXContainerItemProxy */ = { 94 | isa = PBXContainerItemProxy; 95 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 96 | proxyType = 2; 97 | remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; 98 | remoteInfo = React; 99 | }; 100 | 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { 101 | isa = PBXContainerItemProxy; 102 | containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 103 | proxyType = 2; 104 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 105 | remoteInfo = RCTLinking; 106 | }; 107 | 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = { 108 | isa = PBXContainerItemProxy; 109 | containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 110 | proxyType = 2; 111 | remoteGlobalIDString = 58B5119B1A9E6C1200147676; 112 | remoteInfo = RCTText; 113 | }; 114 | /* End PBXContainerItemProxy section */ 115 | 116 | /* Begin PBXFileReference section */ 117 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; 118 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; }; 119 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; }; 120 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; }; 121 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; }; 122 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; }; 123 | 00E356EE1AD99517003FC87E /* reacNativeLazyloadTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = reacNativeLazyloadTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 124 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 125 | 00E356F21AD99517003FC87E /* reacNativeLazyloadTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = reacNativeLazyloadTests.m; sourceTree = ""; }; 126 | 10AF6A551D703E2E00A9EBE2 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = ""; }; 127 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; }; 128 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; }; 129 | 13B07F961A680F5B00A75B9A /* reacNativeLazyload.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = reacNativeLazyload.app; sourceTree = BUILT_PRODUCTS_DIR; }; 130 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = reacNativeLazyload/AppDelegate.h; sourceTree = ""; }; 131 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = reacNativeLazyload/AppDelegate.m; sourceTree = ""; }; 132 | 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 133 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = reacNativeLazyload/Images.xcassets; sourceTree = ""; }; 134 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = reacNativeLazyload/Info.plist; sourceTree = ""; }; 135 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = reacNativeLazyload/main.m; sourceTree = ""; }; 136 | 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; 137 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; 138 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; 139 | /* End PBXFileReference section */ 140 | 141 | /* Begin PBXFrameworksBuildPhase section */ 142 | 00E356EB1AD99517003FC87E /* Frameworks */ = { 143 | isa = PBXFrameworksBuildPhase; 144 | buildActionMask = 2147483647; 145 | files = ( 146 | 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */, 147 | ); 148 | runOnlyForDeploymentPostprocessing = 0; 149 | }; 150 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 151 | isa = PBXFrameworksBuildPhase; 152 | buildActionMask = 2147483647; 153 | files = ( 154 | 10AF6A651D703E4100A9EBE2 /* libRCTAnimation.a in Frameworks */, 155 | 146834051AC3E58100842450 /* libReact.a in Frameworks */, 156 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, 157 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, 158 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, 159 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, 160 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */, 161 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, 162 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, 163 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 164 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, 165 | ); 166 | runOnlyForDeploymentPostprocessing = 0; 167 | }; 168 | /* End PBXFrameworksBuildPhase section */ 169 | 170 | /* Begin PBXGroup section */ 171 | 00C302A81ABCB8CE00DB3ED1 /* Products */ = { 172 | isa = PBXGroup; 173 | children = ( 174 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */, 175 | ); 176 | name = Products; 177 | sourceTree = ""; 178 | }; 179 | 00C302B61ABCB90400DB3ED1 /* Products */ = { 180 | isa = PBXGroup; 181 | children = ( 182 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */, 183 | ); 184 | name = Products; 185 | sourceTree = ""; 186 | }; 187 | 00C302BC1ABCB91800DB3ED1 /* Products */ = { 188 | isa = PBXGroup; 189 | children = ( 190 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, 191 | ); 192 | name = Products; 193 | sourceTree = ""; 194 | }; 195 | 00C302D41ABCB9D200DB3ED1 /* Products */ = { 196 | isa = PBXGroup; 197 | children = ( 198 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, 199 | ); 200 | name = Products; 201 | sourceTree = ""; 202 | }; 203 | 00C302E01ABCB9EE00DB3ED1 /* Products */ = { 204 | isa = PBXGroup; 205 | children = ( 206 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */, 207 | ); 208 | name = Products; 209 | sourceTree = ""; 210 | }; 211 | 00E356EF1AD99517003FC87E /* reacNativeLazyloadTests */ = { 212 | isa = PBXGroup; 213 | children = ( 214 | 00E356F21AD99517003FC87E /* reacNativeLazyloadTests.m */, 215 | 00E356F01AD99517003FC87E /* Supporting Files */, 216 | ); 217 | path = reacNativeLazyloadTests; 218 | sourceTree = ""; 219 | }; 220 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 221 | isa = PBXGroup; 222 | children = ( 223 | 00E356F11AD99517003FC87E /* Info.plist */, 224 | ); 225 | name = "Supporting Files"; 226 | sourceTree = ""; 227 | }; 228 | 10AF6A561D703E2E00A9EBE2 /* Products */ = { 229 | isa = PBXGroup; 230 | children = ( 231 | 10AF6A5B1D703E2E00A9EBE2 /* libRCTAnimation.a */, 232 | ); 233 | name = Products; 234 | sourceTree = ""; 235 | }; 236 | 139105B71AF99BAD00B5F7CC /* Products */ = { 237 | isa = PBXGroup; 238 | children = ( 239 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, 240 | ); 241 | name = Products; 242 | sourceTree = ""; 243 | }; 244 | 139FDEE71B06529A00C62182 /* Products */ = { 245 | isa = PBXGroup; 246 | children = ( 247 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, 248 | ); 249 | name = Products; 250 | sourceTree = ""; 251 | }; 252 | 13B07FAE1A68108700A75B9A /* reacNativeLazyload */ = { 253 | isa = PBXGroup; 254 | children = ( 255 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 256 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 257 | 13B07FB01A68108700A75B9A /* AppDelegate.m */, 258 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 259 | 13B07FB61A68108700A75B9A /* Info.plist */, 260 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, 261 | 13B07FB71A68108700A75B9A /* main.m */, 262 | ); 263 | name = reacNativeLazyload; 264 | sourceTree = ""; 265 | }; 266 | 146834001AC3E56700842450 /* Products */ = { 267 | isa = PBXGroup; 268 | children = ( 269 | 146834041AC3E56700842450 /* libReact.a */, 270 | ); 271 | name = Products; 272 | sourceTree = ""; 273 | }; 274 | 78C398B11ACF4ADC00677621 /* Products */ = { 275 | isa = PBXGroup; 276 | children = ( 277 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, 278 | ); 279 | name = Products; 280 | sourceTree = ""; 281 | }; 282 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 283 | isa = PBXGroup; 284 | children = ( 285 | 10AF6A551D703E2E00A9EBE2 /* RCTAnimation.xcodeproj */, 286 | 146833FF1AC3E56700842450 /* React.xcodeproj */, 287 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, 288 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, 289 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, 290 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */, 291 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */, 292 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */, 293 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, 294 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 295 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, 296 | ); 297 | name = Libraries; 298 | sourceTree = ""; 299 | }; 300 | 832341B11AAA6A8300B99B32 /* Products */ = { 301 | isa = PBXGroup; 302 | children = ( 303 | 832341B51AAA6A8300B99B32 /* libRCTText.a */, 304 | ); 305 | name = Products; 306 | sourceTree = ""; 307 | }; 308 | 83CBB9F61A601CBA00E9B192 = { 309 | isa = PBXGroup; 310 | children = ( 311 | 13B07FAE1A68108700A75B9A /* reacNativeLazyload */, 312 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 313 | 00E356EF1AD99517003FC87E /* reacNativeLazyloadTests */, 314 | 83CBBA001A601CBA00E9B192 /* Products */, 315 | ); 316 | indentWidth = 2; 317 | sourceTree = ""; 318 | tabWidth = 2; 319 | }; 320 | 83CBBA001A601CBA00E9B192 /* Products */ = { 321 | isa = PBXGroup; 322 | children = ( 323 | 13B07F961A680F5B00A75B9A /* reacNativeLazyload.app */, 324 | 00E356EE1AD99517003FC87E /* reacNativeLazyloadTests.xctest */, 325 | ); 326 | name = Products; 327 | sourceTree = ""; 328 | }; 329 | /* End PBXGroup section */ 330 | 331 | /* Begin PBXNativeTarget section */ 332 | 00E356ED1AD99517003FC87E /* reacNativeLazyloadTests */ = { 333 | isa = PBXNativeTarget; 334 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "reacNativeLazyloadTests" */; 335 | buildPhases = ( 336 | 00E356EA1AD99517003FC87E /* Sources */, 337 | 00E356EB1AD99517003FC87E /* Frameworks */, 338 | 00E356EC1AD99517003FC87E /* Resources */, 339 | ); 340 | buildRules = ( 341 | ); 342 | dependencies = ( 343 | 00E356F51AD99517003FC87E /* PBXTargetDependency */, 344 | ); 345 | name = reacNativeLazyloadTests; 346 | productName = reacNativeLazyloadTests; 347 | productReference = 00E356EE1AD99517003FC87E /* reacNativeLazyloadTests.xctest */; 348 | productType = "com.apple.product-type.bundle.unit-test"; 349 | }; 350 | 13B07F861A680F5B00A75B9A /* reacNativeLazyload */ = { 351 | isa = PBXNativeTarget; 352 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "reacNativeLazyload" */; 353 | buildPhases = ( 354 | 13B07F871A680F5B00A75B9A /* Sources */, 355 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 356 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 357 | 13B07F8E1A680F5B00A75B9A /* Resources */, 358 | ); 359 | buildRules = ( 360 | ); 361 | dependencies = ( 362 | ); 363 | name = reacNativeLazyload; 364 | productName = "Hello World"; 365 | productReference = 13B07F961A680F5B00A75B9A /* reacNativeLazyload.app */; 366 | productType = "com.apple.product-type.application"; 367 | }; 368 | /* End PBXNativeTarget section */ 369 | 370 | /* Begin PBXProject section */ 371 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 372 | isa = PBXProject; 373 | attributes = { 374 | LastUpgradeCheck = 0610; 375 | ORGANIZATIONNAME = Facebook; 376 | TargetAttributes = { 377 | 00E356ED1AD99517003FC87E = { 378 | CreatedOnToolsVersion = 6.2; 379 | TestTargetID = 13B07F861A680F5B00A75B9A; 380 | }; 381 | }; 382 | }; 383 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "reacNativeLazyload" */; 384 | compatibilityVersion = "Xcode 3.2"; 385 | developmentRegion = English; 386 | hasScannedForEncodings = 0; 387 | knownRegions = ( 388 | en, 389 | Base, 390 | ); 391 | mainGroup = 83CBB9F61A601CBA00E9B192; 392 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 393 | projectDirPath = ""; 394 | projectReferences = ( 395 | { 396 | ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; 397 | ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; 398 | }, 399 | { 400 | ProductGroup = 10AF6A561D703E2E00A9EBE2 /* Products */; 401 | ProjectRef = 10AF6A551D703E2E00A9EBE2 /* RCTAnimation.xcodeproj */; 402 | }, 403 | { 404 | ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; 405 | ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; 406 | }, 407 | { 408 | ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */; 409 | ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 410 | }, 411 | { 412 | ProductGroup = 78C398B11ACF4ADC00677621 /* Products */; 413 | ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 414 | }, 415 | { 416 | ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */; 417 | ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 418 | }, 419 | { 420 | ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */; 421 | ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 422 | }, 423 | { 424 | ProductGroup = 832341B11AAA6A8300B99B32 /* Products */; 425 | ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 426 | }, 427 | { 428 | ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */; 429 | ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; 430 | }, 431 | { 432 | ProductGroup = 139FDEE71B06529A00C62182 /* Products */; 433 | ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 434 | }, 435 | { 436 | ProductGroup = 146834001AC3E56700842450 /* Products */; 437 | ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; 438 | }, 439 | ); 440 | projectRoot = ""; 441 | targets = ( 442 | 13B07F861A680F5B00A75B9A /* reacNativeLazyload */, 443 | 00E356ED1AD99517003FC87E /* reacNativeLazyloadTests */, 444 | ); 445 | }; 446 | /* End PBXProject section */ 447 | 448 | /* Begin PBXReferenceProxy section */ 449 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = { 450 | isa = PBXReferenceProxy; 451 | fileType = archive.ar; 452 | path = libRCTActionSheet.a; 453 | remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */; 454 | sourceTree = BUILT_PRODUCTS_DIR; 455 | }; 456 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = { 457 | isa = PBXReferenceProxy; 458 | fileType = archive.ar; 459 | path = libRCTGeolocation.a; 460 | remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */; 461 | sourceTree = BUILT_PRODUCTS_DIR; 462 | }; 463 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = { 464 | isa = PBXReferenceProxy; 465 | fileType = archive.ar; 466 | path = libRCTImage.a; 467 | remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */; 468 | sourceTree = BUILT_PRODUCTS_DIR; 469 | }; 470 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = { 471 | isa = PBXReferenceProxy; 472 | fileType = archive.ar; 473 | path = libRCTNetwork.a; 474 | remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */; 475 | sourceTree = BUILT_PRODUCTS_DIR; 476 | }; 477 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = { 478 | isa = PBXReferenceProxy; 479 | fileType = archive.ar; 480 | path = libRCTVibration.a; 481 | remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; 482 | sourceTree = BUILT_PRODUCTS_DIR; 483 | }; 484 | 10AF6A5B1D703E2E00A9EBE2 /* libRCTAnimation.a */ = { 485 | isa = PBXReferenceProxy; 486 | fileType = archive.ar; 487 | path = libRCTAnimation.a; 488 | remoteRef = 10AF6A5A1D703E2E00A9EBE2 /* PBXContainerItemProxy */; 489 | sourceTree = BUILT_PRODUCTS_DIR; 490 | }; 491 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = { 492 | isa = PBXReferenceProxy; 493 | fileType = archive.ar; 494 | path = libRCTSettings.a; 495 | remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */; 496 | sourceTree = BUILT_PRODUCTS_DIR; 497 | }; 498 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = { 499 | isa = PBXReferenceProxy; 500 | fileType = archive.ar; 501 | path = libRCTWebSocket.a; 502 | remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */; 503 | sourceTree = BUILT_PRODUCTS_DIR; 504 | }; 505 | 146834041AC3E56700842450 /* libReact.a */ = { 506 | isa = PBXReferenceProxy; 507 | fileType = archive.ar; 508 | path = libReact.a; 509 | remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; 510 | sourceTree = BUILT_PRODUCTS_DIR; 511 | }; 512 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { 513 | isa = PBXReferenceProxy; 514 | fileType = archive.ar; 515 | path = libRCTLinking.a; 516 | remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */; 517 | sourceTree = BUILT_PRODUCTS_DIR; 518 | }; 519 | 832341B51AAA6A8300B99B32 /* libRCTText.a */ = { 520 | isa = PBXReferenceProxy; 521 | fileType = archive.ar; 522 | path = libRCTText.a; 523 | remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; 524 | sourceTree = BUILT_PRODUCTS_DIR; 525 | }; 526 | /* End PBXReferenceProxy section */ 527 | 528 | /* Begin PBXResourcesBuildPhase section */ 529 | 00E356EC1AD99517003FC87E /* Resources */ = { 530 | isa = PBXResourcesBuildPhase; 531 | buildActionMask = 2147483647; 532 | files = ( 533 | ); 534 | runOnlyForDeploymentPostprocessing = 0; 535 | }; 536 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 537 | isa = PBXResourcesBuildPhase; 538 | buildActionMask = 2147483647; 539 | files = ( 540 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 541 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, 542 | ); 543 | runOnlyForDeploymentPostprocessing = 0; 544 | }; 545 | /* End PBXResourcesBuildPhase section */ 546 | 547 | /* Begin PBXShellScriptBuildPhase section */ 548 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 549 | isa = PBXShellScriptBuildPhase; 550 | buildActionMask = 2147483647; 551 | files = ( 552 | ); 553 | inputPaths = ( 554 | ); 555 | name = "Bundle React Native code and images"; 556 | outputPaths = ( 557 | ); 558 | runOnlyForDeploymentPostprocessing = 0; 559 | shellPath = /bin/sh; 560 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh"; 561 | }; 562 | /* End PBXShellScriptBuildPhase section */ 563 | 564 | /* Begin PBXSourcesBuildPhase section */ 565 | 00E356EA1AD99517003FC87E /* Sources */ = { 566 | isa = PBXSourcesBuildPhase; 567 | buildActionMask = 2147483647; 568 | files = ( 569 | 00E356F31AD99517003FC87E /* reacNativeLazyloadTests.m in Sources */, 570 | ); 571 | runOnlyForDeploymentPostprocessing = 0; 572 | }; 573 | 13B07F871A680F5B00A75B9A /* Sources */ = { 574 | isa = PBXSourcesBuildPhase; 575 | buildActionMask = 2147483647; 576 | files = ( 577 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 578 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 579 | ); 580 | runOnlyForDeploymentPostprocessing = 0; 581 | }; 582 | /* End PBXSourcesBuildPhase section */ 583 | 584 | /* Begin PBXTargetDependency section */ 585 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { 586 | isa = PBXTargetDependency; 587 | target = 13B07F861A680F5B00A75B9A /* reacNativeLazyload */; 588 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; 589 | }; 590 | /* End PBXTargetDependency section */ 591 | 592 | /* Begin PBXVariantGroup section */ 593 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { 594 | isa = PBXVariantGroup; 595 | children = ( 596 | 13B07FB21A68108700A75B9A /* Base */, 597 | ); 598 | name = LaunchScreen.xib; 599 | path = reacNativeLazyload; 600 | sourceTree = ""; 601 | }; 602 | /* End PBXVariantGroup section */ 603 | 604 | /* Begin XCBuildConfiguration section */ 605 | 00E356F61AD99517003FC87E /* Debug */ = { 606 | isa = XCBuildConfiguration; 607 | buildSettings = { 608 | BUNDLE_LOADER = "$(TEST_HOST)"; 609 | GCC_PREPROCESSOR_DEFINITIONS = ( 610 | "DEBUG=1", 611 | "$(inherited)", 612 | ); 613 | INFOPLIST_FILE = reacNativeLazyloadTests/Info.plist; 614 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 615 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 616 | PRODUCT_NAME = "$(TARGET_NAME)"; 617 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/reacNativeLazyload.app/reacNativeLazyload"; 618 | }; 619 | name = Debug; 620 | }; 621 | 00E356F71AD99517003FC87E /* Release */ = { 622 | isa = XCBuildConfiguration; 623 | buildSettings = { 624 | BUNDLE_LOADER = "$(TEST_HOST)"; 625 | COPY_PHASE_STRIP = NO; 626 | INFOPLIST_FILE = reacNativeLazyloadTests/Info.plist; 627 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 628 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 629 | PRODUCT_NAME = "$(TARGET_NAME)"; 630 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/reacNativeLazyload.app/reacNativeLazyload"; 631 | }; 632 | name = Release; 633 | }; 634 | 13B07F941A680F5B00A75B9A /* Debug */ = { 635 | isa = XCBuildConfiguration; 636 | buildSettings = { 637 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 638 | DEAD_CODE_STRIPPING = NO; 639 | HEADER_SEARCH_PATHS = ( 640 | "$(inherited)", 641 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 642 | "$(SRCROOT)/../node_modules/react-native/React/**", 643 | ); 644 | INFOPLIST_FILE = reacNativeLazyload/Info.plist; 645 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 646 | OTHER_LDFLAGS = ( 647 | "$(inherited)", 648 | "-ObjC", 649 | "-lc++", 650 | ); 651 | PRODUCT_NAME = reacNativeLazyload; 652 | }; 653 | name = Debug; 654 | }; 655 | 13B07F951A680F5B00A75B9A /* Release */ = { 656 | isa = XCBuildConfiguration; 657 | buildSettings = { 658 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 659 | HEADER_SEARCH_PATHS = ( 660 | "$(inherited)", 661 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 662 | "$(SRCROOT)/../node_modules/react-native/React/**", 663 | ); 664 | INFOPLIST_FILE = reacNativeLazyload/Info.plist; 665 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 666 | OTHER_LDFLAGS = ( 667 | "$(inherited)", 668 | "-ObjC", 669 | "-lc++", 670 | ); 671 | PRODUCT_NAME = reacNativeLazyload; 672 | }; 673 | name = Release; 674 | }; 675 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 676 | isa = XCBuildConfiguration; 677 | buildSettings = { 678 | ALWAYS_SEARCH_USER_PATHS = NO; 679 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 680 | CLANG_CXX_LIBRARY = "libc++"; 681 | CLANG_ENABLE_MODULES = YES; 682 | CLANG_ENABLE_OBJC_ARC = YES; 683 | CLANG_WARN_BOOL_CONVERSION = YES; 684 | CLANG_WARN_CONSTANT_CONVERSION = YES; 685 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 686 | CLANG_WARN_EMPTY_BODY = YES; 687 | CLANG_WARN_ENUM_CONVERSION = YES; 688 | CLANG_WARN_INT_CONVERSION = YES; 689 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 690 | CLANG_WARN_UNREACHABLE_CODE = YES; 691 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 692 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 693 | COPY_PHASE_STRIP = NO; 694 | ENABLE_STRICT_OBJC_MSGSEND = YES; 695 | GCC_C_LANGUAGE_STANDARD = gnu99; 696 | GCC_DYNAMIC_NO_PIC = NO; 697 | GCC_OPTIMIZATION_LEVEL = 0; 698 | GCC_PREPROCESSOR_DEFINITIONS = ( 699 | "DEBUG=1", 700 | "$(inherited)", 701 | ); 702 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 703 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 704 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 705 | GCC_WARN_UNDECLARED_SELECTOR = YES; 706 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 707 | GCC_WARN_UNUSED_FUNCTION = YES; 708 | GCC_WARN_UNUSED_VARIABLE = YES; 709 | HEADER_SEARCH_PATHS = ( 710 | "$(inherited)", 711 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 712 | "$(SRCROOT)/../node_modules/react-native/React/**", 713 | ); 714 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 715 | MTL_ENABLE_DEBUG_INFO = YES; 716 | ONLY_ACTIVE_ARCH = YES; 717 | SDKROOT = iphoneos; 718 | }; 719 | name = Debug; 720 | }; 721 | 83CBBA211A601CBA00E9B192 /* Release */ = { 722 | isa = XCBuildConfiguration; 723 | buildSettings = { 724 | ALWAYS_SEARCH_USER_PATHS = NO; 725 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 726 | CLANG_CXX_LIBRARY = "libc++"; 727 | CLANG_ENABLE_MODULES = YES; 728 | CLANG_ENABLE_OBJC_ARC = YES; 729 | CLANG_WARN_BOOL_CONVERSION = YES; 730 | CLANG_WARN_CONSTANT_CONVERSION = YES; 731 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 732 | CLANG_WARN_EMPTY_BODY = YES; 733 | CLANG_WARN_ENUM_CONVERSION = YES; 734 | CLANG_WARN_INT_CONVERSION = YES; 735 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 736 | CLANG_WARN_UNREACHABLE_CODE = YES; 737 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 738 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 739 | COPY_PHASE_STRIP = YES; 740 | ENABLE_NS_ASSERTIONS = NO; 741 | ENABLE_STRICT_OBJC_MSGSEND = YES; 742 | GCC_C_LANGUAGE_STANDARD = gnu99; 743 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 744 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 745 | GCC_WARN_UNDECLARED_SELECTOR = YES; 746 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 747 | GCC_WARN_UNUSED_FUNCTION = YES; 748 | GCC_WARN_UNUSED_VARIABLE = YES; 749 | HEADER_SEARCH_PATHS = ( 750 | "$(inherited)", 751 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 752 | "$(SRCROOT)/../node_modules/react-native/React/**", 753 | ); 754 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 755 | MTL_ENABLE_DEBUG_INFO = NO; 756 | SDKROOT = iphoneos; 757 | VALIDATE_PRODUCT = YES; 758 | }; 759 | name = Release; 760 | }; 761 | /* End XCBuildConfiguration section */ 762 | 763 | /* Begin XCConfigurationList section */ 764 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "reacNativeLazyloadTests" */ = { 765 | isa = XCConfigurationList; 766 | buildConfigurations = ( 767 | 00E356F61AD99517003FC87E /* Debug */, 768 | 00E356F71AD99517003FC87E /* Release */, 769 | ); 770 | defaultConfigurationIsVisible = 0; 771 | defaultConfigurationName = Release; 772 | }; 773 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "reacNativeLazyload" */ = { 774 | isa = XCConfigurationList; 775 | buildConfigurations = ( 776 | 13B07F941A680F5B00A75B9A /* Debug */, 777 | 13B07F951A680F5B00A75B9A /* Release */, 778 | ); 779 | defaultConfigurationIsVisible = 0; 780 | defaultConfigurationName = Release; 781 | }; 782 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "reacNativeLazyload" */ = { 783 | isa = XCConfigurationList; 784 | buildConfigurations = ( 785 | 83CBBA201A601CBA00E9B192 /* Debug */, 786 | 83CBBA211A601CBA00E9B192 /* Release */, 787 | ); 788 | defaultConfigurationIsVisible = 0; 789 | defaultConfigurationName = Release; 790 | }; 791 | /* End XCConfigurationList section */ 792 | }; 793 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 794 | } 795 | -------------------------------------------------------------------------------- /Example/ios/reacNativeLazyload.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/ios/reacNativeLazyload.xcodeproj/project.xcworkspace/xcuserdata/osx.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magicismight/react-native-lazyload/650dc182fdae313fdd95a541c142e9694bdae683/Example/ios/reacNativeLazyload.xcodeproj/project.xcworkspace/xcuserdata/osx.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Example/ios/reacNativeLazyload.xcodeproj/xcshareddata/xcschemes/reacNativeLazyload.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /Example/ios/reacNativeLazyload.xcodeproj/xcuserdata/osx.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | reacNativeLazyload.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 00E356ED1AD99517003FC87E 16 | 17 | primary 18 | 19 | 20 | 13B07F861A680F5B00A75B9A 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/ios/reacNativeLazyload/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Example/ios/reacNativeLazyload/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import "RCTBundleURLProvider.h" 13 | #import "RCTRootView.h" 14 | 15 | @implementation AppDelegate 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 18 | { 19 | NSURL *jsCodeLocation; 20 | 21 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; 22 | 23 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 24 | moduleName:@"reacNativeLazyload" 25 | initialProperties:nil 26 | launchOptions:launchOptions]; 27 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 28 | 29 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 30 | UIViewController *rootViewController = [UIViewController new]; 31 | rootViewController.view = rootView; 32 | self.window.rootViewController = rootViewController; 33 | [self.window makeKeyAndVisible]; 34 | return YES; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Example/ios/reacNativeLazyload/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Example/ios/reacNativeLazyload/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Example/ios/reacNativeLazyload/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSTemporaryExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Example/ios/reacNativeLazyload/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Example/ios/reacNativeLazyloadTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/ios/reacNativeLazyloadTests/reacNativeLazyloadTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #import "RCTLog.h" 14 | #import "RCTRootView.h" 15 | 16 | #define TIMEOUT_SECONDS 600 17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 18 | 19 | @interface reacNativeLazyloadTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation reacNativeLazyloadTests 24 | 25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 26 | { 27 | if (test(view)) { 28 | return YES; 29 | } 30 | for (UIView *subview in [view subviews]) { 31 | if ([self findSubviewInView:subview matching:test]) { 32 | return YES; 33 | } 34 | } 35 | return NO; 36 | } 37 | 38 | - (void)testRendersWelcomeScreen 39 | { 40 | UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; 41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 42 | BOOL foundElement = NO; 43 | 44 | __block NSString *redboxError = nil; 45 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 46 | if (level >= RCTLogLevelError) { 47 | redboxError = message; 48 | } 49 | }); 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | RCTSetLogFunction(RCTDefaultLogFunction); 64 | 65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /Example/main.js: -------------------------------------------------------------------------------- 1 | import React, { 2 | Component, 3 | } from 'react'; 4 | 5 | import { 6 | AppRegistry, 7 | StyleSheet, 8 | Text, 9 | View, 10 | TouchableHighlight, 11 | TouchableOpacity, 12 | Animated, 13 | Easing 14 | } from 'react-native'; 15 | 16 | import Modal from 'react-native-root-modal'; 17 | const hairline = StyleSheet.hairlineWidth; 18 | 19 | import LazyloadScrollExample from './LazyloadScrollExample'; 20 | import LazyloadListExample from './LazyloadListExample'; 21 | import LazyloadImageExample from './LazyloadImageExample'; 22 | 23 | class Example extends React.Component { 24 | constructor() { 25 | super(...arguments); 26 | this.state = { 27 | modal: false, 28 | scale: new Animated.Value(0), 29 | content: null 30 | }; 31 | } 32 | 33 | show = (example) => { 34 | if (this.state.modal) { 35 | return; 36 | } 37 | 38 | this.state.scale.setValue(0); 39 | Animated.spring(this.state.scale, { 40 | toValue: 1, 41 | useNativeDriver: true 42 | }).start(); 43 | 44 | this.setState({ 45 | modal: true, 46 | content: example 47 | }); 48 | }; 49 | 50 | hide = () => { 51 | this.state.scale.setValue(1); 52 | Animated.timing(this.state.scale, { 53 | toValue: 0, 54 | easing: Easing.in(Easing.back(2)) 55 | }).start(({finished}) => finished && this.setState({ 56 | modal: false, 57 | content: null 58 | })); 59 | }; 60 | 61 | render() { 62 | return 65 | 66 | SVG library for React Native 67 | 68 | 69 | this.show()} 73 | > 74 | Lazyload ScrollView 75 | 76 | this.show()} 80 | > 81 | Lazyload ListView 82 | 83 | this.show()} 87 | > 88 | Lazyload Image 89 | 90 | 91 | 97 | 98 | {this.state.content} 99 | 100 | 103 | 108 | X 109 | 110 | 111 | 112 | ; 113 | } 114 | } 115 | 116 | const styles = StyleSheet.create({ 117 | container: { 118 | flex: 1, 119 | paddingTop: 20, 120 | alignItems: 'center', 121 | overflow: 'hidden' 122 | }, 123 | contentContainer: { 124 | alignSelf: 'stretch', 125 | borderTopWidth: hairline, 126 | borderTopColor: '#ccc', 127 | borderBottomWidth: hairline, 128 | borderBottomColor: '#ccc', 129 | paddingHorizontal: 10 130 | }, 131 | modal: { 132 | top: 0, 133 | right: 0, 134 | bottom: 0, 135 | left: 0, 136 | backgroundColor: 'rgba(0, 0, 0, 0.2)' 137 | }, 138 | modalContent: { 139 | position: 'absolute', 140 | top: 30, 141 | right: 10, 142 | bottom: 20, 143 | left: 10, 144 | backgroundColor: '#fff' 145 | }, 146 | close: { 147 | position: 'absolute', 148 | right: 20, 149 | top: 40 150 | }, 151 | closeButton: { 152 | width: 20, 153 | height: 20, 154 | borderRadius: 10, 155 | backgroundColor: 'red', 156 | overflow: 'hidden', 157 | alignItems: 'center', 158 | justifyContent: 'center' 159 | }, 160 | closeText: { 161 | color: '#fff' 162 | }, 163 | welcome: { 164 | fontSize: 20, 165 | textAlign: 'center', 166 | margin: 10 167 | }, 168 | instructions: { 169 | textAlign: 'center', 170 | color: '#333333', 171 | marginBottom: 5 172 | }, 173 | button: { 174 | backgroundColor: '#ccc', 175 | borderRadius: 5, 176 | padding: 10, 177 | marginVertical: 10, 178 | alignItems: 'center' 179 | } 180 | }); 181 | 182 | AppRegistry.registerComponent('reacNativeLazyload', () => Example); 183 | -------------------------------------------------------------------------------- /Example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "reacNativeLazyload", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "react-native start" 7 | }, 8 | "dependencies": { 9 | "react": "^15.3.0", 10 | "react-native": "^0.32.0", 11 | "react-native-lazyload": "../", 12 | "react-native-root-modal": "^1.0.4" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) [2015-2016] [Horcrux] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import LazyloadImage from './lib/LazyloadImage'; 2 | import LazyloadView from './lib/LazyloadView'; 3 | import LazyloadListView from './lib/LazyloadListView'; 4 | import LazyloadScrollView from './lib/LazyloadScrollView'; 5 | import LazyloadManager from './lib/LazyloadManager'; 6 | 7 | export { 8 | LazyloadImage, 9 | LazyloadView, 10 | LazyloadListView, 11 | LazyloadScrollView, 12 | LazyloadManager 13 | }; 14 | -------------------------------------------------------------------------------- /lib/Anim.js: -------------------------------------------------------------------------------- 1 | import React, { 2 | PropTypes 3 | } from 'react'; 4 | import ReactNative, { 5 | LayoutAnimation 6 | } from 'react-native'; 7 | 8 | export default PropTypes.shape({ 9 | duration: PropTypes.number, 10 | delay: PropTypes.number, 11 | springDamping: PropTypes.number, 12 | initialVelocity: PropTypes.number, 13 | type: PropTypes.oneOf(Object.keys(LayoutAnimation.Types)), 14 | property: PropTypes.oneOf(Object.keys(LayoutAnimation.Properties)) 15 | }); 16 | 17 | -------------------------------------------------------------------------------- /lib/LazyloadChild.js: -------------------------------------------------------------------------------- 1 | export default class { 2 | constructor(container, measureLayout, toggle) { 3 | let {offset, recycle, horizontal, contentOffset, dimensions} = container; 4 | this._recycle = recycle; 5 | this._toggle = toggle; 6 | this._horizontal = horizontal; 7 | if (recycle && offset >= recycle) { 8 | console.warn('Recycle distance should be much more than render distance.'); 9 | recycle = offset; 10 | } 11 | 12 | measureLayout(container.data, (x, y, width, height) => { 13 | let {width: sightWidth, height: sightHeight} = dimensions; 14 | this._sight = horizontal ? { 15 | start: -(sightWidth - x + offset), 16 | end: x + width + offset 17 | } : { 18 | start: -(sightHeight - y + offset), 19 | end: y + height + offset 20 | }; 21 | if (recycle) { 22 | this._bound = horizontal ? { 23 | start: -(recycle + sightWidth - x), 24 | end: x + width + recycle 25 | } : { 26 | start: -(recycle + sightHeight - y), 27 | end: y + height + recycle 28 | }; 29 | } 30 | 31 | this.move(contentOffset.x, contentOffset.y); 32 | }); 33 | } 34 | 35 | _recycled = false; 36 | _visible = false; 37 | _horizontal = false; 38 | _bound = null; 39 | _recycle = null; 40 | _toggle = null; 41 | _sight = null; 42 | 43 | move = (x, y) => { 44 | if (!this._sight) { 45 | return; 46 | } 47 | let sight = this._sight; 48 | let bound = this._bound; 49 | let recycle = this._recycle; 50 | let scrolled = this._horizontal ? x : y; 51 | 52 | if (this._recycled && scrolled >= bound.start && scrolled <= bound.end) { // Recycled element back into recycle distance 53 | this._recycled = false; 54 | this._visible = true; 55 | this._toggle(true); 56 | } else if (!this._visible && scrolled >= sight.start && scrolled <= sight.end) { // Invisible element scroll into sight 57 | this._visible = true; 58 | this._toggle(true); 59 | } else if (this._visible && recycle && !this._recycled) { 60 | if (scrolled > bound.end || scrolled < bound.start) { 61 | this._recycled = true; 62 | this._visible = false; 63 | this._toggle(false); 64 | } 65 | } 66 | }; 67 | } 68 | -------------------------------------------------------------------------------- /lib/LazyloadImage.js: -------------------------------------------------------------------------------- 1 | import React, { 2 | Component, 3 | PropTypes 4 | } from 'react'; 5 | import { 6 | Image, 7 | Platform 8 | } from 'react-native'; 9 | import LazyloadView from './LazyloadView'; 10 | import Anim from './Anim'; 11 | const emptySource = {uri:'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'}; 12 | 13 | class LazyloadImage extends LazyloadView{ 14 | static displayName = 'LazyloadImage'; 15 | 16 | static propTypes = { 17 | host: PropTypes.string, 18 | initialVisibility: PropTypes.bool, 19 | animation: PropTypes.oneOfType([ 20 | PropTypes.shape({ 21 | duration: PropTypes.number, 22 | create: Anim, 23 | update: Anim, 24 | delete: Anim 25 | }), 26 | PropTypes.bool 27 | ]), 28 | ...Image.propTypes 29 | }; 30 | 31 | render() { 32 | let key = null; 33 | if (this.props.animation) { 34 | key = this.state.visible ? 'visible' : 'invisible'; 35 | } 36 | return this.props.host ? this._root = ele} 38 | {...this.props} 39 | onLayout={this._onLayout} 40 | key={key} 41 | source={this.state.visible ? this.props.source : emptySource} 42 | /> : this._root = ele} 44 | {...this.props} 45 | />; 46 | } 47 | } 48 | 49 | export default LazyloadImage; 50 | -------------------------------------------------------------------------------- /lib/LazyloadListView.js: -------------------------------------------------------------------------------- 1 | import React, { 2 | Component, 3 | PropTypes 4 | } from 'react'; 5 | import { 6 | ListView 7 | } from 'react-native'; 8 | import ScrollableMixin from 'react-native-scrollable-mixin'; 9 | import LazyloadScrollView from './LazyloadScrollView'; 10 | 11 | class LazyloadListView extends Component{ 12 | static displayName = 'LazyloadListView'; 13 | 14 | static propTypes = { 15 | ...ListView.propTypes 16 | }; 17 | 18 | refresh () { 19 | this._scrollView.refresh(); 20 | } 21 | 22 | get scrollProperties() { 23 | return this._listView.scrollProperties; 24 | }; 25 | 26 | /** 27 | * IMPORTANT: You must return the scroll responder of the underlying 28 | * scrollable component from getScrollResponder() when using ScrollableMixin. 29 | */ 30 | getScrollResponder() { 31 | return this._listView.getScrollResponder(); 32 | } 33 | 34 | setNativeProps(props) { 35 | this._listView.setNativeProps(props); 36 | } 37 | 38 | render() { 39 | return this.props.name ? } 42 | ref={ele => this._listView = ele} 43 | /> : this._listView = ele} 46 | />; 47 | } 48 | } 49 | 50 | // Mix in ScrollableMixin's methods as instance methods 51 | Object.assign(LazyloadListView.prototype, ScrollableMixin); 52 | 53 | export default LazyloadListView; 54 | -------------------------------------------------------------------------------- /lib/LazyloadManager.js: -------------------------------------------------------------------------------- 1 | import LazyloadChild from './LazyloadChild'; 2 | 3 | const containers = {}; 4 | 5 | class LazyloadManager{ 6 | static add = ({name, id}, measureLayout, toggle) => { 7 | let container = containers[name]; 8 | if (!container) { 9 | container = containers[name] = { 10 | children: {}, 11 | count: 0, 12 | contentOffset: {x: 0, y: 0}, 13 | uninitiated: [] 14 | } 15 | } 16 | 17 | if (container.dimensions) { 18 | if (!container.children[id]) { 19 | container.count++; 20 | } 21 | 22 | container.children[id] = new LazyloadChild( 23 | container, 24 | measureLayout, 25 | toggle 26 | ); 27 | } else { 28 | container.uninitiated.unshift(() => { 29 | LazyloadManager.add({name, id}, measureLayout, toggle); 30 | }); 31 | } 32 | }; 33 | 34 | static remove = (name, id) => { 35 | let container = containers[name]; 36 | if (container && container.children[id]) { 37 | delete container.children[id]; 38 | container.count--; 39 | } 40 | }; 41 | 42 | constructor({name, dimensions, offset = 0, recycle, horizontal, contentOffset = {x: 0, y: 0}}, data) { 43 | this._name = name; 44 | 45 | if (!name || !dimensions) { 46 | 47 | } 48 | 49 | let content = { 50 | offset, 51 | recycle, 52 | horizontal, 53 | contentOffset, 54 | dimensions, 55 | data 56 | }; 57 | if (!containers[name]) { 58 | containers[name] = { 59 | children: {}, 60 | count: 0, 61 | uninitiated: [], 62 | ...content 63 | }; 64 | } else { 65 | Object.assign(containers[name], content); 66 | } 67 | 68 | let uninitiated; 69 | while (uninitiated = containers[name].uninitiated.pop()) { 70 | uninitiated(); 71 | } 72 | } 73 | 74 | _name = null; 75 | 76 | calculate = ({x, y}) => { 77 | let container = containers[this._name]; 78 | 79 | container.contentOffset = {x, y}; 80 | if (container.count) { 81 | let children = container.children; 82 | for (let key in children) { 83 | if (children.hasOwnProperty(key)) { 84 | children[key].move(x, y); 85 | } 86 | } 87 | } 88 | }; 89 | 90 | 91 | destroy = () => { 92 | this._container = containers[this._name] = null; 93 | }; 94 | } 95 | 96 | export default LazyloadManager; 97 | -------------------------------------------------------------------------------- /lib/LazyloadScrollView.js: -------------------------------------------------------------------------------- 1 | import React, { 2 | Component, 3 | PropTypes 4 | } from 'react'; 5 | import ReactNative, { 6 | ScrollView, 7 | Dimensions 8 | } from 'react-native'; 9 | import ScrollableMixin from 'react-native-scrollable-mixin'; 10 | import LazyloadManager from './LazyloadManager'; 11 | 12 | class LazyloadScrollView extends Component{ 13 | static displayName = 'LazyloadScrollView'; 14 | 15 | static propTypes = { 16 | name: PropTypes.string, 17 | renderDistance: PropTypes.number, 18 | recycle: PropTypes.bool, 19 | recycleDistance : PropTypes.number, 20 | horizontal: PropTypes.bool, 21 | ...ScrollView.propTypes 22 | }; 23 | 24 | static defaultProps = { 25 | renderDistance: 0, 26 | recycle: true, 27 | recycleDistance: Dimensions.get('window').height * 4, 28 | horizontal: false 29 | }; 30 | 31 | 32 | 33 | constructor() { 34 | super(); 35 | 36 | // Used for saving scroll position when refreshing 37 | this.currentPosition = { 38 | x: 0, 39 | y: 0 40 | }; 41 | } 42 | 43 | componentWillUnmount = () => { 44 | if(this._manager){ 45 | this._manager.destroy(); 46 | this._manager = null; 47 | } 48 | }; 49 | 50 | getScrollResponder = () => this._scrollResponder; 51 | 52 | refresh = () => { 53 | this._onScroll({ 54 | nativeEvent: { 55 | contentOffset: { 56 | y: this.currentPosition.y, 57 | x: this.currentPosition.x 58 | } 59 | } 60 | }); 61 | }; 62 | 63 | _manager = null; 64 | 65 | _scrollResponder = null; 66 | 67 | _onLayout = (e, node) => { 68 | this.props.onLayout && this.props.onLayout(e, node); 69 | let {width, height} = e.nativeEvent.layout; 70 | let { 71 | name, 72 | renderDistance, 73 | recycle, 74 | recycleDistance 75 | } = this.props; 76 | 77 | this._manager = new LazyloadManager( 78 | { 79 | name, 80 | dimensions: { 81 | width, 82 | height 83 | }, 84 | offset: renderDistance, 85 | recycle: recycle ? recycleDistance : 0, 86 | horizontal: this.props.horizontal 87 | }, 88 | ReactNative.findNodeHandle(this) 89 | ); 90 | 91 | }; 92 | 93 | _onScroll = e => { 94 | this.props.onScroll && this.props.onScroll(e); 95 | let {x, y} = e.nativeEvent.contentOffset; 96 | this.currentPosition = {x, y}; 97 | this._manager && this._manager.calculate({x, y}); 98 | }; 99 | 100 | render() { 101 | return this.props.name ? this._scrollResponder = ele} 104 | name={null} 105 | onScroll={this._onScroll} 106 | onLayout={this._onLayout} 107 | scrollEventThrottle={this.props.scrollEventThrottle || 16} 108 | /> : this._scrollResponder = ele} 111 | />; 112 | } 113 | } 114 | 115 | Object.assign(LazyloadScrollView.prototype, ScrollableMixin); 116 | 117 | export default LazyloadScrollView; 118 | -------------------------------------------------------------------------------- /lib/LazyloadView.js: -------------------------------------------------------------------------------- 1 | import React, { 2 | Component, 3 | PropTypes 4 | } from 'react'; 5 | import { 6 | View, 7 | LayoutAnimation 8 | } from 'react-native'; 9 | import LazyloadManager from './LazyloadManager'; 10 | import Anim from './Anim'; 11 | 12 | let id = 0; 13 | 14 | class LazyloadView extends Component{ 15 | static displayName = 'LazyloadView'; 16 | 17 | static propTypes = { 18 | host: PropTypes.string, 19 | initialVisibility: PropTypes.bool, 20 | animation: PropTypes.oneOfType([ 21 | PropTypes.shape({ 22 | duration: PropTypes.number, 23 | create: Anim, 24 | update: Anim, 25 | delete: Anim 26 | }), 27 | PropTypes.bool 28 | ]), 29 | ...View.propTypes 30 | }; 31 | 32 | static defaultProps = { 33 | initialVisibility: false, 34 | animation: { 35 | duration: 350, 36 | create: { 37 | property: LayoutAnimation.Properties.opacity, 38 | type: 'easeIn' 39 | } 40 | } 41 | }; 42 | 43 | constructor() { 44 | super(...arguments); 45 | if (this.props.host) { 46 | this._id = id++; 47 | this._visible = this.props.initialVisibility; 48 | this.state = { 49 | visible: this._visible 50 | }; 51 | } 52 | }; 53 | 54 | componentWillUnmount = () => { 55 | if (this.props.host) { 56 | LazyloadManager.remove(this.props.host, this._id); 57 | } 58 | this._unmounted = true; 59 | }; 60 | 61 | shouldComponentUpdate = (nextProps) => { 62 | return this._visible || !nextProps.host; 63 | }; 64 | 65 | _root = null; 66 | _visible = false; 67 | _timeout = null; 68 | _unmounted = false; 69 | 70 | _toggle = visible => { 71 | if (this._visible !== visible) { 72 | this._visible = visible; 73 | clearTimeout(this._timeout); 74 | 75 | // If we have a callback, call it with the visibility state change 76 | if (this.props.onVisibilityChange && typeof this.props.onVisibilityChange === 'function') { 77 | this.props.onVisibilityChange(this._visible, this.ref, this.props); 78 | } 79 | 80 | this._timeout = setTimeout(() => { 81 | if (this._unmounted) { 82 | return; 83 | } 84 | 85 | visible && this.props.animation && LayoutAnimation.configureNext(this.props.animation); 86 | this.setState({ 87 | visible 88 | }); 89 | }, 16); 90 | } 91 | }; 92 | 93 | measureInWindow = (...args) => { 94 | this._root.measureInWindow(...args); 95 | }; 96 | 97 | measureLayout = (...args) => { 98 | this._root.measureLayout(...args); 99 | }; 100 | 101 | setNativeProps = (...args) => { 102 | this._root.setNativeProps(...args); 103 | }; 104 | 105 | focus = (...args) => { 106 | this._root.focus(...args); 107 | }; 108 | 109 | blur = (...args) => { 110 | this._root.blur(...args); 111 | }; 112 | 113 | _onLayout = (...args) => { 114 | if (this._unmounted) { 115 | return; 116 | } 117 | this.props.onLayout && this.props.onLayout(...args); 118 | LazyloadManager.add( 119 | { 120 | name: this.props.host, 121 | id: this._id 122 | }, 123 | this.measureLayout, 124 | this._toggle 125 | ); 126 | }; 127 | 128 | render() { 129 | return this.props.host ? this._root = ele} 132 | onLayout={this._onLayout} 133 | > 134 | {this.state.visible ? this.props.children : null} 135 | : this._root = ele} 137 | {...this.props} 138 | />; 139 | } 140 | } 141 | 142 | export default LazyloadView; 143 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-lazyload", 3 | "version": "1.1.0", 4 | "description": "lazyload for react native", 5 | "license": "MIT", 6 | "main": "./index.js", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/magicismight/react-native-lazyload" 10 | }, 11 | "dependencies": { 12 | "react-native-scrollable-mixin": "^1.0.1" 13 | }, 14 | "keywords": [ 15 | "react-component", 16 | "react-native", 17 | "ios", 18 | "android", 19 | "lazyload", 20 | "load" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ### react-native-lazyload 2 | 3 | ------------------------ 4 | 5 | A \`lazyload\` components suit for React Native. 6 | 7 | #### Install 8 | 9 | ``` 10 | npm install react-native-lazyload 11 | ``` 12 | 13 | #### Components 14 | 15 | Component | Description 16 | ------------------- | -------------------- 17 | LazyloadScrollView | A lazyload container component based on `ScrollView` 18 | LazyloadListView | A lazyload container component based on `ListView` 19 | LazyloadView | Based on View component. This component\`s content won\`t be rendered util it scrolls into sight. It should be inside a `LazyloadScrollView` or `LazyloadListView` which has the same `name` prop as this component\`s host prop. 20 | LazyloadImage | Based on Image component. The image content won\`t be rendered util it scrolls into sight. It should be inside a `LazyloadScrollView` or `LazyloadListView` which has the same `name` prop as this component\`s host prop. 21 | 22 | #### Usage 23 | 24 | ##### LazyloadScrollView 25 | 26 | 1. Using `LazyloadScrollView` instead of `ScrollView`, and specify a unique id for `name` prop. 27 | 2. Layout the views or images which will be lazyloaded by using `LazyloadView` and `LazyloadImage` instead of `View` or `Image`. 28 | 3. Specify `host` prop for every `LazyloadView` and `LazyloadImage`, the `host` prop should be same as outer `LazyloadScrollView` component`s name prop. 29 | 30 | ```js 31 | import React, { 32 | Component 33 | } from 'react-native'; 34 | 35 | import { 36 | LazyloadScrollView, 37 | LazyloadView, 38 | LazyloadImage 39 | } from 'react-native-lazyload'; 40 | 41 | const list = [...list data here]; // many rows 42 | 43 | class LazyloadScrollViewExample extends Component{ 44 | render() { 45 | return ( 46 | 51 | {list.map((file, i) => 55 | 59 | 60 | {file.id} 61 | 62 | 63 | {file.first_name} {file.last_name} 64 | email: {file.email} 65 | last visit ip: {file.ip_address} 66 | 67 | 68 | 69 | 74 | 75 | )} 76 | 77 | ); 78 | } 79 | } 80 | 81 | ``` 82 | 83 | ##### LazyloadListView 84 | 85 | Same as ListView. But it won\`t render `LazyloadView` and `LazyloadImage` inside it, util they are scrolled into sight. 86 | 87 | ### Additional Methods 88 | 89 | *refresh* - Force to trigger an update. Useful after nagivation pop/push where the memory may have been release. 90 | 91 | ### Additional Props 92 | 93 | Components that extend LazyloadView can accept a prop (function) to be called when the item's visibility changes. 94 | 95 | *onVisibilityChange* - An optional function to be called with the new visibility, ref, and props 96 | 97 | Example: 98 | 99 | ``` 100 | 101 | 102 | ... 103 | 104 | 105 | ... 106 | 107 | handleItemVisibility(visibility, ref, props) { 108 | console.log('visibility, ref, props', visibility, ref, props); 109 | } 110 | 111 | ``` 112 | #### Run Example 113 | 114 | Clone this repository from Github and cd to 'Example' directory then run `npm install`. 115 | 116 | --------------------------------------------------------------------------------