├── .eslintrc.js ├── .gitignore ├── .npmignore ├── CONTRIBUTING.md ├── README.md ├── android ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── bufgix │ └── rnsecurewindow │ ├── ReactNativeSecureWindowModule.kt │ └── ReactNativeSecureWindowView.kt ├── example ├── .gitignore ├── App.tsx ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── bufgix │ │ │ │ └── rnsecurewindow │ │ │ │ └── example │ │ │ │ └── ReactNativeFlipper.java │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── bufgix │ │ │ │ │ └── rnsecurewindow │ │ │ │ │ └── example │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ │ ├── drawable-hdpi │ │ │ │ └── splashscreen_image.png │ │ │ │ ├── drawable-mdpi │ │ │ │ └── splashscreen_image.png │ │ │ │ ├── drawable-xhdpi │ │ │ │ └── splashscreen_image.png │ │ │ │ ├── drawable-xxhdpi │ │ │ │ └── splashscreen_image.png │ │ │ │ ├── drawable-xxxhdpi │ │ │ │ └── splashscreen_image.png │ │ │ │ ├── drawable │ │ │ │ ├── rn_edit_text_material.xml │ │ │ │ └── splashscreen.xml │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_foreground.png │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── values-night │ │ │ │ └── colors.xml │ │ │ │ └── values │ │ │ │ ├── colors.xml │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ └── release │ │ │ └── java │ │ │ └── com │ │ │ └── bufgix │ │ │ └── rnsecurewindow │ │ │ └── example │ │ │ └── ReactNativeFlipper.java │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── app.json ├── assets │ ├── adaptive-icon.png │ ├── favicon.png │ ├── icon.png │ └── splash.png ├── babel.config.js ├── ios │ ├── .gitignore │ ├── .xcode.env │ ├── Podfile │ ├── Podfile.lock │ ├── Podfile.properties.json │ ├── reactnativesecurewindowexample.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── reactnativesecurewindowexample.xcscheme │ ├── reactnativesecurewindowexample.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── reactnativesecurewindowexample │ │ ├── AppDelegate.h │ │ ├── AppDelegate.mm │ │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── App-Icon-1024x1024@1x.png │ │ │ └── Contents.json │ │ ├── Contents.json │ │ ├── SplashScreen.imageset │ │ │ ├── Contents.json │ │ │ └── image.png │ │ └── SplashScreenBackground.imageset │ │ │ ├── Contents.json │ │ │ └── image.png │ │ ├── Info.plist │ │ ├── SplashScreen.storyboard │ │ ├── Supporting │ │ └── Expo.plist │ │ ├── main.m │ │ ├── noop-file.swift │ │ ├── reactnativesecurewindowexample-Bridging-Header.h │ │ └── reactnativesecurewindowexample.entitlements ├── metro.config.js ├── package.json ├── tsconfig.json ├── webpack.config.js └── yarn.lock ├── expo-module.config.json ├── ios ├── ReactNativeSecureWindow.podspec ├── ReactNativeSecureWindowModule.swift └── ReactNativeSecureWindowView.swift ├── package.json ├── src ├── ReactNativeSecureWindow.types.ts ├── ReactNativeSecureWindowModule.ts ├── ReactNativeSecureWindowView.tsx └── index.ts ├── tsconfig.json └── yarn.lock /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: ['universe/native', 'universe/web'], 4 | ignorePatterns: ['build'], 5 | }; 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # VSCode 6 | .vscode/ 7 | jsconfig.json 8 | 9 | # Xcode 10 | # 11 | build/ 12 | *.pbxuser 13 | !default.pbxuser 14 | *.mode1v3 15 | !default.mode1v3 16 | *.mode2v3 17 | !default.mode2v3 18 | *.perspectivev3 19 | !default.perspectivev3 20 | xcuserdata 21 | *.xccheckout 22 | *.moved-aside 23 | DerivedData 24 | *.hmap 25 | *.ipa 26 | *.xcuserstate 27 | project.xcworkspace 28 | 29 | # Android/IJ 30 | # 31 | .classpath 32 | .cxx 33 | .gradle 34 | .idea 35 | .project 36 | .settings 37 | local.properties 38 | android.iml 39 | android/app/libs 40 | android/keystores/debug.keystore 41 | 42 | # Cocoapods 43 | # 44 | example/ios/Pods 45 | 46 | # Ruby 47 | example/vendor/ 48 | 49 | # node.js 50 | # 51 | node_modules/ 52 | npm-debug.log 53 | yarn-debug.log 54 | yarn-error.log 55 | 56 | # Expo 57 | .expo/* 58 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Exclude all top-level hidden directories by convention 2 | /.*/ 3 | 4 | __mocks__ 5 | __tests__ 6 | 7 | /babel.config.js 8 | /android/src/androidTest/ 9 | /android/src/test/ 10 | /android/build/ 11 | /example/ 12 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to CONTRIBUTING.md 2 | 3 | First off, thanks for taking the time to contribute! ❤️ 4 | 5 | All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉 6 | 7 | > And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: 8 | > - Star the project 9 | > - Tweet about it 10 | > - Refer this project in your project's readme 11 | > - Mention the project at local meetups and tell your friends/colleagues 12 | 13 | 14 | ## Table of Contents 15 | 16 | - [Code of Conduct](#code-of-conduct) 17 | - [I Have a Question](#i-have-a-question) 18 | - [I Want To Contribute](#i-want-to-contribute) 19 | - [Reporting Bugs](#reporting-bugs) 20 | - [Suggesting Enhancements](#suggesting-enhancements) 21 | - [Your First Code Contribution](#your-first-code-contribution) 22 | - [Improving The Documentation](#improving-the-documentation) 23 | - [Styleguides](#styleguides) 24 | - [Commit Messages](#commit-messages) 25 | - [Join The Project Team](#join-the-project-team) 26 | 27 | 28 | ## Code of Conduct 29 | 30 | This project and everyone participating in it is governed by the 31 | [CONTRIBUTING.md Code of Conduct](blob/master/CODE_OF_CONDUCT.md). 32 | By participating, you are expected to uphold this code. Please report unacceptable behavior 33 | to <>. 34 | 35 | 36 | ## I Have a Question 37 | 38 | > If you want to ask a question, we assume that you have read the available [Documentation](). 39 | 40 | Before you ask a question, it is best to search for existing [Issues](/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first. 41 | 42 | If you then still feel the need to ask a question and need clarification, we recommend the following: 43 | 44 | - Open an [Issue](/issues/new). 45 | - Provide as much context as you can about what you're running into. 46 | - Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant. 47 | 48 | We will then take care of the issue as soon as possible. 49 | 50 | 51 | 52 | ## I Want To Contribute 53 | 54 | > ### Legal Notice 55 | > When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license. 56 | 57 | ### Reporting Bugs 58 | 59 | 60 | #### Before Submitting a Bug Report 61 | 62 | A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. 63 | 64 | - Make sure that you are using the latest version. 65 | - Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](). If you are looking for support, you might want to check [this section](#i-have-a-question)). 66 | - To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](issues?q=label%3Abug). 67 | - Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue. 68 | - Collect information about the bug: 69 | - Stack trace (Traceback) 70 | - OS, Platform and Version (Windows, Linux, macOS, x86, ARM) 71 | - Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant. 72 | - Possibly your input and the output 73 | - Can you reliably reproduce the issue? And can you also reproduce it with older versions? 74 | 75 | 76 | #### How Do I Submit a Good Bug Report? 77 | 78 | > You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to <>. 79 | 80 | 81 | We use GitHub issues to track bugs and errors. If you run into an issue with the project: 82 | 83 | - Open an [Issue](/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.) 84 | - Explain the behavior you would expect and the actual behavior. 85 | - Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case. 86 | - Provide the information you collected in the previous section. 87 | 88 | Once it's filed: 89 | 90 | - The project team will label the issue accordingly. 91 | - A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced. 92 | - If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be [implemented by someone](#your-first-code-contribution). 93 | 94 | 95 | 96 | 97 | ### Suggesting Enhancements 98 | 99 | This section guides you through submitting an enhancement suggestion for CONTRIBUTING.md, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions. 100 | 101 | 102 | #### Before Submitting an Enhancement 103 | 104 | - Make sure that you are using the latest version. 105 | - Read the [documentation]() carefully and find out if the functionality is already covered, maybe by an individual configuration. 106 | - Perform a [search](/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. 107 | - Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library. 108 | 109 | 110 | #### How Do I Submit a Good Enhancement Suggestion? 111 | 112 | Enhancement suggestions are tracked as [GitHub issues](/issues). 113 | 114 | - Use a **clear and descriptive title** for the issue to identify the suggestion. 115 | - Provide a **step-by-step description of the suggested enhancement** in as many details as possible. 116 | - **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you. 117 | - You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux. 118 | - **Explain why this enhancement would be useful** to most CONTRIBUTING.md users. You may also want to point out the other projects that solved it better and which could serve as inspiration. 119 | 120 | 121 | 122 | ### Your First Code Contribution 123 | 124 | 125 | ### Improving The Documentation 126 | 127 | 128 | ## Styleguides 129 | ### Commit Messages 130 | 131 | 132 | ## Join The Project Team 133 | 134 | 135 | 136 | ## Attribution 137 | This guide is based on the **contributing.md**. [Make your own](https://contributing.md/)! 138 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-native-secure-window 2 | 3 | Hide react native views with an overlay when capturing screen 4 | 5 | | iOS | Android | 6 | | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | 7 | | | | 8 | 9 | 10 | 11 | # Installation in bare React Native projects 12 | 13 | For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing. 14 | 15 | # Installation in managed Expo projects 16 | 17 | For managed Expo projects, no additional set up is necessary. 18 | 19 | ### Add the package to your npm dependencies 20 | 21 | ```bash 22 | ## You must install expo-screen-capture first 23 | npx expo install expo-screen-capture 24 | yarn add @bufgix/react-native-secure-window 25 | ``` 26 | 27 | ### Configure for iOS 28 | 29 | Run `npx pod-install` after installing the npm package. 30 | 31 | ### Configure for Android 32 | 33 | No additional set up necessary. 34 | 35 | ### Usage 36 | 37 | ```tsx 38 | import { Text, View } from "react-native"; 39 | import { SecureWindow } from "@bufgix/react-native-secure-window"; 40 | 41 | export default function App() { 42 | return ( 43 | 44 | 45 | This text is protected by the SecureWindow 46 | 47 | 48 | This text is not protected by the SecureWindow 49 | 50 | ); 51 | } 52 | ``` 53 | 54 | for Android, `` component prevent _whole_ screen from capturing due to Android limitation. 55 | 56 | # Contributing 57 | 58 | Contributions are very welcome! Please refer to guidelines described in the [contributing guide](https://github.com/bufgix/react-native-secure-window/blob/main/CONTRIBUTING.md). 59 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'maven-publish' 4 | 5 | group = 'com.bufgix.rnsecurewindow' 6 | version = '0.1.0' 7 | 8 | buildscript { 9 | def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle") 10 | if (expoModulesCorePlugin.exists()) { 11 | apply from: expoModulesCorePlugin 12 | applyKotlinExpoModulesCorePlugin() 13 | } 14 | 15 | // Simple helper that allows the root project to override versions declared by this library. 16 | ext.safeExtGet = { prop, fallback -> 17 | rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback 18 | } 19 | 20 | // Ensures backward compatibility 21 | ext.getKotlinVersion = { 22 | if (ext.has("kotlinVersion")) { 23 | ext.kotlinVersion() 24 | } else { 25 | ext.safeExtGet("kotlinVersion", "1.8.10") 26 | } 27 | } 28 | 29 | repositories { 30 | mavenCentral() 31 | } 32 | 33 | dependencies { 34 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}") 35 | } 36 | } 37 | 38 | afterEvaluate { 39 | publishing { 40 | publications { 41 | release(MavenPublication) { 42 | from components.release 43 | } 44 | } 45 | repositories { 46 | maven { 47 | url = mavenLocal().url 48 | } 49 | } 50 | } 51 | } 52 | 53 | android { 54 | compileSdkVersion safeExtGet("compileSdkVersion", 33) 55 | 56 | compileOptions { 57 | sourceCompatibility JavaVersion.VERSION_11 58 | targetCompatibility JavaVersion.VERSION_11 59 | } 60 | 61 | kotlinOptions { 62 | jvmTarget = JavaVersion.VERSION_11.majorVersion 63 | } 64 | 65 | namespace "com.bufgix.rnsecurewindow" 66 | defaultConfig { 67 | minSdkVersion safeExtGet("minSdkVersion", 21) 68 | targetSdkVersion safeExtGet("targetSdkVersion", 33) 69 | versionCode 1 70 | versionName "0.1.0" 71 | } 72 | lintOptions { 73 | abortOnError false 74 | } 75 | publishing { 76 | singleVariant("release") { 77 | withSourcesJar() 78 | } 79 | } 80 | } 81 | 82 | repositories { 83 | mavenCentral() 84 | } 85 | 86 | dependencies { 87 | implementation project(':expo-modules-core') 88 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}" 89 | } 90 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /android/src/main/java/com/bufgix/rnsecurewindow/ReactNativeSecureWindowModule.kt: -------------------------------------------------------------------------------- 1 | package com.bufgix.rnsecurewindow 2 | 3 | import expo.modules.kotlin.modules.Module 4 | import expo.modules.kotlin.modules.ModuleDefinition 5 | 6 | class ReactNativeSecureWindowModule : Module() { 7 | // Each module class must implement the definition function. The definition consists of components 8 | // that describes the module's functionality and behavior. 9 | // See https://docs.expo.dev/modules/module-api for more details about available components. 10 | override fun definition() = ModuleDefinition { 11 | // Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument. 12 | // Can be inferred from module's class name, but it's recommended to set it explicitly for clarity. 13 | // The module will be accessible from `requireNativeModule('ReactNativeSecureWindow')` in JavaScript. 14 | Name("ReactNativeSecureWindow") 15 | 16 | // Sets constant properties on the module. Can take a dictionary or a closure that returns a dictionary. 17 | Constants( 18 | "PI" to Math.PI 19 | ) 20 | 21 | // Defines event names that the module can send to JavaScript. 22 | Events("onChange") 23 | 24 | // Defines a JavaScript synchronous function that runs the native code on the JavaScript thread. 25 | Function("hello") { 26 | "Hello world! 👋" 27 | } 28 | 29 | // Defines a JavaScript function that always returns a Promise and whose native code 30 | // is by default dispatched on the different thread than the JavaScript runtime runs on. 31 | AsyncFunction("setValueAsync") { value: String -> 32 | // Send an event to JavaScript. 33 | sendEvent("onChange", mapOf( 34 | "value" to value 35 | )) 36 | } 37 | 38 | // Enables the module to be used as a native view. Definition components that are accepted as part of 39 | // the view definition: Prop, Events. 40 | View(ReactNativeSecureWindowView::class) { 41 | // Defines a setter for the `name` prop. 42 | Prop("name") { view: ReactNativeSecureWindowView, prop: String -> 43 | println(prop) 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /android/src/main/java/com/bufgix/rnsecurewindow/ReactNativeSecureWindowView.kt: -------------------------------------------------------------------------------- 1 | package com.bufgix.rnsecurewindow 2 | 3 | import android.content.Context 4 | import expo.modules.kotlin.AppContext 5 | import expo.modules.kotlin.views.ExpoView 6 | 7 | class ReactNativeSecureWindowView(context: Context, appContext: AppContext) : ExpoView(context, appContext) 8 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files 2 | 3 | # dependencies 4 | node_modules/ 5 | 6 | # Expo 7 | .expo/ 8 | dist/ 9 | web-build/ 10 | 11 | # Native 12 | *.orig.* 13 | *.jks 14 | *.p8 15 | *.p12 16 | *.key 17 | *.mobileprovision 18 | 19 | # Metro 20 | .metro-health-check* 21 | 22 | # debug 23 | npm-debug.* 24 | yarn-debug.* 25 | yarn-error.* 26 | 27 | # macOS 28 | .DS_Store 29 | *.pem 30 | 31 | # local env files 32 | .env*.local 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | -------------------------------------------------------------------------------- /example/App.tsx: -------------------------------------------------------------------------------- 1 | import { useState } from "react"; 2 | import { Button, StyleSheet, Text, View, Image } from "react-native"; 3 | 4 | import { SecureWindow } from "@bufgix/react-native-secure-window"; 5 | 6 | export default function App() { 7 | const [counter, setCounter] = useState(0); 8 | 9 | return ( 10 | 11 | 12 | 18 | 19 | This text is protected by the SecureWindow 20 | 21 | Counter: {counter} 22 |