Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
Make iOS 9 compatible again. (#874)
Browse files Browse the repository at this point in the history
Summary:
React Native v0.62.0’s template still uses iOS 9 as deployment target, bumping it to 10 this late in the release cycle is probably not a good idea, so instead I made this tiny change to make it iOS 9 compatible again.

⚠️  I made this change on top of the `v0.32.2` **tag**, as `master` was giving me a build failure and in any case it would be better to release _just_ this change as a patch release so the RN `v0.62.0-rc.3` release can go out without having to test Flipper as thoroughly again.

## Changelog

Make FlipperKit compatible with iOS 9 again.
Pull Request resolved: #874

Test Plan:
- `pod install` with a Podfile that has iOS 9 as its deployment target passes again.
- Building the Flipper Sample works.
- Building with a RN application created with the `v0.62.0-rc.3` template works.

Reviewed By: priteshrnandgaonkar

Differential Revision: D20307073

Pulled By: passy

fbshipit-source-id: 0dd02dfb810b7382c52ca81b8f1322f807fb3f29
  • Loading branch information
alloy authored and facebook-github-bot committed Mar 9, 2020
1 parent eca300d commit c6c667d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion FlipperKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Pod::Spec.new do |spec|
spec.source = { :git => 'https://github.com/facebook/Sonar.git',
:tag=> "v"+flipperkit_version }
spec.module_name = 'FlipperKit'
spec.platforms = { :ios => "10.0" }
spec.platforms = { :ios => "9.0" }
spec.default_subspecs = "Core"

# This subspec is necessary since FBDefines.h is imported as <FBDefines/FBDefines.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ - (NSArray*)validChildrenForNode:(UIView*)node {

- (NSDictionary<NSString*, SKNodeUpdateData>*)dataMutationsForNode:
(UIView*)node {
return @{
NSDictionary<NSString*, SKNodeUpdateData>* dataMutations = @{
// UIView
@"UIView.alpha" : ^(NSNumber* value){
node.alpha = [value floatValue];
Expand Down Expand Up @@ -453,9 +453,6 @@ - (NSArray*)validChildrenForNode:(UIView*)node {
@"Accessibility.accessibilityTraits.UIAccessibilityTraitCausesPageTurn": ^(NSNumber *value) {
node.accessibilityTraits = AccessibilityTraitsToggle(node.accessibilityTraits, UIAccessibilityTraitCausesPageTurn, [value boolValue]);
},
@"Accessibility.accessibilityTraits.UIAccessibilityTraitTabBar": ^(NSNumber *value) {
node.accessibilityTraits = AccessibilityTraitsToggle(node.accessibilityTraits, UIAccessibilityTraitTabBar, [value boolValue]);
},
@"Accessibility.accessibilityViewIsModal": ^(NSNumber *value) {
node.accessibilityViewIsModal = [value boolValue];
},
Expand All @@ -464,6 +461,20 @@ - (NSArray*)validChildrenForNode:(UIView*)node {
},
}
;
if (@available(iOS 10.0, *)) {
NSMutableDictionary<NSString*, SKNodeUpdateData>* latestDataMutations =
[dataMutations mutableCopy];
latestDataMutations
[@"Accessibility.accessibilityTraits.UIAccessibilityTraitTabBar"] =
^(NSNumber* value) {
node.accessibilityTraits = AccessibilityTraitsToggle(
node.accessibilityTraits,
UIAccessibilityTraitTabBar,
[value boolValue]);
};
dataMutations = latestDataMutations;
}
return dataMutations;
}

- (NSArray<SKNamed<NSString*>*>*)attributesForNode:(UIView*)node {
Expand Down
2 changes: 1 addition & 1 deletion iOS/Sample/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source 'https://github.com/facebook/Sonar.git'
source 'https://github.com/CocoaPods/Specs'

target 'Sample' do
platform :ios, '10.0'
platform :ios, '9.0'
pod 'FlipperKit', :path => '../../FlipperKit.podspec'
pod 'FlipperKit/FlipperKitLayoutComponentKitSupport', :path => '../../FlipperKit.podspec'
pod 'FlipperKit/SKIOSNetworkPlugin', :path => '../../FlipperKit.podspec'
Expand Down

0 comments on commit c6c667d

Please sign in to comment.