forked from rnmapbox/maps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(android): MarkerView anchor was missing, also fix existing warnin…
…g for vectorsource if tileUrlTemplates is defined (rnmapbox#3235)
- Loading branch information
Showing
14 changed files
with
184 additions
and
7 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
23 changes: 23 additions & 0 deletions
23
android/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXMarkerViewContent.kt
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,23 @@ | ||
package com.rnmapbox.rnmbx.components.annotation | ||
|
||
import android.content.Context | ||
import com.facebook.react.uimanager.MeasureSpecAssertions | ||
import com.facebook.react.views.view.ReactViewGroup | ||
|
||
class RNMBXMarkerViewContent(context: Context): ReactViewGroup(context) { | ||
// see https://github.com/rnmapbox/maps/pull/3235 | ||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { | ||
try { | ||
super.onMeasure(widthMeasureSpec, heightMeasureSpec) | ||
} catch(e: IllegalStateException) { | ||
val w = MeasureSpec.getSize(widthMeasureSpec) | ||
val h = MeasureSpec.getSize(heightMeasureSpec) | ||
setMeasuredDimension( | ||
if (w == 0) measuredWidth else w, | ||
if (h == 0) measuredHeight else h | ||
) | ||
} | ||
} | ||
|
||
} | ||
|
23 changes: 23 additions & 0 deletions
23
...d/src/main/java/com/rnmapbox/rnmbx/components/annotation/RNMBXMarkerViewContentManager.kt
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,23 @@ | ||
package com.rnmapbox.rnmbx.components.annotation | ||
|
||
import com.facebook.react.bridge.ReactApplicationContext | ||
import com.facebook.react.uimanager.ThemedReactContext | ||
import com.facebook.react.uimanager.ViewGroupManager | ||
import com.facebook.react.viewmanagers.RNMBXMarkerViewContentManagerInterface | ||
|
||
|
||
class RNMBXMarkerViewContentManager(reactApplicationContext: ReactApplicationContext) : | ||
ViewGroupManager<RNMBXMarkerViewContent>(), | ||
RNMBXMarkerViewContentManagerInterface<RNMBXMarkerView> { | ||
override fun getName(): String { | ||
return REACT_CLASS | ||
} | ||
|
||
override fun createViewInstance(context: ThemedReactContext): RNMBXMarkerViewContent { | ||
return RNMBXMarkerViewContent(context) | ||
} | ||
|
||
companion object { | ||
const val REACT_CLASS = "RNMBXMarkerViewContent" | ||
} | ||
} |
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
25 changes: 25 additions & 0 deletions
25
.../main/old-arch/com/facebook/react/viewmanagers/RNMBXMarkerViewContentManagerDelegate.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,25 @@ | ||
/** | ||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). | ||
* | ||
* Do not edit this file as changes may cause incorrect behavior and will be lost | ||
* once the code is regenerated. | ||
* | ||
* @generated by codegen project: GeneratePropsJavaDelegate.js | ||
*/ | ||
|
||
package com.facebook.react.viewmanagers; | ||
|
||
import android.view.View; | ||
import androidx.annotation.Nullable; | ||
import com.facebook.react.uimanager.BaseViewManagerDelegate; | ||
import com.facebook.react.uimanager.BaseViewManagerInterface; | ||
|
||
public class RNMBXMarkerViewContentManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & RNMBXMarkerViewContentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> { | ||
public RNMBXMarkerViewContentManagerDelegate(U viewManager) { | ||
super(viewManager); | ||
} | ||
@Override | ||
public void setProperty(T view, String propName, @Nullable Object value) { | ||
super.setProperty(view, propName, value); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...main/old-arch/com/facebook/react/viewmanagers/RNMBXMarkerViewContentManagerInterface.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,16 @@ | ||
/** | ||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). | ||
* | ||
* Do not edit this file as changes may cause incorrect behavior and will be lost | ||
* once the code is regenerated. | ||
* | ||
* @generated by codegen project: GeneratePropsJavaInterface.js | ||
*/ | ||
|
||
package com.facebook.react.viewmanagers; | ||
|
||
import android.view.View; | ||
|
||
public interface RNMBXMarkerViewContentManagerInterface<T extends View> { | ||
// No props | ||
} |
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,15 @@ | ||
#ifdef RCT_NEW_ARCH_ENABLED | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
#import <React/RCTUIManager.h> | ||
#import <React/RCTViewComponentView.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface RNMBXMarkerViewContentComponentView : RCTViewComponentView | ||
@end | ||
|
||
NS_ASSUME_NONNULL_END | ||
|
||
#endif // RCT_NEW_ARCH_ENABLED |
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,41 @@ | ||
#ifdef RCT_NEW_ARCH_ENABLED | ||
|
||
#import "RNMBXMarkerViewContentComponentView.h" | ||
#import "RNMBXFabricHelpers.h" | ||
|
||
#import <React/RCTConversions.h> | ||
#import <React/RCTFabricComponentsPlugins.h> | ||
|
||
#import <react/renderer/components/rnmapbox_maps_specs/ComponentDescriptors.h> | ||
#import <react/renderer/components/rnmapbox_maps_specs/EventEmitters.h> | ||
#import <react/renderer/components/rnmapbox_maps_specs/Props.h> | ||
#import <react/renderer/components/rnmapbox_maps_specs/RCTComponentViewHelpers.h> | ||
|
||
using namespace facebook::react; | ||
|
||
@interface RNMBXMarkerViewContentComponentView () <RCTRNMBXMarkerViewContentViewProtocol> | ||
@end | ||
|
||
@implementation RNMBXMarkerViewContentComponentView { | ||
} | ||
|
||
- (instancetype)initWithFrame:(CGRect)frame | ||
{ | ||
return [super initWithFrame:frame]; | ||
} | ||
|
||
#pragma mark - RCTComponentViewProtocol | ||
|
||
+ (ComponentDescriptorProvider)componentDescriptorProvider | ||
{ | ||
return concreteComponentDescriptorProvider<RNMBXMarkerViewContentComponentDescriptor>(); | ||
} | ||
|
||
@end | ||
|
||
Class<RCTComponentViewProtocol> RNMBXMarkerViewContentCls(void) | ||
{ | ||
return RNMBXMarkerViewContentComponentView.class; | ||
} | ||
|
||
#endif // RCT_NEW_ARCH_ENABLED |
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,6 @@ | ||
#import "React/RCTBridgeModule.h" | ||
#import <React/RCTViewManager.h> | ||
#import <Foundation/Foundation.h> | ||
|
||
@interface RCT_EXTERN_REMAP_MODULE(RNMBXMarkerViewContent, RNMBXMarkerViewContentManager, RCTViewManager) | ||
@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,14 @@ | ||
import Foundation | ||
import MapboxMaps | ||
|
||
@objc(RNMBXMarkerViewContentManager) | ||
class RNMBXMarkerViewContentManager : RCTViewManager { | ||
@objc | ||
override static func requiresMainQueueSetup() -> Bool { | ||
return true | ||
} | ||
|
||
override func view() -> UIView! { | ||
return UIView() | ||
} | ||
} |
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,9 @@ | ||
import type { HostComponent, ViewProps } from 'react-native'; | ||
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface NativeProps extends ViewProps {} | ||
|
||
export default codegenNativeComponent<NativeProps>( | ||
'RNMBXMarkerViewContent', | ||
) as HostComponent<ViewProps>; |