From 79dc44f7598f229ad2be1f94c96265911e17bf0e Mon Sep 17 00:00:00 2001 From: Dilan Date: Wed, 2 Jun 2021 16:03:47 -0400 Subject: [PATCH] Implement React Native example in code --- native-example/.buckconfig | 6 + native-example/.gitignore | 54 + native-example/App.js | 87 + native-example/android/app/BUCK | 55 + native-example/android/app/build.gradle | 220 + native-example/android/app/build_defs.bzl | 19 + native-example/android/app/debug.keystore | Bin 0 -> 2257 bytes native-example/android/app/proguard-rules.pro | 10 + .../android/app/src/debug/AndroidManifest.xml | 7 + .../com/nativeexample/ReactNativeFlipper.java | 69 + .../android/app/src/main/AndroidManifest.xml | 38 + .../java/com/nativeexample/MainActivity.java | 41 + .../com/nativeexample/MainApplication.java | 128 + .../src/main/res/drawable/splashscreen.xml | 7 + .../main/res/drawable/splashscreen_image.png | Bin 0 -> 9306 bytes .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3056 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 5024 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2096 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 0 -> 2858 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4569 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 0 -> 7098 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 6464 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 0 -> 10676 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 9250 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 15523 bytes .../app/src/main/res/values/colors.xml | 5 + .../app/src/main/res/values/strings.xml | 3 + .../app/src/main/res/values/styles.xml | 12 + native-example/android/build.gradle | 38 + native-example/android/gradle.properties | 29 + .../android/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 53639 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + native-example/android/gradlew | 183 + native-example/android/gradlew.bat | 103 + native-example/android/settings.gradle | 9 + native-example/app.json | 12 + native-example/babel.config.js | 7 + native-example/index.js | 9 + native-example/ios/Podfile | 21 + native-example/ios/Podfile.lock | 563 ++ .../nativeexample.xcodeproj/project.pbxproj | 475 ++ .../xcschemes/nativeexample.xcscheme | 88 + .../contents.xcworkspacedata | 10 + .../ios/nativeexample/AppDelegate.h | 10 + .../ios/nativeexample/AppDelegate.m | 111 + .../nativeexample/Base.lproj/LaunchScreen.xib | 42 + .../AppIcon.appiconset/Contents.json | 38 + .../Images.xcassets/Contents.json | 6 + .../SplashScreen.imageset/Contents.json | 21 + .../SplashScreen.imageset/splashscreen.png | Bin 0 -> 9306 bytes .../Contents.json | 21 + .../background.png | Bin 0 -> 80 bytes native-example/ios/nativeexample/Info.plist | 55 + .../ios/nativeexample/SplashScreen.storyboard | 91 + .../ios/nativeexample/Supporting/Expo.plist | 10 + native-example/ios/nativeexample/main.m | 10 + native-example/metro.config.js | 4 + native-example/package.json | 28 + native-example/yarn.lock | 6945 +++++++++++++++++ 59 files changed, 9705 insertions(+) create mode 100644 native-example/.buckconfig create mode 100644 native-example/.gitignore create mode 100644 native-example/App.js create mode 100644 native-example/android/app/BUCK create mode 100644 native-example/android/app/build.gradle create mode 100644 native-example/android/app/build_defs.bzl create mode 100644 native-example/android/app/debug.keystore create mode 100644 native-example/android/app/proguard-rules.pro create mode 100644 native-example/android/app/src/debug/AndroidManifest.xml create mode 100644 native-example/android/app/src/debug/java/com/nativeexample/ReactNativeFlipper.java create mode 100644 native-example/android/app/src/main/AndroidManifest.xml create mode 100644 native-example/android/app/src/main/java/com/nativeexample/MainActivity.java create mode 100644 native-example/android/app/src/main/java/com/nativeexample/MainApplication.java create mode 100644 native-example/android/app/src/main/res/drawable/splashscreen.xml create mode 100644 native-example/android/app/src/main/res/drawable/splashscreen_image.png create mode 100644 native-example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 native-example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 native-example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 native-example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png create mode 100644 native-example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 native-example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png create mode 100644 native-example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 native-example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png create mode 100644 native-example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 native-example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png create mode 100644 native-example/android/app/src/main/res/values/colors.xml create mode 100644 native-example/android/app/src/main/res/values/strings.xml create mode 100644 native-example/android/app/src/main/res/values/styles.xml create mode 100644 native-example/android/build.gradle create mode 100644 native-example/android/gradle.properties create mode 100644 native-example/android/gradle/wrapper/gradle-wrapper.jar create mode 100644 native-example/android/gradle/wrapper/gradle-wrapper.properties create mode 100755 native-example/android/gradlew create mode 100644 native-example/android/gradlew.bat create mode 100644 native-example/android/settings.gradle create mode 100644 native-example/app.json create mode 100644 native-example/babel.config.js create mode 100644 native-example/index.js create mode 100644 native-example/ios/Podfile create mode 100644 native-example/ios/Podfile.lock create mode 100644 native-example/ios/nativeexample.xcodeproj/project.pbxproj create mode 100644 native-example/ios/nativeexample.xcodeproj/xcshareddata/xcschemes/nativeexample.xcscheme create mode 100644 native-example/ios/nativeexample.xcworkspace/contents.xcworkspacedata create mode 100644 native-example/ios/nativeexample/AppDelegate.h create mode 100644 native-example/ios/nativeexample/AppDelegate.m create mode 100644 native-example/ios/nativeexample/Base.lproj/LaunchScreen.xib create mode 100644 native-example/ios/nativeexample/Images.xcassets/AppIcon.appiconset/Contents.json create mode 100644 native-example/ios/nativeexample/Images.xcassets/Contents.json create mode 100644 native-example/ios/nativeexample/Images.xcassets/SplashScreen.imageset/Contents.json create mode 100644 native-example/ios/nativeexample/Images.xcassets/SplashScreen.imageset/splashscreen.png create mode 100644 native-example/ios/nativeexample/Images.xcassets/SplashScreenBackground.imageset/Contents.json create mode 100644 native-example/ios/nativeexample/Images.xcassets/SplashScreenBackground.imageset/background.png create mode 100644 native-example/ios/nativeexample/Info.plist create mode 100644 native-example/ios/nativeexample/SplashScreen.storyboard create mode 100644 native-example/ios/nativeexample/Supporting/Expo.plist create mode 100644 native-example/ios/nativeexample/main.m create mode 100644 native-example/metro.config.js create mode 100644 native-example/package.json create mode 100644 native-example/yarn.lock diff --git a/native-example/.buckconfig b/native-example/.buckconfig new file mode 100644 index 0000000..934256c --- /dev/null +++ b/native-example/.buckconfig @@ -0,0 +1,6 @@ + +[android] + target = Google Inc.:Google APIs:23 + +[maven_repositories] + central = https://repo1.maven.org/maven2 diff --git a/native-example/.gitignore b/native-example/.gitignore new file mode 100644 index 0000000..350472f --- /dev/null +++ b/native-example/.gitignore @@ -0,0 +1,54 @@ +# OSX +# +.DS_Store + +# Xcode +# +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +*.moved-aside +DerivedData +*.hmap +*.ipa +*.xcuserstate +project.xcworkspace + +# Android/IntelliJ +# +build/ +.idea +.gradle +local.properties +*.iml +*.hprof + +# node.js +# +node_modules/ +npm-debug.log +yarn-error.log + +# BUCK +buck-out/ +\.buckd/ +*.keystore +!debug.keystore + +# Bundle artifacts +*.jsbundle + +# CocoaPods +/ios/Pods/ + +# Expo +.expo/ +web-build/ diff --git a/native-example/App.js b/native-example/App.js new file mode 100644 index 0000000..42f17c6 --- /dev/null +++ b/native-example/App.js @@ -0,0 +1,87 @@ +/* eslint-disable operator-linebreak */ +import React, { useState, useEffect } from 'react'; +import { StyleSheet, Text, View, TextInput, Button } from 'react-native'; +import { useEasybase, EasybaseProvider } from 'easybase-react'; +import ebconfig from './ebconfig'; + +function Account() { + const [userVal, setUserVal] = useState(""); + const [passVal, setPassVal] = useState(""); + + const { signIn, signUp } = useEasybase(); + + const clearInputs = () => { + setUserVal(""); + setPassVal(""); + } + + const handleSignInPress = async () => { + await signIn(userVal, passVal); + clearInputs(); + } + + const handleSignUpPress = async () => { + const res = await signUp(userVal, passVal, { + created_at: new Date().toString + }); + if (res.success) { + await signIn(userVal, passVal); + } + clearInputs(); + } + + return ( + + Welcome to React-flix! + setUserVal(e)} style={styles.accountInput} placeholder="Username" /> + setPassVal(e)} style={styles.accountInput} placeholder="Password"/> + +