Skip to content

Commit

Permalink
react native navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
flexsurfer committed May 24, 2021
1 parent a71468f commit 13a2ef9
Show file tree
Hide file tree
Showing 50 changed files with 1,708 additions and 432 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,7 @@ protected void onDestroy() {
super.onDestroy();
}

/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "StatusIm";
}


@Override
public void onConfigurationChanged(Configuration newConfig) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.aakashns.reactnativedialogs.ReactNativeDialogsPackage;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.reactnativenavigation.react.NavigationReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import com.facebook.react.ReactInstanceManager;
Expand All @@ -22,7 +23,7 @@

public class MainApplication extends MultiDexApplication implements ReactApplication {

private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
private final ReactNativeHost mReactNativeHost = new NavigationReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
Expand Down Expand Up @@ -54,7 +55,7 @@ public ReactNativeHost getReactNativeHost() {
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);

WebView.setWebContentsDebuggingEnabled(BuildConfig.DEBUG_WEBVIEW == "1");
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
Expand Down
2 changes: 2 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Project-wide gradle configuration properties for use by all modules
*/
ext {
RNNKotlinVersion = "1.4.31"
buildToolsVersion = project.buildToolsVersion
minSdkVersion = Integer.valueOf(project.minSdkVersion)
compileSdkVersion = Integer.valueOf(project.compileSdkVersion)
Expand All @@ -19,6 +20,7 @@ buildscript {
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31"
classpath "com.android.tools.build:gradle:${project.ext.gradlePluginVersion}"
// WARNING: Do not place your application dependencies here!
// They belong in the individual module build.gradle files.
Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
platform :ios, '10.0'
platform :ios, '11.0'

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
Expand Down
48 changes: 44 additions & 4 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,15 @@ PODS:
- React
- ReactNativeDarkMode (0.2.2):
- React
- ReactNativeNavigation (7.13.0):
- React-Core
- React-RCTImage
- React-RCTText
- ReactNativeNavigation/Core (= 7.13.0)
- ReactNativeNavigation/Core (7.13.0):
- React-Core
- React-RCTImage
- React-RCTText
- RNCAsyncStorage (1.11.0):
- React
- RNCClipboard (1.2.2):
Expand Down Expand Up @@ -321,8 +330,35 @@ PODS:
- React
- RNReactNativeHapticFeedback (1.9.0):
- React
- RNReanimated (1.13.0):
- RNReanimated (2.1.0):
- DoubleConversion
- FBLazyVector
- FBReactNativeSpec
- Folly
- glog
- RCTRequired
- RCTTypeSafety
- React
- React-callinvoker
- React-Core
- React-Core/DevSupport
- React-Core/RCTWebSocket
- React-CoreModules
- React-cxxreact
- React-jsi
- React-jsiexecutor
- React-jsinspector
- React-RCTActionSheet
- React-RCTAnimation
- React-RCTBlob
- React-RCTImage
- React-RCTLinking
- React-RCTNetwork
- React-RCTSettings
- React-RCTText
- React-RCTVibration
- ReactCommon/turbomodule/core
- Yoga
- RNScreens (2.10.1):
- React
- RNSVG (9.13.6):
Expand Down Expand Up @@ -387,6 +423,7 @@ DEPENDENCIES:
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- "ReactNativeAudioToolkit (from `../node_modules/@react-native-community/audio-toolkit`)"
- ReactNativeDarkMode (from `../node_modules/react-native-dark-mode`)
- ReactNativeNavigation (from `../node_modules/react-native-navigation`)
- "RNCAsyncStorage (from `../node_modules/@react-native-community/async-storage`)"
- "RNCClipboard (from `../node_modules/@react-native-community/clipboard`)"
- "RNCMaskedView (from `../node_modules/@react-native-community/masked-view`)"
Expand Down Expand Up @@ -507,6 +544,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/@react-native-community/audio-toolkit"
ReactNativeDarkMode:
:path: "../node_modules/react-native-dark-mode"
ReactNativeNavigation:
:path: "../node_modules/react-native-navigation"
RNCAsyncStorage:
:path: "../node_modules/@react-native-community/async-storage"
RNCClipboard:
Expand Down Expand Up @@ -562,7 +601,7 @@ SPEC CHECKSUMS:
FBLazyVector: 3bb422f41b18121b71783a905c10e58606f7dc3e
FBReactNativeSpec: f2c97f2529dd79c083355182cc158c9f98f4bd6e
Folly: b73c3869541e86821df3c387eb0af5f65addfab4
glog: cee4319f395bad5865ef3f32466c2e0ae677432c
glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3
Keycard: dd96182888da0aacf4de821b641103143bbb26cc
Permission-Camera: afad27bf90337684d4a86f3825112d648c8c4d3b
Permission-Microphone: 0ffabc3fe1c75cfb260525ee3f529383c9f4368c
Expand Down Expand Up @@ -602,6 +641,7 @@ SPEC CHECKSUMS:
ReactCommon: 73d79c7039f473b76db6ff7c6b159c478acbbb3b
ReactNativeAudioToolkit: de9610f323e855ac6574be8c99621f3d57c5df06
ReactNativeDarkMode: 0178ffca3b10f6a7c9f49d6f9810232b328fa949
ReactNativeNavigation: 4c4ca87edc0da4ee818158a62cb6188088454e5c
RNCAsyncStorage: d059c3ee71738c39834a627476322a5a8cd5bf36
RNCClipboard: 8148e21ac347c51fd6cd4b683389094c216bb543
RNCMaskedView: 71fc32d971f03b7f03d6ab6b86b730c4ee64f5b6
Expand All @@ -614,7 +654,7 @@ SPEC CHECKSUMS:
RNLanguages: 962e562af0d34ab1958d89bcfdb64fafc37c513e
RNPermissions: ad71dd4f767ec254f2cd57592fbee02afee75467
RNReactNativeHapticFeedback: 2566b468cc8d0e7bb2f84b23adc0f4614594d071
RNReanimated: 89f5e0a04d1dd52fbf27e7e7030d8f80a646a3fc
RNReanimated: 70f662b5232dd5d19ccff581e919a54ea73df51c
RNScreens: b748efec66e095134c7166ca333b628cd7e6f3e2
RNSVG: 8ba35cbeb385a52fd960fd28db9d7d18b4c2974f
secp256k1: f61d67e6fdcb85fd727acf1bf35ace6036db540c
Expand All @@ -624,6 +664,6 @@ SPEC CHECKSUMS:
TouchID: ba4c656d849cceabc2e4eef722dea5e55959ecf4
Yoga: 4bd86afe9883422a7c4028c00e34790f560923d6

PODFILE CHECKSUM: 3df5a5ce6c538b5f3727cb3ee1c20bf66d7ac3eb
PODFILE CHECKSUM: 27b3929c4d7f0b5afd76276d0bd4ae289ec11f18

COCOAPODS: 1.10.0
15 changes: 10 additions & 5 deletions ios/StatusIm/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

#import "AppDelegate.h"
#import <ReactNativeNavigation/ReactNativeNavigation.h>

#import <asl.h>
#import "ReactNativeConfig.h"
Expand All @@ -18,7 +19,6 @@

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#import <UserNotifications/UserNotifications.h>
#import <RNCPushNotificationIOS.h>
Expand Down Expand Up @@ -77,21 +77,22 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:@"BLANK_PREVIEW"];
[[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];

RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
[ReactNativeNavigation bootstrapWithDelegate:self launchOptions:launchOptions];
/*RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"StatusIm"
initialProperties:nil];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];*/

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
/*self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
_blankView = [[UIView alloc]initWithFrame:self.window.frame];
_blankView.backgroundColor = [UIColor whiteColor];
_blankView.alpha = 0;
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
[self.window makeKeyAndVisible];*/
[RNSplashScreen show];

UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
Expand All @@ -116,6 +117,10 @@ - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserAct
restorationHandler:restorationHandler];
}

- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge {
return [ReactNativeNavigation extraModulesForBridge:bridge];
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@
"react-native-languages": "^3.0.2",
"react-native-linear-gradient": "^2.5.6",
"react-native-mail": "git+https://github.com/status-im/react-native-mail.git#v4.0.0-status",
"react-native-navigation": "^7.13.0",
"react-native-navigation-bar-color": "^2.0.1",
"react-native-permissions": "^2.1.5",
"react-native-reanimated": "^1.13.0",
"react-native-reanimated": "^2.1.0",
"react-native-redash": "^14.2.2",
"react-native-safe-area-context": "^2.0.0",
"react-native-screens": "^2.10.1",
Expand Down
4 changes: 2 additions & 2 deletions src/mocks/js_dependencies.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
:event nil
:cond nil
:block nil
:interpolate nil
:interpolateNode nil
:call nil
:timing nil
:onChange nil
Expand All @@ -156,7 +156,7 @@
:Text #js {}
:Extrapolate #js {:CLAMP nil}
:Code #js {}}
:Easing #js {:bezier identity
:EasingNode #js {:bezier identity
:linear identity}
:clockRunning nil})
(def react-native-gesture-handler #js {:default #js {}
Expand Down
8 changes: 4 additions & 4 deletions src/quo/animated.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[quo.react-native :as rn]
[quo.gesture-handler :as gh]
[oops.core :refer [oget ocall]]
["react-native-reanimated" :default animated :refer (clockRunning Easing)]
["react-native-reanimated" :default animated :refer (clockRunning EasingNode)]
["react-native-redash" :as redash]
quo.react)
(:require-macros [quo.react :refer [maybe-js-deps]]))
Expand Down Expand Up @@ -55,8 +55,8 @@
(def start-clock (oget animated "startClock"))
(def stop-clock (oget animated "stopClock"))
(def clock-running clockRunning)
(def bezier (.-bezier ^js Easing))
(def linear (.-linear ^js Easing))
(def bezier (.-bezier ^js EasingNode))
(def linear (.-linear ^js EasingNode))

(def easings {:linear linear
:ease-in (bezier 0.42 0 1 1)
Expand Down Expand Up @@ -128,7 +128,7 @@
(.block ^js animated (to-array opts)))

(defn interpolate [anim-value config]
(.interpolate ^js animated anim-value (clj->js config)))
(.interpolateNode ^js animated anim-value (clj->js config)))

(defn call* [args callback]
(.call ^js animated (to-array args) callback))
Expand Down
12 changes: 10 additions & 2 deletions src/quo/react_native.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
[cljs-bean.core :as bean]
[quo.platform :as platform]
["react-native" :as rn]
["@react-native-community/hooks" :as hooks]))
["@react-native-community/hooks" :as hooks]
["react-native-navigation" :refer (Navigation)]))

(def app-registry (.-AppRegistry rn))

Expand All @@ -28,13 +29,20 @@

(def keyboard-avoiding-view-class (reagent/adapt-react-class (.-KeyboardAvoidingView ^js rn)))

(def navigation-const (atom nil))

(.then (.constants Navigation) (fn [consts]
(reset! navigation-const {:top-bar-height (.-topBarHeight consts)
:status-bar-height (.-statusBarHeight consts)})))

(defn keyboard-avoiding-view []
(let [this (reagent/current-component)
props (reagent/props this)]
(into [keyboard-avoiding-view-class
(merge (when platform/ios?
{:behavior :padding})
props)]
props
{:keyboardVerticalOffset (+ 44 (get @navigation-const :status-bar-height))})]
(reagent/children this))))

(def keyboard (.-Keyboard ^js rn))
Expand Down
5 changes: 3 additions & 2 deletions src/status_im/acquisition/chat.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@
[cofx referrer chat-name]
(fx/merge cofx
{::persistence/chat-initalized! true}
(navigation/navigate-to :tabs {:screen :chat-stack
:params {:screen :referral-enclav}})))
(navigation/navigate-to :chat nil)
#_(navigation/navigate-to :tabs {:screen :chat-stack
:params {:screen :referral-enclav}})))

(fx/defn join-public-chat
[cofx chat-name]
Expand Down
6 changes: 4 additions & 2 deletions src/status_im/bottom_sheet/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

(fx/defn show-bottom-sheet
[{:keys [db]} {:keys [view options]}]
{:db (assoc db
{:rnn-show-bottom-sheet nil
:db (assoc db
:bottom-sheet/show? true
:bottom-sheet/view view
:bottom-sheet/options options)})
Expand All @@ -19,4 +20,5 @@
(fx/defn hide-bottom-sheet
{:events [:bottom-sheet/hide]}
[{:keys [db]}]
{:db (assoc db :bottom-sheet/show? false)})
{:rnn-hide-bottom-sheet nil
:db (assoc db :bottom-sheet/show? false)})
3 changes: 1 addition & 2 deletions src/status_im/browser/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,7 @@
(fx/merge cofx
{:db (assoc db :browser/options
{:browser-id (:browser-id browser)})}
(navigation/navigate-to-cofx :browser-stack {:screen :browser
:initial false})
(navigation/navigate-to-cofx :browser nil)
(update-browser browser)
(resolve-url nil)))))

Expand Down
2 changes: 1 addition & 1 deletion src/status_im/chat/models.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
(fn [{:keys [db]}]
{:db (assoc db :current-chat-id chat-id)})
(preload-chat-data chat-id)
(navigation/navigate-to-cofx :chat-stack {:screen :chat})))
(navigation/navigate-to-cofx :chat nil)))

(fx/defn handle-clear-history-response
{:events [::history-cleared]}
Expand Down
Loading

0 comments on commit 13a2ef9

Please sign in to comment.