Skip to content

Commit

Permalink
Fixed code templates and reran autogen scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mfazekas committed Jun 5, 2019
1 parent 4d41499 commit 3759f90
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 8 deletions.
21 changes: 21 additions & 0 deletions docs/UserLocation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,29 @@
| visible | `bool` | `true` | `false` | FIX ME NO DESCRIPTION |
| onPress | `func` | `none` | `false` | FIX ME NO DESCRIPTION |
| onUpdate | `func` | `none` | `false` | FIX ME NO DESCRIPTION |
| children | `any` | `none` | `false` | FIX ME NO DESCRIPTION |

### methods
#### setLocationManager({running})



##### arguments
| Name | Type | Required | Description |
| ---- | :--: | :------: | :----------: |
| `{running}` | `n/a` | `Yes` | undefined |


#### needsLocationManagerRunning()



##### arguments
| Name | Type | Required | Description |
| ---- | :--: | :------: | :----------: |



#### userIconLayers()


Expand Down
26 changes: 26 additions & 0 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -4107,6 +4107,25 @@
"UserLocation": {
"description": "",
"methods": [
{
"name": "setLocationManager",
"docblock": null,
"modifiers": [],
"params": [
{
"name": "{running}",
"type": null
}
],
"returns": null
},
{
"name": "needsLocationManagerRunning",
"docblock": null,
"modifiers": [],
"params": [],
"returns": null
},
{
"name": "userIconLayers",
"docblock": null,
Expand Down Expand Up @@ -4150,6 +4169,13 @@
"type": "func",
"default": "none",
"description": "FIX ME NO DESCRIPTION"
},
{
"name": "children",
"required": false,
"type": "any",
"default": "none",
"description": "FIX ME NO DESCRIPTION"
}
],
"name": "UserLocation"
Expand Down
8 changes: 4 additions & 4 deletions ios/RCTMGL/RCTMGLStyle.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ - (void)fillLayer:(MGLFillStyleLayer *)layer withReactStyle:(NSDictionary *)reac
} else {
NSString *imageURI = [styleValue getImageURI];

[RCTMGLUtils fetchImage:_bridge url:imageURI scale:[styleValue getImageScale] callback:^(NSError *error, UIImage *image) {
[RCTMGLUtils fetchImage:_bridge url:imageURI scale:[styleValue getImageScale] callback:^(NSError *error, UIImage *image) {
if (image != nil) {
dispatch_async(dispatch_get_main_queue(), ^{
[_style setImage:image forName:imageURI];
Expand Down Expand Up @@ -140,7 +140,7 @@ - (void)lineLayer:(MGLLineStyleLayer *)layer withReactStyle:(NSDictionary *)reac
} else {
NSString *imageURI = [styleValue getImageURI];

[RCTMGLUtils fetchImage:_bridge url:imageURI scale:[styleValue getImageScale] callback:^(NSError *error, UIImage *image) {
[RCTMGLUtils fetchImage:_bridge url:imageURI scale:[styleValue getImageScale] callback:^(NSError *error, UIImage *image) {
if (image != nil) {
dispatch_async(dispatch_get_main_queue(), ^{
[_style setImage:image forName:imageURI];
Expand Down Expand Up @@ -458,7 +458,7 @@ - (void)fillExtrusionLayer:(MGLFillExtrusionStyleLayer *)layer withReactStyle:(N
} else {
NSString *imageURI = [styleValue getImageURI];

[RCTMGLUtils fetchImage:_bridge url:imageURI scale:[styleValue getImageScale] callback:^(NSError *error, UIImage *image) {
[RCTMGLUtils fetchImage:_bridge url:imageURI scale:[styleValue getImageScale] callback:^(NSError *error, UIImage *image) {
if (image != nil) {
dispatch_async(dispatch_get_main_queue(), ^{
[_style setImage:image forName:imageURI];
Expand Down Expand Up @@ -604,7 +604,7 @@ - (void)backgroundLayer:(MGLBackgroundStyleLayer *)layer withReactStyle:(NSDicti
} else {
NSString *imageURI = [styleValue getImageURI];

[RCTMGLUtils fetchImage:_bridge url:imageURI scale:[styleValue getImageScale] callback:^(NSError *error, UIImage *image) {
[RCTMGLUtils fetchImage:_bridge url:imageURI scale:[styleValue getImageScale] callback:^(NSError *error, UIImage *image) {
if (image != nil) {
dispatch_async(dispatch_get_main_queue(), ^{
[_style setImage:image forName:imageURI];
Expand Down
9 changes: 7 additions & 2 deletions scripts/autogenHelpers/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const iosSpecOverrides = {
'icon-translate-anchor': 'icon-translation-anchor',
'text-translate': 'text-translation',
'text-translate-anchor': 'text-translation-anchor',
'raster-resampling': 'raster-resampling-mode',
};

global.getValue = function(value, defaultValue) {
Expand Down Expand Up @@ -171,7 +172,7 @@ global.androidOutputType = function(type, value) {
}
};

global.androidGetConfigType = function(androidType) {
global.androidGetConfigType = function(androidType, name) {
switch (androidType) {
case 'Integer':
return 'styleValue.getInt(VALUE_KEY)';
Expand All @@ -184,7 +185,11 @@ global.androidGetConfigType = function(androidType) {
case 'String[]':
return 'styleValue.getStringArray(VALUE_KEY)';
default:
return 'styleValue.getString(VALUE_KEY)';
if (name === 'iconImage') {
return 'styleValue.getImageURI()';
} else {
return 'styleValue.getString(VALUE_KEY)';
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion scripts/templates/RCTMGLStyle.m.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
} else {
NSString *imageURI = [styleValue getImageURI];
[RCTMGLUtils fetchImage:_bridge url:imageURI callback:^(NSError *error, UIImage *image) {
[RCTMGLUtils fetchImage:_bridge url:imageURI scale:[styleValue getImageScale] callback:^(NSError *error, UIImage *image) {
if (image != nil) {
dispatch_async(dispatch_get_main_queue(), ^{
[_style setImage:image forName:imageURI];
Expand Down
2 changes: 1 addition & 1 deletion scripts/templates/RCTMGLStyleFactory.java.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class RCTMGLStyleFactory {
if (styleValue.isExpression()) {
layer.setProperties(PropertyFactory.<%= prop.name %>(styleValue.getExpression()));
} else {
layer.setProperties(PropertyFactory.<%= prop.name %>(<%- androidGetConfigType(androidInputType(prop.type, prop.value)) -%>));
layer.setProperties(PropertyFactory.<%= prop.name %>(<%- androidGetConfigType(androidInputType(prop.type, prop.value), prop.name) -%>));
}
<%_ } _%>
}
Expand Down

0 comments on commit 3759f90

Please sign in to comment.