Skip to content

Commit

Permalink
修正marker旋转角度为逆时针的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
lzj committed Apr 20, 2020
1 parent ea16a06 commit b5716bf
Show file tree
Hide file tree
Showing 11 changed files with 143 additions and 9 deletions.
5 changes: 0 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'signing'

buildscript {
repositories {
Expand Down Expand Up @@ -48,10 +47,6 @@ android {
}
}

signing {
sign configurations.archives
}

dependencies {
compileOnly 'com.facebook.react:react-native:+'
compileOnly files('src/main/assets')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void setAlpha(OverlayMarker overlayMarker, float alpha) {

@ReactProp(name = "rotate")
public void setRotate(OverlayMarker overlayMarker, float rotate) {
overlayMarker.setRotate(rotate);
overlayMarker.setRotate(-rotate);
}

@ReactProp(name = "flat")
Expand Down
2 changes: 1 addition & 1 deletion example/App1.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export default class App1 extends Component<Props> {
title={this.state.markers[0].title}
location={this.state.markers[0].location}
icon={require('./res/image/icon_car.png')}
rotate={90}
rotate={20}
/>

<Overlay.Marker
Expand Down
12 changes: 12 additions & 0 deletions example/react-native-patch/reswift_modify_delete_methods.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- a/Pods/ReSwift/ReSwift/CoreTypes/Store.swift
+++ b/Pods/ReSwift/ReSwift/CoreTypes/Store.swift
@@ -86,9 +86,6 @@

subscriptions.append(subscriptionBox)

- if let state = self.state {
- originalSubscription.newValues(oldState: nil, newState: state)
- }
}

open func subscribe<S: StoreSubscriber>(_ subscriber: S)
62 changes: 62 additions & 0 deletions example/react-native-patch/rn_modify_add_macro.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
--- a/node_modules/react-native/React/Base/RCTBridgeModule.h
+++ b/node_modules/react-native/React/Base/RCTBridgeModule.h
@@ -74,6 +74,17 @@
+ (void)load { RCTRegisterModule(self); }

/**
+ * Same as RCT_EXPORT_MODULE, but uses __attribute__((constructor)) for module
+ * registration. Useful for registering swift classes that forbids use of load
+ * Used in RCT_EXTERN_REMAP_MODULE
+ */
+#define RCT_EXPORT_MODULE_NO_LOAD(js_name, objc_name) \
+RCT_EXTERN void RCTRegisterModule(Class); \
++ (NSString *)moduleName { return @#js_name; } \
+__attribute__((constructor)) static void \
+RCT_CONCAT(initialize_, objc_name)() { RCTRegisterModule([objc_name class]); }
+
+/**
* To improve startup performance users may want to generate their module lists
* at build time and hook the delegate to merge with the runtime list. This
* macro takes the place of the above for those cases by omitting the +load
@@ -250,7 +261,7 @@
@interface objc_name (RCTExternModule) <RCTBridgeModule> \
@end \
@implementation objc_name (RCTExternModule) \
- RCT_EXPORT_MODULE(js_name)
+ RCT_EXPORT_MODULE_NO_LOAD(js_name, objc_name)

/**
* Use this macro in accordance with RCT_EXTERN_MODULE to export methods
@@ -323,10 +334,29 @@
@end

/**
+ * A protocol that allows TurboModules to do lookup on other TurboModules.
+ * Calling these methods may cause a module to be synchronously instantiated.
+ */
+ @protocol RCTTurboModuleLookupDelegate <NSObject>
+ - (id)moduleForName:(const char *)moduleName;
+
+ /**
+ * Rationale:
+ * When TurboModules lookup other modules by name, we first check the TurboModule
+ * registry to see if a TurboModule exists with the respective name. In this case,
+ * we don't want a RedBox to be raised if the TurboModule isn't found.
+ *
+ * This method is deprecated and will be deleted after the migration from
+ * TurboModules to TurboModules is complete.
+ */
+ - (id)moduleForName:(const char *)moduleName warnOnLookupFailure:(BOOL)warnOnLookupFailure;
+ - (BOOL)moduleIsInitialized:(const char *)moduleName;
+ @end
+
+/**
* Experimental.
* A protocol to declare that a class supports TurboModule.
* This may be removed in the future.
+ * See RCTTurboModule.h for actual signature.
*/
-@protocol RCTTurboModule <NSObject>
-
-@end
+@protocol RCTTurboModule;
10 changes: 10 additions & 0 deletions example/react-native-patch/rn_modify_module_method.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- a/node_modules/react-native/React/Base/RCTModuleMethod.mm
+++ b/node_modules/react-native/React/Base/RCTModuleMethod.mm
@@ -90,6 +90,7 @@

static BOOL RCTParseUnused(const char **input)
{
return RCTReadString(input, "__unused") ||
+ RCTReadString(input, "__attribute__((__unused__))") || //lzj fixed
RCTReadString(input, "__attribute__((unused))");
}
29 changes: 29 additions & 0 deletions example/react-native-patch/rn_modify_react_podspec.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--- a/node_modules/react-native/React.podspec
+++ b/node_modules/react-native/React.podspec
@@ -115,6 +115,8 @@
s.subspec "jsiexecutor" do |ss|
ss.dependency "React/cxxreact"
ss.dependency "React/jsi"
+ ss.dependency "DoubleConversion"
+ ss.dependency "glog"
ss.dependency "Folly", folly_version
ss.compiler_flags = folly_compiler_flags
ss.source_files = "ReactCommon/jsiexecutor/jsireact/*.{cpp,h}"
@@ -125,6 +127,8 @@

s.subspec "jsi" do |ss|
ss.dependency "Folly", folly_version
+ ss.dependency "DoubleConversion"
+ ss.dependency "glog"
ss.compiler_flags = folly_compiler_flags
ss.source_files = "ReactCommon/jsi/*.{cpp,h}"
ss.private_header_files = "ReactCommon/jsi/*.h"
@@ -142,6 +146,8 @@
ss.dependency "React/jsinspector"
ss.dependency "boost-for-react-native", "1.63.0"
ss.dependency "Folly", folly_version
+ ss.dependency "DoubleConversion"
+ ss.dependency "glog"
ss.compiler_flags = folly_compiler_flags
ss.source_files = "ReactCommon/cxxreact/*.{cpp,h}"
ss.exclude_files = "ReactCommon/cxxreact/SampleCxxModule.*"
Binary file modified example/res/image/icon_car@3x.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions example/rnRunScript.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

SRCROOT=`pwd`
REACT_NATIVE_DIR=${SRCROOT}/node_modules/react-native
PATCH_FILE_PATH=${SRCROOT}/react-native-patch
echo "REACT_NATIVE_DIR:$REACT_NATIVE_DIR"
echo "PATCH_FILE_PATH:$PATCH_FILE_PATH"

set -x
patch -p0 -N --dry-run --silent -f $REACT_NATIVE_DIR/React/Base/RCTModuleMethod.mm < $PATCH_FILE_PATH/rn_modify_module_method.patch 1>/dev/null
if [ $? -eq 0 ]; then
patch -p0 -f $REACT_NATIVE_DIR/React/Base/RCTModuleMethod.mm < $PATCH_FILE_PATH/rn_modify_module_method.patch
fi

set -x
patch -p0 -N --dry-run --silent -f $REACT_NATIVE_DIR/React.podspec < $PATCH_FILE_PATH/rn_modify_react_podspec.patch 1>/dev/null
if [ $? -eq 0 ]; then
patch -p0 -f $REACT_NATIVE_DIR/React.podspec < $PATCH_FILE_PATH/rn_modify_react_podspec.patch
fi

set -x
patch -p0 -N --dry-run --silent -f $REACT_NATIVE_DIR/React/Base/RCTBridgeModule.h < $PATCH_FILE_PATH/rn_modify_add_macro.patch 1>/dev/null
if [ $? -eq 0 ]; then
patch -p0 -f $REACT_NATIVE_DIR/React/Base/RCTBridgeModule.h < $PATCH_FILE_PATH/rn_modify_add_macro.patch
fi

2 changes: 1 addition & 1 deletion ios/RCTBaiduMap/Module/JMMarkerAnnotation.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ + (UIImage *)imageRotated:(UIImage *)image radians:(CGFloat)radians
if (!image || (num == radians && num % 360 == 0)) {
return image;
}
double radius = radians * M_PI / 180 + M_PI;
double radius = -radians * M_PI / 180;

CGSize rotatedSize = image.size;
UIGraphicsBeginImageContextWithOptions(rotatedSize, false, [UIScreen mainScreen].scale);
Expand Down
2 changes: 1 addition & 1 deletion react-native-baidu-map-jm.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "react-native-baidu-map-jm"
s.version = "1.3.4"
s.version = "1.3.5"
s.summary = "Baidu Map for React Native"

s.description = <<-DESC
Expand Down

0 comments on commit b5716bf

Please sign in to comment.