Browse Source

Xcode 8 fixes

Leo Natan 7 years ago
parent
commit
35ee99c71a
No account linked to committer's email address
1 changed files with 8 additions and 7 deletions
  1. 8
    7
      ios/RNNSwizzles.m

+ 8
- 7
ios/RNNSwizzles.m View File

10
 @import ObjectiveC;
10
 @import ObjectiveC;
11
 @import UIKit;
11
 @import UIKit;
12
 
12
 
13
-static id (*__SWZ_initWithEventDispatcher_orig)(id self, SEL _cmd, id eventDispatcher);
14
-
15
 @implementation RNNSwizzles
13
 @implementation RNNSwizzles
16
 
14
 
15
+#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_10_3
16
+static id (*__SWZ_initWithEventDispatcher_orig)(id self, SEL _cmd, id eventDispatcher);
17
+
17
 - (id)__swz_initWithEventDispatcher:(id)eventDispatcher
18
 - (id)__swz_initWithEventDispatcher:(id)eventDispatcher
18
 {
19
 {
19
 	id returnValue = __SWZ_initWithEventDispatcher_orig(self, _cmd, eventDispatcher);
20
 	id returnValue = __SWZ_initWithEventDispatcher_orig(self, _cmd, eventDispatcher);
20
-
21
-	#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0	
21
+	
22
 	if (@available(iOS 11.0, *)) {
22
 	if (@available(iOS 11.0, *)) {
23
 		[(UIScrollView*)[returnValue valueForKey:@"scrollView"] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentAutomatic];
23
 		[(UIScrollView*)[returnValue valueForKey:@"scrollView"] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentAutomatic];
24
 	}
24
 	}
25
-	#endif
26
 	
25
 	
27
 	return returnValue;
26
 	return returnValue;
28
 }
27
 }
28
+#endif
29
 
29
 
30
 + (void)applySwizzles
30
 + (void)applySwizzles
31
 {
31
 {
32
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0
32
+#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_10_3
33
 	Class cls = NSClassFromString(@"RCTScrollView");
33
 	Class cls = NSClassFromString(@"RCTScrollView");
34
 	if(cls == NULL)
34
 	if(cls == NULL)
35
 	{
35
 	{
45
 	__SWZ_initWithEventDispatcher_orig = (void*)method_getImplementation(m1);
45
 	__SWZ_initWithEventDispatcher_orig = (void*)method_getImplementation(m1);
46
 	Method m2 = class_getInstanceMethod([RNNSwizzles class], NSSelectorFromString(@"__swz_initWithEventDispatcher:"));
46
 	Method m2 = class_getInstanceMethod([RNNSwizzles class], NSSelectorFromString(@"__swz_initWithEventDispatcher:"));
47
 	method_exchangeImplementations(m1, m2);
47
 	method_exchangeImplementations(m1, m2);
48
-}
49
 #endif
48
 #endif
49
+}
50
 
50
 
51
 @end
51
 @end
52
+