From b8f0222436ac8a45222823fb7ff01ccad37d2776 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Thu, 4 Apr 2024 21:15:23 -0700 Subject: [PATCH] feat: Add visionOS support (#227) * rnx-align-deps * Move old example app * init-test-app * Update test app * Remove old test apps * `yarn build` works again * Update example locks --- FabricExample/.bundle/config | 2 - FabricExample/.eslintrc.js | 4 - FabricExample/.gitignore | 66 - FabricExample/.prettierrc.js | 7 - FabricExample/.watchmanconfig | 1 - FabricExample/App.tsx | 171 - FabricExample/Gemfile | 7 - FabricExample/README.md | 79 - FabricExample/__tests__/App.test.tsx | 17 - FabricExample/android/app/build.gradle | 123 - FabricExample/android/app/debug.keystore | Bin 2257 -> 0 bytes FabricExample/android/app/proguard-rules.pro | 10 - .../android/app/src/debug/AndroidManifest.xml | 13 - .../com/fabricexample/ReactNativeFlipper.java | 75 - .../android/app/src/main/AndroidManifest.xml | 25 - .../java/com/fabricexample/MainActivity.java | 32 - .../com/fabricexample/MainApplication.java | 62 - .../res/drawable/rn_edit_text_material.xml | 36 - .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 3056 -> 0 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 5024 -> 0 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 2096 -> 0 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 2858 -> 0 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 4569 -> 0 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 7098 -> 0 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 6464 -> 0 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 10676 -> 0 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 9250 -> 0 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 15523 -> 0 bytes .../app/src/main/res/values/strings.xml | 3 - .../app/src/main/res/values/styles.xml | 9 - .../com/fabricexample/ReactNativeFlipper.java | 20 - FabricExample/android/build.gradle | 21 - FabricExample/android/gradle.properties | 44 - .../android/gradle/wrapper/gradle-wrapper.jar | Bin 61574 -> 0 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 - FabricExample/android/gradlew | 244 - FabricExample/android/gradlew.bat | 92 - FabricExample/android/settings.gradle | 4 - FabricExample/app.json | 4 - FabricExample/babel.config.js | 3 - FabricExample/ios/.xcode.env | 1 - .../FabricExample.xcodeproj/project.pbxproj | 729 -- .../xcschemes/FabricExample.xcscheme | 88 - .../contents.xcworkspacedata | 10 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - FabricExample/ios/FabricExample/AppDelegate.h | 6 - .../ios/FabricExample/AppDelegate.mm | 26 - .../AppIcon.appiconset/Contents.json | 53 - .../Images.xcassets/Contents.json | 6 - FabricExample/ios/FabricExample/Info.plist | 55 - .../ios/FabricExample/LaunchScreen.storyboard | 47 - FabricExample/ios/FabricExample/main.m | 10 - .../FabricExampleTests/FabricExampleTests.m | 66 - .../ios/FabricExampleTests/Info.plist | 24 - FabricExample/ios/Podfile | 63 - FabricExample/ios/Podfile.lock | 1319 --- FabricExample/ios/_xcode.env | 11 - FabricExample/jest.config.js | 3 - FabricExample/metro.config.js | 51 - FabricExample/package.json | 37 - FabricExample/tsconfig.json | 3 - RNCClipboard.podspec | 5 +- example/.buckconfig | 6 - example/.eslintrc.js | 4 - example/.flowconfig | 77 - example/.gitattributes | 1 - example/.gitignore | 67 +- example/.prettierrc.js | 6 - example/.watchmanconfig | 2 +- example/App.tsx | 8 +- example/android/.project | 28 - .../org.eclipse.buildship.core.prefs | 13 - example/android/app/.classpath | 6 - example/android/app/.project | 34 - .../org.eclipse.buildship.core.prefs | 2 - example/android/app/_BUCK | 55 - example/android/app/build.gradle | 224 - example/android/app/build_defs.bzl | 19 - example/android/app/debug.keystore | Bin 2257 -> 0 bytes example/android/app/proguard-rules.pro | 10 - .../android/app/src/debug/AndroidManifest.xml | 8 - .../android/app/src/main/AndroidManifest.xml | 25 - .../main/java/com/example/MainActivity.java | 15 - .../java/com/example/MainApplication.java | 82 - .../java/com/example/ReactNativeFlipper.java | 72 - .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 3056 -> 0 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 5024 -> 0 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 2096 -> 0 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 2858 -> 0 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 4569 -> 0 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 7098 -> 0 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 6464 -> 0 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 10676 -> 0 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 9250 -> 0 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 15523 -> 0 bytes .../app/src/main/res/values/strings.xml | 3 - .../app/src/main/res/values/styles.xml | 9 - example/android/build.gradle | 51 +- example/android/gradle.properties | 49 +- .../android/gradle/wrapper/gradle-wrapper.jar | Bin 59203 -> 43462 bytes .../gradle/wrapper/gradle-wrapper.properties | 4 +- example/android/gradlew | 287 +- example/android/gradlew.bat | 60 +- example/android/settings.gradle | 24 +- example/app.json | 34 +- example/babel.config.js | 2 +- {FabricExample => example}/index.js | 0 example/ios/Podfile | 36 +- example/ios/Podfile.lock | 1488 +++- example/ios/example.xcodeproj/project.pbxproj | 687 -- .../xcshareddata/xcschemes/example.xcscheme | 88 - .../contents.xcworkspacedata | 10 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - example/ios/example/AppDelegate.h | 15 - example/ios/example/AppDelegate.m | 62 - .../AppIcon.appiconset/Contents.json | 38 - .../ios/example/Images.xcassets/Contents.json | 6 - example/ios/example/Info.plist | 55 - example/ios/example/LaunchScreen.storyboard | 47 - example/ios/example/main.m | 16 - example/ios/exampleTests/Info.plist | 24 - example/ios/exampleTests/exampleTests.m | 65 - example/macos/.gitignore | 2 - example/macos/Config/example.debug.xcconfig | 9 - example/macos/Config/example.release.xcconfig | 6 - example/macos/Config/example.shared.xcconfig | 46 - example/macos/Podfile | 49 +- example/macos/Podfile.lock | 1472 +++- example/macos/example-macOS/AppDelegate.h | 9 - example/macos/example-macOS/AppDelegate.m | 32 - .../AppIcon.appiconset/Contents.json | 58 - .../Assets.xcassets/Contents.json | 6 - .../example-macOS/Base.lproj/Main.storyboard | 717 -- example/macos/example-macOS/Info.plist | 47 - example/macos/example-macOS/ViewController.h | 5 - example/macos/example-macOS/ViewController.m | 22 - .../macos/example-macOS/example.entitlements | 12 - example/macos/example-macOS/main.m | 5 - .../macos/example.xcodeproj/project.pbxproj | 339 - .../xcschemes/example-macOS.xcscheme | 78 - .../contents.xcworkspacedata | 10 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - example/metro.config.js | 11 + example/package.json | 51 + example/react-native.config.js | 23 + example/tsconfig.json | 3 + example/visionos/Podfile | 9 + example/visionos/Podfile.lock | 1315 +++ example/windows/.gitignore | 125 +- example/windows/ClipboardExample.sln | 227 - example/windows/ClipboardExample/.gitignore | 1 - example/windows/ClipboardExample/App.cpp | 43 - example/windows/ClipboardExample/App.h | 13 - example/windows/ClipboardExample/App.idl | 3 - example/windows/ClipboardExample/App.xaml | 7 - .../ClipboardExample/App62_TemporaryKey.pfx | Bin 2598 -> 0 bytes .../Assets/LockScreenLogo.scale-200.png | Bin 1430 -> 0 bytes .../Assets/SplashScreen.scale-200.png | Bin 7700 -> 0 bytes .../Assets/Square150x150Logo.scale-200.png | Bin 2937 -> 0 bytes .../Assets/Square44x44Logo.scale-200.png | Bin 1647 -> 0 bytes ...x44Logo.targetsize-24_altform-unplated.png | Bin 1255 -> 0 bytes .../ClipboardExample/Assets/StoreLogo.png | Bin 1451 -> 0 bytes .../Assets/Wide310x150Logo.scale-200.png | Bin 3204 -> 0 bytes .../AutolinkedNativeModules.g.cpp | 13 - .../AutolinkedNativeModules.g.h | 10 - .../ClipboardExample/ClipboardExample.vcxproj | 180 - .../ClipboardExample.vcxproj.filters | 60 - .../ClipboardExample/Package.appxmanifest | 49 - .../ClipboardExample/PropertySheet.props | 16 - .../ClipboardExample/ReactPackageProvider.cpp | 18 - .../ClipboardExample/ReactPackageProvider.h | 15 - .../windows/ClipboardExample/packages.config | 4 - example/windows/ClipboardExample/pch.cpp | 1 - example/windows/ClipboardExample/pch.h | 22 - {FabricExample => example}/yarn.lock | 4735 ++++++---- index.js | 11 - package.json | 51 +- yarn.lock | 7779 +++++++---------- 178 files changed, 10532 insertions(+), 14928 deletions(-) delete mode 100644 FabricExample/.bundle/config delete mode 100644 FabricExample/.eslintrc.js delete mode 100644 FabricExample/.gitignore delete mode 100644 FabricExample/.prettierrc.js delete mode 100644 FabricExample/.watchmanconfig delete mode 100644 FabricExample/App.tsx delete mode 100644 FabricExample/Gemfile delete mode 100644 FabricExample/README.md delete mode 100644 FabricExample/__tests__/App.test.tsx delete mode 100644 FabricExample/android/app/build.gradle delete mode 100644 FabricExample/android/app/debug.keystore delete mode 100644 FabricExample/android/app/proguard-rules.pro delete mode 100644 FabricExample/android/app/src/debug/AndroidManifest.xml delete mode 100644 FabricExample/android/app/src/debug/java/com/fabricexample/ReactNativeFlipper.java delete mode 100644 FabricExample/android/app/src/main/AndroidManifest.xml delete mode 100644 FabricExample/android/app/src/main/java/com/fabricexample/MainActivity.java delete mode 100644 FabricExample/android/app/src/main/java/com/fabricexample/MainApplication.java delete mode 100644 FabricExample/android/app/src/main/res/drawable/rn_edit_text_material.xml delete mode 100644 FabricExample/android/app/src/main/res/mipmap-hdpi/ic_launcher.png delete mode 100644 FabricExample/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png delete mode 100644 FabricExample/android/app/src/main/res/mipmap-mdpi/ic_launcher.png delete mode 100644 FabricExample/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png delete mode 100644 FabricExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png delete mode 100644 FabricExample/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png delete mode 100644 FabricExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png delete mode 100644 FabricExample/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png delete mode 100644 FabricExample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png delete mode 100644 FabricExample/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png delete mode 100644 FabricExample/android/app/src/main/res/values/strings.xml delete mode 100644 FabricExample/android/app/src/main/res/values/styles.xml delete mode 100644 FabricExample/android/app/src/release/java/com/fabricexample/ReactNativeFlipper.java delete mode 100644 FabricExample/android/build.gradle delete mode 100644 FabricExample/android/gradle.properties delete mode 100644 FabricExample/android/gradle/wrapper/gradle-wrapper.jar delete mode 100644 FabricExample/android/gradle/wrapper/gradle-wrapper.properties delete mode 100755 FabricExample/android/gradlew delete mode 100644 FabricExample/android/gradlew.bat delete mode 100644 FabricExample/android/settings.gradle delete mode 100644 FabricExample/app.json delete mode 100644 FabricExample/babel.config.js delete mode 100644 FabricExample/ios/.xcode.env delete mode 100644 FabricExample/ios/FabricExample.xcodeproj/project.pbxproj delete mode 100644 FabricExample/ios/FabricExample.xcodeproj/xcshareddata/xcschemes/FabricExample.xcscheme delete mode 100644 FabricExample/ios/FabricExample.xcworkspace/contents.xcworkspacedata delete mode 100644 FabricExample/ios/FabricExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 FabricExample/ios/FabricExample/AppDelegate.h delete mode 100644 FabricExample/ios/FabricExample/AppDelegate.mm delete mode 100644 FabricExample/ios/FabricExample/Images.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 FabricExample/ios/FabricExample/Images.xcassets/Contents.json delete mode 100644 FabricExample/ios/FabricExample/Info.plist delete mode 100644 FabricExample/ios/FabricExample/LaunchScreen.storyboard delete mode 100644 FabricExample/ios/FabricExample/main.m delete mode 100644 FabricExample/ios/FabricExampleTests/FabricExampleTests.m delete mode 100644 FabricExample/ios/FabricExampleTests/Info.plist delete mode 100644 FabricExample/ios/Podfile delete mode 100644 FabricExample/ios/Podfile.lock delete mode 100644 FabricExample/ios/_xcode.env delete mode 100644 FabricExample/jest.config.js delete mode 100644 FabricExample/metro.config.js delete mode 100644 FabricExample/package.json delete mode 100644 FabricExample/tsconfig.json delete mode 100644 example/.buckconfig delete mode 100644 example/.eslintrc.js delete mode 100644 example/.flowconfig delete mode 100644 example/.gitattributes delete mode 100644 example/.prettierrc.js delete mode 100644 example/android/.project delete mode 100644 example/android/.settings/org.eclipse.buildship.core.prefs delete mode 100644 example/android/app/.classpath delete mode 100644 example/android/app/.project delete mode 100644 example/android/app/.settings/org.eclipse.buildship.core.prefs delete mode 100644 example/android/app/_BUCK delete mode 100644 example/android/app/build.gradle delete mode 100644 example/android/app/build_defs.bzl delete mode 100644 example/android/app/debug.keystore delete mode 100644 example/android/app/proguard-rules.pro delete mode 100644 example/android/app/src/debug/AndroidManifest.xml delete mode 100644 example/android/app/src/main/AndroidManifest.xml delete mode 100644 example/android/app/src/main/java/com/example/MainActivity.java delete mode 100644 example/android/app/src/main/java/com/example/MainApplication.java delete mode 100644 example/android/app/src/main/java/com/example/ReactNativeFlipper.java delete mode 100644 example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png delete mode 100644 example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png delete mode 100644 example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png delete mode 100644 example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png delete mode 100644 example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png delete mode 100644 example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png delete mode 100644 example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png delete mode 100644 example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png delete mode 100644 example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png delete mode 100644 example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png delete mode 100644 example/android/app/src/main/res/values/strings.xml delete mode 100644 example/android/app/src/main/res/values/styles.xml rename {FabricExample => example}/index.js (100%) delete mode 100644 example/ios/example.xcodeproj/project.pbxproj delete mode 100644 example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme delete mode 100644 example/ios/example.xcworkspace/contents.xcworkspacedata delete mode 100644 example/ios/example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 example/ios/example/AppDelegate.h delete mode 100644 example/ios/example/AppDelegate.m delete mode 100644 example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 example/ios/example/Images.xcassets/Contents.json delete mode 100644 example/ios/example/Info.plist delete mode 100644 example/ios/example/LaunchScreen.storyboard delete mode 100644 example/ios/example/main.m delete mode 100644 example/ios/exampleTests/Info.plist delete mode 100644 example/ios/exampleTests/exampleTests.m delete mode 100644 example/macos/.gitignore delete mode 100644 example/macos/Config/example.debug.xcconfig delete mode 100644 example/macos/Config/example.release.xcconfig delete mode 100644 example/macos/Config/example.shared.xcconfig delete mode 100644 example/macos/example-macOS/AppDelegate.h delete mode 100644 example/macos/example-macOS/AppDelegate.m delete mode 100644 example/macos/example-macOS/Assets.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 example/macos/example-macOS/Assets.xcassets/Contents.json delete mode 100644 example/macos/example-macOS/Base.lproj/Main.storyboard delete mode 100644 example/macos/example-macOS/Info.plist delete mode 100644 example/macos/example-macOS/ViewController.h delete mode 100644 example/macos/example-macOS/ViewController.m delete mode 100644 example/macos/example-macOS/example.entitlements delete mode 100644 example/macos/example-macOS/main.m delete mode 100644 example/macos/example.xcodeproj/project.pbxproj delete mode 100644 example/macos/example.xcodeproj/xcshareddata/xcschemes/example-macOS.xcscheme delete mode 100644 example/macos/example.xcworkspace/contents.xcworkspacedata delete mode 100644 example/macos/example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 example/metro.config.js create mode 100644 example/package.json create mode 100644 example/react-native.config.js create mode 100644 example/tsconfig.json create mode 100644 example/visionos/Podfile create mode 100644 example/visionos/Podfile.lock delete mode 100644 example/windows/ClipboardExample.sln delete mode 100644 example/windows/ClipboardExample/.gitignore delete mode 100644 example/windows/ClipboardExample/App.cpp delete mode 100644 example/windows/ClipboardExample/App.h delete mode 100644 example/windows/ClipboardExample/App.idl delete mode 100644 example/windows/ClipboardExample/App.xaml delete mode 100644 example/windows/ClipboardExample/App62_TemporaryKey.pfx delete mode 100644 example/windows/ClipboardExample/Assets/LockScreenLogo.scale-200.png delete mode 100644 example/windows/ClipboardExample/Assets/SplashScreen.scale-200.png delete mode 100644 example/windows/ClipboardExample/Assets/Square150x150Logo.scale-200.png delete mode 100644 example/windows/ClipboardExample/Assets/Square44x44Logo.scale-200.png delete mode 100644 example/windows/ClipboardExample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png delete mode 100644 example/windows/ClipboardExample/Assets/StoreLogo.png delete mode 100644 example/windows/ClipboardExample/Assets/Wide310x150Logo.scale-200.png delete mode 100644 example/windows/ClipboardExample/AutolinkedNativeModules.g.cpp delete mode 100644 example/windows/ClipboardExample/AutolinkedNativeModules.g.h delete mode 100644 example/windows/ClipboardExample/ClipboardExample.vcxproj delete mode 100644 example/windows/ClipboardExample/ClipboardExample.vcxproj.filters delete mode 100644 example/windows/ClipboardExample/Package.appxmanifest delete mode 100644 example/windows/ClipboardExample/PropertySheet.props delete mode 100644 example/windows/ClipboardExample/ReactPackageProvider.cpp delete mode 100644 example/windows/ClipboardExample/ReactPackageProvider.h delete mode 100644 example/windows/ClipboardExample/packages.config delete mode 100644 example/windows/ClipboardExample/pch.cpp delete mode 100644 example/windows/ClipboardExample/pch.h rename {FabricExample => example}/yarn.lock (61%) delete mode 100644 index.js diff --git a/FabricExample/.bundle/config b/FabricExample/.bundle/config deleted file mode 100644 index 848943bb..00000000 --- a/FabricExample/.bundle/config +++ /dev/null @@ -1,2 +0,0 @@ -BUNDLE_PATH: "vendor/bundle" -BUNDLE_FORCE_RUBY_PLATFORM: 1 diff --git a/FabricExample/.eslintrc.js b/FabricExample/.eslintrc.js deleted file mode 100644 index 187894b6..00000000 --- a/FabricExample/.eslintrc.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - root: true, - extends: '@react-native', -}; diff --git a/FabricExample/.gitignore b/FabricExample/.gitignore deleted file mode 100644 index 0cab2ac6..00000000 --- a/FabricExample/.gitignore +++ /dev/null @@ -1,66 +0,0 @@ -# OSX -# -.DS_Store - -# Xcode -# -build/ -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata -*.xccheckout -*.moved-aside -DerivedData -*.hmap -*.ipa -*.xcuserstate -ios/.xcode.env.local - -# Android/IntelliJ -# -build/ -.idea -.gradle -local.properties -*.iml -*.hprof -.cxx/ -*.keystore -!debug.keystore - -# node.js -# -node_modules/ -npm-debug.log -yarn-error.log - -# fastlane -# -# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the -# screenshots whenever they are needed. -# For more information about the recommended setup visit: -# https://docs.fastlane.tools/best-practices/source-control/ - -**/fastlane/report.xml -**/fastlane/Preview.html -**/fastlane/screenshots -**/fastlane/test_output - -# Bundle artifact -*.jsbundle - -# Ruby / CocoaPods -/ios/Pods/ -/vendor/bundle/ - -# Temporary files created by Metro to check the health of the file watcher -.metro-health-check* - -# testing -/coverage diff --git a/FabricExample/.prettierrc.js b/FabricExample/.prettierrc.js deleted file mode 100644 index 2b540746..00000000 --- a/FabricExample/.prettierrc.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - arrowParens: 'avoid', - bracketSameLine: true, - bracketSpacing: false, - singleQuote: true, - trailingComma: 'all', -}; diff --git a/FabricExample/.watchmanconfig b/FabricExample/.watchmanconfig deleted file mode 100644 index 0967ef42..00000000 --- a/FabricExample/.watchmanconfig +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/FabricExample/App.tsx b/FabricExample/App.tsx deleted file mode 100644 index faeccbd6..00000000 --- a/FabricExample/App.tsx +++ /dev/null @@ -1,171 +0,0 @@ -import React, {useEffect, useState} from 'react'; -import { - StyleSheet, - Text, - View, - Button, - TextInput, - Alert, - SafeAreaView, - Platform, - Image, -} from 'react-native'; -import Clipboard, {useClipboard} from '@react-native-clipboard/clipboard'; - -// Small icon of a plus for demo purposes -const TEST_IMAGE = - 'iVBORw0KGgoAAAANSUhEUgAAADMAAAAzCAYAAAA6oTAqAAAAEXRFWHRTb2Z0d2FyZQBwbmdjcnVzaEB1SfMAAABQSURBVGje7dSxCQBACARB+2/ab8BEeQNhFi6WSYzYLYudDQYGBgYGBgYGBgYGBgYGBgZmcvDqYGBgmhivGQYGBgYGBgYGBgYGBgYGBgbmQw+P/eMrC5UTVAAAAABJRU5ErkJggg=='; - -const changeListener = () => { - console.warn('Clipboard changed!'); -}; - -const App: React.FC = () => { - const [text, setText] = useState(''); - const [isURL, setIsURL] = useState(false); - const [data, setString] = useClipboard(); - const [image, setImage] = useState(null); - const [imageString, setImageString] = useState(''); - - const checkStringType = async () => { - const checkClipboard = await Clipboard.hasURL(); - setIsURL(checkClipboard); - }; - - const pasteImageAndroid = async () => { - const base64 = await Clipboard.getImage(); - setImageString(base64); - }; - - useEffect(() => { - checkStringType(); - }, [data]); - - useEffect(() => { - if (Platform.OS === 'ios' || Platform.OS === 'android') { - const listener = Clipboard.addListener(changeListener); - - return () => { - listener.remove(); - }; - } - }, []); - - const writeToClipboard = async () => { - setString(text); - Alert.alert(`Copied to clipboard: ${text}`); - }; - - const writeImageToClipboard = async () => { - Clipboard.setImage(TEST_IMAGE); - Alert.alert(`Copied Image to clipboard`); - }; - - const getImage = async () => { - if (await Clipboard.hasImage()) { - const image = await Clipboard.getImagePNG(); - setImage(image); - } else { - console.warn('No image in clipboard'); - } - }; - - return ( - - Clipboard Module - - Clipboard Contents: - {data} - Content is URL: - {JSON.stringify(isURL)} - Content is IMAGE: - {image && } - - setText(input)} - value={text} - placeholder="Type here..." - /> -