From 2f4f8cf8cc70dafeec599000def5de56a6328483 Mon Sep 17 00:00:00 2001 From: vivekshindhe Date: Mon, 10 Jan 2022 14:41:53 +0530 Subject: [PATCH 1/2] Updated react, react-native versions and the example project --- example/{SampleProject => }/.buckconfig | 0 example/.editorconfig | 3 + example/{SampleProject => }/.eslintrc.js | 0 example/{SampleProject => }/.flowconfig | 22 +- example/.gitattributes | 3 + example/{SampleProject => }/.gitignore | 1 + example/{SampleProject => }/.prettierrc.js | 1 + example/{SampleProject => }/.watchmanconfig | 0 example/App.js | 131 + example/SampleProject/.gitattributes | 1 - example/SampleProject/App.js | 69 - .../app/src/main/res/values/strings.xml | 3 - .../app/src/main/res/values/styles.xml | 9 - example/SampleProject/app.json | 4 - example/SampleProject/ios/Podfile | 53 - example/SampleProject/ios/Podfile.lock | 348 - .../ios/SampleProject-tvOSTests/Info.plist | 24 - .../SampleProject.xcodeproj/project.pbxproj | 945 --- .../xcschemes/SampleProject-tvOS.xcscheme | 129 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 - .../ios/SampleProject/AppDelegate.m | 42 - .../SampleProject/Base.lproj/LaunchScreen.xib | 42 - .../ios/SampleProject/Info.plist | 57 - example/SampleProject/package.json | 30 - example/SampleProject/yarn.lock | 6981 ----------------- .../{SampleProject => }/__tests__/App-test.js | 0 .../android/app/BUCK => android/app/_BUCK} | 4 +- .../android/app/build.gradle | 50 +- .../android/app/build_defs.bzl | 0 .../android/app/debug.keystore | Bin .../android/app/proguard-rules.pro | 0 .../android/app/src/debug/AndroidManifest.xml | 7 +- .../java/com/example/ReactNativeFlipper.java | 72 + .../android/app/src/main/AndroidManifest.xml | 7 +- .../main/java/com/example}/MainActivity.java | 4 +- .../java/com/example}/MainApplication.java | 18 +- .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin .../res/mipmap-hdpi/ic_launcher_round.png | Bin .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin .../res/mipmap-mdpi/ic_launcher_round.png | Bin .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin .../res/mipmap-xhdpi/ic_launcher_round.png | Bin .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin .../app/src/main/res/values/strings.xml | 3 + .../app/src/main/res/values/styles.xml | 8 + .../{SampleProject => }/android/build.gradle | 18 +- .../android/gradle.properties | 7 + .../android/gradle/wrapper/gradle-wrapper.jar | Bin 55616 -> 59203 bytes .../gradle/wrapper/gradle-wrapper.properties | 2 +- example/{SampleProject => }/android/gradlew | 37 +- .../{SampleProject => }/android/gradlew.bat | 189 +- .../android/settings.gradle | 2 +- example/app.json | 4 + example/{SampleProject => }/babel.config.js | 0 example/{SampleProject => }/index.js | 0 example/ios/Podfile | 30 + example/ios/Podfile.lock | 526 ++ example/ios/example.xcodeproj/project.pbxproj | 689 ++ .../xcshareddata/xcschemes/example.xcscheme} | 69 +- .../contents.xcworkspacedata | 2 +- .../example}/AppDelegate.h | 7 - example/ios/example/AppDelegate.m | 62 + .../AppIcon.appiconset/Contents.json | 0 .../example}/Images.xcassets/Contents.json | 0 .../example}/Info.plist | 2 + example/ios/example/LaunchScreen.storyboard | 47 + .../ios/SampleProject => ios/example}/main.m | 7 - .../exampleTests}/Info.plist | 0 .../exampleTests/exampleTests.m} | 13 +- example/{SampleProject => }/metro.config.js | 2 +- example/package.json | 30 + package.json | 6 +- 75 files changed, 1827 insertions(+), 9003 deletions(-) rename example/{SampleProject => }/.buckconfig (100%) create mode 100644 example/.editorconfig rename example/{SampleProject => }/.eslintrc.js (100%) rename example/{SampleProject => }/.flowconfig (50%) create mode 100644 example/.gitattributes rename example/{SampleProject => }/.gitignore (99%) rename example/{SampleProject => }/.prettierrc.js (83%) rename example/{SampleProject => }/.watchmanconfig (100%) create mode 100644 example/App.js delete mode 100644 example/SampleProject/.gitattributes delete mode 100644 example/SampleProject/App.js delete mode 100644 example/SampleProject/android/app/src/main/res/values/strings.xml delete mode 100644 example/SampleProject/android/app/src/main/res/values/styles.xml delete mode 100644 example/SampleProject/app.json delete mode 100644 example/SampleProject/ios/Podfile delete mode 100644 example/SampleProject/ios/Podfile.lock delete mode 100644 example/SampleProject/ios/SampleProject-tvOSTests/Info.plist delete mode 100644 example/SampleProject/ios/SampleProject.xcodeproj/project.pbxproj delete mode 100644 example/SampleProject/ios/SampleProject.xcodeproj/xcshareddata/xcschemes/SampleProject-tvOS.xcscheme delete mode 100644 example/SampleProject/ios/SampleProject.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist delete mode 100644 example/SampleProject/ios/SampleProject/AppDelegate.m delete mode 100644 example/SampleProject/ios/SampleProject/Base.lproj/LaunchScreen.xib delete mode 100644 example/SampleProject/ios/SampleProject/Info.plist delete mode 100644 example/SampleProject/package.json delete mode 100644 example/SampleProject/yarn.lock rename example/{SampleProject => }/__tests__/App-test.js (100%) rename example/{SampleProject/android/app/BUCK => android/app/_BUCK} (94%) rename example/{SampleProject => }/android/app/build.gradle (82%) rename example/{SampleProject => }/android/app/build_defs.bzl (100%) rename example/{SampleProject => }/android/app/debug.keystore (100%) rename example/{SampleProject => }/android/app/proguard-rules.pro (100%) rename example/{SampleProject => }/android/app/src/debug/AndroidManifest.xml (50%) create mode 100644 example/android/app/src/debug/java/com/example/ReactNativeFlipper.java rename example/{SampleProject => }/android/app/src/main/AndroidManifest.xml (86%) rename example/{SampleProject/android/app/src/main/java/com/sampleproject => android/app/src/main/java/com/example}/MainActivity.java (84%) rename example/{SampleProject/android/app/src/main/java/com/sampleproject => android/app/src/main/java/com/example}/MainApplication.java (73%) rename example/{SampleProject => }/android/app/src/main/res/mipmap-hdpi/ic_launcher.png (100%) rename example/{SampleProject => }/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png (100%) rename example/{SampleProject => }/android/app/src/main/res/mipmap-mdpi/ic_launcher.png (100%) rename example/{SampleProject => }/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png (100%) rename example/{SampleProject => }/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png (100%) rename example/{SampleProject => }/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png (100%) rename example/{SampleProject => }/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png (100%) rename example/{SampleProject => }/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png (100%) rename example/{SampleProject => }/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png (100%) rename example/{SampleProject => }/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png (100%) create mode 100644 example/android/app/src/main/res/values/strings.xml create mode 100644 example/android/app/src/main/res/values/styles.xml rename example/{SampleProject => }/android/build.gradle (70%) rename example/{SampleProject => }/android/gradle.properties (71%) rename example/{SampleProject => }/android/gradle/wrapper/gradle-wrapper.jar (56%) rename example/{SampleProject => }/android/gradle/wrapper/gradle-wrapper.properties (93%) rename example/{SampleProject => }/android/gradlew (83%) rename example/{SampleProject => }/android/gradlew.bat (81%) rename example/{SampleProject => }/android/settings.gradle (82%) create mode 100644 example/app.json rename example/{SampleProject => }/babel.config.js (100%) rename example/{SampleProject => }/index.js (100%) create mode 100644 example/ios/Podfile create mode 100644 example/ios/Podfile.lock create mode 100644 example/ios/example.xcodeproj/project.pbxproj rename example/{SampleProject/ios/SampleProject.xcodeproj/xcshareddata/xcschemes/SampleProject.xcscheme => ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme} (51%) rename example/{SampleProject/ios/SampleProject.xcworkspace => ios/example.xcworkspace}/contents.xcworkspacedata (78%) rename example/{SampleProject/ios/SampleProject => ios/example}/AppDelegate.h (50%) create mode 100644 example/ios/example/AppDelegate.m rename example/{SampleProject/ios/SampleProject => ios/example}/Images.xcassets/AppIcon.appiconset/Contents.json (100%) rename example/{SampleProject/ios/SampleProject => ios/example}/Images.xcassets/Contents.json (100%) rename example/{SampleProject/ios/SampleProject-tvOS => ios/example}/Info.plist (96%) create mode 100644 example/ios/example/LaunchScreen.storyboard rename example/{SampleProject/ios/SampleProject => ios/example}/main.m (51%) rename example/{SampleProject/ios/SampleProjectTests => ios/exampleTests}/Info.plist (100%) rename example/{SampleProject/ios/SampleProjectTests/SampleProjectTests.m => ios/exampleTests/exampleTests.m} (86%) rename example/{SampleProject => }/metro.config.js (89%) create mode 100644 example/package.json diff --git a/example/SampleProject/.buckconfig b/example/.buckconfig similarity index 100% rename from example/SampleProject/.buckconfig rename to example/.buckconfig diff --git a/example/.editorconfig b/example/.editorconfig new file mode 100644 index 000000000..7c286132f --- /dev/null +++ b/example/.editorconfig @@ -0,0 +1,3 @@ +# Windows files +[*.bat] +end_of_line = crlf diff --git a/example/SampleProject/.eslintrc.js b/example/.eslintrc.js similarity index 100% rename from example/SampleProject/.eslintrc.js rename to example/.eslintrc.js diff --git a/example/SampleProject/.flowconfig b/example/.flowconfig similarity index 50% rename from example/SampleProject/.flowconfig rename to example/.flowconfig index 4afc766a2..4320b7070 100644 --- a/example/SampleProject/.flowconfig +++ b/example/.flowconfig @@ -8,10 +8,6 @@ ; Ignore polyfills node_modules/react-native/Libraries/polyfills/.* -; These should not be required directly -; require from fbjs/lib instead: require('fbjs/lib/warning') -node_modules/warning/.* - ; Flow doesn't support platforms .*/Libraries/Utilities/LoadingView.js @@ -21,14 +17,15 @@ node_modules/warning/.* [include] [libs] -node_modules/react-native/Libraries/react-native/react-native-interface.js +node_modules/react-native/interface.js node_modules/react-native/flow/ [options] emoji=true -esproposal.optional_chaining=enable -esproposal.nullish_coalescing=enable +exact_by_default=true + +format.bracket_spacing=false module.file_ext=.js module.file_ext=.json @@ -36,19 +33,14 @@ module.file_ext=.ios.js munge_underscores=true -module.name_mapper='^react-native$' -> '/node_modules/react-native/Libraries/react-native/react-native-implementation' module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1' -module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/node_modules/react-native/Libraries/Image/RelativeImageStub' +module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/node_modules/react-native/Libraries/Image/RelativeImageStub' suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FlowFixMeProps suppress_type=$FlowFixMeState -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+ -suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError - [lints] sketchy-null-number=warn sketchy-null-mixed=warn @@ -57,10 +49,8 @@ untyped-type-import=warn nonstrict-import=warn deprecated-type=warn unsafe-getters-setters=warn -inexact-spread=warn unnecessary-invariant=warn signature-verification-failure=warn -deprecated-utility=error [strict] deprecated-type @@ -72,4 +62,4 @@ untyped-import untyped-type-import [version] -^0.105.0 +^0.158.0 diff --git a/example/.gitattributes b/example/.gitattributes new file mode 100644 index 000000000..45a3dcb2a --- /dev/null +++ b/example/.gitattributes @@ -0,0 +1,3 @@ +# Windows files should use crlf line endings +# https://help.github.com/articles/dealing-with-line-endings/ +*.bat text eol=crlf diff --git a/example/SampleProject/.gitignore b/example/.gitignore similarity index 99% rename from example/SampleProject/.gitignore rename to example/.gitignore index ad572e632..cc53454ef 100644 --- a/example/SampleProject/.gitignore +++ b/example/.gitignore @@ -28,6 +28,7 @@ build/ .gradle local.properties *.iml +*.hprof # node.js # diff --git a/example/SampleProject/.prettierrc.js b/example/.prettierrc.js similarity index 83% rename from example/SampleProject/.prettierrc.js rename to example/.prettierrc.js index 5c4de1a4f..84196d95f 100644 --- a/example/SampleProject/.prettierrc.js +++ b/example/.prettierrc.js @@ -3,4 +3,5 @@ module.exports = { jsxBracketSameLine: true, singleQuote: true, trailingComma: 'all', + arrowParens: 'avoid', }; diff --git a/example/SampleProject/.watchmanconfig b/example/.watchmanconfig similarity index 100% rename from example/SampleProject/.watchmanconfig rename to example/.watchmanconfig diff --git a/example/App.js b/example/App.js new file mode 100644 index 000000000..b255f5d76 --- /dev/null +++ b/example/App.js @@ -0,0 +1,131 @@ +/** + * Sample React Native App + * https://github.com/facebook/react-native + * + * @format + * @flow strict-local + */ + +import React from 'react'; +import type {Node} from 'react'; +import { + Button, + SafeAreaView, + ScrollView, + StatusBar, + StyleSheet, + Text, + useColorScheme, + View, +} from 'react-native'; + +import { + Colors, + DebugInstructions, + Header, + LearnMoreLinks, + ReloadInstructions, +} from 'react-native/Libraries/NewAppScreen'; + +import RazorpayCheckout from 'rn-test-rzp-debug'; + +const Section = ({children, title}): Node => { + const isDarkMode = useColorScheme() === 'dark'; + return ( + + + {title} + + + {children} + + + ); +}; + +const App: () => Node = () => { + const isDarkMode = useColorScheme() === 'dark'; + + const backgroundStyle = { + backgroundColor: isDarkMode ? Colors.darker : Colors.lighter, + }; + + return ( + + + +
+ +
+
+
+ + + ); +}; + +const styles = StyleSheet.create({ + sectionContainer: { + marginTop: 32, + paddingHorizontal: 24, + }, + sectionTitle: { + fontSize: 24, + fontWeight: '600', + }, + sectionDescription: { + marginTop: 8, + fontSize: 18, + fontWeight: '400', + }, + highlight: { + fontWeight: '700', + }, +}); + +export default App; diff --git a/example/SampleProject/.gitattributes b/example/SampleProject/.gitattributes deleted file mode 100644 index d42ff1835..000000000 --- a/example/SampleProject/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.pbxproj -text diff --git a/example/SampleProject/App.js b/example/SampleProject/App.js deleted file mode 100644 index 3b48cb97d..000000000 --- a/example/SampleProject/App.js +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Sample React Native App - * https://github.com/facebook/react-native - * - * @format - * @flow - */ - - import React, { Component } from 'react'; - import { Button, StyleSheet, View, NativeModules, NativeEventEmitter } from 'react-native'; - -import RazorpayCheckout from 'react-native-razorpay'; - - - export default class ButtonBasics extends Component { - _onPressButton() { -var options = { - description: 'Credits towards consultation', - image: 'https://i.imgur.com/3g7nmJC.png', - currency: 'INR', - key: 'Your razorpay key', - amount: '5000', - name: 'foo', - prefill: { - email: 'void@razorpay.com', - contact: '9191919191', - name: 'Razorpay Software' - }, - theme: {color: '#F37254'} - } - RazorpayCheckout.open(options).then((data) => { - // handle success - alert(`Success: ${data.razorpay_payment_id}`); - }).catch((error) => { - // handle failure - alert(`Error: ${error.code} | ${error.description}`); - }); - } - - render() { - return ( - - - -