@oguzhnatly/react-native-image-manipulator 1.0.4 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/.github/workflows/publish.yml +72 -0
  2. package/CHANGELOG.md +4 -0
  3. package/Example/.bundle/config +2 -0
  4. package/Example/.eslintrc.js +4 -0
  5. package/Example/.prettierrc.js +7 -0
  6. package/Example/.watchmanconfig +1 -1
  7. package/Example/App.tsx +58 -0
  8. package/Example/Gemfile +7 -0
  9. package/Example/Gemfile.lock +99 -0
  10. package/Example/__tests__/App.test.tsx +17 -0
  11. package/Example/android/app/build.gradle +83 -114
  12. package/Example/android/app/debug.keystore +0 -0
  13. package/Example/android/app/proguard-rules.pro +0 -7
  14. package/Example/android/app/src/debug/AndroidManifest.xml +9 -0
  15. package/Example/android/app/src/main/AndroidManifest.xml +6 -7
  16. package/Example/android/app/src/main/java/com/example/MainActivity.kt +22 -0
  17. package/Example/android/app/src/main/java/com/example/MainApplication.kt +45 -0
  18. package/Example/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -0
  19. package/Example/android/app/src/main/res/values/styles.xml +2 -1
  20. package/Example/android/build.gradle +11 -29
  21. package/Example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  22. package/Example/android/gradle/wrapper/gradle-wrapper.properties +3 -1
  23. package/Example/android/gradle.properties +25 -2
  24. package/Example/android/gradlew +189 -112
  25. package/Example/android/gradlew.bat +32 -24
  26. package/Example/android/settings.gradle +2 -1
  27. package/Example/app.json +1 -1
  28. package/Example/assets/tiktok.png +0 -0
  29. package/Example/babel.config.js +3 -0
  30. package/Example/index.js +3 -1
  31. package/Example/ios/.xcode.env +11 -0
  32. package/Example/ios/Example/AppDelegate.h +2 -10
  33. package/Example/ios/Example/AppDelegate.mm +31 -0
  34. package/Example/ios/Example/Images.xcassets/AppIcon.appiconset/Contents.json +30 -15
  35. package/Example/ios/Example/Info.plist +9 -18
  36. package/Example/ios/Example/LaunchScreen.storyboard +47 -0
  37. package/Example/ios/Example/main.m +2 -8
  38. package/Example/ios/Example.xcodeproj/project.pbxproj +238 -1024
  39. package/Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme +2 -43
  40. package/Example/ios/Example.xcworkspace/contents.xcworkspacedata +10 -0
  41. package/Example/ios/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  42. package/Example/ios/ExampleTests/ExampleTests.m +19 -21
  43. package/Example/ios/Podfile +56 -0
  44. package/Example/ios/Podfile.lock +1448 -0
  45. package/Example/jest.config.js +3 -0
  46. package/Example/metro.config.js +43 -0
  47. package/Example/package.json +26 -6
  48. package/Example/tsconfig.json +3 -0
  49. package/Example/yarn.lock +5580 -3025
  50. package/README.md +218 -104
  51. package/android/build.gradle +34 -3
  52. package/android/src/main/java/com/{reactnativeimagemanipulator → oguzhnatly/rnimagemanipulator}/RNImageManipulatorModule.java +7 -4
  53. package/android/src/main/java/com/oguzhnatly/rnimagemanipulator/RNImageManipulatorPackage.java +112 -0
  54. package/android/src/paper/java/com/oguzhnatly/rnimagemanipulator/NativeImageManipulatorModuleSpec.java +33 -0
  55. package/build/fabric/NativeImageManipulatorModule.d.ts +12 -0
  56. package/build/fabric/NativeImageManipulatorModule.js +3 -0
  57. package/build/fabric/NativeImageManipulatorModule.js.map +1 -0
  58. package/build/index.d.ts +30 -0
  59. package/build/index.js +7 -0
  60. package/build/index.js.map +1 -0
  61. package/fabric/NativeImageManipulatorModule.ts +14 -0
  62. package/index.ts +30 -3
  63. package/ios/ImageUtils.h +6 -1
  64. package/ios/ImageUtils.m +180 -0
  65. package/ios/RNImageManipulator.h +10 -6
  66. package/ios/RNImageManipulator.mm +31 -0
  67. package/package.json +22 -4
  68. package/react-native-image-manipulator.podspec +11 -3
  69. package/tsconfig.json +21 -0
  70. package/Example/.babelrc +0 -3
  71. package/Example/.buckconfig +0 -6
  72. package/Example/.flowconfig +0 -70
  73. package/Example/.gitattributes +0 -1
  74. package/Example/App.js +0 -49
  75. package/Example/android/app/BUCK +0 -65
  76. package/Example/android/app/src/main/java/com/example/MainActivity.java +0 -15
  77. package/Example/android/app/src/main/java/com/example/MainApplication.java +0 -45
  78. package/Example/android/keystores/BUCK +0 -8
  79. package/Example/android/keystores/debug.keystore.properties +0 -4
  80. package/Example/ios/Example/AppDelegate.m +0 -35
  81. package/Example/ios/Example/Base.lproj/LaunchScreen.xib +0 -42
  82. package/Example/ios/Example-tvOS/Info.plist +0 -54
  83. package/Example/ios/Example-tvOSTests/Info.plist +0 -24
  84. package/Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example-tvOS.xcscheme +0 -129
  85. package/android/src/main/java/com/reactnativeimagemanipulator/RNImageManipulatorPackage.java +0 -29
  86. package/index.d.ts +0 -30
  87. package/ios/RNImageManipulator.m +0 -200
@@ -0,0 +1,72 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ paths:
8
+ - 'package.json'
9
+
10
+ jobs:
11
+ publish:
12
+ name: Build and publish
13
+ runs-on: ubuntu-latest
14
+ permissions:
15
+ contents: write
16
+ id-token: write
17
+
18
+ steps:
19
+ - name: Checkout
20
+ uses: actions/checkout@v4
21
+
22
+ - name: Setup Node.js
23
+ uses: actions/setup-node@v4
24
+ with:
25
+ node-version: '20'
26
+
27
+ - name: Upgrade npm
28
+ run: npm install -g npm@latest
29
+
30
+ - name: Install dependencies
31
+ run: yarn install --frozen-lockfile
32
+
33
+ - name: Build
34
+ run: yarn build
35
+
36
+ - name: Check if version changed
37
+ id: version_check
38
+ run: |
39
+ CURRENT_VERSION=$(node -p "require('./package.json').version")
40
+ PUBLISHED_VERSION=$(npm view $(node -p "require('./package.json').name") version 2>/dev/null || echo "0.0.0")
41
+ echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT
42
+ echo "published=$PUBLISHED_VERSION" >> $GITHUB_OUTPUT
43
+ if [ "$CURRENT_VERSION" != "$PUBLISHED_VERSION" ]; then
44
+ echo "changed=true" >> $GITHUB_OUTPUT
45
+ else
46
+ echo "changed=false" >> $GITHUB_OUTPUT
47
+ fi
48
+
49
+ - name: Publish to npm
50
+ if: steps.version_check.outputs.changed == 'true'
51
+ run: |
52
+ echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
53
+ npm publish --provenance --access public
54
+ env:
55
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
56
+
57
+ - name: Create GitHub release
58
+ if: steps.version_check.outputs.changed == 'true'
59
+ uses: softprops/action-gh-release@v2
60
+ with:
61
+ tag_name: v${{ steps.version_check.outputs.current }}
62
+ name: v${{ steps.version_check.outputs.current }}
63
+ body: |
64
+ ## @oguzhnatly/react-native-image-manipulator v${{ steps.version_check.outputs.current }}
65
+
66
+ Published to npm: https://www.npmjs.com/package/@oguzhnatly/react-native-image-manipulator
67
+ generate_release_notes: true
68
+ make_latest: true
69
+
70
+ - name: Skip (version unchanged)
71
+ if: steps.version_check.outputs.changed == 'false'
72
+ run: echo "Version ${{ steps.version_check.outputs.current }} is already published. Bump package.json version to trigger a new release."
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.0.5
2
+
3
+ - Typescript module declarations improved.
4
+
1
5
  ## 1.0.4
2
6
 
3
7
  - Typescript module declarations improved and Pod Errors fixed.
@@ -0,0 +1,2 @@
1
+ BUNDLE_PATH: "vendor/bundle"
2
+ BUNDLE_FORCE_RUBY_PLATFORM: 1
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: '@react-native',
4
+ };
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ arrowParens: 'avoid',
3
+ bracketSameLine: true,
4
+ bracketSpacing: false,
5
+ singleQuote: true,
6
+ trailingComma: 'all',
7
+ };
@@ -1 +1 @@
1
- {}
1
+ {}
@@ -0,0 +1,58 @@
1
+ import React from 'react';
2
+ import {Button, View, Image} from 'react-native';
3
+ import RNImageManipulator from '@oguzhnatly/react-native-image-manipulator';
4
+
5
+ export default class ImageManipulatorSample extends React.Component {
6
+ state = {
7
+ ready: false,
8
+ image: null,
9
+ };
10
+
11
+ componentDidMount() {
12
+ (async () => {
13
+ const image = require('./assets/tiktok.png');
14
+ this.setState({
15
+ ready: true,
16
+ image,
17
+ });
18
+ })();
19
+ }
20
+
21
+ render() {
22
+ return (
23
+ <View style={{flex: 1}}>
24
+ <View style={{padding: 100}}>
25
+ <Button title="rotate" onPress={this._rotate90andFlip} />
26
+ {this.state.ready && this._renderImage()}
27
+ </View>
28
+ </View>
29
+ );
30
+ }
31
+
32
+ _rotate90andFlip = async () => {
33
+ try {
34
+ const manipResult = await RNImageManipulator.manipulate(
35
+ Image.resolveAssetSource(require('./assets/tiktok.png')).uri,
36
+ [{rotate: 90}, {flip: {vertical: true}}],
37
+ {format: 'png'},
38
+ );
39
+ this.setState({image: manipResult});
40
+ } catch (e) {}
41
+ };
42
+
43
+ _renderImage = () => {
44
+ return (
45
+ <View
46
+ style={{
47
+ marginVertical: 10,
48
+ alignItems: 'center',
49
+ justifyContent: 'center',
50
+ }}>
51
+ <Image
52
+ source={this.state.image}
53
+ style={{width: 300, height: 300, resizeMode: 'contain'}}
54
+ />
55
+ </View>
56
+ );
57
+ };
58
+ }
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4
+ ruby ">= 2.6.10"
5
+
6
+ gem 'cocoapods', '~> 1.13'
7
+ gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
@@ -0,0 +1,99 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ CFPropertyList (3.0.6)
5
+ rexml
6
+ activesupport (7.0.8)
7
+ concurrent-ruby (~> 1.0, >= 1.0.2)
8
+ i18n (>= 1.6, < 2)
9
+ minitest (>= 5.1)
10
+ tzinfo (~> 2.0)
11
+ addressable (2.8.6)
12
+ public_suffix (>= 2.0.2, < 6.0)
13
+ algoliasearch (1.27.5)
14
+ httpclient (~> 2.8, >= 2.8.3)
15
+ json (>= 1.5.1)
16
+ atomos (0.1.3)
17
+ claide (1.1.0)
18
+ cocoapods (1.14.3)
19
+ addressable (~> 2.8)
20
+ claide (>= 1.0.2, < 2.0)
21
+ cocoapods-core (= 1.14.3)
22
+ cocoapods-deintegrate (>= 1.0.3, < 2.0)
23
+ cocoapods-downloader (>= 2.1, < 3.0)
24
+ cocoapods-plugins (>= 1.0.0, < 2.0)
25
+ cocoapods-search (>= 1.0.0, < 2.0)
26
+ cocoapods-trunk (>= 1.6.0, < 2.0)
27
+ cocoapods-try (>= 1.1.0, < 2.0)
28
+ colored2 (~> 3.1)
29
+ escape (~> 0.0.4)
30
+ fourflusher (>= 2.3.0, < 3.0)
31
+ gh_inspector (~> 1.0)
32
+ molinillo (~> 0.8.0)
33
+ nap (~> 1.0)
34
+ ruby-macho (>= 2.3.0, < 3.0)
35
+ xcodeproj (>= 1.23.0, < 2.0)
36
+ cocoapods-core (1.14.3)
37
+ activesupport (>= 5.0, < 8)
38
+ addressable (~> 2.8)
39
+ algoliasearch (~> 1.0)
40
+ concurrent-ruby (~> 1.1)
41
+ fuzzy_match (~> 2.0.4)
42
+ nap (~> 1.0)
43
+ netrc (~> 0.11)
44
+ public_suffix (~> 4.0)
45
+ typhoeus (~> 1.0)
46
+ cocoapods-deintegrate (1.0.5)
47
+ cocoapods-downloader (2.1)
48
+ cocoapods-plugins (1.0.0)
49
+ nap
50
+ cocoapods-search (1.0.1)
51
+ cocoapods-trunk (1.6.0)
52
+ nap (>= 0.8, < 2.0)
53
+ netrc (~> 0.11)
54
+ cocoapods-try (1.2.0)
55
+ colored2 (3.1.2)
56
+ concurrent-ruby (1.2.2)
57
+ escape (0.0.4)
58
+ ethon (0.16.0)
59
+ ffi (>= 1.15.0)
60
+ ffi (1.16.3)
61
+ fourflusher (2.3.1)
62
+ fuzzy_match (2.0.4)
63
+ gh_inspector (1.1.3)
64
+ httpclient (2.8.3)
65
+ i18n (1.14.1)
66
+ concurrent-ruby (~> 1.0)
67
+ json (2.7.1)
68
+ minitest (5.21.1)
69
+ molinillo (0.8.0)
70
+ nanaimo (0.3.0)
71
+ nap (1.1.0)
72
+ netrc (0.11.0)
73
+ public_suffix (4.0.7)
74
+ rexml (3.2.6)
75
+ ruby-macho (2.5.1)
76
+ typhoeus (1.4.1)
77
+ ethon (>= 0.9.0)
78
+ tzinfo (2.0.6)
79
+ concurrent-ruby (~> 1.0)
80
+ xcodeproj (1.23.0)
81
+ CFPropertyList (>= 2.3.3, < 4.0)
82
+ atomos (~> 0.1.3)
83
+ claide (>= 1.0.2, < 2.0)
84
+ colored2 (~> 3.1)
85
+ nanaimo (~> 0.3.0)
86
+ rexml (~> 3.2.4)
87
+
88
+ PLATFORMS
89
+ ruby
90
+
91
+ DEPENDENCIES
92
+ activesupport (>= 6.1.7.3, < 7.1.0)
93
+ cocoapods (~> 1.13)
94
+
95
+ RUBY VERSION
96
+ ruby 3.2.1p31
97
+
98
+ BUNDLED WITH
99
+ 2.4.6
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @format
3
+ */
4
+
5
+ import 'react-native';
6
+ import React from 'react';
7
+ import App from '../App';
8
+
9
+ // Note: import explicitly to use the types shipped with jest.
10
+ import {it} from '@jest/globals';
11
+
12
+ // Note: test renderer must be required after react-native.
13
+ import renderer from 'react-test-renderer';
14
+
15
+ it('renders correctly', () => {
16
+ renderer.create(<App />);
17
+ });
@@ -1,150 +1,119 @@
1
1
  apply plugin: "com.android.application"
2
-
3
- import com.android.build.OutputFile
2
+ apply plugin: "org.jetbrains.kotlin.android"
3
+ apply plugin: "com.facebook.react"
4
4
 
5
5
  /**
6
- * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7
- * and bundleReleaseJsAndAssets).
8
- * These basically call `react-native bundle` with the correct arguments during the Android build
9
- * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10
- * bundle directly from the development server. Below you can see all the possible configurations
11
- * and their defaults. If you decide to add a configuration block, make sure to add it before the
12
- * `apply from: "../../node_modules/react-native/react.gradle"` line.
13
- *
14
- * project.ext.react = [
15
- * // the name of the generated asset file containing your JS bundle
16
- * bundleAssetName: "index.android.bundle",
17
- *
18
- * // the entry file for bundle generation
19
- * entryFile: "index.android.js",
20
- *
21
- * // whether to bundle JS and assets in debug mode
22
- * bundleInDebug: false,
23
- *
24
- * // whether to bundle JS and assets in release mode
25
- * bundleInRelease: true,
26
- *
27
- * // whether to bundle JS and assets in another build variant (if configured).
28
- * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29
- * // The configuration property can be in the following formats
30
- * // 'bundleIn${productFlavor}${buildType}'
31
- * // 'bundleIn${buildType}'
32
- * // bundleInFreeDebug: true,
33
- * // bundleInPaidRelease: true,
34
- * // bundleInBeta: true,
35
- *
36
- * // whether to disable dev mode in custom build variants (by default only disabled in release)
37
- * // for example: to disable dev mode in the staging build type (if configured)
38
- * devDisabledInStaging: true,
39
- * // The configuration property can be in the following formats
40
- * // 'devDisabledIn${productFlavor}${buildType}'
41
- * // 'devDisabledIn${buildType}'
42
- *
43
- * // the root of your project, i.e. where "package.json" lives
44
- * root: "../../",
45
- *
46
- * // where to put the JS bundle asset in debug mode
47
- * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
48
- *
49
- * // where to put the JS bundle asset in release mode
50
- * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
51
- *
52
- * // where to put drawable resources / React Native assets, e.g. the ones you use via
53
- * // require('./image.png')), in debug mode
54
- * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
55
- *
56
- * // where to put drawable resources / React Native assets, e.g. the ones you use via
57
- * // require('./image.png')), in release mode
58
- * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
59
- *
60
- * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
61
- * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
62
- * // date; if you have any other folders that you want to ignore for performance reasons (gradle
63
- * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
64
- * // for example, you might want to remove it from here.
65
- * inputExcludes: ["android/**", "ios/**"],
66
- *
67
- * // override which node gets called and with what additional arguments
68
- * nodeExecutableAndArgs: ["node"],
69
- *
70
- * // supply additional arguments to the packager
71
- * extraPackagerArgs: []
72
- * ]
6
+ * This is the configuration block to customize your React Native Android app.
7
+ * By default you don't need to apply any configuration, just uncomment the lines you need.
73
8
  */
9
+ react {
10
+ /* Folders */
11
+ // The root of your project, i.e. where "package.json" lives. Default is '..'
12
+ // root = file("../")
13
+ // The folder where the react-native NPM package is. Default is ../node_modules/react-native
14
+ // reactNativeDir = file("../node_modules/react-native")
15
+ // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
16
+ // codegenDir = file("../node_modules/@react-native/codegen")
17
+ // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
18
+ // cliFile = file("../node_modules/react-native/cli.js")
19
+
20
+ /* Variants */
21
+ // The list of variants to that are debuggable. For those we're going to
22
+ // skip the bundling of the JS bundle and the assets. By default is just 'debug'.
23
+ // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
24
+ // debuggableVariants = ["liteDebug", "prodDebug"]
74
25
 
75
- project.ext.react = [
76
- entryFile: "index.js"
77
- ]
26
+ /* Bundling */
27
+ // A list containing the node command and its flags. Default is just 'node'.
28
+ // nodeExecutableAndArgs = ["node"]
29
+ //
30
+ // The command to run when bundling. By default is 'bundle'
31
+ // bundleCommand = "ram-bundle"
32
+ //
33
+ // The path to the CLI configuration file. Default is empty.
34
+ // bundleConfig = file(../rn-cli.config.js)
35
+ //
36
+ // The name of the generated asset file containing your JS bundle
37
+ // bundleAssetName = "MyApplication.android.bundle"
38
+ //
39
+ // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
40
+ // entryFile = file("../js/MyApplication.android.js")
41
+ //
42
+ // A list of extra flags to pass to the 'bundle' commands.
43
+ // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
44
+ // extraPackagerArgs = []
78
45
 
79
- apply from: "../../node_modules/react-native/react.gradle"
46
+ /* Hermes Commands */
47
+ // The hermes compiler command to run. By default it is 'hermesc'
48
+ // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
49
+ //
50
+ // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
51
+ // hermesFlags = ["-O", "-output-source-map"]
52
+ }
80
53
 
81
54
  /**
82
- * Set this to true to create two separate APKs instead of one:
83
- * - An APK that only works on ARM devices
84
- * - An APK that only works on x86 devices
85
- * The advantage is the size of the APK is reduced by about 4MB.
86
- * Upload all the APKs to the Play Store and people will download
87
- * the correct one based on the CPU architecture of their device.
55
+ * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
88
56
  */
89
- def enableSeparateBuildPerCPUArchitecture = false
57
+ def enableProguardInReleaseBuilds = false
90
58
 
91
59
  /**
92
- * Run Proguard to shrink the Java bytecode in release builds.
60
+ * The preferred build flavor of JavaScriptCore (JSC)
61
+ *
62
+ * For example, to use the international variant, you can use:
63
+ * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
64
+ *
65
+ * The international variant includes ICU i18n library and necessary data
66
+ * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
67
+ * give correct results when using with locales other than en-US. Note that
68
+ * this variant is about 6MiB larger per architecture than default.
93
69
  */
94
- def enableProguardInReleaseBuilds = false
70
+ def jscFlavor = 'org.webkit:android-jsc:+'
95
71
 
96
72
  android {
97
- compileSdkVersion rootProject.ext.compileSdkVersion
73
+ ndkVersion rootProject.ext.ndkVersion
98
74
  buildToolsVersion rootProject.ext.buildToolsVersion
75
+ compileSdk rootProject.ext.compileSdkVersion
99
76
 
77
+ namespace "com.example"
100
78
  defaultConfig {
101
79
  applicationId "com.example"
102
80
  minSdkVersion rootProject.ext.minSdkVersion
103
81
  targetSdkVersion rootProject.ext.targetSdkVersion
104
82
  versionCode 1
105
83
  versionName "1.0"
106
- ndk {
107
- abiFilters "armeabi-v7a", "x86"
108
- }
109
84
  }
110
- splits {
111
- abi {
112
- reset()
113
- enable enableSeparateBuildPerCPUArchitecture
114
- universalApk false // If true, also generate a universal APK
115
- include "armeabi-v7a", "x86"
85
+ signingConfigs {
86
+ debug {
87
+ storeFile file('debug.keystore')
88
+ storePassword 'android'
89
+ keyAlias 'androiddebugkey'
90
+ keyPassword 'android'
116
91
  }
117
92
  }
118
93
  buildTypes {
94
+ debug {
95
+ signingConfig signingConfigs.debug
96
+ }
119
97
  release {
98
+ // Caution! In production, you need to generate your own keystore file.
99
+ // see https://reactnative.dev/docs/signed-apk-android.
100
+ signingConfig signingConfigs.debug
120
101
  minifyEnabled enableProguardInReleaseBuilds
121
102
  proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
122
103
  }
123
104
  }
124
- // applicationVariants are e.g. debug, release
125
- applicationVariants.all { variant ->
126
- variant.outputs.each { output ->
127
- // For each separate APK per architecture, set a unique version code as described here:
128
- // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
129
- def versionCodes = ["armeabi-v7a":1, "x86":2]
130
- def abi = output.getFilter(OutputFile.ABI)
131
- if (abi != null) { // null for the universal-debug, universal-release variants
132
- output.versionCodeOverride =
133
- versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
134
- }
135
- }
136
- }
137
105
  }
138
106
 
139
107
  dependencies {
140
- implementation fileTree(dir: "libs", include: ["*.jar"])
141
- implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
142
- implementation "com.facebook.react:react-native:+" // From node_modules
143
- }
108
+ // The version of react-native is set by the React Native Gradle Plugin
109
+ implementation("com.facebook.react:react-android")
110
+ implementation("com.facebook.react:flipper-integration")
144
111
 
145
- // Run this once to be able to run the application with BUCK
146
- // puts all compile dependencies into folder libs for BUCK to use
147
- task copyDownloadableDepsToLibs(type: Copy) {
148
- from configurations.compile
149
- into 'libs'
112
+ if (hermesEnabled.toBoolean()) {
113
+ implementation("com.facebook.react:hermes-android")
114
+ } else {
115
+ implementation jscFlavor
116
+ }
150
117
  }
118
+
119
+ apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
@@ -8,10 +8,3 @@
8
8
  # http://developer.android.com/guide/developing/tools/proguard.html
9
9
 
10
10
  # Add any project specific keep options here:
11
-
12
- # If your project uses WebView with JS, uncomment the following
13
- # and specify the fully qualified class name to the JavaScript interface
14
- # class:
15
- #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16
- # public *;
17
- #}
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ xmlns:tools="http://schemas.android.com/tools">
4
+
5
+ <application
6
+ android:usesCleartextTraffic="true"
7
+ tools:targetApi="28"
8
+ tools:ignore="GoogleAppIndexingWarning"/>
9
+ </manifest>
@@ -1,26 +1,25 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="com.example">
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
2
 
4
3
  <uses-permission android:name="android.permission.INTERNET" />
5
- <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
6
4
 
7
5
  <application
8
6
  android:name=".MainApplication"
9
7
  android:label="@string/app_name"
10
8
  android:icon="@mipmap/ic_launcher"
9
+ android:roundIcon="@mipmap/ic_launcher_round"
11
10
  android:allowBackup="false"
12
11
  android:theme="@style/AppTheme">
13
12
  <activity
14
13
  android:name=".MainActivity"
15
14
  android:label="@string/app_name"
16
- android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
17
- android:windowSoftInputMode="adjustResize">
15
+ android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
16
+ android:launchMode="singleTask"
17
+ android:windowSoftInputMode="adjustResize"
18
+ android:exported="true">
18
19
  <intent-filter>
19
20
  <action android:name="android.intent.action.MAIN" />
20
21
  <category android:name="android.intent.category.LAUNCHER" />
21
22
  </intent-filter>
22
23
  </activity>
23
- <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
24
24
  </application>
25
-
26
25
  </manifest>
@@ -0,0 +1,22 @@
1
+ package com.example
2
+
3
+ import com.facebook.react.ReactActivity
4
+ import com.facebook.react.ReactActivityDelegate
5
+ import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
6
+ import com.facebook.react.defaults.DefaultReactActivityDelegate
7
+
8
+ class MainActivity : ReactActivity() {
9
+
10
+ /**
11
+ * Returns the name of the main component registered from JavaScript. This is used to schedule
12
+ * rendering of the component.
13
+ */
14
+ override fun getMainComponentName(): String = "Example"
15
+
16
+ /**
17
+ * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
18
+ * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
19
+ */
20
+ override fun createReactActivityDelegate(): ReactActivityDelegate =
21
+ DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
22
+ }
@@ -0,0 +1,45 @@
1
+ package com.example
2
+
3
+ import android.app.Application
4
+ import com.facebook.react.PackageList
5
+ import com.facebook.react.ReactApplication
6
+ import com.facebook.react.ReactHost
7
+ import com.facebook.react.ReactNativeHost
8
+ import com.facebook.react.ReactPackage
9
+ import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
10
+ import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
11
+ import com.facebook.react.defaults.DefaultReactNativeHost
12
+ import com.facebook.react.flipper.ReactNativeFlipper
13
+ import com.facebook.soloader.SoLoader
14
+
15
+ class MainApplication : Application(), ReactApplication {
16
+
17
+ override val reactNativeHost: ReactNativeHost =
18
+ object : DefaultReactNativeHost(this) {
19
+ override fun getPackages(): List<ReactPackage> =
20
+ PackageList(this).packages.apply {
21
+ // Packages that cannot be autolinked yet can be added manually here, for example:
22
+ // add(MyReactNativePackage())
23
+ }
24
+
25
+ override fun getJSMainModuleName(): String = "index"
26
+
27
+ override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
28
+
29
+ override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
30
+ override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
31
+ }
32
+
33
+ override val reactHost: ReactHost
34
+ get() = getDefaultReactHost(this.applicationContext, reactNativeHost)
35
+
36
+ override fun onCreate() {
37
+ super.onCreate()
38
+ SoLoader.init(this, false)
39
+ if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
40
+ // If you opted-in for the New Architecture, we load the native entry point for this app.
41
+ load()
42
+ }
43
+ ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)
44
+ }
45
+ }