From be3753d6050cda9636686dc2cd6cfd68f4470b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20M=C4=99drek?= Date: Fri, 27 Sep 2024 22:34:29 +0200 Subject: [PATCH 1/4] chore: use react-native-test-app for example app --- .editorconfig | 6 + .eslintrc.js | 82 +- .github/workflows/lint-android.yml | 1 - .github/workflows/lint-ios.yml | 16 +- .github/workflows/lint-js.yml | 24 +- .gitignore | 3 - .prettierrc.js | 8 + .yarnrc.yml | 2 - CONTRIBUTING.md | 74 +- README.md | 2 - dprint.json | 29 - lefthook.yml | 15 - package.json | 59 +- packages/app/getSharedBabelConfig.js | 36 - packages/app/getSharedMetroConfig.js | 34 - packages/app/package.json | 18 - packages/app/src/index.tsx | 32 - packages/app/src/navigation/index.tsx | 43 - .../app/src/screens/KeyboardTypeExample.tsx | 156 - packages/example/.gitignore | 16 + packages/example/.watchmanconfig | 1 + packages/example/App.tsx | 31 + packages/example/android/build.gradle | 43 + .../android/gradle.properties | 39 +- .../android/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43453 bytes .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../{fabricMobile => example}/android/gradlew | 17 +- .../android/gradlew.bat | 20 +- packages/example/android/settings.gradle | 21 + packages/example/app.json | 34 + .../assets/AppIconTransparent.png | Bin packages/example/babel.config.js | 31 + .../{mobile/index.tsx => example/index.js} | 2 +- packages/example/ios/Podfile | 13 + packages/example/ios/Podfile.lock | 1906 ++++ packages/example/metro.config.js | 18 + packages/example/package.json | 47 + packages/example/react-native.config.js | 30 + .../src/components/Button.tsx | 3 +- .../src/components/CloseButton.tsx | 3 +- .../src/components/MultilineInput.tsx | 10 +- .../src/components/SingleInput.tsx | 0 .../{app => example}/src/consts/styles.ts | 0 .../src/hooks/useSoftInputHandler.ts | 13 +- packages/example/src/navigation/index.tsx | 45 + .../{app => example}/src/navigation/routes.ts | 0 .../{app => example}/src/navigation/types.ts | 0 .../src/screens/BottomSheetExample.tsx | 49 +- .../CustomAnimationConfigModuleExample.tsx | 18 +- .../CustomAnimationConfigViewExample.tsx | 31 +- .../src/screens/EnabledViewPropExample.tsx | 57 +- .../src/screens/FormExample.tsx | 53 +- .../src/screens/HomeScreen.tsx | 64 +- .../src/screens/KeyboardTypeExample.tsx | 162 + .../src/screens/ModalExample.tsx | 86 +- .../src/screens/ModalFormSheetExample.tsx | 100 +- .../src/screens/PasswordFormExample.tsx | 51 +- .../src/screens/ReanimatedExample.tsx | 38 +- .../src/screens/ScreensNativeModalExample.tsx | 72 +- .../src/screens/StickyFooterExample.tsx | 28 +- packages/{app => example}/tsconfig.json | 6 +- packages/fabricMobile/.bundle/config | 2 - packages/fabricMobile/.gitignore | 63 - packages/fabricMobile/.watchmanconfig | 1 - packages/fabricMobile/Gemfile | 7 - packages/fabricMobile/Gemfile.lock | 100 - .../fabricMobile/android/app/build.gradle | 120 - .../fabricMobile/android/app/debug.keystore | Bin 2257 -> 0 bytes .../android/app/proguard-rules.pro | 12 - .../android/app/src/debug/AndroidManifest.xml | 11 - .../android/app/src/main/AndroidManifest.xml | 26 - .../app/src/main/ic_launcher-playstore.png | Bin 42585 -> 0 bytes .../MainActivity.kt | 28 - .../MainApplication.kt | 44 - .../res/drawable-hdpi/bootsplash_logo.png | Bin 3052 -> 0 bytes .../res/drawable-mdpi/bootsplash_logo.png | Bin 2321 -> 0 bytes .../res/drawable-xhdpi/bootsplash_logo.png | Bin 3757 -> 0 bytes .../res/drawable-xxhdpi/bootsplash_logo.png | Bin 5467 -> 0 bytes .../res/drawable-xxxhdpi/bootsplash_logo.png | Bin 7088 -> 0 bytes .../res/drawable/ic_launcher_background.xml | 74 - .../res/drawable/rn_edit_text_material.xml | 36 - .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 - .../mipmap-anydpi-v26/ic_launcher_round.xml | 5 - .../mipmap-hdpi/ic_launcher_foreground.png | Bin 6273 -> 0 bytes .../mipmap-mdpi/ic_launcher_foreground.png | Bin 3506 -> 0 bytes .../mipmap-xhdpi/ic_launcher_foreground.png | Bin 9051 -> 0 bytes .../mipmap-xxhdpi/ic_launcher_foreground.png | Bin 17340 -> 0 bytes .../mipmap-xxxhdpi/ic_launcher_foreground.png | Bin 29293 -> 0 bytes .../app/src/main/res/values/colors.xml | 3 - .../app/src/main/res/values/strings.xml | 3 - .../app/src/main/res/values/styles.xml | 16 - packages/fabricMobile/android/build.gradle | 27 - .../android/gradle/wrapper/gradle-wrapper.jar | Bin 59821 -> 0 bytes packages/fabricMobile/android/settings.gradle | 4 - packages/fabricMobile/android/spotless.gradle | 14 - packages/fabricMobile/app.json | 4 - .../assets/AppIconTransparent.png | Bin 273154 -> 0 bytes packages/fabricMobile/babel.config.js | 3 - packages/fabricMobile/index.tsx | 8 - packages/fabricMobile/ios/.swiftformat | 117 - packages/fabricMobile/ios/.swiftlint.yml | 172 - packages/fabricMobile/ios/.xcode.env | 16 - ...ricAvoidSoftinputExample-Bridging-Header.h | 4 - .../project.pbxproj | 532 -- .../FabricAvoidSoftinputExample.xcscheme | 77 - .../contents.xcworkspacedata | 10 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - .../FabricAvoidSoftinputExample/AppDelegate.h | 6 - .../AppDelegate.mm | 35 - .../BootSplash.storyboard | 42 - .../FabricAvoidSoftinputExample/File.swift | 1 - .../AppIcon.appiconset/AppIcon-1024.png | Bin 292405 -> 0 bytes .../AppIcon.appiconset/AppIcon-20.png | Bin 1839 -> 0 bytes .../AppIcon.appiconset/AppIcon-20@2x.png | Bin 2943 -> 0 bytes .../AppIcon.appiconset/AppIcon-20@3x.png | Bin 3968 -> 0 bytes .../AppIcon.appiconset/AppIcon-29.png | Bin 2420 -> 0 bytes .../AppIcon.appiconset/AppIcon-29@2x.png | Bin 3762 -> 0 bytes .../AppIcon.appiconset/AppIcon-29@3x.png | Bin 5956 -> 0 bytes .../AppIcon.appiconset/AppIcon-40.png | Bin 2943 -> 0 bytes .../AppIcon.appiconset/AppIcon-40@2x.png | Bin 5404 -> 0 bytes .../AppIcon.appiconset/AppIcon-40@3x.png | Bin 7962 -> 0 bytes .../AppIcon.appiconset/AppIcon-60@2x.png | Bin 7962 -> 0 bytes .../AppIcon.appiconset/AppIcon-60@3x.png | Bin 13483 -> 0 bytes .../AppIcon.appiconset/AppIcon-76.png | Bin 5091 -> 0 bytes .../AppIcon.appiconset/AppIcon-76@2x.png | Bin 10760 -> 0 bytes .../AppIcon.appiconset/AppIcon-83.5@2x.png | Bin 12434 -> 0 bytes .../AppIcon.appiconset/Contents.json | 116 - .../BootSplashLogo.imageset/Contents.json | 23 - .../bootsplash_logo.png | Bin 2145 -> 0 bytes .../bootsplash_logo@2x.png | Bin 3053 -> 0 bytes .../bootsplash_logo@3x.png | Bin 4549 -> 0 bytes .../Images.xcassets/Contents.json | 6 - .../FabricAvoidSoftinputExample/Info.plist | 52 - .../ios/FabricAvoidSoftinputExample/main.mm | 10 - packages/fabricMobile/ios/Podfile | 54 - packages/fabricMobile/ios/Podfile.lock | 1628 ---- packages/fabricMobile/jest.config.js | 3 - packages/fabricMobile/metro.config.js | 5 - packages/fabricMobile/package.json | 49 - packages/fabricMobile/react-native.config.js | 9 - packages/fabricMobile/tsconfig.json | 10 - packages/mobile/.gitignore | 63 - packages/mobile/Gemfile | 7 - packages/mobile/Gemfile.lock | 102 - packages/mobile/android/app/build.gradle | 119 - packages/mobile/android/app/debug.keystore | Bin 2257 -> 0 bytes .../mobile/android/app/proguard-rules.pro | 11 - .../android/app/src/debug/AndroidManifest.xml | 11 - .../android/app/src/main/AndroidManifest.xml | 26 - .../app/src/main/ic_launcher-playstore.png | Bin 42585 -> 0 bytes .../reactnativeavoidsoftinput/MainActivity.kt | 28 - .../MainApplication.kt | 39 - .../res/drawable-hdpi/bootsplash_logo.png | Bin 3052 -> 0 bytes .../res/drawable-mdpi/bootsplash_logo.png | Bin 2321 -> 0 bytes .../res/drawable-xhdpi/bootsplash_logo.png | Bin 3757 -> 0 bytes .../res/drawable-xxhdpi/bootsplash_logo.png | Bin 5467 -> 0 bytes .../res/drawable-xxxhdpi/bootsplash_logo.png | Bin 7088 -> 0 bytes .../res/drawable/ic_launcher_background.xml | 74 - .../res/drawable/rn_edit_text_material.xml | 36 - .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 - .../mipmap-anydpi-v26/ic_launcher_round.xml | 5 - .../mipmap-hdpi/ic_launcher_foreground.png | Bin 6273 -> 0 bytes .../mipmap-mdpi/ic_launcher_foreground.png | Bin 3506 -> 0 bytes .../mipmap-xhdpi/ic_launcher_foreground.png | Bin 9051 -> 0 bytes .../mipmap-xxhdpi/ic_launcher_foreground.png | Bin 17340 -> 0 bytes .../mipmap-xxxhdpi/ic_launcher_foreground.png | Bin 29293 -> 0 bytes .../app/src/main/res/values/colors.xml | 3 - .../app/src/main/res/values/strings.xml | 3 - .../app/src/main/res/values/styles.xml | 15 - packages/mobile/android/build.gradle | 27 - packages/mobile/android/gradle.properties | 37 - .../android/gradle/wrapper/gradle-wrapper.jar | Bin 55616 -> 0 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 - packages/mobile/android/gradlew | 243 - packages/mobile/android/gradlew.bat | 91 - packages/mobile/android/settings.gradle | 4 - packages/mobile/android/spotless.gradle | 14 - packages/mobile/app.json | 4 - packages/mobile/babel.config.js | 3 - packages/mobile/ios/.swiftformat | 117 - packages/mobile/ios/.swiftlint.yml | 172 - packages/mobile/ios/.xcode.env | 15 - .../AvoidSoftinputExample-Bridging-Header.h | 3 - .../project.pbxproj | 515 -- .../xcschemes/AvoidSoftinputExample.xcscheme | 99 - .../contents.xcworkspacedata | 10 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - .../ios/AvoidSoftinputExample/AppDelegate.h | 6 - .../ios/AvoidSoftinputExample/AppDelegate.mm | 35 - .../BootSplash.storyboard | 42 - .../ios/AvoidSoftinputExample/File.swift | 6 - .../AppIcon.appiconset/AppIcon-1024.png | Bin 292405 -> 0 bytes .../AppIcon.appiconset/AppIcon-20.png | Bin 1839 -> 0 bytes .../AppIcon.appiconset/AppIcon-20@2x.png | Bin 2943 -> 0 bytes .../AppIcon.appiconset/AppIcon-20@3x.png | Bin 3968 -> 0 bytes .../AppIcon.appiconset/AppIcon-29.png | Bin 2420 -> 0 bytes .../AppIcon.appiconset/AppIcon-29@2x.png | Bin 3762 -> 0 bytes .../AppIcon.appiconset/AppIcon-29@3x.png | Bin 5956 -> 0 bytes .../AppIcon.appiconset/AppIcon-40.png | Bin 2943 -> 0 bytes .../AppIcon.appiconset/AppIcon-40@2x.png | Bin 5404 -> 0 bytes .../AppIcon.appiconset/AppIcon-40@3x.png | Bin 7962 -> 0 bytes .../AppIcon.appiconset/AppIcon-60@2x.png | Bin 7962 -> 0 bytes .../AppIcon.appiconset/AppIcon-60@3x.png | Bin 13483 -> 0 bytes .../AppIcon.appiconset/AppIcon-76.png | Bin 5091 -> 0 bytes .../AppIcon.appiconset/AppIcon-76@2x.png | Bin 10760 -> 0 bytes .../AppIcon.appiconset/AppIcon-83.5@2x.png | Bin 12434 -> 0 bytes .../AppIcon.appiconset/Contents.json | 116 - .../BootSplashLogo.imageset/Contents.json | 23 - .../bootsplash_logo.png | Bin 2145 -> 0 bytes .../bootsplash_logo@2x.png | Bin 3053 -> 0 bytes .../bootsplash_logo@3x.png | Bin 4549 -> 0 bytes .../Images.xcassets/Contents.json | 6 - .../ios/AvoidSoftinputExample/Info.plist | 52 - .../mobile/ios/AvoidSoftinputExample/main.mm | 17 - packages/mobile/ios/Podfile | 53 - packages/mobile/ios/Podfile.lock | 1421 --- packages/mobile/jest.config.js | 3 - packages/mobile/metro.config.js | 5 - packages/mobile/package.json | 46 - packages/mobile/react-native.config.js | 9 - packages/mobile/tsconfig.json | 10 - scripts/runPackagerInWorkspace.js | 97 - tsconfig.base.json | 21 - tsconfig.jest.json | 7 - yarn.lock | 7850 ++++++++--------- 225 files changed, 6741 insertions(+), 12401 deletions(-) create mode 100644 .prettierrc.js delete mode 100644 dprint.json delete mode 100644 packages/app/getSharedBabelConfig.js delete mode 100644 packages/app/getSharedMetroConfig.js delete mode 100644 packages/app/package.json delete mode 100644 packages/app/src/index.tsx delete mode 100644 packages/app/src/navigation/index.tsx delete mode 100644 packages/app/src/screens/KeyboardTypeExample.tsx create mode 100644 packages/example/.gitignore create mode 100644 packages/example/.watchmanconfig create mode 100644 packages/example/App.tsx create mode 100644 packages/example/android/build.gradle rename packages/{fabricMobile => example}/android/gradle.properties (51%) create mode 100644 packages/example/android/gradle/wrapper/gradle-wrapper.jar rename packages/{fabricMobile => example}/android/gradle/wrapper/gradle-wrapper.properties (94%) rename packages/{fabricMobile => example}/android/gradlew (92%) rename packages/{fabricMobile => example}/android/gradlew.bat (93%) create mode 100644 packages/example/android/settings.gradle create mode 100644 packages/example/app.json rename packages/{app => example}/assets/AppIconTransparent.png (100%) create mode 100644 packages/example/babel.config.js rename packages/{mobile/index.tsx => example/index.js} (77%) create mode 100644 packages/example/ios/Podfile create mode 100644 packages/example/ios/Podfile.lock create mode 100644 packages/example/metro.config.js create mode 100644 packages/example/package.json create mode 100644 packages/example/react-native.config.js rename packages/{app => example}/src/components/Button.tsx (98%) rename packages/{app => example}/src/components/CloseButton.tsx (98%) rename packages/{app => example}/src/components/MultilineInput.tsx (79%) rename packages/{app => example}/src/components/SingleInput.tsx (100%) rename packages/{app => example}/src/consts/styles.ts (100%) rename packages/{app => example}/src/hooks/useSoftInputHandler.ts (87%) create mode 100644 packages/example/src/navigation/index.tsx rename packages/{app => example}/src/navigation/routes.ts (100%) rename packages/{app => example}/src/navigation/types.ts (100%) rename packages/{app => example}/src/screens/BottomSheetExample.tsx (66%) rename packages/{app => example}/src/screens/CustomAnimationConfigModuleExample.tsx (78%) rename packages/{app => example}/src/screens/CustomAnimationConfigViewExample.tsx (68%) rename packages/{app => example}/src/screens/EnabledViewPropExample.tsx (56%) rename packages/{app => example}/src/screens/FormExample.tsx (61%) rename packages/{app => example}/src/screens/HomeScreen.tsx (73%) create mode 100644 packages/example/src/screens/KeyboardTypeExample.tsx rename packages/{app => example}/src/screens/ModalExample.tsx (55%) rename packages/{app => example}/src/screens/ModalFormSheetExample.tsx (51%) rename packages/{app => example}/src/screens/PasswordFormExample.tsx (58%) rename packages/{app => example}/src/screens/ReanimatedExample.tsx (76%) rename packages/{app => example}/src/screens/ScreensNativeModalExample.tsx (61%) rename packages/{app => example}/src/screens/StickyFooterExample.tsx (76%) rename packages/{app => example}/tsconfig.json (57%) delete mode 100644 packages/fabricMobile/.bundle/config delete mode 100644 packages/fabricMobile/.gitignore delete mode 100644 packages/fabricMobile/.watchmanconfig delete mode 100644 packages/fabricMobile/Gemfile delete mode 100644 packages/fabricMobile/Gemfile.lock delete mode 100644 packages/fabricMobile/android/app/build.gradle delete mode 100644 packages/fabricMobile/android/app/debug.keystore delete mode 100644 packages/fabricMobile/android/app/proguard-rules.pro delete mode 100644 packages/fabricMobile/android/app/src/debug/AndroidManifest.xml delete mode 100644 packages/fabricMobile/android/app/src/main/AndroidManifest.xml delete mode 100644 packages/fabricMobile/android/app/src/main/ic_launcher-playstore.png delete mode 100644 packages/fabricMobile/android/app/src/main/java/com/fabricavoidsoftinputexample/MainActivity.kt delete mode 100644 packages/fabricMobile/android/app/src/main/java/com/fabricavoidsoftinputexample/MainApplication.kt delete mode 100644 packages/fabricMobile/android/app/src/main/res/drawable-hdpi/bootsplash_logo.png delete mode 100644 packages/fabricMobile/android/app/src/main/res/drawable-mdpi/bootsplash_logo.png delete mode 100644 packages/fabricMobile/android/app/src/main/res/drawable-xhdpi/bootsplash_logo.png delete mode 100644 packages/fabricMobile/android/app/src/main/res/drawable-xxhdpi/bootsplash_logo.png delete mode 100644 packages/fabricMobile/android/app/src/main/res/drawable-xxxhdpi/bootsplash_logo.png delete mode 100644 packages/fabricMobile/android/app/src/main/res/drawable/ic_launcher_background.xml delete mode 100644 packages/fabricMobile/android/app/src/main/res/drawable/rn_edit_text_material.xml delete mode 100644 packages/fabricMobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml delete mode 100644 packages/fabricMobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml delete mode 100644 packages/fabricMobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png delete mode 100644 packages/fabricMobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png delete mode 100644 packages/fabricMobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png delete mode 100644 packages/fabricMobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png delete mode 100644 packages/fabricMobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png delete mode 100644 packages/fabricMobile/android/app/src/main/res/values/colors.xml delete mode 100644 packages/fabricMobile/android/app/src/main/res/values/strings.xml delete mode 100644 packages/fabricMobile/android/app/src/main/res/values/styles.xml delete mode 100644 packages/fabricMobile/android/build.gradle delete mode 100644 packages/fabricMobile/android/gradle/wrapper/gradle-wrapper.jar delete mode 100644 packages/fabricMobile/android/settings.gradle delete mode 100644 packages/fabricMobile/android/spotless.gradle delete mode 100644 packages/fabricMobile/app.json delete mode 100644 packages/fabricMobile/assets/AppIconTransparent.png delete mode 100644 packages/fabricMobile/babel.config.js delete mode 100644 packages/fabricMobile/index.tsx delete mode 100644 packages/fabricMobile/ios/.swiftformat delete mode 100644 packages/fabricMobile/ios/.swiftlint.yml delete mode 100644 packages/fabricMobile/ios/.xcode.env delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample-Bridging-Header.h delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample.xcodeproj/project.pbxproj delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample.xcodeproj/xcshareddata/xcschemes/FabricAvoidSoftinputExample.xcscheme delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample.xcworkspace/contents.xcworkspacedata delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/AppDelegate.h delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/AppDelegate.mm delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/BootSplash.storyboard delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/File.swift delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-1024.png delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-20.png delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-20@2x.png delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-20@3x.png delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-29.png delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-29@2x.png delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-29@3x.png delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-40.png delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-40@2x.png delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-40@3x.png delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-60@2x.png delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-60@3x.png delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-76.png delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-76@2x.png delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-83.5@2x.png delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/BootSplashLogo.imageset/Contents.json delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo.png delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo@2x.png delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo@3x.png delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Images.xcassets/Contents.json delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/Info.plist delete mode 100644 packages/fabricMobile/ios/FabricAvoidSoftinputExample/main.mm delete mode 100644 packages/fabricMobile/ios/Podfile delete mode 100644 packages/fabricMobile/ios/Podfile.lock delete mode 100644 packages/fabricMobile/jest.config.js delete mode 100644 packages/fabricMobile/metro.config.js delete mode 100644 packages/fabricMobile/package.json delete mode 100644 packages/fabricMobile/react-native.config.js delete mode 100644 packages/fabricMobile/tsconfig.json delete mode 100644 packages/mobile/.gitignore delete mode 100644 packages/mobile/Gemfile delete mode 100644 packages/mobile/Gemfile.lock delete mode 100644 packages/mobile/android/app/build.gradle delete mode 100644 packages/mobile/android/app/debug.keystore delete mode 100644 packages/mobile/android/app/proguard-rules.pro delete mode 100644 packages/mobile/android/app/src/debug/AndroidManifest.xml delete mode 100644 packages/mobile/android/app/src/main/AndroidManifest.xml delete mode 100644 packages/mobile/android/app/src/main/ic_launcher-playstore.png delete mode 100644 packages/mobile/android/app/src/main/java/com/example/reactnativeavoidsoftinput/MainActivity.kt delete mode 100644 packages/mobile/android/app/src/main/java/com/example/reactnativeavoidsoftinput/MainApplication.kt delete mode 100644 packages/mobile/android/app/src/main/res/drawable-hdpi/bootsplash_logo.png delete mode 100644 packages/mobile/android/app/src/main/res/drawable-mdpi/bootsplash_logo.png delete mode 100644 packages/mobile/android/app/src/main/res/drawable-xhdpi/bootsplash_logo.png delete mode 100644 packages/mobile/android/app/src/main/res/drawable-xxhdpi/bootsplash_logo.png delete mode 100644 packages/mobile/android/app/src/main/res/drawable-xxxhdpi/bootsplash_logo.png delete mode 100644 packages/mobile/android/app/src/main/res/drawable/ic_launcher_background.xml delete mode 100644 packages/mobile/android/app/src/main/res/drawable/rn_edit_text_material.xml delete mode 100644 packages/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml delete mode 100644 packages/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml delete mode 100644 packages/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png delete mode 100644 packages/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png delete mode 100644 packages/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png delete mode 100644 packages/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png delete mode 100644 packages/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png delete mode 100644 packages/mobile/android/app/src/main/res/values/colors.xml delete mode 100644 packages/mobile/android/app/src/main/res/values/strings.xml delete mode 100644 packages/mobile/android/app/src/main/res/values/styles.xml delete mode 100644 packages/mobile/android/build.gradle delete mode 100644 packages/mobile/android/gradle.properties delete mode 100644 packages/mobile/android/gradle/wrapper/gradle-wrapper.jar delete mode 100644 packages/mobile/android/gradle/wrapper/gradle-wrapper.properties delete mode 100755 packages/mobile/android/gradlew delete mode 100644 packages/mobile/android/gradlew.bat delete mode 100644 packages/mobile/android/settings.gradle delete mode 100644 packages/mobile/android/spotless.gradle delete mode 100644 packages/mobile/app.json delete mode 100644 packages/mobile/babel.config.js delete mode 100644 packages/mobile/ios/.swiftformat delete mode 100644 packages/mobile/ios/.swiftlint.yml delete mode 100644 packages/mobile/ios/.xcode.env delete mode 100644 packages/mobile/ios/AvoidSoftinputExample-Bridging-Header.h delete mode 100644 packages/mobile/ios/AvoidSoftinputExample.xcodeproj/project.pbxproj delete mode 100644 packages/mobile/ios/AvoidSoftinputExample.xcodeproj/xcshareddata/xcschemes/AvoidSoftinputExample.xcscheme delete mode 100644 packages/mobile/ios/AvoidSoftinputExample.xcworkspace/contents.xcworkspacedata delete mode 100644 packages/mobile/ios/AvoidSoftinputExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/AppDelegate.h delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/AppDelegate.mm delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/BootSplash.storyboard delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/File.swift delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-1024.png delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-20.png delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-20@2x.png delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-20@3x.png delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-29.png delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-29@2x.png delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-29@3x.png delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-40.png delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-40@2x.png delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-40@3x.png delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-60@2x.png delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-60@3x.png delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-76.png delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-76@2x.png delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/AppIcon-83.5@2x.png delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/AppIcon.appiconset/Contents.json delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/BootSplashLogo.imageset/Contents.json delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo.png delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo@2x.png delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/BootSplashLogo.imageset/bootsplash_logo@3x.png delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Images.xcassets/Contents.json delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/Info.plist delete mode 100644 packages/mobile/ios/AvoidSoftinputExample/main.mm delete mode 100644 packages/mobile/ios/Podfile delete mode 100644 packages/mobile/ios/Podfile.lock delete mode 100644 packages/mobile/jest.config.js delete mode 100644 packages/mobile/metro.config.js delete mode 100644 packages/mobile/package.json delete mode 100644 packages/mobile/react-native.config.js delete mode 100644 packages/mobile/tsconfig.json delete mode 100644 scripts/runPackagerInWorkspace.js delete mode 100644 tsconfig.base.json delete mode 100644 tsconfig.jest.json diff --git a/.editorconfig b/.editorconfig index 65365be6..70e1f8a8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,3 +13,9 @@ end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true + +[*.{h,m,mm}] +indent_size = 4 + +[*.{kt,java}] +indent_size = 4 diff --git a/.eslintrc.js b/.eslintrc.js index c7739f7a..bd75c270 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,72 +1,20 @@ +const path = require('path'); + module.exports = { root: true, - parser: '@typescript-eslint/parser', - extends: [ - 'plugin:react/recommended', - 'plugin:@typescript-eslint/recommended', - ], - plugins: [ - 'import', - 'react', - 'react-hooks', - 'react-native', - '@typescript-eslint', - ], - ignorePatterns: [ - 'node_modules/', - '*/node_modules/', - 'lib/', - '*/build/', - ], - rules: { - // Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs - '@typescript-eslint/consistent-type-imports': [ - 'error', - ], - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/explicit-member-accessibility': 'off', - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/no-explicit-any': 'error', - '@typescript-eslint/no-unused-vars': [ - 'error', - { argsIgnorePattern: '^_' }, - ], - '@typescript-eslint/no-var-requires': 'off', - 'import/order': [ - 'error', - { - 'groups': [ - 'builtin', - 'external', - 'internal', - 'parent', - 'sibling', - 'index', - ], - 'newlines-between': 'always', - 'alphabetize': { order: 'asc' }, - }, - ], - 'no-underscore-dangle': 'error', - 'no-unused-vars': 'off', - 'react/display-name': 'off', - 'react/prop-types': 'off', - 'react-hooks/exhaustive-deps': 'warn', - 'react-native/no-inline-styles': 'warn', - 'react-native/no-unused-styles': 'warn', - 'sort-imports': [ - 'error', - { - ignoreCase: false, - ignoreDeclarationSort: true, - ignoreMemberSort: false, - memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], - }, - ], - }, - settings: { - react: { - version: 'detect', + extends: '@react-native', + parserOptions: { + babelOptions: { + configFile: path.resolve(__dirname, 'packages', 'example', 'babel.config.js'), }, }, + overrides: [ + { + files: ['**/jest/*'], + plugins: ['jest'], + env: { + 'jest/globals': true, + }, + }, + ], }; diff --git a/.github/workflows/lint-android.yml b/.github/workflows/lint-android.yml index b34402c0..c1ff6956 100644 --- a/.github/workflows/lint-android.yml +++ b/.github/workflows/lint-android.yml @@ -4,7 +4,6 @@ on: pull_request: branches: [main] paths: - - "packages/mobile/android/**" - "packages/react-native-avoid-softinput/android/**" - ".github/workflows/lint-android.yml" diff --git a/.github/workflows/lint-ios.yml b/.github/workflows/lint-ios.yml index 32308bd6..ece8cd77 100644 --- a/.github/workflows/lint-ios.yml +++ b/.github/workflows/lint-ios.yml @@ -4,14 +4,12 @@ on: pull_request: branches: [main] paths: - - "packages/mobile/ios/**" - - "packages/fabricMobile/ios/**" - "packages/react-native-avoid-softinput/ios/**" - ".github/workflows/lint-ios.yml" jobs: lint-ios: - name: Lint Swift & ObjC + name: Lint ObjC runs-on: macos-latest steps: - uses: actions/checkout@v3 @@ -26,16 +24,7 @@ jobs: registry-url: "https://registry.npmjs.org" cache-dependency-path: "**/yarn.lock" - run: yarn - - name: SwiftLint - run: | - #!/bin/bash - if ! command -v swiftlint &> /dev/null - then - echo "SwiftLint is not installed. Installing" - brew install swiftlint - fi - yarn lint:ios:swift - yarn lint:fabric:ios:swift + - run: yarn install:pods - name: ClangFormat run: | #!/bin/bash @@ -45,4 +34,3 @@ jobs: brew install clang-format fi yarn format:ios:objc - yarn format:fabric:ios:objc diff --git a/.github/workflows/lint-js.yml b/.github/workflows/lint-js.yml index 1c38b4a6..952b57b6 100644 --- a/.github/workflows/lint-js.yml +++ b/.github/workflows/lint-js.yml @@ -4,21 +4,21 @@ on: pull_request: branches: [main] paths: - - "packages/app/src/**" - - "packages/app/package.json" - - "packages/app/tsconfig.json" - - "packages/mobile/babel.config.js" - - "packages/mobile/index.tsx" - - "packages/mobile/metro.config.js" - - "packages/mobile/package.json" + - "packages/exanple/src/**" + - "packages/example/App.tsx" + - "packages/example/babel.config.js" + - "packages/example/index.js" + - "packages/example/metro.config.js" + - "packages/example/package.json" + - "packages/example/react-native.config.js" + - "packages/example/tsconfig.json" + - "packages/react-native-avoid-softinput/jest/**" - "packages/react-native-avoid-softinput/src/**" - "packages/react-native-avoid-softinput/package.json" - "packages/react-native-avoid-softinput/tsconfig.json" - ".eslintrc.js" - - "dprint.json" + - ".prettierrc.js" - "package.json" - - "tsconfig.base.json" - - "tsconfig.jest.json" - ".github/workflows/lint-js.yml" jobs: @@ -38,9 +38,7 @@ jobs: registry-url: "https://registry.npmjs.org" cache-dependency-path: "**/yarn.lock" - run: yarn - - name: ESLint + - name: Lint JS/TS run: yarn lint:js - - name: dprint - uses: dprint/check@v2.2 - name: TypeScript run: yarn typescript diff --git a/.gitignore b/.gitignore index 1c7a4bce..14ea9b48 100644 --- a/.gitignore +++ b/.gitignore @@ -68,6 +68,3 @@ android/keystores/debug.keystore packages/react-native-avoid-softinput/lib/ .npmrc - -startCommand.bat -startCommand.command diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 00000000..cf1fb5da --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,8 @@ +module.exports = { + arrowParens: 'avoid', + bracketSameLine: true, + bracketSpacing: true, + printWidth: 120, + singleQuote: true, + trailingComma: 'all', +}; diff --git a/.yarnrc.yml b/.yarnrc.yml index f6f34f07..01d0b4cd 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -1,5 +1,3 @@ -afterInstall: "yarn pods:mobile && yarn pods:fabricMobile" - compressionLevel: mixed enableGlobalCache: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bde4286b..ddb91e11 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,8 +7,7 @@ We want this community to be friendly and respectful to each other. Please follo This project is a monorepo, which uses [yarn workspaces](https://classic.yarnpkg.com/lang/en/docs/workspaces/) and is divided into: - `docs` - contains library's Docusaurus documentation -- `packages/app` - contains shared JS code for example app -- `packages/mobile` - contains mobile app example +- `packages/example` - contains mobile app example - `packages/react-native-avoid-softinput` - contains library code ## Development workflow @@ -21,48 +20,58 @@ To get started with the project, run `yarn` in the root directory to install the yarn ``` -While developing, you can run the [example app](/packages/mobile/) to test your changes. Any changes you make in your library's JavaScript code will be reflected in the example app without a rebuild. If you change any native code, then you'll need to rebuild the example app. +While developing, you can run the [example app](/packages/example/) to test your changes. Any changes you make in your library's JavaScript code will be reflected in the example app without a rebuild. If you change any native code, then you'll need to rebuild the example app. -To start the packager, run `yarn android:metro` or `yarn ios:metro` +To start the packager, run `cd packages/example` and then run `yarn start` To run the example app on Android: ```sh -yarn android:start +cd packages/example +yarn android ``` To run the example app on iOS: ```sh -yarn ios:start +cd packages/example +yarn ios ``` -Make sure your code passes TypeScript, ESLint and dprint. Run the following to verify: +Make sure your code passes TypeScript, ESLint and Prettier. Run the following to verify: ```sh yarn typescript yarn lint:js -yarn dprint check ``` To fix formatting errors, run the following: ```sh -yarn lint:js --fix yarn format:js ``` -To edit the Swift and Objective-C files, run `yarn ios:xcode` and find the source files at `Pods > Development Pods > react-native-avoid-softinput`. +To edit the Objective-C files + +- install Pods with `yarn install:pods` +- open XCode with + +```sh +cd packages/example +xed ios +``` + +- find the source files in XCode at `Pods > Development Pods > ReactNativeAvoidSoftinput`. To edit the Kotlin files: -- if you have a command line launcher for Android Studio set up, you can run `yarn android:studio` -- otherwise open `packages/mobile/android` in Android Studio and find the source files at `reactnativeavoidsoftinput` under `Android`. +- open `packages/example/android` in Android Studio and find the source files at `react-native-avoid-softinput` under `Android`. To run Docusaurus documentation locally, run the following: ```sh -yarn docs:start +cd docs +yarn start ``` ### Commit message & branch convention @@ -102,11 +111,9 @@ git branch chore/2-configuration ### Linting and tests - [ESLint](https://eslint.org/) - JS/TS linting -- [dprint](https://dprint.dev/) - JS/TS formatting +- [Prettier](https://prettier.io/) - JS/TS formatting - [TypeScript](https://www.typescriptlang.org/) - TS type checking - [Spotless](https://github.com/diffplug/spotless) & [Ktfmt](https://github.com/facebook/ktfmt) - Kotlin/Java linting and formatting -- [SwiftFormat](https://github.com/nicklockwood/SwiftFormat) - Swift formatting -- [SwiftLint](https://github.com/realm/SwiftLint) - Swift linting - [ClangFormat](https://clang.llvm.org/) - ObjC/ObjC++ linting and formatting Our pre-commit hooks verify that the linter and type checks pass when committing. @@ -126,41 +133,18 @@ yarn release The `package.json` file contains various scripts for common tasks: - `yarn typescript`: type-check files with TypeScript. -- `yarn lint:js`: lint all JS/TS files with ESLint. +- `yarn lint:js`: lint all JS/TS files with ESLint & Prettier. - `yarn lint:android`: run linter (Spotless/Ktfmt) for all Kotlin/Java files. -- `yarn lint:ios:swift`: run linter (SwiftLint) for all Swift files within old arch project (install [SwiftLint](https://github.com/realm/SwiftLint) e.g. with Homebrew). -- `yarn lint:ios:objc`: run linter (ClangFormat) for all ObjC/ObjC++ files within old arch project (install [ClangFormat](https://clang.llvm.org/) e.g. with Homebrew). -- `yarn lint:fabric:ios:swift`: run linter (SwiftLint) for all Swift files within new arch project (install [SwiftLint](https://github.com/realm/SwiftLint) e.g. with Homebrew). -- `yarn lint:fabric:ios:objc`: run linter (ClangFormat) for all ObjC/ObjC++ files within new arch project (install [ClangFormat](https://clang.llvm.org/) e.g. with Homebrew). -- `yarn format:js`: format all JS/TS files with dprint. +- `yarn lint:ios:objc`: run linter (ClangFormat) for all ObjC/ObjC++ files (install [ClangFormat](https://clang.llvm.org/) e.g. with Homebrew). +- `yarn format:js`: format all JS/TS files with ESLint & Prettier. - `yarn format:android`: format (Spotless/Ktfmt) all Kotlin/Java files. -- `yarn format:ios:swift`: format (SwiftFormat) all Swift files within old arch project (install [SwiftFormat](https://github.com/nicklockwood/SwiftFormat) e.g. with Homebrew). -- `yarn format:ios:objc`: format (ClangFormat) all ObjC/ObjC++ files within old arch project (install [ClangFormat](https://clang.llvm.org/) e.g. with Homebrew). -- `yarn format:fabric:ios:swift`: format (SwiftFormat) all Swift files within new arch project (install [SwiftFormat](https://github.com/nicklockwood/SwiftFormat) e.g. with Homebrew). -- `yarn format:fabric:ios:objc`: format (ClangFormat) all ObjC/ObjC++ files within new arch project (install [ClangFormat](https://clang.llvm.org/) e.g. with Homebrew). +- `yarn format:ios:objc`: format (ClangFormat) all ObjC/ObjC++ files (install [ClangFormat](https://clang.llvm.org/) e.g. with Homebrew). - `yarn release` release library to npm. -- `yarn bootstrap`: setup projects (old and new arch) by installing all dependencies and pods. -- `yarn bootstrap:mobile`: setup old arch project by installing all dependencies and pods. -- `yarn bootstrap:fabricMobile`: setup new arch project by installing all dependencies and pods. -- `yarn pods`: setup project's pods. +- `yarn install:pods`: setup project's pods. +- `yarn install:pods:fabric`: setup project's pods with new arch. - `yarn reset`: clean all project's dependencies and pods. - `yarn reset:node_modules`: clean all project's dependencies. - `yarn reset:pods`: clean all project's pods. -- `yarn android:metro`: start the Metro server for the old arch example app. -- `yarn android:start`: run the old arch example app on Android. -- `yarn android:studio`: open old arch Android project in Android Studio. -- `yarn ios:metro`: start the Metro server for the old arch example app. -- `yarn ios:start`: run the old arch example app on iOS. -- `yarn ios:xcode`: open old arch iOS project in XCode. -- `yarn fabric:android:metro`: start the Metro server for the new arch example app. -- `yarn fabric:android:start`: run the new arch example app on Android. -- `yarn fabric:android:studio`: open new arch Android project in Android Studio. -- `yarn fabric:ios:metro`: start the Metro server for the new arch example app. -- `yarn fabric:ios:start`: run the new arch example app on iOS. -- `yarn fabric:ios:xcode`: open new arch iOS project in XCode. -- `yarn docs:start`: run Docusaurus documentation locally. -- `yarn docs:build`: build Docusaurus documentation. -- `yarn docs:clear`: clear Docusaurus project. ### Sending a pull request diff --git a/README.md b/README.md index d7ba4294..9004be16 100644 --- a/README.md +++ b/README.md @@ -50,8 +50,6 @@ npm i --save react-native-avoid-softinput npx pod-install ``` -3. (iOS-only) Create and configure bridging header in your iOS project, if it doesn't exist (the easiest way is to create empty .swift file in XCode) - For reference, you can visit [Getting started](https://mateusz1913.github.io/react-native-avoid-softinput/docs/guides/) section ## Expo diff --git a/dprint.json b/dprint.json deleted file mode 100644 index bf6d83ab..00000000 --- a/dprint.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "typescript": { - "jsx.multiLineParens": "never", - "jsx.quoteStyle": "preferDouble", - "newLineKind": "auto", - "quoteProps": "consistent", - "quoteStyle": "preferSingle", - "semiColons": "always" - }, - "json": { - }, - "markdown": { - }, - "excludes": [ - ".yarn", - "**/build", - "**/.cxx", - "**/Pods", - "**/lib", - "**/node_modules", - "**/vendor", - "**/*-lock.json" - ], - "plugins": [ - "https://plugins.dprint.dev/typescript-0.88.3.wasm", - "https://plugins.dprint.dev/json-0.19.0.wasm", - "https://plugins.dprint.dev/markdown-0.16.2.wasm" - ] -} diff --git a/lefthook.yml b/lefthook.yml index 4b57d640..7bf56a6a 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -7,7 +7,6 @@ pre-commit: glob: "*.{js,ts,jsx,tsx}" run: | yarn lint:js - yarn dprint check typescript: # Run type-checking for TS files if any of them are staged files: git diff --name-only --cached @@ -18,19 +17,6 @@ pre-commit: files: git diff --name-only --cached glob: "*.{kt,java}" run: yarn lint:android - lint-swift: - # if any Swift file changed, run Swift linter - files: git diff --name-only --cached - glob: "*.swift" - run: | - #!/bin/bash - if command -v swiftlint &> /dev/null - then - yarn lint:ios:swift --strict - yarn lint:fabric:ios:swift --strict - else - echo "SwiftLint is not installed. Skipping" - fi lint-objc: # if any ObjC/ObjC++ file changed, run ObjC linter files: git diff --name-only --cached @@ -40,7 +26,6 @@ pre-commit: if command -v clang-format &> /dev/null then yarn lint:ios:objc --Werror - yarn lint:fabric:ios:objc --Werror else echo "ClangFormat is not installed. Skipping" fi diff --git a/package.json b/package.json index f5b22a6e..54a00fe5 100644 --- a/package.json +++ b/package.json @@ -2,44 +2,25 @@ "private": true, "workspaces": { "packages": [ - "packages/*" + "packages/example", + "packages/react-native-avoid-softinput" ] }, "scripts": { - "test": "jest", - "typescript": "tsc --noEmit -p packages/app/tsconfig.json && tsc --noEmit -p packages/fabricMobile/tsconfig.json && tsc --noEmit -p packages/mobile/tsconfig.json && tsc --noEmit -p packages/react-native-avoid-softinput/tsconfig.json", - "dprint": "dprint", - "lint:js": "eslint \"**/*.{js,ts,tsx}\"", - "lint:android": "./packages/react-native-avoid-softinput/android/gradlew -p packages/react-native-avoid-softinput/android spotlessCheck --quiet && ./packages/mobile/android/gradlew -p packages/mobile/android spotlessCheck --quiet && ./packages/fabricMobile/android/gradlew -p packages/fabricMobile/android spotlessCheck --quiet", - "lint:ios:swift": "swiftlint lint --config ./packages/mobile/ios/.swiftlint.yml --quiet", - "lint:ios:objc": "clang-format --dry-run -i ./packages/react-native-avoid-softinput/ios/*.{h,mm} ./packages/mobile/ios/AvoidSoftinputExample/*.{h,mm}", - "lint:fabric:ios:swift": "swiftlint lint --config ./packages/fabricMobile/ios/.swiftlint.yml --quiet", - "lint:fabric:ios:objc": "clang-format --dry-run -i ./packages/react-native-avoid-softinput/ios/*.{h,mm} ./packages/fabricMobile/ios/FabricAvoidSoftinputExample/*.{h,mm}", - "format:js": "dprint fmt", - "format:android": "./packages/react-native-avoid-softinput/android/gradlew -p packages/react-native-avoid-softinput/android spotlessApply && ./packages/mobile/android/gradlew -p packages/mobile/android spotlessApply && ./packages/fabricMobile/android/gradlew -p packages/fabricMobile/android spotlessApply", - "format:ios:swift": "swiftformat ./packages/react-native-avoid-softinput/ios ./packages/mobile/ios --config ./packages/mobile/ios/.swiftformat", - "format:ios:objc": "clang-format -i ./packages/react-native-avoid-softinput/ios/*.{h,mm} ./packages/mobile/ios/AvoidSoftinputExample/*.{h,mm} -Werror", - "format:fabric:ios:swift": "swiftformat ./packages/react-native-avoid-softinput/ios ./packages/fabricMobile/ios --config ./packages/fabricMobile/ios/.swiftformat", - "format:fabric:ios:objc": "clang-format -i ./packages/react-native-avoid-softinput/ios/*.{h,mm} ./packages/fabricMobile/ios/FabricAvoidSoftinputExample/*.{h,mm} -Werror", + "typescript": "tsc --noEmit -p packages/example/tsconfig.json && tsc --noEmit -p packages/react-native-avoid-softinput/tsconfig.json", + "lint:js": "eslint \"**/*.{js,ts,tsx}\" && prettier --config .prettierrc.js \"packages/**/*.{js,ts,tsx}\"", + "lint:android": "./packages/react-native-avoid-softinput/android/gradlew -p packages/react-native-avoid-softinput/android spotlessCheck --quiet", + "lint:ios:objc": "clang-format --dry-run -i ./packages/react-native-avoid-softinput/ios/*.{h,mm}", + "format:js": "eslint \"**/*.{js,ts,tsx}\" --fix --quiet && prettier -w --config .prettierrc.js \"packages/**/*.{js,ts,tsx}\"", + "format:android": "./packages/react-native-avoid-softinput/android/gradlew -p packages/react-native-avoid-softinput/android spotlessApply", + "format:ios:objc": "clang-format -i ./packages/react-native-avoid-softinput/ios/*.{h,mm} -Werror", "prepare": "yarn workspace react-native-avoid-softinput build-library", "release": "yarn workspace react-native-avoid-softinput release-library", - "pods:mobile": "pod-install packages/mobile/ios --quiet", - "pods:fabricMobile": "RCT_NEW_ARCH_ENABLED=1 pod-install packages/fabricMobile/ios --quiet", + "install:pods": "pod-install packages/example/ios --quiet", + "install:pods:fabric": "RCT_NEW_ARCH_ENABLED=1 pod-install packages/example/ios --quiet", "reset": "yarn reset:node_modules && yarn reset:pods", "reset:node_modules": "find . -type dir -name node_modules | xargs rm -rf && rm -rf yarn.lock", - "reset:pods": "find . -type dir -name Pods | xargs rm -rf && find . -type f -name Podfile.lock | xargs rm -rf", - "android:metro": "yarn workspace @avoid-softinput-example/mobile start", - "android:start": "yarn workspace @avoid-softinput-example/mobile android", - "android:studio": "yarn workspace @avoid-softinput-example/mobile studio", - "ios:metro": "yarn workspace @avoid-softinput-example/mobile start", - "ios:start": "yarn workspace @avoid-softinput-example/mobile ios", - "ios:xcode": "yarn workspace @avoid-softinput-example/mobile xcode", - "fabric:android:metro": "yarn workspace @avoid-softinput-example/fabric-mobile start", - "fabric:android:start": "yarn workspace @avoid-softinput-example/fabric-mobile android", - "fabric:android:studio": "yarn workspace @avoid-softinput-example/fabric-mobile studio", - "fabric:ios:metro": "yarn workspace @avoid-softinput-example/fabric-mobile start", - "fabric:ios:start": "yarn workspace @avoid-softinput-example/fabric-mobile ios", - "fabric:ios:xcode": "yarn workspace @avoid-softinput-example/fabric-mobile xcode" + "reset:pods": "find . -type dir -name Pods | xargs rm -rf && find . -type f -name Podfile.lock | xargs rm -rf" }, "repository": "https://github.com/mateusz1913/react-native-avoid-softinput", "author": "Mateusz Mędrek (https://github.com/mateusz1913)", @@ -54,18 +35,14 @@ "devDependencies": { "@commitlint/config-conventional": "17.6.6", "@evilmartians/lefthook": "1.4.3", - "@typescript-eslint/eslint-plugin": "5.61.0", - "@typescript-eslint/parser": "5.61.0", + "@react-native/eslint-config": "0.75.3", + "@react-native/typescript-config": "0.75.3", "commitlint": "17.6.6", - "dprint": "^0.42.3", - "eslint": "8.44.0", - "eslint-config-react": "1.1.7", - "eslint-plugin-import": "2.27.5", - "eslint-plugin-react": "7.32.2", - "eslint-plugin-react-hooks": "4.6.0", - "eslint-plugin-react-native": "4.0.0", + "eslint": "^8.19.0", + "jest": "29.7.0", "pod-install": "0.1.38", - "typescript": "5.1.6" + "prettier": "2.8.8", + "typescript": "5.0.4" }, "commitlint": { "extends": [ diff --git a/packages/app/getSharedBabelConfig.js b/packages/app/getSharedBabelConfig.js deleted file mode 100644 index 41e8adbc..00000000 --- a/packages/app/getSharedBabelConfig.js +++ /dev/null @@ -1,36 +0,0 @@ -const path = require('path'); - -function getSharedBabelConfig(dirname) { - return { - presets: ['module:@react-native/babel-preset'], - plugins: [ - [ - 'module-resolver', - { - extensions: [ - '.ios.js', - '.ios.ts', - '.ios.tsx', - '.android.js', - '.android.ts', - '.android.tsx', - '.native.js', - '.native.ts', - '.native.tsx', - '.js', - '.ts', - '.tsx', - '.json', - ], - alias: { - '@avoid-softinput-example/app': path.join(dirname, '../app'), - 'react-native-avoid-softinput': path.join(dirname, '../react-native-avoid-softinput'), - }, - }, - ], - 'react-native-reanimated/plugin', - ], - }; -} - -module.exports = getSharedBabelConfig; diff --git a/packages/app/getSharedMetroConfig.js b/packages/app/getSharedMetroConfig.js deleted file mode 100644 index b1398e01..00000000 --- a/packages/app/getSharedMetroConfig.js +++ /dev/null @@ -1,34 +0,0 @@ -const path = require('path'); - -const { - getMetroAndroidAssetsResolutionFix, -} = require('react-native-monorepo-tools'); - -function getSharedMetroConfig(dirname) { - const androidAssetsResolutionFix = getMetroAndroidAssetsResolutionFix(); - /** - * Metro configuration - * https://facebook.github.io/metro/docs/configuration - * - * @type {import('metro-config').MetroConfig} - */ - const config = { - transformer: { - publicPath: androidAssetsResolutionFix.publicPath, - }, - server: { - enhanceMiddleware: (middleware) => { - return androidAssetsResolutionFix.applyMiddleware(middleware); - }, - }, - watchFolders: [ - path.join(dirname, '../../node_modules'), - path.join(dirname, '../app'), - path.join(dirname, '../react-native-avoid-softinput'), - ], - }; - - return config; -} - -module.exports = getSharedMetroConfig; diff --git a/packages/app/package.json b/packages/app/package.json deleted file mode 100644 index e4339624..00000000 --- a/packages/app/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "@avoid-softinput-example/app", - "version": "0.0.0", - "private": true, - "main": "src", - "peerDependencies": { - "@gorhom/bottom-sheet": "*", - "@react-navigation/native": "*", - "@react-navigation/native-stack": "*", - "react": "*", - "react-native": "*", - "react-native-bootsplash": "*", - "react-native-gesture-handler": "*", - "react-native-reanimated": "*", - "react-native-safe-area-context": "*", - "react-native-screens": "*" - } -} diff --git a/packages/app/src/index.tsx b/packages/app/src/index.tsx deleted file mode 100644 index 478d410d..00000000 --- a/packages/app/src/index.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { BottomSheetModalProvider } from '@gorhom/bottom-sheet'; -import { NavigationContainer } from '@react-navigation/native'; -import * as React from 'react'; -import { StyleSheet } from 'react-native'; -import RNBootSplash from 'react-native-bootsplash'; -import { GestureHandlerRootView } from 'react-native-gesture-handler'; -import { SafeAreaProvider } from 'react-native-safe-area-context'; - -import { Navigation } from './navigation'; - -function onNavigationReady() { - RNBootSplash.hide({ fade: true }); -} - -export const App: React.FC = () => { - return - - - - - - - - ; -}; - -const styles = StyleSheet.create({ - rootView: { - alignSelf: 'stretch', - flex: 1, - }, -}); diff --git a/packages/app/src/navigation/index.tsx b/packages/app/src/navigation/index.tsx deleted file mode 100644 index 941fe699..00000000 --- a/packages/app/src/navigation/index.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { createNativeStackNavigator } from '@react-navigation/native-stack'; -import * as React from 'react'; - -import { BottomSheetExample } from '../screens/BottomSheetExample'; -import { CustomAnimationConfigModuleExample } from '../screens/CustomAnimationConfigModuleExample'; -import { CustomAnimationConfigViewExample } from '../screens/CustomAnimationConfigViewExample'; -import { EnabledViewPropExample } from '../screens/EnabledViewPropExample'; -import { FormExample } from '../screens/FormExample'; -import { HomeScreen } from '../screens/HomeScreen'; -import { KeyboardTypeExample } from '../screens/KeyboardTypeExample'; -import { ModalExample } from '../screens/ModalExample'; -import { ModalFormSheetExample } from '../screens/ModalFormSheetExample'; -import { PasswordFormExample } from '../screens/PasswordFormExample'; -import { ReanimatedExample } from '../screens/ReanimatedExample'; -import { ScreensNativeModalExample } from '../screens/ScreensNativeModalExample'; -import { StickyFooterExample } from '../screens/StickyFooterExample'; - -import { ROUTES } from './routes'; -import type { RootStackParamList } from './types'; - -const Stack = createNativeStackNavigator(); - -export const Navigation: React.FC = () => { - return - - - - - - - - - - - - - - ; -}; diff --git a/packages/app/src/screens/KeyboardTypeExample.tsx b/packages/app/src/screens/KeyboardTypeExample.tsx deleted file mode 100644 index 24a484e3..00000000 --- a/packages/app/src/screens/KeyboardTypeExample.tsx +++ /dev/null @@ -1,156 +0,0 @@ -import { useFocusEffect } from '@react-navigation/native'; -import * as React from 'react'; -import type { TextInput } from 'react-native'; -import { Image, ScrollView, StyleSheet, View } from 'react-native'; -import { AvoidSoftInput } from 'react-native-avoid-softinput'; -import { SafeAreaView } from 'react-native-safe-area-context'; - -import Button from '../components/Button'; -import SingleInput from '../components/SingleInput'; -import { styles as commonStyles } from '../consts/styles'; - -type InputsRef = { - plain: TextInput | null; - email: TextInput | null; - password: TextInput | null; - decimal: TextInput | null; - webSearch: TextInput | null; - numeric: TextInput | null; -}; - -export const KeyboardTypeExample: React.FC = () => { - const inputsRef = React.useRef({ - plain: null, - email: null, - password: null, - decimal: null, - webSearch: null, - numeric: null, - }); - - const onFocusEffect = React.useCallback(() => { - AvoidSoftInput.setShouldMimicIOSBehavior(true); - AvoidSoftInput.setEnabled(true); - return () => { - AvoidSoftInput.setEnabled(false); - AvoidSoftInput.setShouldMimicIOSBehavior(false); - }; - }, []); - - useFocusEffect(onFocusEffect); - - function onSubmit() { - Object.values(inputsRef.current).map((ref) => { - if (ref?.isFocused()) { - ref.blur(); - } - }); - } - - function onPlainInputSubmit() { - inputsRef.current.email?.focus(); - } - - function onEmailInputSubmit() { - inputsRef.current.password?.focus(); - } - - function onPasswordInputSubmit() { - inputsRef.current.decimal?.focus(); - } - - function onDecimalInputSubmit() { - inputsRef.current.webSearch?.focus(); - } - - function onWebSearchInputSubmit() { - inputsRef.current.numeric?.focus(); - } - - return - - - - - - inputsRef.current.plain = instance} - placeholder="Single line input" - onSubmitEditing={onPlainInputSubmit} - /> - inputsRef.current.email = instance} - placeholder="Email input" - keyboardType="email-address" - onSubmitEditing={onEmailInputSubmit} - /> - inputsRef.current.password = instance} - placeholder="Password input" - secureTextEntry - onSubmitEditing={onPasswordInputSubmit} - /> - inputsRef.current.decimal = instance} - placeholder="Decimal input" - keyboardType="decimal-pad" - onSubmitEditing={onDecimalInputSubmit} - /> - inputsRef.current.webSearch = instance} - placeholder="Web search input" - keyboardType="web-search" - onSubmitEditing={onWebSearchInputSubmit} - /> - inputsRef.current.numeric = instance} - placeholder="Numeric input" - keyboardType="numeric" - /> - - -