@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,14 @@
1
+ import {TurboModuleRegistry, TurboModule} from 'react-native';
2
+
3
+ type RNImageManipulatorResult = {
4
+ uri: string;
5
+ width: number;
6
+ height: number;
7
+ base64?: string;
8
+ };
9
+
10
+ export interface Spec extends TurboModule {
11
+ manipulate(uriString: string, actions: Object[], saveOptions: Object): Promise<RNImageManipulatorResult>;
12
+ }
13
+
14
+ export default TurboModuleRegistry.getEnforcing<Spec>('RNImageManipulator');
package/index.ts CHANGED
@@ -1,5 +1,32 @@
1
- import { NativeModules } from "react-native";
1
+ import RNImageManipulator from './fabric/NativeImageManipulatorModule';
2
2
 
3
- const { RNImageManipulator } = NativeModules;
3
+ export type RNImageManipulatorResult = {
4
+ uri: string;
5
+ width: number;
6
+ height: number;
7
+ base64?: string;
8
+ };
4
9
 
5
- export default RNImageManipulator;
10
+ export default {
11
+ manipulate(
12
+ uri: string,
13
+ actions: Array<{
14
+ resize?: {width?: number; height?: number};
15
+ rotate?: number;
16
+ flip?: {vertical?: boolean; horizontal?: boolean};
17
+ crop?: {
18
+ originX?: number;
19
+ originY?: number;
20
+ width?: number;
21
+ height?: number;
22
+ };
23
+ }>,
24
+ saveOptions: {
25
+ compress?: number;
26
+ format?: 'jpeg' | 'png';
27
+ base64?: boolean;
28
+ },
29
+ ): Promise<RNImageManipulatorResult> {
30
+ return RNImageManipulator.manipulate(uri, actions, saveOptions);
31
+ },
32
+ };
package/ios/ImageUtils.h CHANGED
@@ -1,9 +1,14 @@
1
1
  #import <UIKit/UIKit.h>
2
2
  #import <CoreMedia/CoreMedia.h>
3
3
  #import <Foundation/Foundation.h>
4
+ #import <React/RCTBridge.h>
4
5
 
5
6
  @interface ImageUtils : NSObject
6
7
 
7
8
  + (UIImage *)cropImage:(UIImage *)image toRect:(CGRect)rect;
8
-
9
+ + (void)manipulate:(NSString *)uri
10
+ actions:(NSArray *)actions
11
+ saveOptions:(NSDictionary *)saveOptions
12
+ resolver:(RCTPromiseResolveBlock)resolve
13
+ rejecter:(RCTPromiseRejectBlock)reject;
9
14
  @end
package/ios/ImageUtils.m CHANGED
@@ -1,7 +1,187 @@
1
1
  #import "ImageUtils.h"
2
+ #import <Photos/Photos.h>
3
+ #import <React/RCTLog.h>
2
4
 
3
5
  @implementation ImageUtils
4
6
 
7
+ + (void)manipulate:(NSString *)uri
8
+ actions:(NSArray *)actions
9
+ saveOptions:(NSDictionary *)saveOptions
10
+ resolver:(RCTPromiseResolveBlock)resolve
11
+ rejecter:(RCTPromiseRejectBlock)reject
12
+ {
13
+ NSURL *url = [NSURL URLWithString:uri];
14
+ NSString *path = [url.path stringByStandardizingPath];
15
+
16
+ if ([[url scheme] isEqualToString:@"assets-library"]) {
17
+ PHFetchResult<PHAsset *> *fetchResult = [PHAsset fetchAssetsWithALAssetURLs:@[url] options:nil];
18
+ if (fetchResult.count > 0) {
19
+ PHAsset *asset = fetchResult[0];
20
+ CGSize size = CGSizeMake([asset pixelWidth], [asset pixelHeight]);
21
+ PHImageRequestOptions *options = [PHImageRequestOptions new];
22
+ [options setResizeMode:PHImageRequestOptionsResizeModeExact];
23
+ [options setNetworkAccessAllowed:YES];
24
+ [options setSynchronous:NO];
25
+ [options setDeliveryMode:PHImageRequestOptionsDeliveryModeHighQualityFormat];
26
+
27
+ [[PHImageManager defaultManager] requestImageForAsset:asset targetSize:size contentMode:PHImageContentModeAspectFit options:options resultHandler:^(UIImage * _Nullable image, NSDictionary * _Nullable info) {
28
+ if (!image) {
29
+ reject(@"E_IMAGE_MANIPULATION_FAILED", [NSString stringWithFormat:@"The file isn't convertable to image. Given path: `%@`.", path], nil);
30
+ return;
31
+ }
32
+ [ImageUtils manipulateImage:image actions:actions saveOptions:saveOptions resolver:resolve rejecter:reject];
33
+ }];
34
+ return;
35
+ } else {
36
+ reject(@"E_IMAGE_MANIPULATION_FAILED", [NSString stringWithFormat:@"The file does not exist. Given path: `%@`.", path], nil);
37
+ return;
38
+ }
39
+ } else {
40
+ if (![[NSFileManager defaultManager] fileExistsAtPath:path]) {
41
+ reject(@"E_IMAGE_MANIPULATION_FAILED", [NSString stringWithFormat:@"The file does not exist. Given path: `%@`.", path], nil);
42
+ return;
43
+ }
44
+
45
+ UIImage *image = [[UIImage alloc] initWithContentsOfFile:path];
46
+ if (image == nil) {
47
+ reject(@"E_CANNOT_OPEN", @"Could not open provided image", nil);
48
+ return;
49
+ }
50
+
51
+ [ImageUtils manipulateImage:image actions:actions saveOptions:saveOptions resolver:resolve rejecter:reject];
52
+ return;
53
+ }
54
+ }
55
+
56
+ + (void)manipulateImage:(UIImage *)image
57
+ actions:(NSArray *)actions
58
+ saveOptions:(NSDictionary *)saveOptions
59
+ resolver:(RCTPromiseResolveBlock)resolve
60
+ rejecter:(RCTPromiseRejectBlock)reject
61
+ {
62
+ for (NSDictionary *options in actions) {
63
+ if (options[@"resize"]) {
64
+ float imageWidth = image.size.width;
65
+ float imageHeight = image.size.height;
66
+ float imageRatio = imageWidth / imageHeight;
67
+
68
+ NSInteger requestedWidth = 0;
69
+ NSInteger requestedHeight = 0;
70
+ NSDictionary *resize = options[@"resize"];
71
+ if (resize[@"width"]) {
72
+ requestedWidth = [(NSNumber *)resize[@"width"] integerValue];
73
+ requestedHeight = requestedWidth/imageRatio;
74
+ }
75
+ if (resize[@"height"]) {
76
+ requestedHeight = [(NSNumber *)resize[@"height"] integerValue];
77
+ requestedWidth = requestedWidth == 0 ? imageRatio * requestedHeight : requestedWidth;
78
+ }
79
+
80
+ CGSize requestedSize = CGSizeMake(requestedWidth, requestedHeight);
81
+ UIGraphicsBeginImageContextWithOptions(requestedSize, NO, 1.0);
82
+ [image drawInRect:CGRectMake(0, 0, requestedWidth, requestedHeight)];
83
+ image = UIGraphicsGetImageFromCurrentImageContext();
84
+ UIGraphicsEndImageContext();
85
+ } else if (options[@"rotate"]) {
86
+ float rads = [(NSNumber *)options[@"rotate"] integerValue] * M_PI/180;
87
+ CGSize size = image.size;
88
+ UIView *rotatedViewBox = [[UIView alloc] initWithFrame:CGRectMake(0,0,size.width, size.height)];
89
+ CGAffineTransform t = CGAffineTransformMakeRotation(rads);
90
+ rotatedViewBox.transform = t;
91
+ CGSize rotatedSize = rotatedViewBox.frame.size;
92
+
93
+ UIGraphicsBeginImageContext(rotatedSize);
94
+ CGContextRef bitmap = UIGraphicsGetCurrentContext();
95
+ CGContextTranslateCTM(bitmap, rotatedSize.width/2, rotatedSize.height/2);
96
+ CGContextRotateCTM(bitmap, rads);
97
+ CGContextScaleCTM(bitmap, 1.0, -1.0);
98
+ CGContextDrawImage(bitmap, CGRectMake(-size.width / 2, -size.height / 2, size.width, size.height), image.CGImage);
99
+
100
+ image = UIGraphicsGetImageFromCurrentImageContext();
101
+ UIGraphicsEndImageContext();
102
+ } else if (options[@"flip"]) {
103
+ NSDictionary *flip = options[@"flip"];
104
+ UIImageView *tempImageView = [[UIImageView alloc] initWithImage:image];
105
+
106
+ UIGraphicsBeginImageContext(tempImageView.frame.size);
107
+ CGContextRef context = UIGraphicsGetCurrentContext();
108
+ CGAffineTransform transform;
109
+ if (flip[@"vertical"]) {
110
+ transform = CGAffineTransformMake(1, 0, 0, -1, 0, tempImageView.frame.size.height);
111
+ CGContextConcatCTM(context, transform);
112
+ } else if (flip[@"horizontal"]) {
113
+ transform = CGAffineTransformMake(-1, 0, 0, 1, tempImageView.frame.size.width, 0);
114
+ CGContextConcatCTM(context, transform);
115
+ }
116
+
117
+ [tempImageView.layer renderInContext:context];
118
+ image = UIGraphicsGetImageFromCurrentImageContext();
119
+ UIGraphicsEndImageContext();
120
+ } else if (options[@"crop"]) {
121
+ NSDictionary *cropData = options[@"crop"];
122
+ if (cropData[@"originX"] == nil || cropData[@"originY"] == nil || cropData[@"width"] == nil || cropData[@"height"]== nil) {
123
+ reject(@"E_INVALID_CROP_DATA", @"Invalid crop options has been passed. Please make sure the object contains originX, originY, width and height.", nil);
124
+ return;
125
+ }
126
+
127
+ float originX = [(NSNumber *)cropData[@"originX"] floatValue];
128
+ float originY = [(NSNumber *)cropData[@"originY"] floatValue];
129
+ float requestedWidth = [(NSNumber *)cropData[@"width"] floatValue];
130
+ float requestedHeight = [(NSNumber *)cropData[@"height"] floatValue];
131
+
132
+ if (originX > image.size.width || originY > image.size.height || requestedWidth > image.size.width || requestedHeight > image.size.height) {
133
+ reject(@"E_INVALID_CROP_DATA", @"Invalid crop options has been passed. Please make sure the requested crop rectangle is inside source image.", nil);
134
+ return;
135
+ }
136
+ CGRect cropDimensions = CGRectMake(originX, originY, requestedWidth, requestedHeight);
137
+ image = [ImageUtils cropImage:image toRect:cropDimensions];
138
+ }
139
+ }
140
+
141
+ float compressionValue = 1.0;
142
+ if (saveOptions[@"compress"] != nil) {
143
+ compressionValue = [(NSNumber *)saveOptions[@"compress"] floatValue];
144
+ }
145
+
146
+ NSData *imageData = nil;
147
+ NSString *format = saveOptions[@"format"];
148
+ NSString *extension;
149
+ if (format == nil) {
150
+ format = @"jpeg";
151
+ }
152
+ if ([format isEqualToString:@"jpeg"]) {
153
+ imageData = UIImageJPEGRepresentation(image, compressionValue);
154
+ extension = @".jpg";
155
+ } else if ([format isEqualToString:@"png"]) {
156
+ imageData = UIImagePNGRepresentation(image);
157
+ extension = @".png";
158
+ } else {
159
+ RCTLogWarn(@"Unsupported format: %@, using JPEG instead.", format);
160
+ imageData = UIImageJPEGRepresentation(image, compressionValue);
161
+ extension = @".jpg";
162
+ }
163
+
164
+
165
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
166
+ NSString *directory = directory = [paths firstObject];
167
+ NSString *fileName = [[[NSUUID UUID] UUIDString] stringByAppendingString:extension];
168
+ NSString *newPath = [directory stringByAppendingPathComponent:fileName];
169
+
170
+ [imageData writeToFile:newPath atomically:YES];
171
+ NSURL *fileURL = [NSURL fileURLWithPath:newPath];
172
+ NSString *filePath = [fileURL absoluteString];
173
+ NSMutableDictionary *response = [[NSMutableDictionary alloc] init];
174
+ response[@"uri"] = filePath;
175
+ response[@"filename"] = fileName;
176
+ response[@"width"] = @(CGImageGetWidth(image.CGImage));
177
+ response[@"height"] = @(CGImageGetHeight(image.CGImage));
178
+ if (saveOptions[@"base64"] && [saveOptions[@"base64"] boolValue]) {
179
+ response[@"base64"] = [imageData base64EncodedStringWithOptions:0];
180
+ }
181
+
182
+ resolve(response);
183
+ }
184
+
5
185
  + (UIImage *)cropImage:(UIImage *)image toRect:(CGRect)rect
6
186
  {
7
187
  CGImageRef takenCGImage = image.CGImage;
@@ -1,11 +1,15 @@
1
-
2
- #if __has_include("RCTBridgeModule.h")
3
- #import "RCTBridgeModule.h"
1
+ #ifdef RCT_NEW_ARCH_ENABLED
2
+ #import <rnimagemanipulator/rnimagemanipulator.h>
4
3
  #else
5
- #import <React/RCTBridgeModule.h>
4
+ #import <React/RCTBridge.h>
6
5
  #endif
7
6
 
8
- @interface RNImageManipulator : NSObject <RCTBridgeModule>
7
+ @interface RNImageManipulator : NSObject
8
+ #ifdef RCT_NEW_ARCH_ENABLED
9
+ <NativeImageManipulatorModuleSpec>
10
+ #else
11
+ <RCTBridgeModule>
12
+ #endif
9
13
 
10
14
  @end
11
-
15
+
@@ -0,0 +1,31 @@
1
+ #import "RNImageManipulator.h"
2
+ #import "ImageUtils.h"
3
+ #import <React/RCTLog.h>
4
+
5
+ @implementation RNImageManipulator
6
+
7
+ RCT_EXPORT_MODULE();
8
+
9
+ - (dispatch_queue_t)methodQueue
10
+ {
11
+ return dispatch_get_main_queue();
12
+ }
13
+
14
+ RCT_EXPORT_METHOD(manipulate:(NSString *)uriString
15
+ actions:(NSArray *)actions
16
+ saveOptions:(NSDictionary *)saveOptions
17
+ resolve:(RCTPromiseResolveBlock)resolve
18
+ reject:(RCTPromiseRejectBlock)reject)
19
+ {
20
+ [ImageUtils manipulate:uriString actions:actions saveOptions:saveOptions resolver:resolve rejecter:reject];
21
+ }
22
+
23
+ #if RCT_NEW_ARCH_ENABLED
24
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
25
+ (const facebook::react::ObjCTurboModule::InitParams &)params
26
+ {
27
+ return std::make_shared<facebook::react::NativeImageManipulatorModuleSpecJSI>(params);
28
+ }
29
+ #endif
30
+
31
+ @end
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@oguzhnatly/react-native-image-manipulator",
3
- "version": "1.0.4",
3
+ "version": "1.0.13",
4
4
  "description": "ImageManipulator for react native without Expo and Unimodules. Based on Expo ImageManipulator",
5
- "main": "index.js",
5
+ "main": "build/index.js",
6
6
  "author": "oguzhnatly",
7
7
  "homepage": "https://github.com/oguzhnatly/react-native-image-manipulator",
8
8
  "license": "MIT",
9
- "typings": "index.d.ts",
9
+ "typings": "build/index.d.ts",
10
10
  "keywords": [
11
11
  "react-native",
12
12
  "react",
@@ -18,9 +18,27 @@
18
18
  "react-native-flip-image",
19
19
  "react-native-image-manipulator"
20
20
  ],
21
+ "scripts": {
22
+ "build": "tsc"
23
+ },
21
24
  "dependencies": {},
22
25
  "devDependencies": {
23
- "react-native": "^0.68.0",
26
+ "react-native": "^0.71.2",
24
27
  "typescript": "^4.6.3"
28
+ },
29
+ "peerDependencies": {
30
+ "react-native": ">=0.63"
31
+ },
32
+ "codegenConfig": {
33
+ "name": "rnimagemanipulator",
34
+ "type": "modules",
35
+ "jsSrcsDir": "./fabric",
36
+ "android": {
37
+ "javaPackageName": "com.oguzhnatly.rnimagemanipulator"
38
+ }
39
+ },
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/oguzhnatly/react-native-image-manipulator"
25
43
  }
26
44
  }
@@ -10,10 +10,18 @@ Pod::Spec.new do |s|
10
10
 
11
11
  s.authors = package['author']
12
12
  s.homepage = package['homepage']
13
- s.platform = :ios, "9.0"
14
13
 
15
14
  s.source = { :git => "https://github.com/oguzhnatly/react-native-image-manipulator.git", :tag => "v#{s.version}" }
16
- s.source_files = 'ios/**/*.{h,m}'
17
15
 
18
- s.dependency 'React'
16
+ s.source_files = "ios/**/*.{h,m,mm}"
17
+
18
+ if defined?(install_modules_dependencies()) != nil
19
+ s.platform = :ios, "13.4"
20
+ install_modules_dependencies(s)
21
+ else
22
+ s.platforms = { :ios => "9.0", :tvos => "9.0" }
23
+
24
+ s.dependency "React-Core"
25
+ end
26
+
19
27
  end
package/tsconfig.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "esnext",
4
+ "lib": ["dom", "esnext"],
5
+ "jsx": "react-native",
6
+ "moduleResolution": "node",
7
+ "esModuleInterop": true,
8
+ "allowSyntheticDefaultImports": true,
9
+ "sourceMap": true,
10
+ "declaration": true,
11
+ "inlineSources": true,
12
+ "strictNullChecks": true,
13
+ "strictPropertyInitialization": true,
14
+ "strictFunctionTypes": true,
15
+ "skipLibCheck": true,
16
+ "noImplicitThis": true,
17
+ "noImplicitReturns": true,
18
+ "outDir": "./build"
19
+ },
20
+ "include": ["index.ts", "fabric/"]
21
+ }
package/Example/.babelrc DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "presets": ["module:metro-react-native-babel-preset"]
3
- }
@@ -1,6 +0,0 @@
1
-
2
- [android]
3
- target = Google Inc.:Google APIs:23
4
-
5
- [maven_repositories]
6
- central = https://repo1.maven.org/maven2
@@ -1,70 +0,0 @@
1
- [ignore]
2
- ; We fork some components by platform
3
- .*/*[.]android.js
4
-
5
- ; Ignore "BUCK" generated dirs
6
- <PROJECT_ROOT>/\.buckd/
7
-
8
- ; Ignore unexpected extra "@providesModule"
9
- .*/node_modules/.*/node_modules/fbjs/.*
10
-
11
- ; Ignore duplicate module providers
12
- ; For RN Apps installed via npm, "Libraries" folder is inside
13
- ; "node_modules/react-native" but in the source repo it is in the root
14
- .*/Libraries/react-native/React.js
15
-
16
- ; Ignore polyfills
17
- .*/Libraries/polyfills/.*
18
-
19
- ; Ignore metro
20
- .*/node_modules/metro/.*
21
-
22
- [include]
23
-
24
- [libs]
25
- node_modules/react-native/Libraries/react-native/react-native-interface.js
26
- node_modules/react-native/flow/
27
- node_modules/react-native/flow-github/
28
-
29
- [options]
30
- emoji=true
31
-
32
- esproposal.optional_chaining=enable
33
- esproposal.nullish_coalescing=enable
34
-
35
- module.system=haste
36
- module.system.haste.use_name_reducers=true
37
- # get basename
38
- module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
39
- # strip .js or .js.flow suffix
40
- module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
41
- # strip .ios suffix
42
- module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
43
- module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
44
- module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
45
- module.system.haste.paths.blacklist=.*/__tests__/.*
46
- module.system.haste.paths.blacklist=.*/__mocks__/.*
47
- module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
48
- module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
49
-
50
- munge_underscores=true
51
-
52
- module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
53
-
54
- module.file_ext=.js
55
- module.file_ext=.jsx
56
- module.file_ext=.json
57
- module.file_ext=.native.js
58
-
59
- suppress_type=$FlowIssue
60
- suppress_type=$FlowFixMe
61
- suppress_type=$FlowFixMeProps
62
- suppress_type=$FlowFixMeState
63
-
64
- suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
65
- suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
66
- suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
67
- suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
68
-
69
- [version]
70
- ^0.78.0
@@ -1 +0,0 @@
1
- *.pbxproj -text
package/Example/App.js DELETED
@@ -1,49 +0,0 @@
1
- /**
2
- * Sample React Native App
3
- * https://github.com/facebook/react-native
4
- *
5
- * @format
6
- * @flow
7
- */
8
-
9
- import React, {Component} from 'react';
10
- import {Platform, StyleSheet, Text, View} from 'react-native';
11
-
12
- const instructions = Platform.select({
13
- ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
14
- android:
15
- 'Double tap R on your keyboard to reload,\n' +
16
- 'Shake or press menu button for dev menu',
17
- });
18
-
19
- type Props = {};
20
- export default class App extends Component<Props> {
21
- render() {
22
- return (
23
- <View style={styles.container}>
24
- <Text style={styles.welcome}>Welcome to React Native!</Text>
25
- <Text style={styles.instructions}>To get started, edit App.js</Text>
26
- <Text style={styles.instructions}>{instructions}</Text>
27
- </View>
28
- );
29
- }
30
- }
31
-
32
- const styles = StyleSheet.create({
33
- container: {
34
- flex: 1,
35
- justifyContent: 'center',
36
- alignItems: 'center',
37
- backgroundColor: '#F5FCFF',
38
- },
39
- welcome: {
40
- fontSize: 20,
41
- textAlign: 'center',
42
- margin: 10,
43
- },
44
- instructions: {
45
- textAlign: 'center',
46
- color: '#333333',
47
- marginBottom: 5,
48
- },
49
- });
@@ -1,65 +0,0 @@
1
- # To learn about Buck see [Docs](https://buckbuild.com/).
2
- # To run your application with Buck:
3
- # - install Buck
4
- # - `npm start` - to start the packager
5
- # - `cd android`
6
- # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7
- # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8
- # - `buck install -r android/app` - compile, install and run application
9
- #
10
-
11
- lib_deps = []
12
-
13
- for jarfile in glob(['libs/*.jar']):
14
- name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
15
- lib_deps.append(':' + name)
16
- prebuilt_jar(
17
- name = name,
18
- binary_jar = jarfile,
19
- )
20
-
21
- for aarfile in glob(['libs/*.aar']):
22
- name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
23
- lib_deps.append(':' + name)
24
- android_prebuilt_aar(
25
- name = name,
26
- aar = aarfile,
27
- )
28
-
29
- android_library(
30
- name = "all-libs",
31
- exported_deps = lib_deps,
32
- )
33
-
34
- android_library(
35
- name = "app-code",
36
- srcs = glob([
37
- "src/main/java/**/*.java",
38
- ]),
39
- deps = [
40
- ":all-libs",
41
- ":build_config",
42
- ":res",
43
- ],
44
- )
45
-
46
- android_build_config(
47
- name = "build_config",
48
- package = "com.example",
49
- )
50
-
51
- android_resource(
52
- name = "res",
53
- package = "com.example",
54
- res = "src/main/res",
55
- )
56
-
57
- android_binary(
58
- name = "app",
59
- keystore = "//android/keystores:debug",
60
- manifest = "src/main/AndroidManifest.xml",
61
- package_type = "debug",
62
- deps = [
63
- ":app-code",
64
- ],
65
- )
@@ -1,15 +0,0 @@
1
- package com.example;
2
-
3
- import com.facebook.react.ReactActivity;
4
-
5
- public class MainActivity extends ReactActivity {
6
-
7
- /**
8
- * Returns the name of the main component registered from JavaScript.
9
- * This is used to schedule rendering of the component.
10
- */
11
- @Override
12
- protected String getMainComponentName() {
13
- return "Example";
14
- }
15
- }
@@ -1,45 +0,0 @@
1
- package com.example;
2
-
3
- import android.app.Application;
4
-
5
- import com.facebook.react.ReactApplication;
6
- import com.facebook.react.ReactNativeHost;
7
- import com.facebook.react.ReactPackage;
8
- import com.facebook.react.shell.MainReactPackage;
9
- import com.facebook.soloader.SoLoader;
10
-
11
- import java.util.Arrays;
12
- import java.util.List;
13
-
14
- public class MainApplication extends Application implements ReactApplication {
15
-
16
- private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
17
- @Override
18
- public boolean getUseDeveloperSupport() {
19
- return BuildConfig.DEBUG;
20
- }
21
-
22
- @Override
23
- protected List<ReactPackage> getPackages() {
24
- return Arrays.<ReactPackage>asList(
25
- new MainReactPackage()
26
- );
27
- }
28
-
29
- @Override
30
- protected String getJSMainModuleName() {
31
- return "index";
32
- }
33
- };
34
-
35
- @Override
36
- public ReactNativeHost getReactNativeHost() {
37
- return mReactNativeHost;
38
- }
39
-
40
- @Override
41
- public void onCreate() {
42
- super.onCreate();
43
- SoLoader.init(this, /* native exopackage */ false);
44
- }
45
- }
@@ -1,8 +0,0 @@
1
- keystore(
2
- name = "debug",
3
- properties = "debug.keystore.properties",
4
- store = "debug.keystore",
5
- visibility = [
6
- "PUBLIC",
7
- ],
8
- )
@@ -1,4 +0,0 @@
1
- key.store=debug.keystore
2
- key.alias=androiddebugkey
3
- key.store.password=android
4
- key.alias.password=android