Skip to content

Commit

Permalink
fix: change android package name (#2275)
Browse files Browse the repository at this point in the history
# Summary

Fixes android packageName by changing it in codegen configuration from
`com.horcrux.rnsvg` to `com.horcrux.svg`

## Tests

Tested with oldest supported `react-native@0.70.0` with an old
architecture and everything is working as expected.
  • Loading branch information
jakex7 authored May 15, 2024
1 parent 118a20c commit 0db8703
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.module.annotations.ReactModule;
import com.horcrux.rnsvg.NativeSvgRenderableModuleSpec;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
Expand Down
1 change: 0 additions & 1 deletion android/src/main/java/com/horcrux/svg/SvgViewModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.UiThreadUtil;
import com.facebook.react.module.annotations.ReactModule;
import com.horcrux.rnsvg.NativeSvgViewModuleSpec;
import javax.annotation.Nonnull;

@ReactModule(name = SvgViewModule.NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @generated by codegen project: GenerateModuleJavaSpec.js
* @nolint
*/
package com.horcrux.rnsvg;
package com.horcrux.svg;

import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.Promise;
Expand All @@ -17,39 +17,50 @@
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public abstract class NativeSvgRenderableModuleSpec extends ReactContextBaseJavaModule
implements TurboModule {
public static final String NAME = "RNSVGRenderableModule";

public abstract class NativeSvgRenderableModuleSpec extends ReactContextBaseJavaModule {
public NativeSvgRenderableModuleSpec(ReactApplicationContext reactContext) {
super(reactContext);
}

@Override
public @Nonnull String getName() {
return NAME;
}

@ReactMethod(isBlockingSynchronousMethod = true)
@DoNotStrip
public abstract boolean isPointInFill(Double tag, ReadableMap options);
public abstract boolean isPointInFill(@Nullable Double tag, @Nullable ReadableMap options);

@ReactMethod(isBlockingSynchronousMethod = true)
@DoNotStrip
public abstract boolean isPointInStroke(Double tag, ReadableMap options);
public abstract boolean isPointInStroke(@Nullable Double tag, @Nullable ReadableMap options);

@ReactMethod(isBlockingSynchronousMethod = true)
@DoNotStrip
public abstract double getTotalLength(Double tag);
public abstract double getTotalLength(@Nullable Double tag);

@ReactMethod(isBlockingSynchronousMethod = true)
@DoNotStrip
public abstract WritableMap getPointAtLength(Double tag, ReadableMap options);
public abstract WritableMap getPointAtLength(@Nullable Double tag, @Nullable ReadableMap options);

@ReactMethod(isBlockingSynchronousMethod = true)
@DoNotStrip
public abstract WritableMap getBBox(Double tag, ReadableMap options);
public abstract WritableMap getBBox(@Nullable Double tag, @Nullable ReadableMap options);

@ReactMethod(isBlockingSynchronousMethod = true)
@DoNotStrip
public abstract WritableMap getCTM(Double tag);
public abstract WritableMap getCTM(@Nullable Double tag);

@ReactMethod(isBlockingSynchronousMethod = true)
@DoNotStrip
public abstract WritableMap getScreenCTM(Double tag);
public abstract WritableMap getScreenCTM(@Nullable Double tag);

@ReactMethod
@DoNotStrip
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@

/**
* This code was generated by
* [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* <p>Do not edit this file as changes may cause incorrect behavior and will be lost once the code
* is regenerated.
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateModuleJavaSpec.js
*
* @nolint
*/
package com.horcrux.rnsvg;

package com.horcrux.svg;

import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public abstract class NativeSvgViewModuleSpec extends ReactContextBaseJavaModule implements TurboModule {
public static final String NAME = "RNSVGSvgViewModule";

public abstract class NativeSvgViewModuleSpec extends ReactContextBaseJavaModule {
public NativeSvgViewModuleSpec(ReactApplicationContext reactContext) {
super(reactContext);
}

@Override
public @Nonnull String getName() {
return NAME;
}

@ReactMethod
@DoNotStrip
public abstract void toDataURL(Double tag, ReadableMap options, Callback callback);
public abstract void toDataURL(@Nullable Double tag, @Nullable ReadableMap options, @Nullable Callback callback);
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"type": "all",
"jsSrcsDir": "./src/fabric",
"android": {
"javaPackageName": "com.horcrux.rnsvg"
"javaPackageName": "com.horcrux.svg"
}
}
}

0 comments on commit 0db8703

Please sign in to comment.