-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for dot indicator to BottomTabs.
- Loading branch information
Showing
57 changed files
with
1,208 additions
and
490 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
lib/android/app/src/main/java/com/reactnativenavigation/parse/DotIndicatorOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.reactnativenavigation.parse; | ||
|
||
import android.support.annotation.Nullable; | ||
|
||
import com.reactnativenavigation.parse.params.Bool; | ||
import com.reactnativenavigation.parse.params.Colour; | ||
import com.reactnativenavigation.parse.params.NullBool; | ||
import com.reactnativenavigation.parse.params.NullColor; | ||
import com.reactnativenavigation.parse.params.NullNumber; | ||
import com.reactnativenavigation.parse.params.Number; | ||
import com.reactnativenavigation.parse.parsers.BoolParser; | ||
import com.reactnativenavigation.parse.parsers.ColorParser; | ||
import com.reactnativenavigation.parse.parsers.NumberParser; | ||
|
||
import org.json.JSONObject; | ||
|
||
public class DotIndicatorOptions { | ||
public static DotIndicatorOptions parse(@Nullable JSONObject json) { | ||
DotIndicatorOptions options = new DotIndicatorOptions(); | ||
if (json == null) return options; | ||
|
||
options.color = ColorParser.parse(json, "color"); | ||
options.size = NumberParser.parse(json, "size"); | ||
options.visible = BoolParser.parse(json, "visible"); | ||
|
||
return options; | ||
} | ||
|
||
public Colour color = new NullColor(); | ||
public Number size = new NullNumber(); | ||
public Bool visible = new NullBool(); | ||
|
||
public boolean hasValue() { | ||
return visible.hasValue(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,6 @@ | |
|
||
- (BOOL)getWithDefaultValue:(BOOL)value; | ||
|
||
- (bool) isFalse; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#import "RNNOptions.h" | ||
|
||
@interface DotIndicatorOptions : RNNOptions | ||
|
||
@property(nonatomic, strong) Color *color; | ||
@property(nonatomic, strong) Number *size; | ||
@property(nonatomic, strong) Bool *visible; | ||
|
||
- (bool)hasValue; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#import "DotIndicatorOptions.h" | ||
#import "NullColor.h" | ||
#import "NullNumber.h" | ||
#import "NullBool.h" | ||
|
||
|
||
@implementation DotIndicatorOptions | ||
- (instancetype)initWithDict:(NSDictionary *)dict { | ||
self = [super init]; | ||
|
||
self.color = [ColorParser parse:dict key:@"color"]; | ||
self.size = [NumberParser parse:dict key:@"size"]; | ||
self.visible = [BoolParser parse:dict key:@"visible"]; | ||
return self; | ||
} | ||
|
||
- (instancetype)init { | ||
_color = [NullColor new]; | ||
_size = [NullNumber new]; | ||
_visible = [NullBool new]; | ||
return self; | ||
} | ||
|
||
- (bool)hasValue { | ||
return [self.visible hasValue]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#import <Foundation/Foundation.h> | ||
|
||
@class DotIndicatorOptions; | ||
|
||
@interface DotIndicatorParser : NSObject | ||
+ (DotIndicatorOptions *)parse:(NSDictionary *)dict; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#import "DotIndicatorParser.h" | ||
#import "DotIndicatorOptions.h" | ||
|
||
|
||
@implementation DotIndicatorParser | ||
+ (DotIndicatorOptions *)parse:(NSDictionary *)dict { | ||
return [[DotIndicatorOptions alloc] initWithDict:dict[@"dotIndicator"]]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.