stream-chat-react-native 6.0.0-rc.2 → 6.0.0-rc.20
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.
- package/README.md +1 -1
- package/android/build.gradle +103 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/streamchatreactnative/StreamChatReactNative.java +594 -0
- package/android/src/main/java/com/streamchatreactnative/StreamChatReactNativeModule.java +111 -0
- package/android/src/main/java/com/streamchatreactnative/StreamChatReactNativePackage.java +45 -0
- package/android/src/newarch/com/streamchatreactnative/StreamChatReactNative.java +9 -0
- package/android/src/oldarch/com/streamchatreactnative/StreamChatReactNativeSpec.java +16 -0
- package/ios/ImageHelpers.h +57 -0
- package/ios/ImageHelpers.m +179 -0
- package/ios/StreamChatReactNative.h +13 -0
- package/ios/StreamChatReactNative.mm +417 -0
- package/ios/StreamChatReactNative.xcodeproj/project.pbxproj +280 -0
- package/package.json +16 -4
- package/src/handlers/compressImage.ts +3 -4
- package/src/native/NativeStreamChatReactNative.ts +24 -0
- package/src/native/index.tsx +48 -0
- package/src/native/types.ts +32 -0
- package/src/optionalDependencies/Audio.ts +0 -1
- package/src/optionalDependencies/pickImage.ts +1 -0
- package/stream-chat-react-native.podspec +38 -0
package/package.json
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat-react-native",
|
|
3
3
|
"description": "The official React Native SDK for Stream Chat, a service for building chat applications",
|
|
4
|
-
"version": "6.0.0-rc.
|
|
4
|
+
"version": "6.0.0-rc.20",
|
|
5
|
+
"homepage": "https://www.npmjs.com/package/stream-chat-react-native",
|
|
5
6
|
"author": {
|
|
6
7
|
"company": "Stream.io Inc",
|
|
7
8
|
"name": "Stream.io Inc"
|
|
8
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"types",
|
|
13
|
+
"android",
|
|
14
|
+
"ios",
|
|
15
|
+
"*.podspec",
|
|
16
|
+
"package.json"
|
|
17
|
+
],
|
|
9
18
|
"license": "SEE LICENSE IN LICENSE",
|
|
10
19
|
"main": "src/index.js",
|
|
11
20
|
"types": "types/index.d.ts",
|
|
12
21
|
"dependencies": {
|
|
13
22
|
"es6-symbol": "^3.1.3",
|
|
14
|
-
"stream-chat-react-native-core": "6.0.0-rc.
|
|
23
|
+
"stream-chat-react-native-core": "6.0.0-rc.20"
|
|
15
24
|
},
|
|
16
25
|
"peerDependencies": {
|
|
17
|
-
"@bam.tech/react-native-image-resizer": ">=3.0.10",
|
|
18
26
|
"@react-native-camera-roll/camera-roll": ">=7.8.0",
|
|
19
27
|
"@react-native-clipboard/clipboard": ">=1.14.1",
|
|
20
28
|
"@stream-io/flat-list-mvcp": ">=0.10.3",
|
|
@@ -64,7 +72,11 @@
|
|
|
64
72
|
"postpack": "rm README.md"
|
|
65
73
|
},
|
|
66
74
|
"devDependencies": {
|
|
67
|
-
"@bam.tech/react-native-image-resizer": ">=3.0.10",
|
|
68
75
|
"react-native": ">=0.67.0"
|
|
76
|
+
},
|
|
77
|
+
"codegenConfig": {
|
|
78
|
+
"name": "StreamChatReactNativeSpec",
|
|
79
|
+
"type": "modules",
|
|
80
|
+
"jsSrcsDir": "src/native"
|
|
69
81
|
}
|
|
70
82
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import ImageResizer from '@bam.tech/react-native-image-resizer';
|
|
1
|
+
import StreamChatReactNative from '../native';
|
|
3
2
|
|
|
4
3
|
type CompressImageParams = {
|
|
5
4
|
compressImageQuality: number;
|
|
@@ -15,7 +14,7 @@ export const compressImage = async ({
|
|
|
15
14
|
width,
|
|
16
15
|
}: CompressImageParams) => {
|
|
17
16
|
try {
|
|
18
|
-
const { uri: compressedUri } = await
|
|
17
|
+
const { uri: compressedUri } = await StreamChatReactNative.createResizedImage(
|
|
19
18
|
uri,
|
|
20
19
|
width,
|
|
21
20
|
height,
|
|
@@ -28,7 +27,7 @@ export const compressImage = async ({
|
|
|
28
27
|
);
|
|
29
28
|
return compressedUri;
|
|
30
29
|
} catch (error) {
|
|
31
|
-
console.log(error);
|
|
30
|
+
console.log('Error resizing image:', error);
|
|
32
31
|
return uri;
|
|
33
32
|
}
|
|
34
33
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
+
|
|
5
|
+
export interface Spec extends TurboModule {
|
|
6
|
+
createResizedImage(
|
|
7
|
+
uri: string,
|
|
8
|
+
width: number,
|
|
9
|
+
height: number,
|
|
10
|
+
format: string,
|
|
11
|
+
quality: number,
|
|
12
|
+
mode: string,
|
|
13
|
+
onlyScaleDown: boolean,
|
|
14
|
+
rotation?: number,
|
|
15
|
+
outputPath?: string | null,
|
|
16
|
+
keepMeta?: boolean,
|
|
17
|
+
): Promise<{
|
|
18
|
+
base64: string;
|
|
19
|
+
height: number;
|
|
20
|
+
name: string;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('StreamChatReactNative');
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { NativeModules } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import type { Options, ResizeFormat, Response } from './types';
|
|
4
|
+
export type { ResizeFormat, ResizeMode, Response } from './types';
|
|
5
|
+
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
8
|
+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
9
|
+
|
|
10
|
+
const ImageResizer = isTurboModuleEnabled
|
|
11
|
+
? require('./NativeStreamChatReactNative').default
|
|
12
|
+
: NativeModules.StreamChatReactNative;
|
|
13
|
+
|
|
14
|
+
const defaultOptions: Options = {
|
|
15
|
+
mode: 'contain',
|
|
16
|
+
onlyScaleDown: false,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
async function createResizedImage(
|
|
20
|
+
uri: string,
|
|
21
|
+
width: number,
|
|
22
|
+
height: number,
|
|
23
|
+
format: ResizeFormat,
|
|
24
|
+
quality: number,
|
|
25
|
+
rotation: number = 0,
|
|
26
|
+
outputPath?: string | null,
|
|
27
|
+
keepMeta = false,
|
|
28
|
+
options: Options = defaultOptions,
|
|
29
|
+
): Promise<Response> {
|
|
30
|
+
const { mode, onlyScaleDown } = { ...defaultOptions, ...options };
|
|
31
|
+
|
|
32
|
+
return await ImageResizer.createResizedImage(
|
|
33
|
+
uri,
|
|
34
|
+
width,
|
|
35
|
+
height,
|
|
36
|
+
format,
|
|
37
|
+
quality,
|
|
38
|
+
mode,
|
|
39
|
+
onlyScaleDown,
|
|
40
|
+
rotation,
|
|
41
|
+
outputPath,
|
|
42
|
+
keepMeta,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default {
|
|
47
|
+
createResizedImage,
|
|
48
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface Response {
|
|
2
|
+
height: number;
|
|
3
|
+
name: string;
|
|
4
|
+
path: string;
|
|
5
|
+
size: number;
|
|
6
|
+
uri: string;
|
|
7
|
+
width: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type ResizeFormat = 'PNG' | 'JPEG' | 'WEBP';
|
|
11
|
+
export type ResizeMode = 'contain' | 'cover' | 'stretch';
|
|
12
|
+
|
|
13
|
+
export type Options = {
|
|
14
|
+
/**
|
|
15
|
+
* Either `contain` (the default), `cover`, or `stretch`. Similar to
|
|
16
|
+
* [react-native <Image>'s resizeMode](https://reactnative.dev/docs/image#resizemode)
|
|
17
|
+
*
|
|
18
|
+
* - `contain` will fit the image within `width` and `height`,
|
|
19
|
+
* preserving its ratio
|
|
20
|
+
* - `cover` will make sure at least one dimension fits `width` or
|
|
21
|
+
* `height`, and the other is larger, also preserving its ratio.
|
|
22
|
+
* - `stretch` will resize the image to exactly `width` and `height`.
|
|
23
|
+
*
|
|
24
|
+
* (Default: 'contain')
|
|
25
|
+
*/
|
|
26
|
+
mode?: ResizeMode;
|
|
27
|
+
/**
|
|
28
|
+
* Whether to avoid resizing the image to be larger than the original.
|
|
29
|
+
* (Default: false)
|
|
30
|
+
*/
|
|
31
|
+
onlyScaleDown?: boolean;
|
|
32
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
|
+
|
|
6
|
+
Pod::Spec.new do |s|
|
|
7
|
+
s.name = "stream-chat-react-native"
|
|
8
|
+
s.version = package["version"]
|
|
9
|
+
s.summary = package["description"]
|
|
10
|
+
s.homepage = package["homepage"]
|
|
11
|
+
s.license = package["license"]
|
|
12
|
+
s.authors = package["author"]
|
|
13
|
+
|
|
14
|
+
s.platforms = { :ios => "10.0" }
|
|
15
|
+
s.source = { :git => "./ios", :tag => "#{s.version}" }
|
|
16
|
+
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm}"
|
|
18
|
+
|
|
19
|
+
s.dependency "React-Core"
|
|
20
|
+
s.ios.framework = 'AssetsLibrary', 'MobileCoreServices'
|
|
21
|
+
|
|
22
|
+
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
23
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
24
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
25
|
+
s.pod_target_xcconfig = {
|
|
26
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
27
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
28
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
29
|
+
}
|
|
30
|
+
s.dependency "React-Codegen"
|
|
31
|
+
s.dependency "RCT-Folly"
|
|
32
|
+
s.dependency "RCTRequired"
|
|
33
|
+
s.dependency "RCTTypeSafety"
|
|
34
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
35
|
+
install_modules_dependencies(s)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|