-
-
Notifications
You must be signed in to change notification settings - Fork 121
Feat(rnpsw): add example project #222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Jokotoye18
wants to merge
13
commits into
just1and0:main
Choose a base branch
from
Jokotoye18:feat(RNPSW)-add-demo-project
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5f537c9
feat: add a demo project to showcase react-native-paystack-webview
Jokotoye18 99e4207
chore: update readme and add .yarnrc
Jokotoye18 3e96f3c
chore: code nit and clean up
Jokotoye18 28cc799
chore: remove dead code
Jokotoye18 10b109e
chore: readme.md clean up
Jokotoye18 2e5df13
chore: add demo preview link
Jokotoye18 3e09f8a
fix: remove incorrect numAmount calculation
Jokotoye18 c9e2c5f
chore: rename demo to example
Jokotoye18 53177e5
chore: replace demo with example
Jokotoye18 29e4bb7
chore: replace demo with example
Jokotoye18 a2f6496
chore: add package manager version
Jokotoye18 b408fa1
chore: remove redundant formatting changes
Jokotoye18 d73d1a6
docs: update read me to include example project
Jokotoye18 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| nodeLinker: node-modules |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files | ||
|
|
||
| # dependencies | ||
| node_modules/ | ||
|
|
||
| # Expo | ||
| .expo/ | ||
| dist/ | ||
| web-build/ | ||
| expo-env.d.ts | ||
|
|
||
| # Native | ||
| .kotlin/ | ||
| *.orig.* | ||
| *.jks | ||
| *.p8 | ||
| *.p12 | ||
| *.key | ||
| *.mobileprovision | ||
|
|
||
| # Metro | ||
| .metro-health-check* | ||
|
|
||
| # debug | ||
| npm-debug.* | ||
| yarn-debug.* | ||
| yarn-error.* | ||
|
|
||
| # macOS | ||
| .DS_Store | ||
| *.pem | ||
|
|
||
| # local env files | ||
| .env*.local | ||
|
|
||
| # typescript | ||
| *.tsbuildinfo | ||
|
|
||
| app-example |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| nodeLinker: node-modules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,154 @@ | ||
| # React Native Paystack WebView Demo | ||
|
|
||
| This is a clean, interactive demo showcasing the React Native Paystack WebView library in action. The demo provides a streamlined payment interface that demonstrates the library's core functionality. | ||
|
|
||
| ## 🚀 Features | ||
|
|
||
| - **Clean UI/UX**: Modern, minimalist design with smooth interactions | ||
| - **Real Paystack Integration**: Uses the actual Paystack WebView library | ||
| - **Form Validation**: Email and amount validation with real-time feedback | ||
| - **Payment Processing**: Simulates the complete payment flow | ||
| - **Mobile Optimized**: Touch-friendly interface with proper keyboard handling | ||
| - **Status Bar Integration**: Proper status bar styling for iOS/Android | ||
|
|
||
| ## 🎯 Demo Features | ||
|
|
||
| ### Interactive Payment Flow | ||
|
|
||
| - Enter email and amount | ||
| - Real-time form validation | ||
| - Process payment through Paystack WebView | ||
| - Success/error handling with user feedback | ||
| - Clean, intuitive interface | ||
|
|
||
| ### UI Components | ||
|
|
||
| - **Header**: Gradient background with payment info and amount display | ||
| - **Form Inputs**: Email and amount with validation and proper keyboard handling | ||
| - **Payment Button**: Dynamic state with loading indicator | ||
| - **Demo Notice**: Clear indication this is a demo environment | ||
| - **Status Bar**: Light status bar for better visual integration | ||
|
|
||
| ## 🛠️ Technical Details | ||
|
|
||
| ### Integration | ||
|
|
||
| - Uses `PaystackProvider` from the development library | ||
| - Implements `usePaystack` hook for payment processing | ||
| - Proper TypeScript types and error handling | ||
| - Safe area handling for different device types | ||
|
|
||
| ### Styling | ||
|
|
||
| - Modern color scheme with Paystack branding | ||
| - Smooth animations and transitions | ||
| - Responsive design for different screen sizes | ||
| - Proper spacing and typography | ||
| - Status bar integration | ||
|
|
||
| ### Validation | ||
|
|
||
| - Email format validation | ||
| - Amount validation (positive numbers only) | ||
| - Required field validation | ||
| - Real-time feedback | ||
|
|
||
| ## 🚀 Running the Demo | ||
|
|
||
| 1. **Start the development server**: | ||
|
|
||
| ```bash | ||
| yarn start | ||
| # or | ||
| npm start | ||
| ``` | ||
|
|
||
| 2. **Open on your device**: | ||
|
|
||
| - Scan the QR code with Expo Go app | ||
| - Or press 'i' for iOS simulator | ||
| - Or press 'a' for Android emulator | ||
|
|
||
| 3. **Test the payment flow**: | ||
| - Enter a valid email (e.g., `test@example.com`) | ||
| - Enter an amount (e.g., `5000`) | ||
| - Tap "Pay" to initiate payment | ||
| - Experience the WebView integration | ||
|
|
||
| ## 📱 Demo Screenshots | ||
|
|
||
| 🎥 [Watch the demo video on Imgur](https://imgur.com/a/E3pH8Hu) | ||
|
|
||
| ## 🔧 Configuration | ||
|
|
||
| ### Paystack Setup | ||
|
|
||
| The demo uses a test public key. To use your own: | ||
|
|
||
| 1. Replace the public key in `app/_layout.tsx`: | ||
|
|
||
| ```typescript | ||
| publicKey = 'pk_test_YOUR_TEST_KEY_HERE'; | ||
| ``` | ||
|
|
||
| 2. For production, use your live key: | ||
| ```typescript | ||
| publicKey = 'pk_live_YOUR_LIVE_KEY_HERE'; | ||
| ``` | ||
|
|
||
| ### Customization | ||
|
|
||
| - Modify colors in the component styles | ||
| - Update validation rules | ||
| - Customize success/error messages | ||
| - Adjust status bar styling | ||
|
|
||
| ## 🎨 Design System | ||
|
|
||
| ### Colors | ||
|
|
||
| - Primary: `#667eea` (Paystack Blue) | ||
| - Background: `#f8fafc` (Light Gray) | ||
| - Text: `#1a202c` (Dark Gray) | ||
| - Input Border: `#e2e8f0` (Light Gray) | ||
| - Success: `#48bb78` (Green) | ||
| - Error: `#f56565` (Red) | ||
|
|
||
| ### Typography | ||
|
|
||
| - Headers: Bold, 24px | ||
| - Body: Regular, 16px | ||
| - Labels: Semi-bold, 16px | ||
| - Amount Display: Bold, 32px | ||
|
|
||
| ### Spacing | ||
|
|
||
| - Consistent 8px grid system | ||
| - Proper padding and margins | ||
| - Touch-friendly button sizes | ||
| - Safe area handling | ||
|
|
||
| ## 🔒 Security | ||
|
|
||
| - SSL encryption notice | ||
| - Secure payment processing | ||
| - No sensitive data stored | ||
| - Demo environment only | ||
|
|
||
| ## 📄 License | ||
|
|
||
| This demo is part of the React Native Paystack WebView project and follows the same MIT license. | ||
|
|
||
| ## 🤝 Contributing | ||
|
|
||
| [Contributing guide](https://github.com/just1and0/React-Native-Paystack-WebView/blob/main/CONTRIBUTING.md) | ||
|
|
||
| ## 🔗 Links | ||
|
|
||
| - [Main Library Repository](https://github.com/just1and0/React-Native-Paystack-WebView) | ||
| - [Paystack Documentation](https://paystack.com/docs) | ||
| - [React Native WebView](https://github.com/react-native-webview/react-native-webview) | ||
|
|
||
| --- | ||
|
|
||
| **Enjoy testing the React Native Paystack WebView library! 🎉** | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| { | ||
| "expo": { | ||
| "name": "demo", | ||
| "slug": "demo", | ||
| "version": "1.0.0", | ||
| "orientation": "portrait", | ||
| "icon": "./assets/images/icon.png", | ||
| "scheme": "demo", | ||
| "userInterfaceStyle": "automatic", | ||
| "newArchEnabled": true, | ||
| "ios": { | ||
| "supportsTablet": true | ||
| }, | ||
| "android": { | ||
| "adaptiveIcon": { | ||
| "foregroundImage": "./assets/images/adaptive-icon.png", | ||
| "backgroundColor": "#ffffff" | ||
| }, | ||
| "edgeToEdgeEnabled": true | ||
| }, | ||
| "web": { | ||
| "bundler": "metro", | ||
| "output": "static", | ||
| "favicon": "./assets/images/favicon.png" | ||
| }, | ||
| "plugins": [ | ||
| "expo-router", | ||
| [ | ||
| "expo-splash-screen", | ||
| { | ||
| "image": "./assets/images/splash-icon.png", | ||
| "imageWidth": 200, | ||
| "resizeMode": "contain", | ||
| "backgroundColor": "#ffffff" | ||
| } | ||
| ] | ||
| ], | ||
| "experiments": { | ||
| "typedRoutes": true | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { Stack } from 'expo-router'; | ||
| import { PaystackProvider } from '../../development/PaystackProvider'; | ||
|
|
||
| export default function Layout() { | ||
| return ( | ||
| <PaystackProvider | ||
| publicKey="pk_test_d319f8851d3f60e748d8c67ac58af67ba0ecd72d" | ||
| currency="NGN" | ||
| debug={true} | ||
| onGlobalSuccess={(res) => console.log('Global Success:', res)} | ||
| onGlobalCancel={() => console.log('Global Cancel')} | ||
| > | ||
| <Stack | ||
| screenOptions={{ | ||
| headerShown: false, | ||
| }} | ||
| /> | ||
| </PaystackProvider> | ||
| ); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jokotoye18 we have a contribution guideline, you can reference that here rather that listing a new one.
See contribution.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't resolved yet