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 ( - - - -