├── .circleci └── config.yml ├── .editorconfig ├── .gitattributes ├── .gitignore ├── .npmignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── babel.config.js ├── example ├── android │ ├── app │ │ ├── build.gradle │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── reactnativeimagegrid │ │ │ │ └── ReactNativeFlipper.java │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── reactnativeimagegrid │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── app.json ├── babel.config.js ├── index.js ├── ios │ ├── File.swift │ ├── ImageGridExample-Bridging-Header.h │ ├── ImageGridExample.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── ImageGridExample.xcscheme │ ├── ImageGridExample.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── ImageGridExample │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── LaunchScreen.storyboard │ │ └── main.m │ ├── Podfile │ └── Podfile.lock ├── metro.config.js ├── package.json ├── src │ └── App.js └── yarn.lock ├── package.json ├── scripts └── bootstrap.js ├── src ├── Grid.js ├── GroupImage │ ├── Five.js │ ├── Four.js │ ├── One.js │ ├── Six.js │ ├── Three.js │ ├── Two.js │ └── index.js ├── Image.js ├── ImageGrid.tsx ├── assets │ ├── delete.png │ ├── emptyImage.png │ └── video-icon.png ├── helpers.js └── index.ts ├── tsconfig.build.json ├── tsconfig.json └── yarn.lock /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | 3 | executors: 4 | default: 5 | docker: 6 | - image: circleci/node:10 7 | working_directory: ~/project 8 | 9 | commands: 10 | attach_project: 11 | steps: 12 | - attach_workspace: 13 | at: ~/project 14 | 15 | jobs: 16 | install-dependencies: 17 | executor: default 18 | steps: 19 | - checkout 20 | - attach_project 21 | - restore_cache: 22 | keys: 23 | - dependencies-{{ checksum "package.json" }} 24 | - dependencies- 25 | - restore_cache: 26 | keys: 27 | - dependencies-example-{{ checksum "example/package.json" }} 28 | - dependencies-example- 29 | - run: 30 | name: Install dependencies 31 | command: | 32 | yarn install --cwd example --frozen-lockfile 33 | yarn install --frozen-lockfile 34 | - save_cache: 35 | key: dependencies-{{ checksum "package.json" }} 36 | paths: node_modules 37 | - save_cache: 38 | key: dependencies-example-{{ checksum "example/package.json" }} 39 | paths: example/node_modules 40 | - persist_to_workspace: 41 | root: . 42 | paths: . 43 | 44 | lint: 45 | executor: default 46 | steps: 47 | - attach_project 48 | - run: 49 | name: Lint files 50 | command: | 51 | yarn lint 52 | 53 | typescript: 54 | executor: default 55 | steps: 56 | - attach_project 57 | - run: 58 | name: Typecheck files 59 | command: | 60 | yarn typescript 61 | 62 | unit-tests: 63 | executor: default 64 | steps: 65 | - attach_project 66 | - run: 67 | name: Run unit tests 68 | command: | 69 | yarn test --coverage 70 | - store_artifacts: 71 | path: coverage 72 | destination: coverage 73 | 74 | build-package: 75 | executor: default 76 | steps: 77 | - attach_project 78 | - run: 79 | name: Build package 80 | command: | 81 | yarn prepare 82 | 83 | workflows: 84 | build-and-test: 85 | jobs: 86 | - install-dependencies 87 | - lint: 88 | requires: 89 | - install-dependencies 90 | - typescript: 91 | requires: 92 | - install-dependencies 93 | - unit-tests: 94 | requires: 95 | - install-dependencies 96 | - build-package: 97 | requires: 98 | - install-dependencies 99 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | 9 | indent_style = space 10 | indent_size = 2 11 | 12 | end_of_line = lf 13 | charset = utf-8 14 | trim_trailing_whitespace = true 15 | insert_final_newline = true 16 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | # specific for windows script files 3 | *.bat text eol=crlf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # XDE 6 | .expo/ 7 | 8 | # VSCode 9 | .vscode/ 10 | jsconfig.json 11 | 12 | # Xcode 13 | # 14 | build/ 15 | *.pbxuser 16 | !default.pbxuser 17 | *.mode1v3 18 | !default.mode1v3 19 | *.mode2v3 20 | !default.mode2v3 21 | *.perspectivev3 22 | !default.perspectivev3 23 | xcuserdata 24 | *.xccheckout 25 | *.moved-aside 26 | DerivedData 27 | *.hmap 28 | *.ipa 29 | *.xcuserstate 30 | project.xcworkspace 31 | 32 | # Android/IJ 33 | # 34 | .idea 35 | .gradle 36 | local.properties 37 | android.iml 38 | 39 | # Cocoapods 40 | # 41 | example/ios/Pods 42 | 43 | # node.js 44 | # 45 | node_modules/ 46 | npm-debug.log 47 | yarn-debug.log 48 | yarn-error.log 49 | 50 | # BUCK 51 | buck-out/ 52 | \.buckd/ 53 | android/app/libs 54 | android/keystores/debug.keystore 55 | 56 | # Expo 57 | .expo/* 58 | 59 | # generated by bob 60 | lib/ 61 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | example/ 2 | files/ 3 | node_modules/ 4 | npm-debug.log 5 | package-lock.json 6 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. 4 | 5 | ## Development workflow 6 | 7 | To get started with the project, run `yarn` in the root directory to install the required dependencies for each package: 8 | 9 | ```sh 10 | yarn 11 | ``` 12 | 13 | While developing, you can run the [example app](/example/) to test your changes. 14 | 15 | To start the packager: 16 | 17 | ```sh 18 | yarn example start 19 | ``` 20 | 21 | To run the example app on Android: 22 | 23 | ```sh 24 | yarn example android 25 | ``` 26 | 27 | To run the example app on iOS: 28 | 29 | ```sh 30 | yarn example ios 31 | ``` 32 | 33 | Make sure your code passes TypeScript and ESLint. Run the following to verify: 34 | 35 | ```sh 36 | yarn typescript 37 | yarn lint 38 | ``` 39 | 40 | To fix formatting errors, run the following: 41 | 42 | ```sh 43 | yarn lint --fix 44 | ``` 45 | 46 | Remember to add tests for your change if possible. Run the unit tests by: 47 | 48 | ```sh 49 | yarn test 50 | ``` 51 | 52 | To edit the Objective-C files, open `example/ios/ImageGridExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-image-grid`. 53 | 54 | To edit the Kotlin files, open `example/android` in Android studio and find the source files at `reactnativeimagegrid` under `Android`. 55 | 56 | ### Commit message convention 57 | 58 | We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages: 59 | 60 | - `fix`: bug fixes, e.g. fix crash due to deprecated method. 61 | - `feat`: new features, e.g. add new method to the module. 62 | - `refactor`: code refactor, e.g. migrate from class components to hooks. 63 | - `docs`: changes into documentation, e.g. add usage example for the module.. 64 | - `test`: adding or updating tests, e.g. add integration tests using detox. 65 | - `chore`: tooling changes, e.g. change CI config. 66 | 67 | Our pre-commit hooks verify that your commit message matches this format when committing. 68 | 69 | ### Linting and tests 70 | 71 | [ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/) 72 | 73 | We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing. 74 | 75 | Our pre-commit hooks verify that the linter and tests pass when committing. 76 | 77 | ### Scripts 78 | 79 | The `package.json` file contains various scripts for common tasks: 80 | 81 | - `yarn bootstrap`: setup project by installing all dependencies and pods. 82 | - `yarn typescript`: type-check files with TypeScript. 83 | - `yarn lint`: lint files with ESLint. 84 | - `yarn test`: run unit tests with Jest. 85 | - `yarn example start`: start the Metro server for the example app. 86 | - `yarn example android`: run the example app on Android. 87 | - `yarn example ios`: run the example app on iOS. 88 | 89 | ### Sending a pull request 90 | 91 | > **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github). 92 | 93 | When you're sending a pull request: 94 | 95 | - Prefer small pull requests focused on one change. 96 | - Verify that linters and tests are passing. 97 | - Review the documentation to make sure it looks good. 98 | - Follow the pull request template when opening a pull request. 99 | - For pull requests that change the API or implementation, discuss with maintainers first by opening an issue. 100 | 101 | ## Code of Conduct 102 | 103 | ### Our Pledge 104 | 105 | We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. 106 | 107 | We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. 108 | 109 | ### Our Standards 110 | 111 | Examples of behavior that contributes to a positive environment for our community include: 112 | 113 | - Demonstrating empathy and kindness toward other people 114 | - Being respectful of differing opinions, viewpoints, and experiences 115 | - Giving and gracefully accepting constructive feedback 116 | - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience 117 | - Focusing on what is best not just for us as individuals, but for the overall community 118 | 119 | Examples of unacceptable behavior include: 120 | 121 | - The use of sexualized language or imagery, and sexual attention or 122 | advances of any kind 123 | - Trolling, insulting or derogatory comments, and personal or political attacks 124 | - Public or private harassment 125 | - Publishing others' private information, such as a physical or email 126 | address, without their explicit permission 127 | - Other conduct which could reasonably be considered inappropriate in a 128 | professional setting 129 | 130 | ### Enforcement Responsibilities 131 | 132 | Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. 133 | 134 | Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. 135 | 136 | ### Scope 137 | 138 | This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. 139 | 140 | ### Enforcement 141 | 142 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly. 143 | 144 | All community leaders are obligated to respect the privacy and security of the reporter of any incident. 145 | 146 | ### Enforcement Guidelines 147 | 148 | Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: 149 | 150 | #### 1. Correction 151 | 152 | **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. 153 | 154 | **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. 155 | 156 | #### 2. Warning 157 | 158 | **Community Impact**: A violation through a single incident or series of actions. 159 | 160 | **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. 161 | 162 | #### 3. Temporary Ban 163 | 164 | **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. 165 | 166 | **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. 167 | 168 | #### 4. Permanent Ban 169 | 170 | **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. 171 | 172 | **Consequence**: A permanent ban from any sort of public interaction within the community. 173 | 174 | ### Attribution 175 | 176 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, 177 | available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 178 | 179 | Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). 180 | 181 | [homepage]: https://www.contributor-covenant.org 182 | 183 | For answers to common questions about this code of conduct, see the FAQ at 184 | https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. 185 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Baron 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-native-image-grid 2 | 3 | Display images grid like Facebook App. 4 | 5 | ## Installation 6 | 7 | ```sh 8 | npm i @baronha/react-native-image-grid 9 | or 10 | yarn add @baronha/react-native-image-grid 11 | ``` 12 | ## Usage 13 | 14 | ```...UPDATING``` 15 | 16 | ## Contributing 17 | 18 | See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow. 19 | 20 | ## License 21 | 22 | MIT 23 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /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 | * // https://reactnative.dev/docs/performance#enable-the-ram-format 22 | * bundleCommand: "ram-bundle", 23 | * 24 | * // whether to bundle JS and assets in debug mode 25 | * bundleInDebug: false, 26 | * 27 | * // whether to bundle JS and assets in release mode 28 | * bundleInRelease: true, 29 | * 30 | * // whether to bundle JS and assets in another build variant (if configured). 31 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 32 | * // The configuration property can be in the following formats 33 | * // 'bundleIn${productFlavor}${buildType}' 34 | * // 'bundleIn${buildType}' 35 | * // bundleInFreeDebug: true, 36 | * // bundleInPaidRelease: true, 37 | * // bundleInBeta: true, 38 | * 39 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 40 | * // for ImageGridExample: to disable dev mode in the staging build type (if configured) 41 | * devDisabledInStaging: true, 42 | * // The configuration property can be in the following formats 43 | * // 'devDisabledIn${productFlavor}${buildType}' 44 | * // 'devDisabledIn${buildType}' 45 | * 46 | * // the root of your project, i.e. where "package.json" lives 47 | * root: "../../", 48 | * 49 | * // where to put the JS bundle asset in debug mode 50 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 51 | * 52 | * // where to put the JS bundle asset in release mode 53 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 54 | * 55 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 56 | * // require('./image.png')), in debug mode 57 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 58 | * 59 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 60 | * // require('./image.png')), in release mode 61 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 62 | * 63 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 64 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 65 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 66 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 67 | * // for ImageGridExample, you might want to remove it from here. 68 | * inputExcludes: ["android/**", "ios/**"], 69 | * 70 | * // override which node gets called and with what additional arguments 71 | * nodeExecutableAndArgs: ["node"], 72 | * 73 | * // supply additional arguments to the packager 74 | * extraPackagerArgs: [] 75 | * ] 76 | */ 77 | 78 | project.ext.react = [ 79 | enableHermes: false, // clean and rebuild if changing 80 | entryFile: "index.tsx", 81 | ] 82 | 83 | apply from: "../../node_modules/react-native/react.gradle" 84 | 85 | /** 86 | * Set this to true to create two separate APKs instead of one: 87 | * - An APK that only works on ARM devices 88 | * - An APK that only works on x86 devices 89 | * The advantage is the size of the APK is reduced by about 4MB. 90 | * Upload all the APKs to the Play Store and people will download 91 | * the correct one based on the CPU architecture of their device. 92 | */ 93 | def enableSeparateBuildPerCPUArchitecture = false 94 | 95 | /** 96 | * Run Proguard to shrink the Java bytecode in release builds. 97 | */ 98 | def enableProguardInReleaseBuilds = false 99 | 100 | /** 101 | * The preferred build flavor of JavaScriptCore. 102 | * 103 | * For ImageGridExample, to use the international variant, you can use: 104 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 105 | * 106 | * The international variant includes ICU i18n library and necessary data 107 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 108 | * give correct results when using with locales other than en-US. Note that 109 | * this variant is about 6MiB larger per architecture than default. 110 | */ 111 | def jscFlavor = 'org.webkit:android-jsc:+' 112 | 113 | /** 114 | * Whether to enable the Hermes VM. 115 | * 116 | * This should be set on project.ext.react and mirrored here. If it is not set 117 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode 118 | * and the benefits of using Hermes will therefore be sharply reduced. 119 | */ 120 | def enableHermes = project.ext.react.get("enableHermes", false); 121 | 122 | android { 123 | compileSdkVersion rootProject.ext.compileSdkVersion 124 | 125 | compileOptions { 126 | sourceCompatibility JavaVersion.VERSION_1_8 127 | targetCompatibility JavaVersion.VERSION_1_8 128 | } 129 | 130 | defaultConfig { 131 | applicationId "com.example.reactnativeimagegrid" 132 | minSdkVersion rootProject.ext.minSdkVersion 133 | targetSdkVersion rootProject.ext.targetSdkVersion 134 | versionCode 1 135 | versionName "1.0" 136 | } 137 | splits { 138 | abi { 139 | reset() 140 | enable enableSeparateBuildPerCPUArchitecture 141 | universalApk false // If true, also generate a universal APK 142 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" 143 | } 144 | } 145 | signingConfigs { 146 | debug { 147 | storeFile file('debug.keystore') 148 | storePassword 'android' 149 | keyAlias 'androiddebugkey' 150 | keyPassword 'android' 151 | } 152 | } 153 | buildTypes { 154 | debug { 155 | signingConfig signingConfigs.debug 156 | } 157 | release { 158 | // Caution! In production, you need to generate your own keystore file. 159 | // see https://reactnative.dev/docs/signed-apk-android. 160 | signingConfig signingConfigs.debug 161 | minifyEnabled enableProguardInReleaseBuilds 162 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 163 | } 164 | } 165 | // applicationVariants are e.g. debug, release 166 | applicationVariants.all { variant -> 167 | variant.outputs.each { output -> 168 | // For each separate APK per architecture, set a unique version code as described here: 169 | // https://developer.android.com/studio/build/configure-apk-splits.html 170 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] 171 | def abi = output.getFilter(OutputFile.ABI) 172 | if (abi != null) { // null for the universal-debug, universal-release variants 173 | output.versionCodeOverride = 174 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 175 | } 176 | 177 | } 178 | } 179 | } 180 | 181 | dependencies { 182 | implementation fileTree(dir: "libs", include: ["*.jar"]) 183 | //noinspection GradleDynamicVersion 184 | implementation "com.facebook.react:react-native:+" // From node_modules 185 | 186 | 187 | implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" 188 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { 189 | exclude group:'com.facebook.fbjni' 190 | } 191 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { 192 | exclude group:'com.facebook.flipper' 193 | exclude group:'com.squareup.okhttp3', module:'okhttp' 194 | } 195 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { 196 | exclude group:'com.facebook.flipper' 197 | } 198 | 199 | if (enableHermes) { 200 | def hermesPath = "../../node_modules/hermes-engine/android/"; 201 | debugImplementation files(hermesPath + "hermes-debug.aar") 202 | releaseImplementation files(hermesPath + "hermes-release.aar") 203 | } else { 204 | implementation jscFlavor 205 | } 206 | 207 | } 208 | 209 | // Run this once to be able to run the application with BUCK 210 | // puts all compile dependencies into folder libs for BUCK to use 211 | task copyDownloadableDepsToLibs(type: Copy) { 212 | from configurations.compile 213 | into 'libs' 214 | } 215 | 216 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 217 | -------------------------------------------------------------------------------- /example/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baronha/react-native-image-grid/d617c413019d3083d5a8bc9f7fa6a15b7f78c6c1/example/android/app/debug.keystore -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/debug/java/com/example/reactnativeimagegrid/ReactNativeFlipper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | *

This source code is licensed under the MIT license found in the LICENSE file in the root 5 | * directory of this source tree. 6 | */ 7 | package com.example.reactnativeimagegrid; 8 | 9 | import android.content.Context; 10 | import com.facebook.flipper.android.AndroidFlipperClient; 11 | import com.facebook.flipper.android.utils.FlipperUtils; 12 | import com.facebook.flipper.core.FlipperClient; 13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; 14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; 15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; 16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping; 17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; 18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; 19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; 20 | import com.facebook.flipper.plugins.react.ReactFlipperPlugin; 21 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; 22 | import com.facebook.react.ReactInstanceManager; 23 | import com.facebook.react.bridge.ReactContext; 24 | import com.facebook.react.modules.network.NetworkingModule; 25 | import okhttp3.OkHttpClient; 26 | 27 | public class ReactNativeFlipper { 28 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 29 | if (FlipperUtils.shouldEnableFlipper(context)) { 30 | final FlipperClient client = AndroidFlipperClient.getInstance(context); 31 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); 32 | client.addPlugin(new ReactFlipperPlugin()); 33 | client.addPlugin(new DatabasesFlipperPlugin(context)); 34 | client.addPlugin(new SharedPreferencesFlipperPlugin(context)); 35 | client.addPlugin(CrashReporterPlugin.getInstance()); 36 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); 37 | NetworkingModule.setCustomClientBuilder( 38 | new NetworkingModule.CustomClientBuilder() { 39 | @Override 40 | public void apply(OkHttpClient.Builder builder) { 41 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); 42 | } 43 | }); 44 | client.addPlugin(networkFlipperPlugin); 45 | client.start(); 46 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized 47 | // Hence we run if after all native modules have been initialized 48 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); 49 | if (reactContext == null) { 50 | reactInstanceManager.addReactInstanceEventListener( 51 | new ReactInstanceManager.ReactInstanceEventListener() { 52 | @Override 53 | public void onReactContextInitialized(ReactContext reactContext) { 54 | reactInstanceManager.removeReactInstanceEventListener(this); 55 | reactContext.runOnNativeModulesQueueThread( 56 | new Runnable() { 57 | @Override 58 | public void run() { 59 | client.addPlugin(new FrescoFlipperPlugin()); 60 | } 61 | }); 62 | } 63 | }); 64 | } else { 65 | client.addPlugin(new FrescoFlipperPlugin()); 66 | } 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 13 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/example/reactnativeimagegrid/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.reactnativeimagegrid; 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. This is used to schedule 9 | * rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "ImageGridExample"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/example/reactnativeimagegrid/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.reactnativeimagegrid; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import com.facebook.react.PackageList; 6 | import com.facebook.react.ReactApplication; 7 | import com.facebook.react.ReactNativeHost; 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.react.ReactInstanceManager; 10 | import com.facebook.soloader.SoLoader; 11 | import java.lang.reflect.InvocationTargetException; 12 | import java.util.List; 13 | 14 | public class MainApplication extends Application implements ReactApplication { 15 | 16 | private final ReactNativeHost mReactNativeHost = 17 | new ReactNativeHost(this) { 18 | @Override 19 | public boolean getUseDeveloperSupport() { 20 | return BuildConfig.DEBUG; 21 | } 22 | 23 | @Override 24 | protected List getPackages() { 25 | @SuppressWarnings("UnnecessaryLocalVariable") 26 | List packages = new PackageList(this).getPackages(); 27 | // Packages that cannot be autolinked yet can be added manually here, for ImageGridExample: 28 | // packages.add(new MyReactNativePackage()); 29 | 30 | return packages; 31 | } 32 | 33 | @Override 34 | protected String getJSMainModuleName() { 35 | return "index"; 36 | } 37 | }; 38 | 39 | @Override 40 | public ReactNativeHost getReactNativeHost() { 41 | return mReactNativeHost; 42 | } 43 | 44 | @Override 45 | public void onCreate() { 46 | super.onCreate(); 47 | SoLoader.init(this, /* native exopackage */ false); 48 | initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); // Remove this line if you don't want Flipper enabled 49 | } 50 | 51 | /** 52 | * Loads Flipper in React Native templates. 53 | * 54 | * @param context 55 | */ 56 | private static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 57 | if (BuildConfig.DEBUG) { 58 | try { 59 | /* 60 | We use reflection here to pick up the class that initializes Flipper, 61 | since Flipper library is not available in release mode 62 | */ 63 | Class aClass = Class.forName("com.reactnativeimagegridExample.ReactNativeFlipper"); 64 | aClass 65 | .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) 66 | .invoke(null, context, reactInstanceManager); 67 | } catch (ClassNotFoundException e) { 68 | e.printStackTrace(); 69 | } catch (NoSuchMethodException e) { 70 | e.printStackTrace(); 71 | } catch (IllegalAccessException e) { 72 | e.printStackTrace(); 73 | } catch (InvocationTargetException e) { 74 | e.printStackTrace(); 75 | } 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baronha/react-native-image-grid/d617c413019d3083d5a8bc9f7fa6a15b7f78c6c1/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baronha/react-native-image-grid/d617c413019d3083d5a8bc9f7fa6a15b7f78c6c1/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baronha/react-native-image-grid/d617c413019d3083d5a8bc9f7fa6a15b7f78c6c1/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baronha/react-native-image-grid/d617c413019d3083d5a8bc9f7fa6a15b7f78c6c1/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baronha/react-native-image-grid/d617c413019d3083d5a8bc9f7fa6a15b7f78c6c1/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baronha/react-native-image-grid/d617c413019d3083d5a8bc9f7fa6a15b7f78c6c1/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baronha/react-native-image-grid/d617c413019d3083d5a8bc9f7fa6a15b7f78c6c1/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baronha/react-native-image-grid/d617c413019d3083d5a8bc9f7fa6a15b7f78c6c1/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baronha/react-native-image-grid/d617c413019d3083d5a8bc9f7fa6a15b7f78c6c1/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baronha/react-native-image-grid/d617c413019d3083d5a8bc9f7fa6a15b7f78c6c1/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ImageGrid Example 3 | 4 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /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 | ext { 5 | buildToolsVersion = "29.0.2" 6 | minSdkVersion = 19 7 | compileSdkVersion = 29 8 | targetSdkVersion = 29 9 | } 10 | repositories { 11 | google() 12 | jcenter() 13 | } 14 | dependencies { 15 | classpath("com.android.tools.build:gradle:4.1.2") 16 | 17 | // NOTE: Do not place your application dependencies here; they belong 18 | // in the individual module build.gradle files 19 | } 20 | } 21 | 22 | allprojects { 23 | repositories { 24 | mavenLocal() 25 | maven { 26 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 27 | url("$rootDir/../node_modules/react-native/android") 28 | } 29 | maven { 30 | // Android JSC is installed from npm 31 | url("$rootDir/../node_modules/jsc-android/dist") 32 | } 33 | 34 | google() 35 | jcenter() 36 | maven { url 'https://www.jitpack.io' } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /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.useAndroidX=true 21 | android.enableJetifier=true 22 | FLIPPER_VERSION=0.54.0 23 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baronha/react-native-image-grid/d617c413019d3083d5a8bc9f7fa6a15b7f78c6c1/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /example/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=`expr $i + 1` 158 | done 159 | case $i in 160 | 0) set -- ;; 161 | 1) set -- "$args0" ;; 162 | 2) set -- "$args0" "$args1" ;; 163 | 3) set -- "$args0" "$args1" "$args2" ;; 164 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=`save "$@"` 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | exec "$JAVACMD" "$@" 184 | -------------------------------------------------------------------------------- /example/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem http://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'ImageGridExample' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | 5 | -------------------------------------------------------------------------------- /example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ImageGridExample", 3 | "displayName": "ImageGrid Example" 4 | } 5 | -------------------------------------------------------------------------------- /example/babel.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const pak = require('../package.json'); 3 | 4 | module.exports = { 5 | presets: ['module:metro-react-native-babel-preset'], 6 | plugins: [ 7 | [ 8 | 'module-resolver', 9 | { 10 | alias: { 11 | [pak.name]: path.join(__dirname, '..', pak.source), 12 | }, 13 | }, 14 | ], 15 | ], 16 | }; 17 | -------------------------------------------------------------------------------- /example/index.js: -------------------------------------------------------------------------------- 1 | import { AppRegistry } from 'react-native'; 2 | import App from './src/App'; 3 | import { name as appName } from './app.json'; 4 | 5 | AppRegistry.registerComponent(appName, () => App); 6 | -------------------------------------------------------------------------------- /example/ios/File.swift: -------------------------------------------------------------------------------- 1 | // 2 | // File.swift 3 | // ImageGridExample 4 | // 5 | // Created by Bảo on 25/02/2021. 6 | // 7 | 8 | import Foundation 9 | -------------------------------------------------------------------------------- /example/ios/ImageGridExample-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | -------------------------------------------------------------------------------- /example/ios/ImageGridExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 00E356F31AD99517003FC87E /* ImageGridExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* ImageGridExampleTests.m */; }; 11 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 12 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 13 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 14 | 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 15 | 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 16 | 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 17 | 2DCD954D1E0B4F2C00145EB5 /* ImageGridExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* ImageGridExampleTests.m */; }; 18 | 4C39C56BAD484C67AA576FFA /* libPods-ImageGridExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CA3E69C5B9553B26FBA2DF04 /* libPods-ImageGridExample.a */; }; 19 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; 20 | 92E8147E25E79BB100487F1F /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92E8147D25E79BB100487F1F /* File.swift */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A; 29 | remoteInfo = ImageGridExample; 30 | }; 31 | 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */ = { 32 | isa = PBXContainerItemProxy; 33 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 34 | proxyType = 1; 35 | remoteGlobalIDString = 2D02E47A1E0B4A5D006451C7; 36 | remoteInfo = "ImageGridExample-tvOS"; 37 | }; 38 | /* End PBXContainerItemProxy section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; 42 | 00E356EE1AD99517003FC87E /* ImageGridExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ImageGridExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | 00E356F21AD99517003FC87E /* ImageGridExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ImageGridExampleTests.m; sourceTree = ""; }; 45 | 13B07F961A680F5B00A75B9A /* ImageGridExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ImageGridExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = ImageGridExample/AppDelegate.h; sourceTree = ""; }; 47 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = ImageGridExample/AppDelegate.m; sourceTree = ""; }; 48 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = ImageGridExample/Images.xcassets; sourceTree = ""; }; 49 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ImageGridExample/Info.plist; sourceTree = ""; }; 50 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = ImageGridExample/main.m; sourceTree = ""; }; 51 | 2D02E47B1E0B4A5D006451C7 /* ImageGridExample-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ImageGridExample-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 2D02E4901E0B4A5D006451C7 /* ImageGridExample-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ImageGridExample-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 47F7ED3B7971BE374F7B8635 /* Pods-ImageGridExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ImageGridExample.debug.xcconfig"; path = "Target Support Files/Pods-ImageGridExample/Pods-ImageGridExample.debug.xcconfig"; sourceTree = ""; }; 54 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = ImageGridExample/LaunchScreen.storyboard; sourceTree = ""; }; 55 | 92E8147C25E79BB100487F1F /* ImageGridExample-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ImageGridExample-Bridging-Header.h"; sourceTree = ""; }; 56 | 92E8147D25E79BB100487F1F /* File.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = ""; }; 57 | CA3E69C5B9553B26FBA2DF04 /* libPods-ImageGridExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ImageGridExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 58 | E00ACF0FDA8BF921659E2F9A /* Pods-ImageGridExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ImageGridExample.release.xcconfig"; path = "Target Support Files/Pods-ImageGridExample/Pods-ImageGridExample.release.xcconfig"; sourceTree = ""; }; 59 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; 60 | ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; }; 61 | /* End PBXFileReference section */ 62 | 63 | /* Begin PBXFrameworksBuildPhase section */ 64 | 00E356EB1AD99517003FC87E /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | 4C39C56BAD484C67AA576FFA /* libPods-ImageGridExample.a in Frameworks */, 76 | ); 77 | runOnlyForDeploymentPostprocessing = 0; 78 | }; 79 | 2D02E4781E0B4A5D006451C7 /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | ); 84 | runOnlyForDeploymentPostprocessing = 0; 85 | }; 86 | 2D02E48D1E0B4A5D006451C7 /* Frameworks */ = { 87 | isa = PBXFrameworksBuildPhase; 88 | buildActionMask = 2147483647; 89 | files = ( 90 | ); 91 | runOnlyForDeploymentPostprocessing = 0; 92 | }; 93 | /* End PBXFrameworksBuildPhase section */ 94 | 95 | /* Begin PBXGroup section */ 96 | 00E356EF1AD99517003FC87E /* ImageGridExampleTests */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 00E356F21AD99517003FC87E /* ImageGridExampleTests.m */, 100 | 00E356F01AD99517003FC87E /* Supporting Files */, 101 | ); 102 | path = ImageGridExampleTests; 103 | sourceTree = ""; 104 | }; 105 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 00E356F11AD99517003FC87E /* Info.plist */, 109 | ); 110 | name = "Supporting Files"; 111 | sourceTree = ""; 112 | }; 113 | 13B07FAE1A68108700A75B9A /* ImageGridExample */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 117 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 118 | 13B07FB01A68108700A75B9A /* AppDelegate.m */, 119 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 120 | 13B07FB61A68108700A75B9A /* Info.plist */, 121 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */, 122 | 13B07FB71A68108700A75B9A /* main.m */, 123 | 92E8147D25E79BB100487F1F /* File.swift */, 124 | 92E8147C25E79BB100487F1F /* ImageGridExample-Bridging-Header.h */, 125 | ); 126 | name = ImageGridExample; 127 | sourceTree = ""; 128 | }; 129 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */, 133 | ED2971642150620600B7C4FE /* JavaScriptCore.framework */, 134 | CA3E69C5B9553B26FBA2DF04 /* libPods-ImageGridExample.a */, 135 | ); 136 | name = Frameworks; 137 | sourceTree = ""; 138 | }; 139 | 6B9684456A2045ADE5A6E47E /* Pods */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | 47F7ED3B7971BE374F7B8635 /* Pods-ImageGridExample.debug.xcconfig */, 143 | E00ACF0FDA8BF921659E2F9A /* Pods-ImageGridExample.release.xcconfig */, 144 | ); 145 | path = Pods; 146 | sourceTree = ""; 147 | }; 148 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 149 | isa = PBXGroup; 150 | children = ( 151 | ); 152 | name = Libraries; 153 | sourceTree = ""; 154 | }; 155 | 83CBB9F61A601CBA00E9B192 = { 156 | isa = PBXGroup; 157 | children = ( 158 | 13B07FAE1A68108700A75B9A /* ImageGridExample */, 159 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 160 | 00E356EF1AD99517003FC87E /* ImageGridExampleTests */, 161 | 83CBBA001A601CBA00E9B192 /* Products */, 162 | 2D16E6871FA4F8E400B85C8A /* Frameworks */, 163 | 6B9684456A2045ADE5A6E47E /* Pods */, 164 | ); 165 | indentWidth = 2; 166 | sourceTree = ""; 167 | tabWidth = 2; 168 | usesTabs = 0; 169 | }; 170 | 83CBBA001A601CBA00E9B192 /* Products */ = { 171 | isa = PBXGroup; 172 | children = ( 173 | 13B07F961A680F5B00A75B9A /* ImageGridExample.app */, 174 | 00E356EE1AD99517003FC87E /* ImageGridExampleTests.xctest */, 175 | 2D02E47B1E0B4A5D006451C7 /* ImageGridExample-tvOS.app */, 176 | 2D02E4901E0B4A5D006451C7 /* ImageGridExample-tvOSTests.xctest */, 177 | ); 178 | name = Products; 179 | sourceTree = ""; 180 | }; 181 | /* End PBXGroup section */ 182 | 183 | /* Begin PBXNativeTarget section */ 184 | 00E356ED1AD99517003FC87E /* ImageGridExampleTests */ = { 185 | isa = PBXNativeTarget; 186 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "ImageGridExampleTests" */; 187 | buildPhases = ( 188 | 00E356EA1AD99517003FC87E /* Sources */, 189 | 00E356EB1AD99517003FC87E /* Frameworks */, 190 | 00E356EC1AD99517003FC87E /* Resources */, 191 | ); 192 | buildRules = ( 193 | ); 194 | dependencies = ( 195 | 00E356F51AD99517003FC87E /* PBXTargetDependency */, 196 | ); 197 | name = ImageGridExampleTests; 198 | productName = ImageGridExampleTests; 199 | productReference = 00E356EE1AD99517003FC87E /* ImageGridExampleTests.xctest */; 200 | productType = "com.apple.product-type.bundle.unit-test"; 201 | }; 202 | 13B07F861A680F5B00A75B9A /* ImageGridExample */ = { 203 | isa = PBXNativeTarget; 204 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ImageGridExample" */; 205 | buildPhases = ( 206 | 4F0A6FC082772762E3E4C96C /* [CP] Check Pods Manifest.lock */, 207 | FD10A7F022414F080027D42C /* Start Packager */, 208 | 13B07F871A680F5B00A75B9A /* Sources */, 209 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 210 | 13B07F8E1A680F5B00A75B9A /* Resources */, 211 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 212 | C1D60D28B925C94BD88E79D7 /* [CP] Copy Pods Resources */, 213 | ); 214 | buildRules = ( 215 | ); 216 | dependencies = ( 217 | ); 218 | name = ImageGridExample; 219 | productName = ImageGridExample; 220 | productReference = 13B07F961A680F5B00A75B9A /* ImageGridExample.app */; 221 | productType = "com.apple.product-type.application"; 222 | }; 223 | 2D02E47A1E0B4A5D006451C7 /* ImageGridExample-tvOS */ = { 224 | isa = PBXNativeTarget; 225 | buildConfigurationList = 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "ImageGridExample-tvOS" */; 226 | buildPhases = ( 227 | FD10A7F122414F3F0027D42C /* Start Packager */, 228 | 2D02E4771E0B4A5D006451C7 /* Sources */, 229 | 2D02E4781E0B4A5D006451C7 /* Frameworks */, 230 | 2D02E4791E0B4A5D006451C7 /* Resources */, 231 | 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */, 232 | ); 233 | buildRules = ( 234 | ); 235 | dependencies = ( 236 | ); 237 | name = "ImageGridExample-tvOS"; 238 | productName = "ImageGridExample-tvOS"; 239 | productReference = 2D02E47B1E0B4A5D006451C7 /* ImageGridExample-tvOS.app */; 240 | productType = "com.apple.product-type.application"; 241 | }; 242 | 2D02E48F1E0B4A5D006451C7 /* ImageGridExample-tvOSTests */ = { 243 | isa = PBXNativeTarget; 244 | buildConfigurationList = 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "ImageGridExample-tvOSTests" */; 245 | buildPhases = ( 246 | 2D02E48C1E0B4A5D006451C7 /* Sources */, 247 | 2D02E48D1E0B4A5D006451C7 /* Frameworks */, 248 | 2D02E48E1E0B4A5D006451C7 /* Resources */, 249 | ); 250 | buildRules = ( 251 | ); 252 | dependencies = ( 253 | 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */, 254 | ); 255 | name = "ImageGridExample-tvOSTests"; 256 | productName = "ImageGridExample-tvOSTests"; 257 | productReference = 2D02E4901E0B4A5D006451C7 /* ImageGridExample-tvOSTests.xctest */; 258 | productType = "com.apple.product-type.bundle.unit-test"; 259 | }; 260 | /* End PBXNativeTarget section */ 261 | 262 | /* Begin PBXProject section */ 263 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 264 | isa = PBXProject; 265 | attributes = { 266 | LastUpgradeCheck = 1130; 267 | TargetAttributes = { 268 | 00E356ED1AD99517003FC87E = { 269 | CreatedOnToolsVersion = 6.2; 270 | TestTargetID = 13B07F861A680F5B00A75B9A; 271 | }; 272 | 13B07F861A680F5B00A75B9A = { 273 | LastSwiftMigration = 1240; 274 | }; 275 | 2D02E47A1E0B4A5D006451C7 = { 276 | CreatedOnToolsVersion = 8.2.1; 277 | ProvisioningStyle = Automatic; 278 | }; 279 | 2D02E48F1E0B4A5D006451C7 = { 280 | CreatedOnToolsVersion = 8.2.1; 281 | ProvisioningStyle = Automatic; 282 | TestTargetID = 2D02E47A1E0B4A5D006451C7; 283 | }; 284 | }; 285 | }; 286 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ImageGridExample" */; 287 | compatibilityVersion = "Xcode 3.2"; 288 | developmentRegion = en; 289 | hasScannedForEncodings = 0; 290 | knownRegions = ( 291 | en, 292 | Base, 293 | ); 294 | mainGroup = 83CBB9F61A601CBA00E9B192; 295 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 296 | projectDirPath = ""; 297 | projectRoot = ""; 298 | targets = ( 299 | 13B07F861A680F5B00A75B9A /* ImageGridExample */, 300 | 00E356ED1AD99517003FC87E /* ImageGridExampleTests */, 301 | 2D02E47A1E0B4A5D006451C7 /* ImageGridExample-tvOS */, 302 | 2D02E48F1E0B4A5D006451C7 /* ImageGridExample-tvOSTests */, 303 | ); 304 | }; 305 | /* End PBXProject section */ 306 | 307 | /* Begin PBXResourcesBuildPhase section */ 308 | 00E356EC1AD99517003FC87E /* Resources */ = { 309 | isa = PBXResourcesBuildPhase; 310 | buildActionMask = 2147483647; 311 | files = ( 312 | ); 313 | runOnlyForDeploymentPostprocessing = 0; 314 | }; 315 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 316 | isa = PBXResourcesBuildPhase; 317 | buildActionMask = 2147483647; 318 | files = ( 319 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */, 320 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 321 | ); 322 | runOnlyForDeploymentPostprocessing = 0; 323 | }; 324 | 2D02E4791E0B4A5D006451C7 /* Resources */ = { 325 | isa = PBXResourcesBuildPhase; 326 | buildActionMask = 2147483647; 327 | files = ( 328 | 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */, 329 | ); 330 | runOnlyForDeploymentPostprocessing = 0; 331 | }; 332 | 2D02E48E1E0B4A5D006451C7 /* Resources */ = { 333 | isa = PBXResourcesBuildPhase; 334 | buildActionMask = 2147483647; 335 | files = ( 336 | ); 337 | runOnlyForDeploymentPostprocessing = 0; 338 | }; 339 | /* End PBXResourcesBuildPhase section */ 340 | 341 | /* Begin PBXShellScriptBuildPhase section */ 342 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 343 | isa = PBXShellScriptBuildPhase; 344 | buildActionMask = 2147483647; 345 | files = ( 346 | ); 347 | inputPaths = ( 348 | ); 349 | name = "Bundle React Native code and images"; 350 | outputPaths = ( 351 | ); 352 | runOnlyForDeploymentPostprocessing = 0; 353 | shellPath = /bin/sh; 354 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; 355 | }; 356 | 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = { 357 | isa = PBXShellScriptBuildPhase; 358 | buildActionMask = 2147483647; 359 | files = ( 360 | ); 361 | inputPaths = ( 362 | ); 363 | name = "Bundle React Native Code And Images"; 364 | outputPaths = ( 365 | ); 366 | runOnlyForDeploymentPostprocessing = 0; 367 | shellPath = /bin/sh; 368 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; 369 | }; 370 | 4F0A6FC082772762E3E4C96C /* [CP] Check Pods Manifest.lock */ = { 371 | isa = PBXShellScriptBuildPhase; 372 | buildActionMask = 2147483647; 373 | files = ( 374 | ); 375 | inputFileListPaths = ( 376 | ); 377 | inputPaths = ( 378 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 379 | "${PODS_ROOT}/Manifest.lock", 380 | ); 381 | name = "[CP] Check Pods Manifest.lock"; 382 | outputFileListPaths = ( 383 | ); 384 | outputPaths = ( 385 | "$(DERIVED_FILE_DIR)/Pods-ImageGridExample-checkManifestLockResult.txt", 386 | ); 387 | runOnlyForDeploymentPostprocessing = 0; 388 | shellPath = /bin/sh; 389 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 390 | showEnvVarsInLog = 0; 391 | }; 392 | C1D60D28B925C94BD88E79D7 /* [CP] Copy Pods Resources */ = { 393 | isa = PBXShellScriptBuildPhase; 394 | buildActionMask = 2147483647; 395 | files = ( 396 | ); 397 | inputPaths = ( 398 | "${PODS_ROOT}/Target Support Files/Pods-ImageGridExample/Pods-ImageGridExample-resources.sh", 399 | "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle", 400 | "${PODS_ROOT}/TLPhotoPicker/TLPhotoPicker/TLPhotoPickerController.bundle", 401 | "${PODS_CONFIGURATION_BUILD_DIR}/TLPhotoPicker/TLPhotoPicker.bundle", 402 | "${PODS_ROOT}/../../node_modules/@baronha/react-native-multiple-image-picker/ios/MultipleImagePicker.bundle", 403 | "${PODS_CONFIGURATION_BUILD_DIR}/react-native-multiple-image-picker/MultipleImagePicker.bundle", 404 | ); 405 | name = "[CP] Copy Pods Resources"; 406 | outputPaths = ( 407 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle", 408 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/TLPhotoPickerController.bundle", 409 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/TLPhotoPicker.bundle", 410 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MultipleImagePicker.bundle", 411 | ); 412 | runOnlyForDeploymentPostprocessing = 0; 413 | shellPath = /bin/sh; 414 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ImageGridExample/Pods-ImageGridExample-resources.sh\"\n"; 415 | showEnvVarsInLog = 0; 416 | }; 417 | FD10A7F022414F080027D42C /* Start Packager */ = { 418 | isa = PBXShellScriptBuildPhase; 419 | buildActionMask = 2147483647; 420 | files = ( 421 | ); 422 | inputFileListPaths = ( 423 | ); 424 | inputPaths = ( 425 | ); 426 | name = "Start Packager"; 427 | outputFileListPaths = ( 428 | ); 429 | outputPaths = ( 430 | ); 431 | runOnlyForDeploymentPostprocessing = 0; 432 | shellPath = /bin/sh; 433 | shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; 434 | showEnvVarsInLog = 0; 435 | }; 436 | FD10A7F122414F3F0027D42C /* Start Packager */ = { 437 | isa = PBXShellScriptBuildPhase; 438 | buildActionMask = 2147483647; 439 | files = ( 440 | ); 441 | inputFileListPaths = ( 442 | ); 443 | inputPaths = ( 444 | ); 445 | name = "Start Packager"; 446 | outputFileListPaths = ( 447 | ); 448 | outputPaths = ( 449 | ); 450 | runOnlyForDeploymentPostprocessing = 0; 451 | shellPath = /bin/sh; 452 | shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; 453 | showEnvVarsInLog = 0; 454 | }; 455 | /* End PBXShellScriptBuildPhase section */ 456 | 457 | /* Begin PBXSourcesBuildPhase section */ 458 | 00E356EA1AD99517003FC87E /* Sources */ = { 459 | isa = PBXSourcesBuildPhase; 460 | buildActionMask = 2147483647; 461 | files = ( 462 | 00E356F31AD99517003FC87E /* ImageGridExampleTests.m in Sources */, 463 | ); 464 | runOnlyForDeploymentPostprocessing = 0; 465 | }; 466 | 13B07F871A680F5B00A75B9A /* Sources */ = { 467 | isa = PBXSourcesBuildPhase; 468 | buildActionMask = 2147483647; 469 | files = ( 470 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 471 | 92E8147E25E79BB100487F1F /* File.swift in Sources */, 472 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 473 | ); 474 | runOnlyForDeploymentPostprocessing = 0; 475 | }; 476 | 2D02E4771E0B4A5D006451C7 /* Sources */ = { 477 | isa = PBXSourcesBuildPhase; 478 | buildActionMask = 2147483647; 479 | files = ( 480 | 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */, 481 | 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */, 482 | ); 483 | runOnlyForDeploymentPostprocessing = 0; 484 | }; 485 | 2D02E48C1E0B4A5D006451C7 /* Sources */ = { 486 | isa = PBXSourcesBuildPhase; 487 | buildActionMask = 2147483647; 488 | files = ( 489 | 2DCD954D1E0B4F2C00145EB5 /* ImageGridExampleTests.m in Sources */, 490 | ); 491 | runOnlyForDeploymentPostprocessing = 0; 492 | }; 493 | /* End PBXSourcesBuildPhase section */ 494 | 495 | /* Begin PBXTargetDependency section */ 496 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { 497 | isa = PBXTargetDependency; 498 | target = 13B07F861A680F5B00A75B9A /* ImageGridExample */; 499 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; 500 | }; 501 | 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */ = { 502 | isa = PBXTargetDependency; 503 | target = 2D02E47A1E0B4A5D006451C7 /* ImageGridExample-tvOS */; 504 | targetProxy = 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */; 505 | }; 506 | /* End PBXTargetDependency section */ 507 | 508 | /* Begin XCBuildConfiguration section */ 509 | 00E356F61AD99517003FC87E /* Debug */ = { 510 | isa = XCBuildConfiguration; 511 | buildSettings = { 512 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 513 | BUNDLE_LOADER = "$(TEST_HOST)"; 514 | GCC_PREPROCESSOR_DEFINITIONS = ( 515 | "DEBUG=1", 516 | "$(inherited)", 517 | ); 518 | INFOPLIST_FILE = ImageGridExampleTests/Info.plist; 519 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 520 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 521 | OTHER_LDFLAGS = ( 522 | "-ObjC", 523 | "-lc++", 524 | "$(inherited)", 525 | ); 526 | PRODUCT_BUNDLE_IDENTIFIER = com.example.reactnativeimagegrid; 527 | PRODUCT_NAME = "$(TARGET_NAME)"; 528 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ImageGridExample.app/ImageGridExample"; 529 | }; 530 | name = Debug; 531 | }; 532 | 00E356F71AD99517003FC87E /* Release */ = { 533 | isa = XCBuildConfiguration; 534 | buildSettings = { 535 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 536 | BUNDLE_LOADER = "$(TEST_HOST)"; 537 | COPY_PHASE_STRIP = NO; 538 | INFOPLIST_FILE = ImageGridExampleTests/Info.plist; 539 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 540 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 541 | OTHER_LDFLAGS = ( 542 | "-ObjC", 543 | "-lc++", 544 | "$(inherited)", 545 | ); 546 | PRODUCT_BUNDLE_IDENTIFIER = com.example.reactnativeimagegrid; 547 | PRODUCT_NAME = "$(TARGET_NAME)"; 548 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ImageGridExample.app/ImageGridExample"; 549 | }; 550 | name = Release; 551 | }; 552 | 13B07F941A680F5B00A75B9A /* Debug */ = { 553 | isa = XCBuildConfiguration; 554 | baseConfigurationReference = 47F7ED3B7971BE374F7B8635 /* Pods-ImageGridExample.debug.xcconfig */; 555 | buildSettings = { 556 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 557 | CLANG_ENABLE_MODULES = YES; 558 | CURRENT_PROJECT_VERSION = 1; 559 | ENABLE_BITCODE = NO; 560 | INFOPLIST_FILE = ImageGridExample/Info.plist; 561 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 562 | OTHER_LDFLAGS = ( 563 | "$(inherited)", 564 | "-ObjC", 565 | "-lc++", 566 | ); 567 | PRODUCT_BUNDLE_IDENTIFIER = com.example.reactnativeimagegrid; 568 | PRODUCT_NAME = ImageGridExample; 569 | SWIFT_OBJC_BRIDGING_HEADER = "ImageGridExample-Bridging-Header.h"; 570 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 571 | SWIFT_VERSION = 5.0; 572 | VERSIONING_SYSTEM = "apple-generic"; 573 | }; 574 | name = Debug; 575 | }; 576 | 13B07F951A680F5B00A75B9A /* Release */ = { 577 | isa = XCBuildConfiguration; 578 | baseConfigurationReference = E00ACF0FDA8BF921659E2F9A /* Pods-ImageGridExample.release.xcconfig */; 579 | buildSettings = { 580 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 581 | CLANG_ENABLE_MODULES = YES; 582 | CURRENT_PROJECT_VERSION = 1; 583 | INFOPLIST_FILE = ImageGridExample/Info.plist; 584 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 585 | OTHER_LDFLAGS = ( 586 | "$(inherited)", 587 | "-ObjC", 588 | "-lc++", 589 | ); 590 | PRODUCT_BUNDLE_IDENTIFIER = com.example.reactnativeimagegrid; 591 | PRODUCT_NAME = ImageGridExample; 592 | SWIFT_OBJC_BRIDGING_HEADER = "ImageGridExample-Bridging-Header.h"; 593 | SWIFT_VERSION = 5.0; 594 | VERSIONING_SYSTEM = "apple-generic"; 595 | }; 596 | name = Release; 597 | }; 598 | 2D02E4971E0B4A5E006451C7 /* Debug */ = { 599 | isa = XCBuildConfiguration; 600 | buildSettings = { 601 | ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; 602 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 603 | CLANG_ANALYZER_NONNULL = YES; 604 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 605 | CLANG_WARN_INFINITE_RECURSION = YES; 606 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 607 | DEBUG_INFORMATION_FORMAT = dwarf; 608 | ENABLE_TESTABILITY = YES; 609 | GCC_NO_COMMON_BLOCKS = YES; 610 | INFOPLIST_FILE = "ImageGridExample-tvOS/Info.plist"; 611 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 612 | OTHER_LDFLAGS = ( 613 | "$(inherited)", 614 | "-ObjC", 615 | "-lc++", 616 | ); 617 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.ImageGridExample-tvOS"; 618 | PRODUCT_NAME = "$(TARGET_NAME)"; 619 | SDKROOT = appletvos; 620 | TARGETED_DEVICE_FAMILY = 3; 621 | TVOS_DEPLOYMENT_TARGET = 10.0; 622 | }; 623 | name = Debug; 624 | }; 625 | 2D02E4981E0B4A5E006451C7 /* Release */ = { 626 | isa = XCBuildConfiguration; 627 | buildSettings = { 628 | ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; 629 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 630 | CLANG_ANALYZER_NONNULL = YES; 631 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 632 | CLANG_WARN_INFINITE_RECURSION = YES; 633 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 634 | COPY_PHASE_STRIP = NO; 635 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 636 | GCC_NO_COMMON_BLOCKS = YES; 637 | INFOPLIST_FILE = "ImageGridExample-tvOS/Info.plist"; 638 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 639 | OTHER_LDFLAGS = ( 640 | "$(inherited)", 641 | "-ObjC", 642 | "-lc++", 643 | ); 644 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.ImageGridExample-tvOS"; 645 | PRODUCT_NAME = "$(TARGET_NAME)"; 646 | SDKROOT = appletvos; 647 | TARGETED_DEVICE_FAMILY = 3; 648 | TVOS_DEPLOYMENT_TARGET = 10.0; 649 | }; 650 | name = Release; 651 | }; 652 | 2D02E4991E0B4A5E006451C7 /* Debug */ = { 653 | isa = XCBuildConfiguration; 654 | buildSettings = { 655 | BUNDLE_LOADER = "$(TEST_HOST)"; 656 | CLANG_ANALYZER_NONNULL = YES; 657 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 658 | CLANG_WARN_INFINITE_RECURSION = YES; 659 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 660 | DEBUG_INFORMATION_FORMAT = dwarf; 661 | ENABLE_TESTABILITY = YES; 662 | GCC_NO_COMMON_BLOCKS = YES; 663 | INFOPLIST_FILE = "ImageGridExample-tvOSTests/Info.plist"; 664 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 665 | OTHER_LDFLAGS = ( 666 | "$(inherited)", 667 | "-ObjC", 668 | "-lc++", 669 | ); 670 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.ImageGridExample-tvOSTests"; 671 | PRODUCT_NAME = "$(TARGET_NAME)"; 672 | SDKROOT = appletvos; 673 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ImageGridExample-tvOS.app/ImageGridExample-tvOS"; 674 | TVOS_DEPLOYMENT_TARGET = 10.1; 675 | }; 676 | name = Debug; 677 | }; 678 | 2D02E49A1E0B4A5E006451C7 /* Release */ = { 679 | isa = XCBuildConfiguration; 680 | buildSettings = { 681 | BUNDLE_LOADER = "$(TEST_HOST)"; 682 | CLANG_ANALYZER_NONNULL = YES; 683 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 684 | CLANG_WARN_INFINITE_RECURSION = YES; 685 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 686 | COPY_PHASE_STRIP = NO; 687 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 688 | GCC_NO_COMMON_BLOCKS = YES; 689 | INFOPLIST_FILE = "ImageGridExample-tvOSTests/Info.plist"; 690 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 691 | OTHER_LDFLAGS = ( 692 | "$(inherited)", 693 | "-ObjC", 694 | "-lc++", 695 | ); 696 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.ImageGridExample-tvOSTests"; 697 | PRODUCT_NAME = "$(TARGET_NAME)"; 698 | SDKROOT = appletvos; 699 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ImageGridExample-tvOS.app/ImageGridExample-tvOS"; 700 | TVOS_DEPLOYMENT_TARGET = 10.1; 701 | }; 702 | name = Release; 703 | }; 704 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 705 | isa = XCBuildConfiguration; 706 | buildSettings = { 707 | ALWAYS_SEARCH_USER_PATHS = NO; 708 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 709 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 710 | CLANG_CXX_LIBRARY = "libc++"; 711 | CLANG_ENABLE_MODULES = YES; 712 | CLANG_ENABLE_OBJC_ARC = YES; 713 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 714 | CLANG_WARN_BOOL_CONVERSION = YES; 715 | CLANG_WARN_COMMA = YES; 716 | CLANG_WARN_CONSTANT_CONVERSION = YES; 717 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 718 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 719 | CLANG_WARN_EMPTY_BODY = YES; 720 | CLANG_WARN_ENUM_CONVERSION = YES; 721 | CLANG_WARN_INFINITE_RECURSION = YES; 722 | CLANG_WARN_INT_CONVERSION = YES; 723 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 724 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 725 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 726 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 727 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 728 | CLANG_WARN_STRICT_PROTOTYPES = YES; 729 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 730 | CLANG_WARN_UNREACHABLE_CODE = YES; 731 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 732 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 733 | COPY_PHASE_STRIP = NO; 734 | ENABLE_STRICT_OBJC_MSGSEND = YES; 735 | ENABLE_TESTABILITY = YES; 736 | GCC_C_LANGUAGE_STANDARD = gnu99; 737 | GCC_DYNAMIC_NO_PIC = NO; 738 | GCC_NO_COMMON_BLOCKS = YES; 739 | GCC_OPTIMIZATION_LEVEL = 0; 740 | GCC_PREPROCESSOR_DEFINITIONS = ( 741 | "DEBUG=1", 742 | "$(inherited)", 743 | ); 744 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 745 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 746 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 747 | GCC_WARN_UNDECLARED_SELECTOR = YES; 748 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 749 | GCC_WARN_UNUSED_FUNCTION = YES; 750 | GCC_WARN_UNUSED_VARIABLE = YES; 751 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 752 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)"; 753 | LIBRARY_SEARCH_PATHS = ( 754 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 755 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.3/$(PLATFORM_NAME)\"", 756 | "\"$(inherited)\"", 757 | ); 758 | MTL_ENABLE_DEBUG_INFO = YES; 759 | ONLY_ACTIVE_ARCH = YES; 760 | SDKROOT = iphoneos; 761 | }; 762 | name = Debug; 763 | }; 764 | 83CBBA211A601CBA00E9B192 /* Release */ = { 765 | isa = XCBuildConfiguration; 766 | buildSettings = { 767 | ALWAYS_SEARCH_USER_PATHS = NO; 768 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 769 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 770 | CLANG_CXX_LIBRARY = "libc++"; 771 | CLANG_ENABLE_MODULES = YES; 772 | CLANG_ENABLE_OBJC_ARC = YES; 773 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 774 | CLANG_WARN_BOOL_CONVERSION = YES; 775 | CLANG_WARN_COMMA = YES; 776 | CLANG_WARN_CONSTANT_CONVERSION = YES; 777 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 778 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 779 | CLANG_WARN_EMPTY_BODY = YES; 780 | CLANG_WARN_ENUM_CONVERSION = YES; 781 | CLANG_WARN_INFINITE_RECURSION = YES; 782 | CLANG_WARN_INT_CONVERSION = YES; 783 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 784 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 785 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 786 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 787 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 788 | CLANG_WARN_STRICT_PROTOTYPES = YES; 789 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 790 | CLANG_WARN_UNREACHABLE_CODE = YES; 791 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 792 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 793 | COPY_PHASE_STRIP = YES; 794 | ENABLE_NS_ASSERTIONS = NO; 795 | ENABLE_STRICT_OBJC_MSGSEND = YES; 796 | GCC_C_LANGUAGE_STANDARD = gnu99; 797 | GCC_NO_COMMON_BLOCKS = YES; 798 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 799 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 800 | GCC_WARN_UNDECLARED_SELECTOR = YES; 801 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 802 | GCC_WARN_UNUSED_FUNCTION = YES; 803 | GCC_WARN_UNUSED_VARIABLE = YES; 804 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 805 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)"; 806 | LIBRARY_SEARCH_PATHS = ( 807 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 808 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.3/$(PLATFORM_NAME)\"", 809 | "\"$(inherited)\"", 810 | ); 811 | MTL_ENABLE_DEBUG_INFO = NO; 812 | SDKROOT = iphoneos; 813 | VALIDATE_PRODUCT = YES; 814 | }; 815 | name = Release; 816 | }; 817 | /* End XCBuildConfiguration section */ 818 | 819 | /* Begin XCConfigurationList section */ 820 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "ImageGridExampleTests" */ = { 821 | isa = XCConfigurationList; 822 | buildConfigurations = ( 823 | 00E356F61AD99517003FC87E /* Debug */, 824 | 00E356F71AD99517003FC87E /* Release */, 825 | ); 826 | defaultConfigurationIsVisible = 0; 827 | defaultConfigurationName = Release; 828 | }; 829 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ImageGridExample" */ = { 830 | isa = XCConfigurationList; 831 | buildConfigurations = ( 832 | 13B07F941A680F5B00A75B9A /* Debug */, 833 | 13B07F951A680F5B00A75B9A /* Release */, 834 | ); 835 | defaultConfigurationIsVisible = 0; 836 | defaultConfigurationName = Release; 837 | }; 838 | 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "ImageGridExample-tvOS" */ = { 839 | isa = XCConfigurationList; 840 | buildConfigurations = ( 841 | 2D02E4971E0B4A5E006451C7 /* Debug */, 842 | 2D02E4981E0B4A5E006451C7 /* Release */, 843 | ); 844 | defaultConfigurationIsVisible = 0; 845 | defaultConfigurationName = Release; 846 | }; 847 | 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "ImageGridExample-tvOSTests" */ = { 848 | isa = XCConfigurationList; 849 | buildConfigurations = ( 850 | 2D02E4991E0B4A5E006451C7 /* Debug */, 851 | 2D02E49A1E0B4A5E006451C7 /* Release */, 852 | ); 853 | defaultConfigurationIsVisible = 0; 854 | defaultConfigurationName = Release; 855 | }; 856 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ImageGridExample" */ = { 857 | isa = XCConfigurationList; 858 | buildConfigurations = ( 859 | 83CBBA201A601CBA00E9B192 /* Debug */, 860 | 83CBBA211A601CBA00E9B192 /* Release */, 861 | ); 862 | defaultConfigurationIsVisible = 0; 863 | defaultConfigurationName = Release; 864 | }; 865 | /* End XCConfigurationList section */ 866 | }; 867 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 868 | } 869 | -------------------------------------------------------------------------------- /example/ios/ImageGridExample.xcodeproj/xcshareddata/xcschemes/ImageGridExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 81 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /example/ios/ImageGridExample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/ImageGridExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/ImageGridExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (nonatomic, strong) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /example/ios/ImageGridExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | 10 | #import 11 | #import 12 | #import 13 | 14 | #ifdef FB_SONARKIT_ENABLED 15 | #import 16 | #import 17 | #import 18 | #import 19 | #import 20 | #import 21 | static void InitializeFlipper(UIApplication *application) { 22 | FlipperClient *client = [FlipperClient sharedClient]; 23 | SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; 24 | [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; 25 | [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; 26 | [client addPlugin:[FlipperKitReactPlugin new]]; 27 | [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; 28 | [client start]; 29 | } 30 | #endif 31 | 32 | @implementation AppDelegate 33 | 34 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 35 | { 36 | #ifdef FB_SONARKIT_ENABLED 37 | InitializeFlipper(application); 38 | #endif 39 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 40 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 41 | moduleName:@"ImageGridExample" 42 | initialProperties:nil]; 43 | 44 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 45 | 46 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 47 | UIViewController *rootViewController = [UIViewController new]; 48 | rootViewController.view = rootView; 49 | self.window.rootViewController = rootViewController; 50 | [self.window makeKeyAndVisible]; 51 | return YES; 52 | } 53 | 54 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 55 | { 56 | #if DEBUG 57 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 58 | #else 59 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 60 | #endif 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /example/ios/ImageGridExample/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/ImageGridExample/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/ImageGridExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSCameraUsageDescription 6 | Camera Usage 7 | NSPhotoLibraryUsageDescription 8 | Photo Library Usage 9 | CFBundleDevelopmentRegion 10 | en 11 | CFBundleDisplayName 12 | ImageGrid Example 13 | CFBundleExecutable 14 | $(EXECUTABLE_NAME) 15 | CFBundleIdentifier 16 | $(PRODUCT_BUNDLE_IDENTIFIER) 17 | CFBundleInfoDictionaryVersion 18 | 6.0 19 | CFBundleName 20 | $(PRODUCT_NAME) 21 | CFBundlePackageType 22 | APPL 23 | CFBundleShortVersionString 24 | 1.0 25 | CFBundleSignature 26 | ???? 27 | CFBundleVersion 28 | 1 29 | LSRequiresIPhoneOS 30 | 31 | NSAppTransportSecurity 32 | 33 | NSAllowsArbitraryLoads 34 | 35 | NSExceptionDomains 36 | 37 | localhost 38 | 39 | NSExceptionAllowsInsecureHTTPLoads 40 | 41 | 42 | 43 | 44 | NSLocationWhenInUseUsageDescription 45 | 46 | UILaunchStoryboardName 47 | LaunchScreen 48 | UIRequiredDeviceCapabilities 49 | 50 | armv7 51 | 52 | UISupportedInterfaceOrientations 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationLandscapeLeft 56 | UIInterfaceOrientationLandscapeRight 57 | 58 | UIViewControllerBasedStatusBarAppearance 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /example/ios/ImageGridExample/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /example/ios/ImageGridExample/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | require_relative '../node_modules/react-native/scripts/react_native_pods' 2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | platform :ios, '10.0' 5 | 6 | target 'ImageGridExample' do 7 | config = use_native_modules! 8 | 9 | use_react_native!(:path => config["reactNativePath"]) 10 | 11 | 12 | # Enables Flipper. 13 | # 14 | # Note that if you have use_frameworks! enabled, Flipper will not work and 15 | # you should disable these next few lines. 16 | # use_flipper! 17 | # post_install do |installer| 18 | # flipper_post_install(installer) 19 | # end 20 | end 21 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - boost-for-react-native (1.63.0) 3 | - DoubleConversion (1.1.6) 4 | - FBLazyVector (0.63.4) 5 | - FBReactNativeSpec (0.63.4): 6 | - Folly (= 2020.01.13.00) 7 | - RCTRequired (= 0.63.4) 8 | - RCTTypeSafety (= 0.63.4) 9 | - React-Core (= 0.63.4) 10 | - React-jsi (= 0.63.4) 11 | - ReactCommon/turbomodule/core (= 0.63.4) 12 | - Folly (2020.01.13.00): 13 | - boost-for-react-native 14 | - DoubleConversion 15 | - Folly/Default (= 2020.01.13.00) 16 | - glog 17 | - Folly/Default (2020.01.13.00): 18 | - boost-for-react-native 19 | - DoubleConversion 20 | - glog 21 | - glog (0.3.5) 22 | - libwebp (1.2.0): 23 | - libwebp/demux (= 1.2.0) 24 | - libwebp/mux (= 1.2.0) 25 | - libwebp/webp (= 1.2.0) 26 | - libwebp/demux (1.2.0): 27 | - libwebp/webp 28 | - libwebp/mux (1.2.0): 29 | - libwebp/demux 30 | - libwebp/webp (1.2.0) 31 | - RCTRequired (0.63.4) 32 | - RCTTypeSafety (0.63.4): 33 | - FBLazyVector (= 0.63.4) 34 | - Folly (= 2020.01.13.00) 35 | - RCTRequired (= 0.63.4) 36 | - React-Core (= 0.63.4) 37 | - React (0.63.4): 38 | - React-Core (= 0.63.4) 39 | - React-Core/DevSupport (= 0.63.4) 40 | - React-Core/RCTWebSocket (= 0.63.4) 41 | - React-RCTActionSheet (= 0.63.4) 42 | - React-RCTAnimation (= 0.63.4) 43 | - React-RCTBlob (= 0.63.4) 44 | - React-RCTImage (= 0.63.4) 45 | - React-RCTLinking (= 0.63.4) 46 | - React-RCTNetwork (= 0.63.4) 47 | - React-RCTSettings (= 0.63.4) 48 | - React-RCTText (= 0.63.4) 49 | - React-RCTVibration (= 0.63.4) 50 | - React-callinvoker (0.63.4) 51 | - React-Core (0.63.4): 52 | - Folly (= 2020.01.13.00) 53 | - glog 54 | - React-Core/Default (= 0.63.4) 55 | - React-cxxreact (= 0.63.4) 56 | - React-jsi (= 0.63.4) 57 | - React-jsiexecutor (= 0.63.4) 58 | - Yoga 59 | - React-Core/CoreModulesHeaders (0.63.4): 60 | - Folly (= 2020.01.13.00) 61 | - glog 62 | - React-Core/Default 63 | - React-cxxreact (= 0.63.4) 64 | - React-jsi (= 0.63.4) 65 | - React-jsiexecutor (= 0.63.4) 66 | - Yoga 67 | - React-Core/Default (0.63.4): 68 | - Folly (= 2020.01.13.00) 69 | - glog 70 | - React-cxxreact (= 0.63.4) 71 | - React-jsi (= 0.63.4) 72 | - React-jsiexecutor (= 0.63.4) 73 | - Yoga 74 | - React-Core/DevSupport (0.63.4): 75 | - Folly (= 2020.01.13.00) 76 | - glog 77 | - React-Core/Default (= 0.63.4) 78 | - React-Core/RCTWebSocket (= 0.63.4) 79 | - React-cxxreact (= 0.63.4) 80 | - React-jsi (= 0.63.4) 81 | - React-jsiexecutor (= 0.63.4) 82 | - React-jsinspector (= 0.63.4) 83 | - Yoga 84 | - React-Core/RCTActionSheetHeaders (0.63.4): 85 | - Folly (= 2020.01.13.00) 86 | - glog 87 | - React-Core/Default 88 | - React-cxxreact (= 0.63.4) 89 | - React-jsi (= 0.63.4) 90 | - React-jsiexecutor (= 0.63.4) 91 | - Yoga 92 | - React-Core/RCTAnimationHeaders (0.63.4): 93 | - Folly (= 2020.01.13.00) 94 | - glog 95 | - React-Core/Default 96 | - React-cxxreact (= 0.63.4) 97 | - React-jsi (= 0.63.4) 98 | - React-jsiexecutor (= 0.63.4) 99 | - Yoga 100 | - React-Core/RCTBlobHeaders (0.63.4): 101 | - Folly (= 2020.01.13.00) 102 | - glog 103 | - React-Core/Default 104 | - React-cxxreact (= 0.63.4) 105 | - React-jsi (= 0.63.4) 106 | - React-jsiexecutor (= 0.63.4) 107 | - Yoga 108 | - React-Core/RCTImageHeaders (0.63.4): 109 | - Folly (= 2020.01.13.00) 110 | - glog 111 | - React-Core/Default 112 | - React-cxxreact (= 0.63.4) 113 | - React-jsi (= 0.63.4) 114 | - React-jsiexecutor (= 0.63.4) 115 | - Yoga 116 | - React-Core/RCTLinkingHeaders (0.63.4): 117 | - Folly (= 2020.01.13.00) 118 | - glog 119 | - React-Core/Default 120 | - React-cxxreact (= 0.63.4) 121 | - React-jsi (= 0.63.4) 122 | - React-jsiexecutor (= 0.63.4) 123 | - Yoga 124 | - React-Core/RCTNetworkHeaders (0.63.4): 125 | - Folly (= 2020.01.13.00) 126 | - glog 127 | - React-Core/Default 128 | - React-cxxreact (= 0.63.4) 129 | - React-jsi (= 0.63.4) 130 | - React-jsiexecutor (= 0.63.4) 131 | - Yoga 132 | - React-Core/RCTSettingsHeaders (0.63.4): 133 | - Folly (= 2020.01.13.00) 134 | - glog 135 | - React-Core/Default 136 | - React-cxxreact (= 0.63.4) 137 | - React-jsi (= 0.63.4) 138 | - React-jsiexecutor (= 0.63.4) 139 | - Yoga 140 | - React-Core/RCTTextHeaders (0.63.4): 141 | - Folly (= 2020.01.13.00) 142 | - glog 143 | - React-Core/Default 144 | - React-cxxreact (= 0.63.4) 145 | - React-jsi (= 0.63.4) 146 | - React-jsiexecutor (= 0.63.4) 147 | - Yoga 148 | - React-Core/RCTVibrationHeaders (0.63.4): 149 | - Folly (= 2020.01.13.00) 150 | - glog 151 | - React-Core/Default 152 | - React-cxxreact (= 0.63.4) 153 | - React-jsi (= 0.63.4) 154 | - React-jsiexecutor (= 0.63.4) 155 | - Yoga 156 | - React-Core/RCTWebSocket (0.63.4): 157 | - Folly (= 2020.01.13.00) 158 | - glog 159 | - React-Core/Default (= 0.63.4) 160 | - React-cxxreact (= 0.63.4) 161 | - React-jsi (= 0.63.4) 162 | - React-jsiexecutor (= 0.63.4) 163 | - Yoga 164 | - React-CoreModules (0.63.4): 165 | - FBReactNativeSpec (= 0.63.4) 166 | - Folly (= 2020.01.13.00) 167 | - RCTTypeSafety (= 0.63.4) 168 | - React-Core/CoreModulesHeaders (= 0.63.4) 169 | - React-jsi (= 0.63.4) 170 | - React-RCTImage (= 0.63.4) 171 | - ReactCommon/turbomodule/core (= 0.63.4) 172 | - React-cxxreact (0.63.4): 173 | - boost-for-react-native (= 1.63.0) 174 | - DoubleConversion 175 | - Folly (= 2020.01.13.00) 176 | - glog 177 | - React-callinvoker (= 0.63.4) 178 | - React-jsinspector (= 0.63.4) 179 | - React-jsi (0.63.4): 180 | - boost-for-react-native (= 1.63.0) 181 | - DoubleConversion 182 | - Folly (= 2020.01.13.00) 183 | - glog 184 | - React-jsi/Default (= 0.63.4) 185 | - React-jsi/Default (0.63.4): 186 | - boost-for-react-native (= 1.63.0) 187 | - DoubleConversion 188 | - Folly (= 2020.01.13.00) 189 | - glog 190 | - React-jsiexecutor (0.63.4): 191 | - DoubleConversion 192 | - Folly (= 2020.01.13.00) 193 | - glog 194 | - React-cxxreact (= 0.63.4) 195 | - React-jsi (= 0.63.4) 196 | - React-jsinspector (0.63.4) 197 | - react-native-multiple-image-picker (0.2.0): 198 | - React-Core 199 | - TLPhotoPicker 200 | - React-RCTActionSheet (0.63.4): 201 | - React-Core/RCTActionSheetHeaders (= 0.63.4) 202 | - React-RCTAnimation (0.63.4): 203 | - FBReactNativeSpec (= 0.63.4) 204 | - Folly (= 2020.01.13.00) 205 | - RCTTypeSafety (= 0.63.4) 206 | - React-Core/RCTAnimationHeaders (= 0.63.4) 207 | - React-jsi (= 0.63.4) 208 | - ReactCommon/turbomodule/core (= 0.63.4) 209 | - React-RCTBlob (0.63.4): 210 | - FBReactNativeSpec (= 0.63.4) 211 | - Folly (= 2020.01.13.00) 212 | - React-Core/RCTBlobHeaders (= 0.63.4) 213 | - React-Core/RCTWebSocket (= 0.63.4) 214 | - React-jsi (= 0.63.4) 215 | - React-RCTNetwork (= 0.63.4) 216 | - ReactCommon/turbomodule/core (= 0.63.4) 217 | - React-RCTImage (0.63.4): 218 | - FBReactNativeSpec (= 0.63.4) 219 | - Folly (= 2020.01.13.00) 220 | - RCTTypeSafety (= 0.63.4) 221 | - React-Core/RCTImageHeaders (= 0.63.4) 222 | - React-jsi (= 0.63.4) 223 | - React-RCTNetwork (= 0.63.4) 224 | - ReactCommon/turbomodule/core (= 0.63.4) 225 | - React-RCTLinking (0.63.4): 226 | - FBReactNativeSpec (= 0.63.4) 227 | - React-Core/RCTLinkingHeaders (= 0.63.4) 228 | - React-jsi (= 0.63.4) 229 | - ReactCommon/turbomodule/core (= 0.63.4) 230 | - React-RCTNetwork (0.63.4): 231 | - FBReactNativeSpec (= 0.63.4) 232 | - Folly (= 2020.01.13.00) 233 | - RCTTypeSafety (= 0.63.4) 234 | - React-Core/RCTNetworkHeaders (= 0.63.4) 235 | - React-jsi (= 0.63.4) 236 | - ReactCommon/turbomodule/core (= 0.63.4) 237 | - React-RCTSettings (0.63.4): 238 | - FBReactNativeSpec (= 0.63.4) 239 | - Folly (= 2020.01.13.00) 240 | - RCTTypeSafety (= 0.63.4) 241 | - React-Core/RCTSettingsHeaders (= 0.63.4) 242 | - React-jsi (= 0.63.4) 243 | - ReactCommon/turbomodule/core (= 0.63.4) 244 | - React-RCTText (0.63.4): 245 | - React-Core/RCTTextHeaders (= 0.63.4) 246 | - React-RCTVibration (0.63.4): 247 | - FBReactNativeSpec (= 0.63.4) 248 | - Folly (= 2020.01.13.00) 249 | - React-Core/RCTVibrationHeaders (= 0.63.4) 250 | - React-jsi (= 0.63.4) 251 | - ReactCommon/turbomodule/core (= 0.63.4) 252 | - ReactCommon/turbomodule/core (0.63.4): 253 | - DoubleConversion 254 | - Folly (= 2020.01.13.00) 255 | - glog 256 | - React-callinvoker (= 0.63.4) 257 | - React-Core (= 0.63.4) 258 | - React-cxxreact (= 0.63.4) 259 | - React-jsi (= 0.63.4) 260 | - RNFastImage (8.3.4): 261 | - React-Core 262 | - SDWebImage (~> 5.8) 263 | - SDWebImageWebPCoder (~> 0.6.1) 264 | - SDWebImage (5.10.4): 265 | - SDWebImage/Core (= 5.10.4) 266 | - SDWebImage/Core (5.10.4) 267 | - SDWebImageWebPCoder (0.6.1): 268 | - libwebp (~> 1.0) 269 | - SDWebImage/Core (~> 5.7) 270 | - TLPhotoPicker (2.1.3) 271 | - Yoga (1.14.0) 272 | 273 | DEPENDENCIES: 274 | - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) 275 | - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) 276 | - FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`) 277 | - Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`) 278 | - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) 279 | - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`) 280 | - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`) 281 | - React (from `../node_modules/react-native/`) 282 | - React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`) 283 | - React-Core (from `../node_modules/react-native/`) 284 | - React-Core/DevSupport (from `../node_modules/react-native/`) 285 | - React-Core/RCTWebSocket (from `../node_modules/react-native/`) 286 | - React-CoreModules (from `../node_modules/react-native/React/CoreModules`) 287 | - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`) 288 | - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`) 289 | - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) 290 | - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) 291 | - "react-native-multiple-image-picker (from `../node_modules/@baronha/react-native-multiple-image-picker`)" 292 | - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) 293 | - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) 294 | - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`) 295 | - React-RCTImage (from `../node_modules/react-native/Libraries/Image`) 296 | - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`) 297 | - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`) 298 | - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`) 299 | - React-RCTText (from `../node_modules/react-native/Libraries/Text`) 300 | - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) 301 | - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) 302 | - RNFastImage (from `../node_modules/react-native-fast-image`) 303 | - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) 304 | 305 | SPEC REPOS: 306 | trunk: 307 | - boost-for-react-native 308 | - libwebp 309 | - SDWebImage 310 | - SDWebImageWebPCoder 311 | - TLPhotoPicker 312 | 313 | EXTERNAL SOURCES: 314 | DoubleConversion: 315 | :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" 316 | FBLazyVector: 317 | :path: "../node_modules/react-native/Libraries/FBLazyVector" 318 | FBReactNativeSpec: 319 | :path: "../node_modules/react-native/Libraries/FBReactNativeSpec" 320 | Folly: 321 | :podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec" 322 | glog: 323 | :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" 324 | RCTRequired: 325 | :path: "../node_modules/react-native/Libraries/RCTRequired" 326 | RCTTypeSafety: 327 | :path: "../node_modules/react-native/Libraries/TypeSafety" 328 | React: 329 | :path: "../node_modules/react-native/" 330 | React-callinvoker: 331 | :path: "../node_modules/react-native/ReactCommon/callinvoker" 332 | React-Core: 333 | :path: "../node_modules/react-native/" 334 | React-CoreModules: 335 | :path: "../node_modules/react-native/React/CoreModules" 336 | React-cxxreact: 337 | :path: "../node_modules/react-native/ReactCommon/cxxreact" 338 | React-jsi: 339 | :path: "../node_modules/react-native/ReactCommon/jsi" 340 | React-jsiexecutor: 341 | :path: "../node_modules/react-native/ReactCommon/jsiexecutor" 342 | React-jsinspector: 343 | :path: "../node_modules/react-native/ReactCommon/jsinspector" 344 | react-native-multiple-image-picker: 345 | :path: "../node_modules/@baronha/react-native-multiple-image-picker" 346 | React-RCTActionSheet: 347 | :path: "../node_modules/react-native/Libraries/ActionSheetIOS" 348 | React-RCTAnimation: 349 | :path: "../node_modules/react-native/Libraries/NativeAnimation" 350 | React-RCTBlob: 351 | :path: "../node_modules/react-native/Libraries/Blob" 352 | React-RCTImage: 353 | :path: "../node_modules/react-native/Libraries/Image" 354 | React-RCTLinking: 355 | :path: "../node_modules/react-native/Libraries/LinkingIOS" 356 | React-RCTNetwork: 357 | :path: "../node_modules/react-native/Libraries/Network" 358 | React-RCTSettings: 359 | :path: "../node_modules/react-native/Libraries/Settings" 360 | React-RCTText: 361 | :path: "../node_modules/react-native/Libraries/Text" 362 | React-RCTVibration: 363 | :path: "../node_modules/react-native/Libraries/Vibration" 364 | ReactCommon: 365 | :path: "../node_modules/react-native/ReactCommon" 366 | RNFastImage: 367 | :path: "../node_modules/react-native-fast-image" 368 | Yoga: 369 | :path: "../node_modules/react-native/ReactCommon/yoga" 370 | 371 | SPEC CHECKSUMS: 372 | boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c 373 | DoubleConversion: cde416483dac037923206447da6e1454df403714 374 | FBLazyVector: 3bb422f41b18121b71783a905c10e58606f7dc3e 375 | FBReactNativeSpec: f2c97f2529dd79c083355182cc158c9f98f4bd6e 376 | Folly: b73c3869541e86821df3c387eb0af5f65addfab4 377 | glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3 378 | libwebp: e90b9c01d99205d03b6bb8f2c8c415e5a4ef66f0 379 | RCTRequired: 082f10cd3f905d6c124597fd1c14f6f2655ff65e 380 | RCTTypeSafety: 8c9c544ecbf20337d069e4ae7fd9a377aadf504b 381 | React: b0a957a2c44da4113b0c4c9853d8387f8e64e615 382 | React-callinvoker: c3f44dd3cb195b6aa46621fff95ded79d59043fe 383 | React-Core: d3b2a1ac9a2c13c3bcde712d9281fc1c8a5b315b 384 | React-CoreModules: 0581ff36cb797da0943d424f69e7098e43e9be60 385 | React-cxxreact: c1480d4fda5720086c90df537ee7d285d4c57ac3 386 | React-jsi: a0418934cf48f25b485631deb27c64dc40fb4c31 387 | React-jsiexecutor: 93bd528844ad21dc07aab1c67cb10abae6df6949 388 | React-jsinspector: 58aef7155bc9a9683f5b60b35eccea8722a4f53a 389 | react-native-multiple-image-picker: 11cff69eecd2fec69e9a2aad6e39bae88b74ddde 390 | React-RCTActionSheet: 89a0ca9f4a06c1f93c26067af074ccdce0f40336 391 | React-RCTAnimation: 1bde3ecc0c104c55df246eda516e0deb03c4e49b 392 | React-RCTBlob: a97d378b527740cc667e03ebfa183a75231ab0f0 393 | React-RCTImage: c1b1f2d3f43a4a528c8946d6092384b5c880d2f0 394 | React-RCTLinking: 35ae4ab9dc0410d1fcbdce4d7623194a27214fb2 395 | React-RCTNetwork: 29ec2696f8d8cfff7331fac83d3e893c95ef43ae 396 | React-RCTSettings: 60f0691bba2074ef394f95d4c2265ec284e0a46a 397 | React-RCTText: 5c51df3f08cb9dedc6e790161195d12bac06101c 398 | React-RCTVibration: ae4f914cfe8de7d4de95ae1ea6cc8f6315d73d9d 399 | ReactCommon: 73d79c7039f473b76db6ff7c6b159c478acbbb3b 400 | RNFastImage: d4870d58f5936111c56218dbd7fcfc18e65b58ff 401 | SDWebImage: c666b97e1fa9c64b4909816a903322018f0a9c84 402 | SDWebImageWebPCoder: d0dac55073088d24b2ac1b191a71a8f8d0adac21 403 | TLPhotoPicker: 2c4a20d62952bd368edbf44d18476f663a718ada 404 | Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6 405 | 406 | PODFILE CHECKSUM: 42c41325f5293b7a4ed18eddcecc7da09b77693e 407 | 408 | COCOAPODS: 1.10.2 409 | -------------------------------------------------------------------------------- /example/metro.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const blacklist = require('metro-config/src/defaults/blacklist'); 3 | const escape = require('escape-string-regexp'); 4 | const pak = require('../package.json'); 5 | 6 | const root = path.resolve(__dirname, '..'); 7 | 8 | const modules = Object.keys({ 9 | ...pak.peerDependencies, 10 | }); 11 | 12 | module.exports = { 13 | projectRoot: __dirname, 14 | watchFolders: [root], 15 | 16 | // We need to make sure that only one version is loaded for peerDependencies 17 | // So we blacklist them at the root, and alias them to the versions in example's node_modules 18 | resolver: { 19 | blacklistRE: blacklist( 20 | modules.map( 21 | (m) => 22 | new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`) 23 | ) 24 | ), 25 | 26 | extraNodeModules: modules.reduce((acc, name) => { 27 | acc[name] = path.join(__dirname, 'node_modules', name); 28 | return acc; 29 | }, {}), 30 | }, 31 | 32 | transformer: { 33 | getTransformOptions: async () => ({ 34 | transform: { 35 | experimentalImportSupport: false, 36 | inlineRequires: true, 37 | }, 38 | }), 39 | }, 40 | }; 41 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-image-grid-example", 3 | "description": "Example app for react-native-image-grid", 4 | "version": "0.0.1", 5 | "private": true, 6 | "scripts": { 7 | "android": "react-native run-android", 8 | "start": "react-native start", 9 | "ios": "react-native run-ios --simulator='iPhone 11 Pro'" 10 | }, 11 | "dependencies": { 12 | "@baronha/react-native-multiple-image-picker": "^0.2.0", 13 | "react": "16.13.1", 14 | "react-native": "0.63.4", 15 | "react-native-fast-image": "^8.3.4" 16 | }, 17 | "devDependencies": { 18 | "@babel/core": "^7.12.10", 19 | "@babel/runtime": "^7.12.5", 20 | "babel-plugin-module-resolver": "^4.0.0", 21 | "metro-react-native-babel-preset": "^0.64.0" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/src/App.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable react-native/no-inline-styles */ 2 | import React, { useState } from 'react'; 3 | import { Platform, Text } from 'react-native'; 4 | import { TouchableOpacity } from 'react-native'; 5 | import { ScrollView } from 'react-native'; 6 | import { View } from 'react-native'; 7 | import { Dimensions } from 'react-native'; 8 | import { StatusBar } from 'react-native'; 9 | import { SafeAreaView } from 'react-native'; 10 | 11 | import { StyleSheet } from 'react-native'; 12 | import ImageGrid from '@baronha/react-native-image-grid'; 13 | import ImagePicker from '@baronha/react-native-multiple-image-picker'; 14 | 15 | const { width } = Dimensions.get('window'); 16 | 17 | export default function App() { 18 | const [images, setImages] = useState([]); 19 | const onPressImage = (item, index) => { 20 | console.log(item, index); 21 | }; 22 | 23 | const openPicker = async () => { 24 | try { 25 | const response = await ImagePicker.openPicker({ 26 | selectedAssets: images, 27 | isExportThumbnail: true, 28 | maxVideo: 1, 29 | }); 30 | console.log(response); 31 | setImages(response); 32 | } catch (e) {} 33 | }; 34 | 35 | return ( 36 | 37 | 38 | 39 | 51 | 62 | 63 | Open Gallery 64 | 65 | 66 | 67 | 68 | 69 | 70 | IMAGE GRID 71 | 72 | 73 | ); 74 | } 75 | 76 | const style = StyleSheet.create({ 77 | container: { 78 | backgroundColor: '#000', 79 | flex: 1, 80 | }, 81 | title: { 82 | fontWeight: '900', 83 | fontSize: 24, 84 | paddingVertical: 24, 85 | fontFamily: 'Avenir', 86 | color: '#cdac81', 87 | textAlign: 'center', 88 | }, 89 | buttonOpen: { 90 | margin: 24, 91 | backgroundColor: '#fff', 92 | padding: 12, 93 | alignItems: 'center', 94 | width: width - 48, 95 | }, 96 | textOpen: { 97 | fontWeight: 'bold', 98 | }, 99 | header: { 100 | position: 'absolute', 101 | top: 0, 102 | left: 0, 103 | right: 0, 104 | backgroundColor: 'rgba(0,0,0,0.8)', 105 | }, 106 | }); 107 | 108 | const dataImageString = [ 109 | 'https://images.unsplash.com/photo-1532673492-1b3cdb05d51b?ixid=MXwxMjA3fDB8MHxzZWFyY2h8NHx8cmV0cm98ZW58MHx8MHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60', 110 | 'https://images.unsplash.com/photo-1509281373149-e957c6296406?ixid=MXwxMjA3fDB8MHxzZWFyY2h8MXx8cmV0cm98ZW58MHx8MHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60', 111 | 'https://images.unsplash.com/photo-1613904985222-0d534430bdbd?ixid=MXwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwyODd8fHxlbnwwfHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60', 112 | 'https://images.unsplash.com/photo-1613824320065-3d07b66b8d32?ixid=MXwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwyODJ8fHxlbnwwfHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60', 113 | 'https://images.unsplash.com/photo-1613766259482-10e3c6682e5d?ixid=MXwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHw0MjN8fHxlbnwwfHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60', 114 | 'https://images.unsplash.com/photo-1613987549117-13c4781b32d3?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80', 115 | 'https://images.unsplash.com/photo-1613858749327-c09380ae8116?ixid=MXwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHwzMDR8fHxlbnwwfHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60', 116 | ]; 117 | 118 | const dataImageObject = [ 119 | { 120 | url: 121 | 'https://images.unsplash.com/photo-1622021211530-7d31fd86862d?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=668&q=80', 122 | Width: 500, 123 | Height: 800, 124 | domainColor: '#e48257', 125 | }, 126 | { 127 | url: 128 | 'https://images.unsplash.com/photo-1613766259482-10e3c6682e5d?ixid=MXwxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHw0MjN8fHxlbnwwfHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60', 129 | Width: 500, 130 | Height: 800, 131 | domainColor: '#393232', 132 | }, 133 | { 134 | url: 135 | 'https://images.unsplash.com/photo-1621570169694-4867389dcc66?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1650&q=80', 136 | Width: 500, 137 | Height: 800, 138 | domainColor: '#393232', 139 | }, 140 | { 141 | url: 142 | 'https://images.unsplash.com/photo-1622134093410-ba321c0a6955?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=668&q=80', 143 | Width: 500, 144 | Height: 800, 145 | domainColor: '#393232', 146 | }, 147 | { 148 | url: 149 | 'https://images.unsplash.com/photo-1622024276239-cbefd614cf5b?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=668&q=80', 150 | Width: 500, 151 | Height: 800, 152 | domainColor: '#393232', 153 | }, 154 | { 155 | url: 156 | 'https://images.unsplash.com/photo-1622085354806-80fcdcd4ef4a?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1700&q=80', 157 | Width: 500, 158 | Height: 800, 159 | domainColor: '#393232', 160 | }, 161 | ]; 162 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@baronha/react-native-image-grid", 3 | "version": "0.2.7", 4 | "description": "Display images like Facebook App.", 5 | "main": "lib/commonjs/index", 6 | "module": "lib/module/index", 7 | "types": "lib/typescript/src/index.d.ts", 8 | "react-native": "src/index", 9 | "source": "src/index", 10 | "files": [ 11 | "src", 12 | "lib", 13 | "android", 14 | "ios", 15 | "cpp", 16 | "react-native-image-grid.podspec", 17 | "!lib/typescript/example", 18 | "!android/build", 19 | "!ios/build", 20 | "!**/__tests__", 21 | "!**/__fixtures__", 22 | "!**/__mocks__" 23 | ], 24 | "scripts": { 25 | "test": "jest", 26 | "typescript": "tsc --noEmit", 27 | "lint": "eslint \"**/*.{js,ts,tsx}\"", 28 | "prepare": "bob build", 29 | "release": "release-it", 30 | "example": "yarn --cwd example", 31 | "pods": "cd example && pod-install --quiet", 32 | "bootstrap": "yarn example && yarn && yarn pods" 33 | }, 34 | "keywords": [ 35 | "react-native", 36 | "ios", 37 | "android" 38 | ], 39 | "repository": "https://github.com/baronha/react-native-image-grid", 40 | "author": "Baron (https://github.com/baronha)", 41 | "license": "MIT", 42 | "bugs": { 43 | "url": "https://github.com/baronha/react-native-image-grid/issues" 44 | }, 45 | "homepage": "https://github.com/baronha/react-native-image-grid#readme", 46 | "publishConfig": { 47 | "registry": "https://registry.npmjs.org/" 48 | }, 49 | "devDependencies": { 50 | "@commitlint/config-conventional": "^11.0.0", 51 | "@react-native-community/eslint-config": "^2.0.0", 52 | "@release-it/conventional-changelog": "^2.0.0", 53 | "@types/jest": "^26.0.0", 54 | "@types/react": "^16.9.19", 55 | "@types/react-native": "0.62.13", 56 | "commitlint": "^11.0.0", 57 | "eslint": "^7.2.0", 58 | "eslint-config-prettier": "^7.0.0", 59 | "eslint-plugin-prettier": "^3.1.3", 60 | "jest": "^26.0.1", 61 | "pod-install": "^0.1.0", 62 | "prettier": "^2.0.5", 63 | "react": "16.13.1", 64 | "react-native": "0.63.4", 65 | "react-native-builder-bob": "^0.17.1", 66 | "release-it": "^14.2.2", 67 | "typescript": "^4.1.3" 68 | }, 69 | "peerDependencies": { 70 | "react": "*", 71 | "react-native": "*" 72 | }, 73 | "jest": { 74 | "preset": "react-native", 75 | "modulePathIgnorePatterns": [ 76 | "/example/node_modules", 77 | "/lib/" 78 | ] 79 | }, 80 | "husky": { 81 | "hooks": { 82 | "commit-msg": "commitlint -E HUSKY_GIT_PARAMS", 83 | "pre-commit": "yarn lint && yarn typescript" 84 | } 85 | }, 86 | "commitlint": { 87 | "extends": [ 88 | "@commitlint/config-conventional" 89 | ] 90 | }, 91 | "release-it": { 92 | "git": { 93 | "commitMessage": "chore: release ${version}", 94 | "tagName": "v${version}" 95 | }, 96 | "npm": { 97 | "publish": true 98 | }, 99 | "github": { 100 | "release": true 101 | }, 102 | "plugins": { 103 | "@release-it/conventional-changelog": { 104 | "preset": "angular" 105 | } 106 | } 107 | }, 108 | "eslintConfig": { 109 | "root": true, 110 | "extends": [ 111 | "@react-native-community", 112 | "prettier" 113 | ], 114 | "rules": { 115 | "prettier/prettier": [ 116 | "error", 117 | { 118 | "quoteProps": "consistent", 119 | "singleQuote": true, 120 | "tabWidth": 2, 121 | "trailingComma": "es5", 122 | "useTabs": false 123 | } 124 | ] 125 | } 126 | }, 127 | "eslintIgnore": [ 128 | "node_modules/", 129 | "lib/" 130 | ], 131 | "prettier": { 132 | "quoteProps": "consistent", 133 | "singleQuote": true, 134 | "tabWidth": 2, 135 | "trailingComma": "es5", 136 | "useTabs": false 137 | }, 138 | "react-native-builder-bob": { 139 | "source": "src", 140 | "output": "lib", 141 | "targets": [ 142 | "commonjs", 143 | "module", 144 | [ 145 | "typescript", 146 | { 147 | "project": "tsconfig.build.json" 148 | } 149 | ] 150 | ] 151 | }, 152 | "dependencies": {} 153 | } 154 | -------------------------------------------------------------------------------- /scripts/bootstrap.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const child_process = require('child_process'); 3 | 4 | const root = path.resolve(__dirname, '..'); 5 | const args = process.argv.slice(2); 6 | const options = { 7 | cwd: process.cwd(), 8 | env: process.env, 9 | stdio: 'inherit', 10 | encoding: 'utf-8', 11 | }; 12 | 13 | let result; 14 | 15 | if (process.cwd() !== root || args.length) { 16 | // We're not in the root of the project, or additional arguments were passed 17 | // In this case, forward the command to `yarn` 18 | result = child_process.spawnSync('yarn', args, options); 19 | } else { 20 | // If `yarn` is run without arguments, perform bootstrap 21 | result = child_process.spawnSync('yarn', ['bootstrap'], options); 22 | } 23 | 24 | process.exitCode = result.status; 25 | -------------------------------------------------------------------------------- /src/Grid.js: -------------------------------------------------------------------------------- 1 | import React, { useContext } from 'react'; 2 | import { View, StyleSheet } from 'react-native'; 3 | 4 | import { ImageGridContext } from './ImageGrid.tsx'; 5 | import { Five, Four, One, Six, Three, Two } from './GroupImage'; 6 | 7 | const Grid = () => { 8 | const { containerStyle, length } = useContext(ImageGridContext); 9 | 10 | const renderGroup = () => { 11 | switch (length) { 12 | case 2: 13 | return ; 14 | case 3: 15 | return ; 16 | case 4: 17 | return ; 18 | case 5: 19 | return ; 20 | case 6: 21 | return ; 22 | default: 23 | //default is 1 24 | return ; 25 | } 26 | }; 27 | 28 | return {renderGroup()}; 29 | }; 30 | 31 | export default Grid; 32 | 33 | const style = StyleSheet.create({ 34 | container: { 35 | overflow: 'hidden', 36 | }, 37 | }); 38 | -------------------------------------------------------------------------------- /src/GroupImage/Five.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable react-native/no-inline-styles */ 2 | import React, { useContext } from 'react'; 3 | import { View, StyleSheet } from 'react-native'; 4 | 5 | import { ImageGridContext } from '../ImageGrid.tsx'; 6 | import { LAYOUT_ROW_SQUARE } from '../helpers'; 7 | import Image from '../Image'; 8 | import Two from './Two'; 9 | 10 | const Five = () => { 11 | const { data, width, spaceSize, length } = useContext(ImageGridContext); 12 | 13 | const commonSize = width / 3 - (spaceSize * 2) / 3; 14 | 15 | return ( 16 | 24 | 25 | 31 | {[...data].splice(2, length).map((item, index) => { 32 | return ( 33 | 42 | ); 43 | })} 44 | 45 | 46 | ); 47 | }; 48 | 49 | export default Five; 50 | 51 | const style = StyleSheet.create({ 52 | container: { 53 | justifyContent: 'space-between', 54 | }, 55 | }); 56 | -------------------------------------------------------------------------------- /src/GroupImage/Four.js: -------------------------------------------------------------------------------- 1 | import React, { useContext, useEffect } from 'react'; 2 | import { View, StyleSheet } from 'react-native'; 3 | 4 | import { ImageGridContext } from '../ImageGrid.tsx'; 5 | import { LAYOUT_COLUMN, LAYOUT_ROW } from '../helpers'; 6 | import Image from '../Image'; 7 | 8 | const Four = () => { 9 | const { data, width, layout, spaceSize, length } = useContext( 10 | ImageGridContext 11 | ); 12 | const subLayout = layout === LAYOUT_ROW ? LAYOUT_COLUMN : LAYOUT_ROW; 13 | 14 | const commonSize = width / 3 - (spaceSize * 2) / 3; 15 | 16 | useEffect(() => {}, []); 17 | 18 | const handleStyleMain = () => { 19 | let widthShape = width - commonSize - spaceSize; 20 | let hightShape = width; 21 | if (layout === LAYOUT_COLUMN) { 22 | widthShape = width; 23 | hightShape = width - commonSize - spaceSize; 24 | } 25 | return { 26 | width: widthShape, 27 | height: hightShape, 28 | }; 29 | }; 30 | 31 | return ( 32 | 35 | 36 | 37 | 38 | 39 | {[...data].splice(1, length).map((item, index) => { 40 | return ( 41 | 50 | ); 51 | })} 52 | 53 | 54 | ); 55 | }; 56 | 57 | export default Four; 58 | 59 | const style = StyleSheet.create({ 60 | container: { 61 | justifyContent: 'space-between', 62 | }, 63 | }); 64 | -------------------------------------------------------------------------------- /src/GroupImage/One.js: -------------------------------------------------------------------------------- 1 | import React, { useContext } from 'react'; 2 | import { View, StyleSheet } from 'react-native'; 3 | 4 | import { ImageGridContext } from '../ImageGrid.tsx'; 5 | import Image from '../Image'; 6 | 7 | const One = () => { 8 | const { 9 | data, 10 | width, 11 | heightKey, 12 | widthKey, 13 | ratioImagePortrait, 14 | ratioOneLandscape, 15 | } = useContext(ImageGridContext); 16 | 17 | const handleStyle = () => { 18 | let heightShape = width; 19 | let widthShape = width; 20 | const widthImage = Number(data[0][widthKey]); 21 | const heightImage = Number(data[0][heightKey]); 22 | if (!Number.isNaN(widthImage) && !Number.isNaN(heightImage)) { 23 | let ratio = widthImage / heightImage; 24 | if (heightImage > widthImage) { 25 | ratio = heightImage / widthImage; 26 | heightShape = 27 | ratio > ratioImagePortrait 28 | ? width * ratioImagePortrait 29 | : ratio * width; 30 | } else if (widthImage > heightImage) { 31 | ratio = widthImage / heightImage; 32 | heightShape = 33 | ratio > ratioOneLandscape ? width / ratioOneLandscape : width / ratio; 34 | } 35 | } 36 | return { 37 | width: widthShape, 38 | height: heightShape, 39 | }; 40 | }; 41 | 42 | return ( 43 | 44 | 45 | 46 | ); 47 | }; 48 | 49 | export default One; 50 | 51 | const style = StyleSheet.create({ 52 | container: { 53 | justifyContent: 'space-between', 54 | }, 55 | }); 56 | -------------------------------------------------------------------------------- /src/GroupImage/Six.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable react-native/no-inline-styles */ 2 | import React, { useContext, useEffect } from 'react'; 3 | import { View, StyleSheet } from 'react-native'; 4 | 5 | import { ImageGridContext } from '../ImageGrid.tsx'; 6 | import Image from '../Image'; 7 | 8 | const Six = () => { 9 | const { data, width, spaceSize, length } = useContext(ImageGridContext); 10 | 11 | const commonSubSize = width / 3 - (spaceSize * 2) / 3; 12 | const commonSize = width - commonSubSize - spaceSize; 13 | 14 | useEffect(() => {}, []); 15 | 16 | const handleStyleMain = () => { 17 | const style = { 18 | width: commonSize, 19 | height: commonSize, 20 | }; 21 | return style; 22 | }; 23 | 24 | const handleStyleSub = () => { 25 | const style = { 26 | width: commonSubSize, 27 | height: commonSubSize, 28 | }; 29 | return style; 30 | }; 31 | 32 | return ( 33 | 42 | 43 | 44 | 45 | {[...data].splice(1, 2).map((item, index) => { 46 | return ( 47 | 53 | ); 54 | })} 55 | 56 | 57 | 58 | {[...data].splice(3, length).map((item, index) => { 59 | return ( 60 | 66 | ); 67 | })} 68 | 69 | 70 | ); 71 | }; 72 | 73 | export default Six; 74 | 75 | const style = StyleSheet.create({ 76 | container: { 77 | justifyContent: 'space-between', 78 | }, 79 | }); 80 | -------------------------------------------------------------------------------- /src/GroupImage/Three.js: -------------------------------------------------------------------------------- 1 | import React, { useContext } from 'react'; 2 | import { View, StyleSheet } from 'react-native'; 3 | 4 | import { ImageGridContext } from '../ImageGrid.tsx'; 5 | import { LAYOUT_COLUMN, LAYOUT_ROW } from '../helpers'; 6 | import Image from '../Image'; 7 | 8 | const Three = () => { 9 | const { data, width, layout, spaceSize, length } = useContext( 10 | ImageGridContext 11 | ); 12 | const subLayout = layout === LAYOUT_ROW ? LAYOUT_COLUMN : LAYOUT_ROW; 13 | 14 | const commonSize = width / 2 - spaceSize / 2; 15 | 16 | const handleStyleMain = () => { 17 | let widthShape = commonSize; 18 | let heightShape = width; 19 | if (layout === LAYOUT_COLUMN) { 20 | widthShape = width; 21 | heightShape = commonSize; 22 | } 23 | return { 24 | width: widthShape, 25 | height: heightShape, 26 | }; 27 | }; 28 | 29 | const handleStyleSub = () => { 30 | const style = { 31 | width: commonSize, 32 | height: commonSize, 33 | }; 34 | return style; 35 | }; 36 | 37 | return ( 38 | 41 | 42 | 43 | 44 | 45 | {[...data].splice(1, length).map((item, index) => { 46 | return ( 47 | 53 | ); 54 | })} 55 | 56 | 57 | ); 58 | }; 59 | 60 | export default Three; 61 | 62 | const style = StyleSheet.create({ 63 | container: { 64 | justifyContent: 'space-between', 65 | }, 66 | }); 67 | -------------------------------------------------------------------------------- /src/GroupImage/Two.js: -------------------------------------------------------------------------------- 1 | import React, { useContext } from 'react'; 2 | import { View, StyleSheet } from 'react-native'; 3 | 4 | import { ImageGridContext } from '../ImageGrid.tsx'; 5 | import { LAYOUT_COLUMN, LAYOUT_ROW_SQUARE } from '../helpers'; 6 | import Image from '../Image'; 7 | 8 | const Two = ({ layoutProps, dataProps }) => { 9 | const { data: dataMain, width, layout: layoutMain, spaceSize } = useContext( 10 | ImageGridContext 11 | ); 12 | 13 | const data = dataProps || dataMain; 14 | const layoutChange = layoutProps || layoutMain; 15 | const layout = layoutProps || layoutChange.match('row') ? 'row' : 'column'; 16 | const widthCommon = width / 2 - spaceSize / 2; 17 | 18 | const handleStyle = () => { 19 | let widthShape = widthCommon; 20 | let heightShape = width; 21 | 22 | switch (layoutChange) { 23 | case LAYOUT_ROW_SQUARE: 24 | widthShape = widthCommon; 25 | heightShape = widthCommon; 26 | break; 27 | case LAYOUT_COLUMN: 28 | widthShape = width; 29 | heightShape = widthCommon; 30 | break; 31 | default: 32 | } 33 | return { 34 | width: widthShape, 35 | height: heightShape, 36 | }; 37 | }; 38 | 39 | return ( 40 | 50 | {data.map((item, index) => { 51 | return ( 52 | 58 | ); 59 | })} 60 | 61 | ); 62 | }; 63 | 64 | export default Two; 65 | 66 | const style = StyleSheet.create({ 67 | container: { 68 | justifyContent: 'space-between', 69 | }, 70 | }); 71 | -------------------------------------------------------------------------------- /src/GroupImage/index.js: -------------------------------------------------------------------------------- 1 | import One from './One'; 2 | import Two from './Two'; 3 | import Three from './Three'; 4 | import Four from './Four'; 5 | import Five from './Five'; 6 | import Six from './Six'; 7 | 8 | export { One, Two, Three, Four, Five, Six }; 9 | -------------------------------------------------------------------------------- /src/Image.js: -------------------------------------------------------------------------------- 1 | import React, { useContext, useState } from 'react'; 2 | import { Text, Image as RNImage, View, StyleSheet } from 'react-native'; 3 | import PropTypes from 'prop-types'; 4 | 5 | import { ImageGridContext } from './ImageGrid.tsx'; 6 | import { TouchableOpacity } from 'react-native'; 7 | 8 | const COLOR_GREY = '#323232'; 9 | 10 | const Image = (props) => { 11 | const { image, imageStyle, index } = props; 12 | const { 13 | sourceKey, 14 | activeOpacity, 15 | onPressImage, 16 | imageProps, 17 | remain, 18 | length, 19 | backgroundMask, 20 | numberRemainStyle, 21 | backgroundMaskVideo, 22 | videoIconStyle, 23 | videoKey, 24 | conditionCheckVideo, 25 | width, 26 | colorLoader, 27 | videoURLKey, 28 | emptyImageSource, 29 | componentDelete, 30 | showDelete, 31 | onDeleteImage, 32 | prefixPath, 33 | data, 34 | backgroundColorKey, 35 | ImageWrap, 36 | } = useContext(ImageGridContext); 37 | const isVideo = image?.[videoKey] === conditionCheckVideo; 38 | const uri = 39 | prefixPath + 40 | (typeof image === 'string' 41 | ? image 42 | : isVideo 43 | ? image[videoURLKey] 44 | : image[sourceKey]); 45 | const size = 46 | index === 0 47 | ? Math.round(width / 7) 48 | : index === 1 && length === 2 49 | ? Math.round(width / 9) 50 | : Math.round(width / (index + length * 2)); 51 | 52 | const handleBackgroundColor = () => { 53 | const color = data?.[index]?.[backgroundColorKey]; 54 | if (color && typeof color === 'string') { 55 | return color; 56 | } 57 | if (typeof colorLoader === 'string') { 58 | return colorLoader; 59 | } 60 | if (typeof colorLoader === 'object') { 61 | if (colorLoader.length > 1) { 62 | const random = Math.floor(Math.random() * colorLoader.length); 63 | return colorLoader[random]; 64 | } 65 | return colorLoader[0]; 66 | } 67 | return COLOR_GREY; 68 | }; 69 | 70 | const backgroundColor = handleBackgroundColor(); 71 | 72 | const [isError, setError] = useState(false); 73 | 74 | const onPress = () => { 75 | onPressImage(image, index); 76 | }; 77 | 78 | const onError = () => { 79 | setError(true); 80 | imageProps?.onError(); 81 | }; 82 | 83 | const onDelete = () => { 84 | if (isError) { 85 | setError(false); 86 | } 87 | onDeleteImage(image, index); 88 | }; 89 | 90 | return ( 91 | 96 | 97 | 104 | 105 | {isVideo && (remain === 0 || index !== length - 1) && ( 106 | 107 | 118 | 119 | )} 120 | {remain > 0 && index === length - 1 && ( 121 | 122 | 131 | +{remain} 132 | 133 | 134 | )} 135 | {showDelete && 136 | (componentDelete || ( 137 | 138 | 143 | 148 | 149 | 150 | ))} 151 | 152 | ); 153 | }; 154 | 155 | export default Image; 156 | 157 | const style = StyleSheet.create({ 158 | container: { 159 | overflow: 'hidden', 160 | }, 161 | overlay: { 162 | ...StyleSheet.absoluteFill, 163 | alignItems: 'center', 164 | justifyContent: 'center', 165 | }, 166 | titleRemain: { 167 | fontWeight: 'bold', 168 | textAlign: 'center', 169 | color: '#fff', 170 | fontFamily: 'Avenir', 171 | }, 172 | videoIcon: { 173 | tintColor: '#fff', 174 | }, 175 | componentDelete: { 176 | position: 'absolute', 177 | top: 8, 178 | right: 8, 179 | }, 180 | buttonDelete: { 181 | backgroundColor: 'rgba(0,0,0,0.2)', 182 | paddingHorizontal: 8, 183 | borderRadius: 4, 184 | paddingVertical: 6, 185 | }, 186 | deleteImage: { 187 | width: 16, 188 | height: 16, 189 | tintColor: '#fff', 190 | }, 191 | }); 192 | 193 | Image.propTypes = { 194 | image: PropTypes.any.isRequired, 195 | imageStyle: PropTypes.any, 196 | index: PropTypes.number, 197 | }; 198 | 199 | Image.defaultProps = {}; 200 | -------------------------------------------------------------------------------- /src/ImageGrid.tsx: -------------------------------------------------------------------------------- 1 | import React, { createContext } from 'react'; 2 | import { Dimensions, Image } from 'react-native'; 3 | import PropTypes, { InferProps } from 'prop-types'; 4 | 5 | import Grid from './Grid.js'; 6 | import { checkLayoutImage, LAYOUT_ROW } from './helpers'; 7 | 8 | const { width: windowWidth } = Dimensions.get('window'); 9 | 10 | export const ImageGridContext = createContext({}); 11 | 12 | export function ImageGrid(props: InferProps) { 13 | const { dataImage, widthKey, heightKey } = props; 14 | 15 | const maximum = props.maximum as number; 16 | 17 | const data = [...dataImage]; 18 | const length = maximum > data.length ? data.length : maximum; 19 | const remain = data.length - length; 20 | data.length = length > 6 ? 6 : length; 21 | const layout = 22 | checkLayoutImage(data, length, widthKey, heightKey) || LAYOUT_ROW; 23 | 24 | const value = { 25 | ...props, 26 | //props 27 | layout, 28 | length, 29 | remain, 30 | data, 31 | }; 32 | 33 | if (data.length) { 34 | return ( 35 | 36 | 37 | 38 | ); 39 | } 40 | return null; 41 | } 42 | 43 | ImageGrid.propTypes = { 44 | dataImage: PropTypes.any.isRequired, 45 | sourceKey: PropTypes.string, 46 | width: PropTypes.number, 47 | colorLoader: PropTypes.any, 48 | spaceSize: PropTypes.number, 49 | containerStyle: PropTypes.any, 50 | activeOpacity: PropTypes.number, 51 | maximum: PropTypes.number, 52 | onPressImage: PropTypes.func, 53 | backgroundMask: PropTypes.string, 54 | backgroundMaskVideo: PropTypes.string, 55 | numberRemainStyle: PropTypes.any, 56 | videoIconStyle: PropTypes.any, 57 | videoKey: PropTypes.string, 58 | videoURLKey: PropTypes.string, 59 | conditionCheckVideo: PropTypes.any, 60 | heightKey: PropTypes.string, 61 | widthKey: PropTypes.string, 62 | componentDelete: PropTypes.element, 63 | onDeleteImage: PropTypes.func, 64 | showDelete: PropTypes.bool, 65 | ratioImagePortrait: PropTypes.number, 66 | ratioImageLandscape: PropTypes.number, 67 | prefixPath: PropTypes.string, 68 | backgroundColorKey: PropTypes.string, 69 | ImageWrap: PropTypes.elementType, 70 | }; 71 | 72 | ImageGrid.defaultProps = { 73 | dataImage: [], 74 | colorLoader: [ 75 | '#fcf8e8', 76 | '#d4e2d4', 77 | '#ecb390', 78 | '#df7861', 79 | '#dff3e3', 80 | '#86aba1', 81 | '#f4eeed', 82 | ], 83 | sourceKey: 'url', 84 | videoURLKey: 'url', 85 | width: windowWidth, 86 | spaceSize: 3, 87 | activeOpacity: 0.9, 88 | maximum: 6, 89 | backgroundMask: 'rgba(0,0,0,0.6)', 90 | backgroundMaskVideo: 'rgba(0,0,0,0.6)', 91 | videoKey: 'isVideo', 92 | conditionCheckVideo: true, 93 | heightKey: 'height', 94 | widthKey: 'width', 95 | onPressImage: () => {}, 96 | emptyImageSource: require('./assets/emptyImage.png'), 97 | showDelete: false, 98 | onDeleteImage: () => {}, 99 | ratioImagePortrait: 1.618, 100 | ratioImageLandscape: 1.2, 101 | prefixPath: '', 102 | backgroundColorKey: 'backgroundColor', 103 | ImageWrap: Image, 104 | }; 105 | -------------------------------------------------------------------------------- /src/assets/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baronha/react-native-image-grid/d617c413019d3083d5a8bc9f7fa6a15b7f78c6c1/src/assets/delete.png -------------------------------------------------------------------------------- /src/assets/emptyImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baronha/react-native-image-grid/d617c413019d3083d5a8bc9f7fa6a15b7f78c6c1/src/assets/emptyImage.png -------------------------------------------------------------------------------- /src/assets/video-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baronha/react-native-image-grid/d617c413019d3083d5a8bc9f7fa6a15b7f78c6c1/src/assets/video-icon.png -------------------------------------------------------------------------------- /src/helpers.js: -------------------------------------------------------------------------------- 1 | export const LAYOUT_ROW = 'row'; 2 | export const LAYOUT_ROW_SQUARE = 'row_square'; 3 | export const LAYOUT_COLUMN = 'column'; 4 | 5 | export const checkLayoutImage = (data, length, widthKey, heightKey) => { 6 | if (length >= 2) { 7 | const firstItem = data[0]; 8 | if ( 9 | typeof firstItem === 'string' || 10 | !firstItem?.[widthKey] || 11 | !firstItem?.[heightKey] 12 | ) { 13 | if (length === 5) { 14 | return LAYOUT_COLUMN; 15 | } 16 | return LAYOUT_ROW; 17 | } 18 | let isLandscapeFirst = checkLandscape(firstItem, widthKey, heightKey); // mean: is Reactangle Horizontal First Item 19 | switch (length) { 20 | case 2: 21 | const secondItem = data[1]; 22 | let isLandscapeSecond = checkLandscape(secondItem, widthKey, heightKey); // mean: is Reactangle Horizontal Second Item 23 | if (isLandscapeFirst && isLandscapeSecond) { 24 | return LAYOUT_COLUMN; 25 | } 26 | if (isLandscapeFirst !== isLandscapeSecond) { 27 | return LAYOUT_ROW_SQUARE; 28 | } 29 | return LAYOUT_ROW; 30 | case 3: 31 | case 4: 32 | if (isLandscapeFirst) { 33 | return LAYOUT_COLUMN; 34 | } 35 | return LAYOUT_ROW; 36 | default: 37 | return LAYOUT_COLUMN; 38 | } 39 | } 40 | }; 41 | 42 | const checkLandscape = (data, widthKey, heightKey) => { 43 | const width = Number(data[widthKey]); 44 | const height = Number(data[heightKey]); 45 | if (width > height) { 46 | return true; 47 | } 48 | return false; 49 | }; 50 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { ImageGrid } from './ImageGrid'; 2 | export default ImageGrid; 3 | -------------------------------------------------------------------------------- /tsconfig.build.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "extends": "./tsconfig", 4 | "exclude": ["example"] 5 | } 6 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "paths": { 5 | "react-native-image-grid": ["./src/index"] 6 | }, 7 | "allowUnreachableCode": false, 8 | "allowUnusedLabels": false, 9 | "esModuleInterop": true, 10 | "importsNotUsedAsValues": "error", 11 | "forceConsistentCasingInFileNames": true, 12 | "jsx": "react", 13 | "lib": ["esnext"], 14 | "module": "esnext", 15 | "moduleResolution": "node", 16 | "noFallthroughCasesInSwitch": true, 17 | "noImplicitReturns": true, 18 | "noImplicitUseStrict": false, 19 | "noStrictGenericChecks": false, 20 | "noUnusedLocals": true, 21 | "noUnusedParameters": true, 22 | "resolveJsonModule": true, 23 | "skipLibCheck": true, 24 | "strict": true, 25 | "target": "esnext", 26 | "allowJs": true, 27 | } 28 | } 29 | --------------------------------------------------------------------------------