Skip to content

Commit c6c002d

Browse files
author
Pavlo Aksonov
committed
merge upstream, resolve conflicts
2 parents 69fa4a1 + ff31832 commit c6c002d

File tree

19 files changed

+181
-113
lines changed

19 files changed

+181
-113
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# React Native Controllers
22

3+
>Important: Please review the following issue before using this project: [React Native Controllers Evolution] (https://github.com/wix/react-native-controllers/issues/87)
4+
35
`react-native-controllers` is a [React Native](https://facebook.github.io/react-native/) npm extension package for iOS which provides a completely native skeleton for iOS apps, allowing you to easily wrap core native UI components without compromising on the native experience. Key benefits:
46

57
* Truly native navigation (instead of the JS-based [`Navigator`](https://facebook.github.io/react-native/docs/navigator-comparison.html) or the [deprecated `NavigatorIOS`](https://facebook.github.io/react-native/docs/navigatorios.html))

example/.flowconfig

Lines changed: 23 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,28 @@
11
[ignore]
22

33
# We fork some components by platform.
4-
.*/*.web.js
54
.*/*.android.js
65

7-
# Some modules have their own node_modules with overlap
8-
.*/node_modules/node-haste/.*
9-
10-
# Ugh
11-
.*/node_modules/babel.*
12-
.*/node_modules/babylon.*
13-
.*/node_modules/invariant.*
14-
15-
# Ignore react and fbjs where there are overlaps, but don't ignore
16-
# anything that react-native relies on
17-
.*/node_modules/fbjs/lib/Map.js
18-
.*/node_modules/fbjs/lib/fetch.js
19-
.*/node_modules/fbjs/lib/ExecutionEnvironment.js
20-
.*/node_modules/fbjs/lib/ErrorUtils.js
21-
22-
# Flow has a built-in definition for the 'react' module which we prefer to use
23-
# over the currently-untyped source
24-
.*/node_modules/react/react.js
25-
.*/node_modules/react/lib/React.js
26-
.*/node_modules/react/lib/ReactDOM.js
27-
28-
.*/__mocks__/.*
29-
.*/__tests__/.*
30-
31-
.*/commoner/test/source/widget/share.js
32-
33-
# Ignore commoner tests
34-
.*/node_modules/commoner/test/.*
35-
36-
# See https://github.com/facebook/flow/issues/442
37-
.*/react-tools/node_modules/commoner/lib/reader.js
6+
# Ignore templates with `@flow` in header
7+
.*/local-cli/generator.*
388

39-
# Ignore jest
40-
.*/node_modules/jest-cli/.*
9+
# Ignore malformed json
10+
.*/node_modules/y18n/test/.*\.json
4111

42-
# Ignore Website
43-
.*/website/.*
12+
# Ignore the website subdir
13+
<PROJECT_ROOT>/website/.*
4414

45-
# Ignore generators
46-
.*/local-cli/generator.*
15+
# Ignore BUCK generated dirs
16+
<PROJECT_ROOT>/\.buckd/
4717

48-
# Ignore BUCK generated folders
49-
.*\.buckd/
50-
51-
.*/node_modules/is-my-json-valid/test/.*\.json
52-
.*/node_modules/iconv-lite/encodings/tables/.*\.json
53-
.*/node_modules/y18n/test/.*\.json
54-
.*/node_modules/spdx-license-ids/spdx-license-ids.json
55-
.*/node_modules/spdx-exceptions/index.json
56-
.*/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json
57-
.*/node_modules/resolve/lib/core.json
58-
.*/node_modules/jsonparse/samplejson/.*\.json
59-
.*/node_modules/json5/test/.*\.json
60-
.*/node_modules/ua-parser-js/test/.*\.json
61-
.*/node_modules/builtin-modules/builtin-modules.json
62-
.*/node_modules/binary-extensions/binary-extensions.json
63-
.*/node_modules/url-regex/tlds.json
64-
.*/node_modules/joi/.*\.json
65-
.*/node_modules/isemail/.*\.json
66-
.*/node_modules/tr46/.*\.json
18+
# Ignore unexpected extra @providesModule
19+
.*/node_modules/commoner/test/source/widget/share.js
6720

21+
# Ignore duplicate module providers
22+
# For RN Apps installed via npm, "Libraries" folder is inside node_modules/react-native but in the source repo it is in the root
23+
.*/Libraries/react-native/React.js
24+
.*/Libraries/react-native/ReactNative.js
25+
.*/node_modules/jest-runtime/build/__tests__/.*
6826

6927
[include]
7028

@@ -79,18 +37,22 @@ module.system=haste
7937
esproposal.class_static_fields=enable
8038
esproposal.class_instance_fields=enable
8139

40+
experimental.strict_type_args=true
41+
8242
munge_underscores=true
8343

8444
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
85-
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\)$' -> 'RelativeImageStub'
45+
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\)$' -> 'RelativeImageStub'
8646

8747
suppress_type=$FlowIssue
8848
suppress_type=$FlowFixMe
8949
suppress_type=$FixMe
9050

91-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-3]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
92-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-3]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
51+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-9]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
52+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-9]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
9353
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
9454

55+
unsafe.enable_getters_and_setters=true
56+
9557
[version]
96-
0.23.0
58+
^0.29.0

example/android/app/BUCK

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import re
55
# - install Buck
66
# - `npm start` - to start the packager
77
# - `cd android`
8-
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US`
8+
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
99
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
1010
# - `buck install -r android/app` - compile, install and run application
1111
#

example/android/app/build.gradle

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ import com.android.build.OutputFile
5555
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
5656
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
5757
* // for example, you might want to remove it from here.
58-
* inputExcludes: ["android/**", "ios/**"]
58+
* inputExcludes: ["android/**", "ios/**"],
59+
*
60+
* // override which node gets called and with what additional arguments
61+
* nodeExecutableAndArgs: ["node"]
62+
*
63+
* // supply additional arguments to the packager
64+
* extraPackagerArgs: []
5965
* ]
6066
*/
6167

example/android/app/proguard-rules.pro

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@
2626
# See http://sourceforge.net/p/proguard/bugs/466/
2727
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
2828
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
29+
-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
2930

3031
# Do not strip any method/class that is annotated with @DoNotStrip
3132
-keep @com.facebook.proguard.annotations.DoNotStrip class *
33+
-keep @com.facebook.common.internal.DoNotStrip class *
3234
-keepclassmembers class * {
3335
@com.facebook.proguard.annotations.DoNotStrip *;
36+
@com.facebook.common.internal.DoNotStrip *;
3437
}
3538

3639
-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
@@ -51,9 +54,9 @@
5154

5255
-keepattributes Signature
5356
-keepattributes *Annotation*
54-
-keep class com.squareup.okhttp.** { *; }
55-
-keep interface com.squareup.okhttp.** { *; }
56-
-dontwarn com.squareup.okhttp.**
57+
-keep class okhttp3.** { *; }
58+
-keep interface okhttp3.** { *; }
59+
-dontwarn okhttp3.**
5760

5861
# okio
5962

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
package com.controllersexample;
22

33
import com.facebook.react.ReactActivity;
4-
import com.facebook.react.ReactPackage;
5-
import com.facebook.react.shell.MainReactPackage;
6-
7-
import java.util.Arrays;
8-
import java.util.List;
94

105
public class MainActivity extends ReactActivity {
116

@@ -17,24 +12,4 @@ public class MainActivity extends ReactActivity {
1712
protected String getMainComponentName() {
1813
return "ControllersExample";
1914
}
20-
21-
/**
22-
* Returns whether dev mode should be enabled.
23-
* This enables e.g. the dev menu.
24-
*/
25-
@Override
26-
protected boolean getUseDeveloperSupport() {
27-
return BuildConfig.DEBUG;
28-
}
29-
30-
/**
31-
* A list of packages used by the app. If the app uses additional views
32-
* or modules besides the default ones, add more packages here.
33-
*/
34-
@Override
35-
protected List<ReactPackage> getPackages() {
36-
return Arrays.<ReactPackage>asList(
37-
new MainReactPackage()
38-
);
39-
}
4015
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.controllersexample;
2+
3+
import android.app.Application;
4+
import android.util.Log;
5+
6+
import com.facebook.react.ReactApplication;
7+
import com.facebook.react.ReactInstanceManager;
8+
import com.facebook.react.ReactNativeHost;
9+
import com.facebook.react.ReactPackage;
10+
import com.facebook.react.shell.MainReactPackage;
11+
12+
import java.util.Arrays;
13+
import java.util.List;
14+
15+
public class MainApplication extends Application implements ReactApplication {
16+
17+
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
18+
@Override
19+
protected boolean getUseDeveloperSupport() {
20+
return BuildConfig.DEBUG;
21+
}
22+
23+
@Override
24+
protected List<ReactPackage> getPackages() {
25+
return Arrays.<ReactPackage>asList(
26+
new MainReactPackage()
27+
);
28+
}
29+
};
30+
31+
@Override
32+
public ReactNativeHost getReactNativeHost() {
33+
return mReactNativeHost;
34+
}
35+
}

example/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ allprojects {
1818
jcenter()
1919
maven {
2020
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
21-
url "$projectDir/../../node_modules/react-native/android"
21+
url "$rootDir/../node_modules/react-native/android"
2222
}
2323
}
2424
}

example/ios/ControllersExample.xcodeproj/project.pbxproj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,10 @@
653653
INFOPLIST_FILE = ControllersExample/Info.plist;
654654
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
655655
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
656-
OTHER_LDFLAGS = "-ObjC";
656+
OTHER_LDFLAGS = (
657+
"-ObjC",
658+
"-lc++",
659+
);
657660
PRODUCT_NAME = ControllersExample;
658661
};
659662
name = Debug;
@@ -671,7 +674,10 @@
671674
INFOPLIST_FILE = ControllersExample/Info.plist;
672675
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
673676
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
674-
OTHER_LDFLAGS = "-ObjC";
677+
OTHER_LDFLAGS = (
678+
"-ObjC",
679+
"-lc++",
680+
);
675681
PRODUCT_NAME = ControllersExample;
676682
};
677683
name = Release;

example/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"version": "0.0.1",
44
"private": true,
55
"scripts": {
6-
"start": "react-native start"
6+
"start": "watchman watch-del-all && adb reverse tcp:8081 tcp:8081 && node node_modules/react-native/local-cli/cli start --reset-cache"
77
},
88
"dependencies": {
9-
"react-native": "0.25.1",
10-
"react": "0.14.5",
11-
"react-native-controllers": "latest"
9+
"react-native": "0.31.0",
10+
"react": "15.2.1",
11+
"react-native-controllers": "file:../"
1212
}
1313
}

ios/RCCDrawerController/MMDrawerController/MMDrawerController.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,19 @@ typedef void (^MMDrawerControllerDrawerVisualStateBlock)(MMDrawerController * dr
449449
*/
450450
-(void)setGestureCompletionBlock:(void(^)(MMDrawerController * drawerController, UIGestureRecognizer * gesture))gestureCompletionBlock;
451451

452+
///---------------------------------------
453+
/// @name Gesture Start Handling
454+
///---------------------------------------
455+
456+
/**
457+
Sets a callback to be called when a gesture starts
458+
459+
This block is called when a gesture action has started.
460+
461+
@param gestureCompletionBlock A block object to be called that allows the implementer be notified when a gesture action has started.
462+
*/
463+
-(void)setGestureStartBlock:(void (^)(MMDrawerController *, UIGestureRecognizer *))gestureStartBlock;
464+
452465
///---------------------------------------
453466
/// @name Custom Gesture Handler
454467
///---------------------------------------

ios/RCCDrawerController/MMDrawerController/MMDrawerController.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
/** The percent of the possible overshoot width to use as the actual overshoot percentage. */
5050
CGFloat const MMDrawerOvershootPercentage = 0.1f;
5151

52+
typedef void (^MMDrawerGestureStartedBlock)(MMDrawerController * drawerController, UIGestureRecognizer * gesture);
5253
typedef BOOL (^MMDrawerGestureShouldRecognizeTouchBlock)(MMDrawerController * drawerController, UIGestureRecognizer * gesture, UITouch * touch);
5354
typedef void (^MMDrawerGestureCompletionBlock)(MMDrawerController * drawerController, UIGestureRecognizer * gesture);
5455

@@ -163,6 +164,7 @@ @interface MMDrawerController () <UIGestureRecognizerDelegate>{
163164
@property (nonatomic, assign) CGRect startingPanRect;
164165
@property (nonatomic, copy) MMDrawerControllerDrawerVisualStateBlock drawerVisualState;
165166
@property (nonatomic, copy) MMDrawerGestureShouldRecognizeTouchBlock gestureShouldRecognizeTouch;
167+
@property (nonatomic, copy) MMDrawerGestureCompletionBlock gestureStart;
166168
@property (nonatomic, copy) MMDrawerGestureCompletionBlock gestureCompletion;
167169
@property (nonatomic, assign, getter = isAnimatingDrawer) BOOL animatingDrawer;
168170

@@ -726,6 +728,11 @@ -(void)setGestureCompletionBlock:(void (^)(MMDrawerController *, UIGestureRecogn
726728
[self setGestureCompletion:gestureCompletionBlock];
727729
}
728730

731+
#pragma mark - Setting the Gesture Start Block
732+
-(void)setGestureStartBlock:(void (^)(MMDrawerController *, UIGestureRecognizer *))gestureStartBlock{
733+
[self setGestureStart:gestureStartBlock];
734+
}
735+
729736
#pragma mark - Subclass Methods
730737
-(BOOL)shouldAutomaticallyForwardAppearanceMethods{
731738
return NO;
@@ -1090,6 +1097,9 @@ -(void)tapGestureCallback:(UITapGestureRecognizer *)tapGesture{
10901097
-(void)panGestureCallback:(UIPanGestureRecognizer *)panGesture{
10911098
switch (panGesture.state) {
10921099
case UIGestureRecognizerStateBegan:{
1100+
if(self.gestureStart){
1101+
self.gestureStart(self, panGesture);
1102+
}
10931103
if(self.animatingDrawer){
10941104
[panGesture setEnabled:NO];
10951105
break;

ios/RCCDrawerController/RCCDrawerController.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#import "RCTRootView.h"
77
#import "RCCEventEmitter.h"
88
#import "UIViewController+NavBarButtons.h"
9+
#import "RCCManagerModule.h"
910

1011
#define RCCDRAWERCONTROLLER_ANIMATION_DURATION 0.33f
1112

@@ -81,6 +82,10 @@ - (instancetype)initWithProps:(NSDictionary *)props children:(NSArray *)children
8182
[[RCCEventEmitter sharedInstance] didTransition:self.navigatorID];
8283
}];
8384

85+
[self setGestureStartBlock:^(MMDrawerController *drawerController, UIGestureRecognizer *gesture) {
86+
[RCCManagerModule cancelAllRCCViewControllerReactTouches];
87+
}];
88+
8489
self.view.backgroundColor = [UIColor clearColor];
8590

8691
if (!self) return nil;

ios/RCCManagerModule.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44

55

66
@interface RCCManagerModule : NSObject <RCTBridgeModule>
7+
+(void)cancelAllRCCViewControllerReactTouches;
78
@end

0 commit comments

Comments
 (0)