51 Commits

Author SHA1 Message Date
Jakub Grzywacz 73bdb03f4c fix: CMake flags (#2603)
# Summary

Fix typo in CMakeLists.txt flags and use `ReactAndroid_VERSION_MINOR`
instead of `REACT_NATIVE_MINOR_VERSION`

## Test Plan

Example apps should build without warnings/errors on 0.73+ as well as on
0.77.0-rc.6
2025-01-08 10:30:37 +01:00
Jakub Grzywacz 6377be5f20 fix: remove package from AndroidManifest.xml (#2600)
# Summary

Fixes #2599 

Starting with `v15.8.0`, we support `react-native@0.73+`, which
eliminates the need to worry about AGP versions below 7. Consequently,
the `package` attribute in `AndroidManifest.xml` can be safely removed,
along with the corresponding check in `build.gradle`.

## Test Plan

Build the app on all supported versions

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| Android |          |
2025-01-07 14:43:58 +01:00
Jakub Grzywacz 6042b89b6b feat: use yoga::StyleLength instead of yoga::value on 77+ (#2582)
# Summary

With react-native@0.77 `yoga::value` is no longer available and we
should use `yoga::StyleLength`.

## Test Plan

App should build again on 0.77.rc-3
2024-12-19 14:34:55 +01:00
Jakub Grzywacz 2dcc8324b6 refactor: replace deprecated processTransform (#2554)
# Summary

Replace deprecated `TransformHelper.processTransform` with a new
function that also gets `transformOrigin`.

## Test Plan

Transforms should function properly, and this error should not occur
during the build process:
```
> Task :react-native-svg:compileDebugJavaWithJavac
/react-native-svg/apps/paper-example/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/RenderableViewManager.java:390: warning: [removal] processTransform(ReadableArray,double[]) in TransformHelper has been deprecated and marked for removal
    TransformHelper.processTransform(transforms, sTransformDecompositionArray);
                   ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 warning
```

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| Android |          |
2024-11-28 15:29:45 +01:00
Jakub Grzywacz 74b77a672e fix: react-native@0.73 sourceSet to maintain support (#2543)
# Summary

#2541 is not compatible with `react-native@0.73`. This PR introduces
sourceSet to maintain support for that version.

## Test Plan

Build app with `react-native@0.73.x`

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| Android |          |
2024-11-19 13:54:39 +01:00
Jakub Grzywacz 93df20ca3f remove: deprecated sourceSets (#2493)
# Summary

Remove deprecated sourceSet and drop support for `react-native@0.72` to
simplify codebase.
2024-10-17 11:11:24 +02:00
Jakub Grzywacz cc961774e7 fix: do not crash when borderRadius is set on Android (#2415)
# Summary

Fixes #2462
Currently, on Android, when `borderRadius` style is applied to a `Svg`
component an error occurs, stating `Cannot cast Double to Float`

This PR updates the codegen types, changing them from Double to Dynamic,
aligning with the implementation with the ViewProps.

## Test

### Tested on

- [x] react-native@0.76.0-rc.1
- [x] react-native@0.75.1
- [x] react-native@0.74.2
- [x] react-native@0.73.9

### Test case
```jsx
<Svg
  width="60"
  height="60"
  viewBox="0 0 24 24"
  style={{
    borderRadius: 16.2,
    borderTopLeftRadius: 16.2,
    borderBottomRightRadius: 16.2,
    borderStartStartRadius: 16.2,
    borderStartEndRadius: 16.2,
    borderTopRightRadius: 16.2,
    borderBottomLeftRadius: 16.2,
    borderTopStartRadius: 16.2,
    borderTopEndRadius: 16.2,
    borderBottomStartRadius: 16.2,
    borderBottomEndRadius: 16.2,
    borderEndEndRadius: 16.2,
    borderEndStartRadius: 16.2,
  }}>
  <Rect x="0" y="0" width="24" height="24" fill="red" />
</Svg>
```

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| Android |          |
2024-09-30 13:02:40 +02:00
Jakub Grzywacz 9df974194f refactor: use node resolver to locate React Native package (#2461)
# Summary

Twin pull request to
https://github.com/software-mansion/react-native-reanimated/pull/6482
2024-09-19 12:18:59 +02:00
Jakub Grzywacz b65b3c2679 feat: support react-native@0.76 (#2445)
# Summary

This PR adds support for React Native 0.76 (currently: 0.76.0-rc.0).
2024-09-17 11:02:48 +02:00
Jakub Grzywacz fbc66311a9 fix: add deprecated SvgViewManager to not break 0.72 (#2435)
# Summary

Fixes #2428
To not introduce the breaking change in minor version, it restores the
old `SvgViewManager.java` on RN <= 72 using sourceSets

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| Android |          |
2024-09-02 15:28:54 +02:00
Maciej Stosio 170339977d fix: error when building paper after fabric (#2281)
# Summary

We had similar config in react-native-screens. It caused problem when
building Paper arch app after Fabric. Those changes help, so I'm moving
them here as well.
2024-05-21 10:42:46 +02:00
pvegh a5dae2f54d enable buildConfig generation to better support AGP8 (#2143)
Since AGP8 this flag is disabled by default. Consumer projects have to enable this flag in them globally if the library doesn't do this correctly itself, but uses custom buildConfig fields.

- What issues does the pull request solve? Please tag them so that they will get automatically closed once the PR is merged
Solves Build Errors with default setup using AGP8+
- What is the feature? (if applicable)
No errors and better build performance than the workaround in consuming projects would be.
2023-10-25 11:44:50 +02:00
Wojciech Lewicki 29382d927a fix: scale path markers so they match ios (#2018)
PR adding scaling of markers of path in order to make them behave the same as on iOS. Also bumped the versions of agp and spotless.
2023-03-30 14:27:30 +02:00
Kacper Kafara 998c3e310e chore: set library namespace in build script (#2005)
Since AGP 8.0 project namespace must be set inside build script.
It is also the recommended way in Android docs.

It is also recommended, that the package name definition is removed from Android manifest file, but I've had some problems in react-native-screens with RN CLI crashing (as it was expecting the package field to exist) & according to this conversation it'll still be legal to leave package name definition in Android manifest file as long as it exactly matches the value in build script.
2023-03-23 20:39:41 +01:00
Wojciech Lewicki cb87e7510f feat: update FabricExample to 0.71.0-rc.6 (#1962)
PR bumping examples to RN 0.71. For now web Example seems not to load code properly.
2023-01-13 14:19:17 +01:00
Amit Kumar 1637580732 Include proguard config (#1842)
This will remove the requirement for people to add the proguard configs themselves. A lot of people first release to production with proguard and then realize why the app crashes. This will solve such issues.

This uses android's consumer proguard setting to enable specific proguard config.
2023-01-03 15:59:10 +01:00
Wojciech Lewicki 1126079425 feat: use codegenNativeComponent to import native views (#1847)
Changed `requireNativeComponent` to `codegenNativeComponent` so that upcoming changes (Static View Configs, Bridgeless Mode and idk what more) in `react-native` are available in the library. Also, types and native components are now taken directly from `fabric` folder to make sure the values passed to the native components are the ones defined in props. It should work on all supported versions since `codegenNativeComponent` function exists from RN v. 0.61.0. Suggested by @RSNara and @cipolleschi

Reason for [`5394bbb` (#1847)](https://github.com/software-mansion/react-native-svg/pull/1847/commits/5394bbbced6c1838e67240997cf4621d7f783197): 
- on `Paper`, `Animated` uses `setNativeProps` method when we set `useNativeDriver`  to `false`, and does not rerender the component. Therefore, new transform lands only in `SvgView` and is parsed in `RCTViewManager.m` .
- on `Fabric`, the same code makes the components rerender. Due to this, information about new transform is passed to the `SvgView` child: `G` , making it apply translations from the transform in its `updateProps` method.
- other than `Animated` use-case, on both archs, if we just passed `transform` prop to `Svg` component, it would end up in double transformations now as well. All of those changes are due to https://github.com/software-mansion/react-native-svg/pull/1895, which added proper parsing of RN style `transform` prop (array of transformations objects) therefore making `G` properly handle `transform` prop passed from `Svg`.

Reason for [`19bcb24` (#1847)](https://github.com/software-mansion/react-native-svg/pull/1847/commits/19bcb2464b3a40a47e4396ea66f49d6a95bfc9bc): Same as https://github.com/software-mansion/react-native-screens/pull/1624
2022-11-03 15:47:29 +01:00
Wojciech Lewicki 0a26639532 chore: bump library and examples to rn 0.70-rc3 (#1837)
PR bumping library to RN 0.70-rc3, which might make it not compatible with earlier versions of RN on Fabric. It should come with the same change in other libraries.

In this PR, I had to remove macos code from Example since it breaks @react-native-community/cli resolution. Hopefully we can bring it back soon.
2022-08-17 14:24:50 +02:00
Wojciech Lewicki 98c14b4f45 chore: add CI for JS, iOS and Android formatting (#1782)
Added CI workflow and local pre-commit hook for formatting and linting the newly added JS, iOS and Android code.
2022-08-16 12:00:32 +02:00
Wojciech Lewicki 77267be5fc feat: support Fabric on Android (#1804)
Most of Android changes for Fabric and bump of FabricExample to RN 0.69.2. iOS and JS changes are available in #1821.
The most notable change on Android is adding methods to components that accept String values of each NumberProp instead of Dynamic. Another change is changed structure of RenderableViewManager.java since we needed to abstract methods that belong only to components inheriting from VirtualView in order to be able to properly override them in their children.
2022-08-12 11:42:44 +02:00
Mrinal Maheshwari 39c8332f4d Adding mavenCentral() as jcenter() is shutting (#1570)
Adding mavenCentral() as jcenter() is shutting down
2022-02-25 14:21:56 +01:00
SaeedZhiany b893785014 bumped AGP to 3.6.1 and removed buildToolsVersion 2020-03-02 14:59:22 +03:30
SaeedZhiany 81252b8249 Refactored Gradle setup
- moved safeExtGet to out of `buildscript` block, because it's no longer needed to be there (previously we needed it there for getting AGP version from root project)

- bumped AGP version to 3.5.3

- replace `${safeExtGet('reactnativeVersion', '+')}` with `+`, becase react-native version automatically resolved by npm and it does not need to handle using `safeExtGet`
2020-02-11 15:36:28 +03:30
SaeedZhiany d3b2f27e22 Load Android Gradle Plugin conditionally 2019-10-21 09:11:01 +03:30
SaeedZhiany 44ff4da5a0 Update build.gradle
Fixed android build failure
2019-08-05 02:15:22 +03:00
SaeedZhiany c999cd6acd Update build.gradle
get react-native version from root project
2019-08-05 02:15:22 +03:00
SaeedZhiany 4bc3890a55 Update build.gradle
read android gradle plugin version from root project
2019-08-05 02:15:22 +03:00
Mikael Sand 7e8d7428f3 Fix gradle 2019-06-09 13:07:41 +03:00
SaeedZhiany d32b661e7b Merge branch 'master' into patch-1 2019-05-01 17:22:42 +04:30
SaeedZhiany f0223ab881 Update build.gradle
Upgrade android gradle plugin to latest version
2019-02-13 08:26:34 +03:30
Mikael Sand b4c8985b81 Sync version used in build.gradle with react-native master
Add gradleBuildTools configuration to override gradle classpath
2019-02-11 15:34:10 +02:00
jesse 81f483aaf5 add google for build gradle repository 2018-12-09 07:19:36 +02:00
Abdulaziz Ghuloum a82d4876b3 upgraded gradle to 3.2.1 2018-12-09 07:19:11 +02:00
Mikael Sand 69e9fcde14 Use Android SDK 27 2018-11-17 04:12:52 +02:00
Mikael Sand e48dbdb08b bump android gradle build tools to 3.1.4 2018-11-17 04:08:29 +02:00
Mikael Sand 349c3b3367 Rebase pull request #807 from agustin107/master
Update README.md, changing dependency configuration for Android platform
2018-10-12 16:04:59 +03:00
colorfulberry 62a72e12ac Update build.gradle
compile should instead implemention
2018-07-27 17:21:30 +08:00
Mikael Sand 890d4d9d45 Merge remote-tracking branch 'yeomann/patch-1' 2018-07-26 23:53:26 +03:00
Danish 22bdfa930e Update obsolete compile to implemenation
Hi, as React native 0.56.0 is released with MAJOR android changes such as:

-Gradle 3.5.1
-Compile using Android SDK 26
-Google Maven repo
-etc

more about Change log, specially of Android Here, https://github.com/react-native-community/react-native-releases/blob/master/CHANGELOG.md#android-projects-are-now-compiled-using-the-android-26-sdk
and https://github.com/react-native-community/react-native-releases/blob/master/CHANGELOG.md#android-specific-changes

Aslo as Per Google new "Google Play's target API level requirement", mentioned here  https://developer.android.com/distribute/best-practices/develop/target-sdk

"Google Play will require that new apps target at least Android 8.0 (API level 26) from August 1, 2018, and that app updates target Android 8.0 from November 1, 2018."

It's clear that Android would be moving to new Gradle and new SDK changes, Thus creating a new type of error that is:

"Configuration 'compile' is obsolete and has been replaced with 'implementation' or 'Api'" 

more about the Old and new configuration please see this https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration?utm_source=android-studio#new_configurations 
at the heading of "Use the new dependency configurations"

Therefore, all old "compile" should be now "implementation" or "provided" should be "compileOnly"

I have tested the with "compile" and "implementation" in my current release ready product and also by "renaming" "compile" to "implementation".
Also tested with higher andorid SDK configs such as of below:

```
ext {
    buildToolsVersion = "27.0.3"
    minSdkVersion = 19
    compileSdkVersion = 27
    targetSdkVersion = 27
    supportLibVersion = "27.1.1"
}
```

so SDK 27 was also compiled successully. test on Android phone with ADK 23 all looks good. Thus, `react-native-svg` was working just fine as intended. thank you so much for this package btw. Love this package so much :)

Therefore, Please would it be possible to merge as i am sure many new projects and old one are going to update specially Gradle and SDK as of Google new requirements. 

related mention of Upgrading issue mention here https://github.com/facebook/react-native/issues/20273#issuecomment-405959030


Moreover, if someone still have any issue after upgrading everything successfully, then he should use following in build.gradle under `andorid/build.gradle`

```

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 27
                buildToolsVersion '27.0.3'
                supportLibVersion = "27.1.1"
            }
        }
    }
}
```
2018-07-19 20:28:05 +03:00
Reza 89ae631c95 upgrade SDK Build Tools 2018-07-06 01:10:42 +04:30
Mikael Sand 1c12e4bd04 Align SDK and gradle with react-native init
Remove com.android.support:appcompat-v7 dependency (less version issues)
Copy PaintCompat.hasGlyph implementation verbatim.
It is the only really needed part.

Minimize issues for beginners and make first experience maximally smooth
2018-02-03 20:52:49 +02:00
Mikael Sand a77d104a51 Fix linting and gradle 3.0.1 compatibility 2018-01-19 17:53:08 +02:00
Hem Brahmbhatt 20ea2d9bb5 Upgrade build tools (#492) 2017-11-23 13:48:31 -08:00
Mikael Sand b38ae08e9c Add com.android.support:appcompat-v7:25.3.1 to dependencies.
Set SDK version to latest stable with available sources.
2017-08-03 21:46:01 +03:00
Mikael Sand 553c17794e Implement support for multi-letter ligatures.
Typographic ligature: In writing and typography, a ligature occurs where two or more graphemes or letters are joined as a single glyph.
Optimize kerning and advance widths calculation using Paint.getTextWidths(String text, float[] widths);
Make strokeWidth numberProp instead of string.
Fix caching of AlignmentBaseline.
Rename distance to pathLength.
Upgrade gradle build tools.
2017-08-03 21:35:30 +03:00
Mikael Sand 7994070c41 Upgrade com.android.tools.build:gradle to 2.3.2 and buildToolsVersion to 26 2017-07-22 03:13:57 +03:00
Mikael Sand 3960a11c21 Fix code inspection / analysis warnings.
Update sdk, build tools, gradle, and target sdk version.
2017-07-21 02:41:54 +03:00
Lucas Bento 47a79d392a Change SDK Build Tools version 2017-03-16 14:25:50 -03:00
Nhat a1424bcb52 Upgrade gradle to match the version in react native.
Change url of react native repository so that it loads the correct local version.
2016-07-08 17:32:19 +07:00
Horcrux 677bbbe408 change package names 2016-04-20 13:06:31 +08:00