@react-native-ohos/react-native-fileupload 1.2.0-rc.1 → 1.2.0
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/CHANGELOG.md +7 -7
- package/COMMITTERS.md +6 -6
- package/LICENSE +20 -20
- package/NativeRNFileupload.ts +7 -7
- package/README.OpenSource +10 -10
- package/README.md +9 -9
- package/harmony/fileUpload/LICENSE +19 -19
- package/harmony/fileUpload/OAT.xml +37 -37
- package/harmony/fileUpload/README.OpenSource +10 -10
- package/harmony/fileUpload/README.md +164 -164
- package/harmony/fileUpload/build-profile.json5 +28 -28
- package/harmony/fileUpload/hvigorfile.ts +6 -6
- package/harmony/fileUpload/index.ets +1 -1
- package/harmony/fileUpload/obfuscation-rules.txt +17 -17
- package/harmony/fileUpload/oh-package.json5 +11 -11
- package/harmony/fileUpload/src/main/cpp/CMakeLists.txt +8 -8
- package/harmony/fileUpload/src/main/cpp/FileuploadPackage.h +18 -18
- package/harmony/fileUpload/src/main/cpp/generated/RNOH/generated/BaseReactNativeFileuploadPackage.h +65 -65
- package/harmony/fileUpload/src/main/cpp/generated/RNOH/generated/turbo_modules/RNFileupload.cpp +16 -16
- package/harmony/fileUpload/src/main/cpp/generated/RNOH/generated/turbo_modules/RNFileupload.h +16 -16
- package/harmony/fileUpload/src/main/cpp/generated/react/renderer/components/react_native_fileupload/ComponentDescriptors.h +22 -22
- package/harmony/fileUpload/src/main/cpp/generated/react/renderer/components/react_native_fileupload/EventEmitters.cpp +18 -18
- package/harmony/fileUpload/src/main/cpp/generated/react/renderer/components/react_native_fileupload/EventEmitters.h +19 -19
- package/harmony/fileUpload/src/main/cpp/generated/react/renderer/components/react_native_fileupload/Props.cpp +21 -21
- package/harmony/fileUpload/src/main/cpp/generated/react/renderer/components/react_native_fileupload/Props.h +20 -20
- package/harmony/fileUpload/src/main/cpp/generated/react/renderer/components/react_native_fileupload/ShadowNodes.cpp +19 -19
- package/harmony/fileUpload/src/main/cpp/generated/react/renderer/components/react_native_fileupload/ShadowNodes.h +25 -25
- package/harmony/fileUpload/src/main/cpp/generated/react/renderer/components/react_native_fileupload/States.cpp +18 -18
- package/harmony/fileUpload/src/main/cpp/generated/react/renderer/components/react_native_fileupload/States.h +22 -22
- package/harmony/fileUpload/src/main/ets/FileUpLoadModule.ts +106 -106
- package/harmony/fileUpload/src/main/ets/FileUpLoadPackage.ts +46 -46
- package/harmony/fileUpload/src/main/ets/Logger.ts +63 -63
- package/harmony/fileUpload/src/main/ets/generated/components/ts.ts +5 -5
- package/harmony/fileUpload/src/main/ets/generated/index.ets +5 -5
- package/harmony/fileUpload/src/main/ets/generated/ts.ts +6 -6
- package/harmony/fileUpload/src/main/ets/generated/turboModules/RNFileupload.ts +14 -14
- package/harmony/fileUpload/src/main/ets/generated/turboModules/ts.ts +5 -5
- package/harmony/fileUpload/src/main/module.json5 +11 -11
- package/harmony/fileUpload/src/main/resources/base/element/string.json +8 -8
- package/harmony/fileUpload/src/main/resources/en_US/element/string.json +8 -8
- package/harmony/fileUpload/src/main/resources/zh_CN/element/string.json +8 -8
- package/harmony/fileUpload/src/test/List.test.ets +4 -4
- package/harmony/fileUpload/src/test/LocalUnit.test.ets +32 -32
- package/harmony/fileUpload/ts.ts +1 -1
- package/harmony/fileupload.har +0 -0
- package/index.js +1 -1
- package/package.json +42 -42
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
## v1.1.1-rc.1
|
|
3
|
-
|
|
4
|
-
### 更新内容
|
|
5
|
-
|
|
6
|
-
- 适配 RN0.77 版本
|
|
7
|
-
- 修改组织名为@react-native-ohos
|
|
1
|
+
# Changelog
|
|
2
|
+
## v1.1.1-rc.1
|
|
3
|
+
|
|
4
|
+
### 更新内容
|
|
5
|
+
|
|
6
|
+
- 适配 RN0.77 版本
|
|
7
|
+
- 修改组织名为@react-native-ohos
|
package/COMMITTERS.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
## Committers列表
|
|
2
|
-
|
|
3
|
-
### 以下是此项目的committer人员
|
|
4
|
-
|
|
5
|
-
不区分先后顺序
|
|
6
|
-
|
|
1
|
+
## Committers列表
|
|
2
|
+
|
|
3
|
+
### 以下是此项目的committer人员
|
|
4
|
+
|
|
5
|
+
不区分先后顺序
|
|
6
|
+
|
|
7
7
|
- [xiafeng_xf_admin](https://gitee.com/xiafeng_xf_admin)
|
package/LICENSE
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2015 Liucw & PhilippKrone
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
-
the Software without restriction, including without limitation the rights to
|
|
8
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
-
subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Liucw & PhilippKrone
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/NativeRNFileupload.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { TurboModule } from "react-native/Libraries/TurboModule/RCTExport";
|
|
2
|
-
import { TurboModuleRegistry } from "react-native";
|
|
3
|
-
|
|
4
|
-
export interface Spec extends TurboModule {
|
|
5
|
-
upload(options: Object, callback: (err: string, result: string)=>void): void;
|
|
6
|
-
}
|
|
7
|
-
|
|
1
|
+
import type { TurboModule } from "react-native/Libraries/TurboModule/RCTExport";
|
|
2
|
+
import { TurboModuleRegistry } from "react-native";
|
|
3
|
+
|
|
4
|
+
export interface Spec extends TurboModule {
|
|
5
|
+
upload(options: Object, callback: (err: string, result: string)=>void): void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
8
|
export default TurboModuleRegistry.getEnforcing<Spec>("RNFileupload");
|
package/README.OpenSource
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"Name": "react-native-fileupload",
|
|
4
|
-
"License": "MIT License",
|
|
5
|
-
"License File": "LICENSE",
|
|
6
|
-
"Version Number": "1.1.0",
|
|
7
|
-
"Owner" : "xiafeng@huawei.com",
|
|
8
|
-
"Upstream URL": "https://github.com/PhilippKrone/react-native-fileupload",
|
|
9
|
-
"Description": "A file upload plugin for react-native."
|
|
10
|
-
}
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"Name": "react-native-fileupload",
|
|
4
|
+
"License": "MIT License",
|
|
5
|
+
"License File": "LICENSE",
|
|
6
|
+
"Version Number": "1.1.0",
|
|
7
|
+
"Owner" : "xiafeng@huawei.com",
|
|
8
|
+
"Upstream URL": "https://github.com/PhilippKrone/react-native-fileupload",
|
|
9
|
+
"Description": "A file upload plugin for react-native."
|
|
10
|
+
}
|
|
11
11
|
]
|
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# @react-native-ohos/react-native-fileupload
|
|
2
|
-
This project is based on [react-native-fileupload V1.1.0](https://github.com/PhilippKrone/react-native-fileupload)
|
|
3
|
-
## Documentation
|
|
4
|
-
[中文](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-fileupload.md)
|
|
5
|
-
|
|
6
|
-
[English](https://gitee.com/react-native-oh-library/usage-docs/blob/master/en/react-native-fileupload.md)
|
|
7
|
-
|
|
8
|
-
## License
|
|
9
|
-
This library is licensed under [MIT License (MIT)](https://github.com/react-native-oh-library/react-native-fileupload/blob/sig/LICENSE).
|
|
1
|
+
# @react-native-ohos/react-native-fileupload
|
|
2
|
+
This project is based on [react-native-fileupload V1.1.0](https://github.com/PhilippKrone/react-native-fileupload)
|
|
3
|
+
## Documentation
|
|
4
|
+
[中文](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-fileupload.md)
|
|
5
|
+
|
|
6
|
+
[English](https://gitee.com/react-native-oh-library/usage-docs/blob/master/en/react-native-fileupload.md)
|
|
7
|
+
|
|
8
|
+
## License
|
|
9
|
+
This library is licensed under [MIT License (MIT)](https://github.com/react-native-oh-library/react-native-fileupload/blob/sig/LICENSE).
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2015 Liucw & PhilippKrone
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
-
the Software without restriction, including without limitation the rights to
|
|
8
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
-
subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Liucw & PhilippKrone
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
20
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<configuration>
|
|
3
|
-
<oatconfig>
|
|
4
|
-
<licensefile>LICENSE</licensefile>
|
|
5
|
-
<filefilterlist>
|
|
6
|
-
<filefilter name="copyrightPolicyFilter" desc="Filters for compatibility,license header policies">
|
|
7
|
-
<filteritem type="filename" name="hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不需要添加版权头"/>
|
|
8
|
-
<filteritem type="filename" name="*.json5" desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加版权头"/>
|
|
9
|
-
<filteritem type="filename" name="*.proto" desc="资源文件,不需要添加版权头"/>
|
|
10
|
-
<filteritem type="filename" name="*.json" desc="资源文件,不需要添加版权头"/>
|
|
11
|
-
<filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
12
|
-
<filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
13
|
-
<filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
14
|
-
<filteritem type="filename" name="LICENSE" desc="工程文件,不修改版权头"/>
|
|
15
|
-
</filefilter>
|
|
16
|
-
<filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
|
|
17
|
-
<filteritem type="filename" name="hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不需要添加许可证头"/>
|
|
18
|
-
<filteritem type="filename" name="*.json5" desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加许可证头"/>
|
|
19
|
-
<filteritem type="filename" name="LICENSE" desc="原三方库证书文件无需更改,因此添加过滤"/>
|
|
20
|
-
<filteritem type="filename" name="*.proto" desc="资源文件,不需要添加许可证头"/>
|
|
21
|
-
<filteritem type="filename" name="*.json" desc="资源文件,不需要添加许可证头"/>
|
|
22
|
-
<filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
23
|
-
<filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
24
|
-
<filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
25
|
-
</filefilter>
|
|
26
|
-
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for resources files policies">
|
|
27
|
-
<filteritem type="filename" name="icon.png" desc="应用图标"/>
|
|
28
|
-
<filteritem type="filename" name="app_icon.png" desc="应用图标"/>
|
|
29
|
-
<filteritem type="filename" name="warn.png" desc="页面展示图标"/>
|
|
30
|
-
</filefilter>
|
|
31
|
-
</filefilterlist>
|
|
32
|
-
<policylist>
|
|
33
|
-
<policy name="projectPolicy" desc="">
|
|
34
|
-
<policyitem type="license" name="MIT" path=".*" desc="license under the MIT"/>
|
|
35
|
-
</policy>
|
|
36
|
-
</policylist>
|
|
37
|
-
</oatconfig>
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<configuration>
|
|
3
|
+
<oatconfig>
|
|
4
|
+
<licensefile>LICENSE</licensefile>
|
|
5
|
+
<filefilterlist>
|
|
6
|
+
<filefilter name="copyrightPolicyFilter" desc="Filters for compatibility,license header policies">
|
|
7
|
+
<filteritem type="filename" name="hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不需要添加版权头"/>
|
|
8
|
+
<filteritem type="filename" name="*.json5" desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加版权头"/>
|
|
9
|
+
<filteritem type="filename" name="*.proto" desc="资源文件,不需要添加版权头"/>
|
|
10
|
+
<filteritem type="filename" name="*.json" desc="资源文件,不需要添加版权头"/>
|
|
11
|
+
<filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
12
|
+
<filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
13
|
+
<filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
14
|
+
<filteritem type="filename" name="LICENSE" desc="工程文件,不修改版权头"/>
|
|
15
|
+
</filefilter>
|
|
16
|
+
<filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
|
|
17
|
+
<filteritem type="filename" name="hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不需要添加许可证头"/>
|
|
18
|
+
<filteritem type="filename" name="*.json5" desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加许可证头"/>
|
|
19
|
+
<filteritem type="filename" name="LICENSE" desc="原三方库证书文件无需更改,因此添加过滤"/>
|
|
20
|
+
<filteritem type="filename" name="*.proto" desc="资源文件,不需要添加许可证头"/>
|
|
21
|
+
<filteritem type="filename" name="*.json" desc="资源文件,不需要添加许可证头"/>
|
|
22
|
+
<filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
23
|
+
<filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
24
|
+
<filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
25
|
+
</filefilter>
|
|
26
|
+
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for resources files policies">
|
|
27
|
+
<filteritem type="filename" name="icon.png" desc="应用图标"/>
|
|
28
|
+
<filteritem type="filename" name="app_icon.png" desc="应用图标"/>
|
|
29
|
+
<filteritem type="filename" name="warn.png" desc="页面展示图标"/>
|
|
30
|
+
</filefilter>
|
|
31
|
+
</filefilterlist>
|
|
32
|
+
<policylist>
|
|
33
|
+
<policy name="projectPolicy" desc="">
|
|
34
|
+
<policyitem type="license" name="MIT" path=".*" desc="license under the MIT"/>
|
|
35
|
+
</policy>
|
|
36
|
+
</policylist>
|
|
37
|
+
</oatconfig>
|
|
38
38
|
</configuration>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"Name": "react-native-fileupload",
|
|
4
|
-
"License": "MIT License",
|
|
5
|
-
"License File": "https://github.com/PhilippKrone/react-native-fileupload/blob/master/LICENSE",
|
|
6
|
-
"Version Number": "1.1.0",
|
|
7
|
-
"Owner" : "Philipp Krone"
|
|
8
|
-
"Upstream URL": "https://github.com/PhilippKrone/react-native-fileupload",
|
|
9
|
-
"Description": "A file upload plugin for react-native."
|
|
10
|
-
}
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"Name": "react-native-fileupload",
|
|
4
|
+
"License": "MIT License",
|
|
5
|
+
"License File": "https://github.com/PhilippKrone/react-native-fileupload/blob/master/LICENSE",
|
|
6
|
+
"Version Number": "1.1.0",
|
|
7
|
+
"Owner" : "Philipp Krone"
|
|
8
|
+
"Upstream URL": "https://github.com/PhilippKrone/react-native-fileupload",
|
|
9
|
+
"Description": "A file upload plugin for react-native."
|
|
10
|
+
}
|
|
11
11
|
]
|
|
@@ -1,165 +1,165 @@
|
|
|
1
|
-
# react-native-fileupload [](https://www.npmjs.com/package/react-native-fileupload)
|
|
2
|
-
|
|
3
|
-
**Important**: iOS version created by booxood (react-native-file-upload). This repository is the continuation of https://github.com/booxood/react-native-file-upload.
|
|
4
|
-
|
|
5
|
-
* Support to upload multiple files at a time
|
|
6
|
-
* Support to files and fields
|
|
7
|
-
|
|
8
|
-
## Getting started
|
|
9
|
-
|
|
10
|
-
`npm install react-native-fileupload --save`
|
|
11
|
-
|
|
12
|
-
### iOS
|
|
13
|
-
1. In XCode, in the project navigator, right click `your project` ➜ `Add Files to [your project's name]`
|
|
14
|
-
2. Go to `node_modules` ➜ `react-native-fileupload` and add `FileUpload.m`
|
|
15
|
-
3. Run your project (`Cmd+R`)
|
|
16
|
-
|
|
17
|
-
### Android
|
|
18
|
-
|
|
19
|
-
*Note: Android support requires React Native 0.12 or later*
|
|
20
|
-
|
|
21
|
-
* Edit `android/settings.gradle` to look like this:
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
rootProject.name = 'MyApp'
|
|
25
|
-
|
|
26
|
-
include ':app'
|
|
27
|
-
|
|
28
|
-
//Add the following two lines:
|
|
29
|
-
include ':react-native-fileupload'
|
|
30
|
-
project(':react-native-fileupload').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fileupload/android')
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
* Edit `android/app/build.gradle` (note: **app** folder) to look like this:
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
apply plugin: 'com.android.application'
|
|
37
|
-
|
|
38
|
-
android {
|
|
39
|
-
...
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
dependencies {
|
|
43
|
-
compile fileTree(dir: 'libs', include: ['*.jar'])
|
|
44
|
-
compile 'com.android.support:appcompat-v7:23.0.0'
|
|
45
|
-
compile 'com.facebook.react:react-native:0.12.+'
|
|
46
|
-
|
|
47
|
-
// Add this line:
|
|
48
|
-
compile project(':react-native-fileupload')
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
* Edit your `MainActivity.java` (deep in `android/app/src/main/java/...`) to look like this:
|
|
53
|
-
|
|
54
|
-
```
|
|
55
|
-
package com.myapp;
|
|
56
|
-
|
|
57
|
-
// Add this line:
|
|
58
|
-
import com.yoloci.fileupload.FileUploadPackage;
|
|
59
|
-
|
|
60
|
-
import android.app.Activity;
|
|
61
|
-
....
|
|
62
|
-
|
|
63
|
-
public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
|
|
64
|
-
|
|
65
|
-
private ReactInstanceManager mReactInstanceManager;
|
|
66
|
-
private ReactRootView mReactRootView;
|
|
67
|
-
|
|
68
|
-
@Override
|
|
69
|
-
protected void onCreate(Bundle savedInstanceState) {
|
|
70
|
-
super.onCreate(savedInstanceState);
|
|
71
|
-
mReactRootView = new ReactRootView(this);
|
|
72
|
-
|
|
73
|
-
mReactInstanceManager = ReactInstanceManager.builder()
|
|
74
|
-
.setApplication(getApplication())
|
|
75
|
-
.setBundleAssetName("index.android.bundle")
|
|
76
|
-
.setJSMainModuleName("index.android")
|
|
77
|
-
.addPackage(new MainReactPackage())
|
|
78
|
-
|
|
79
|
-
// and this line:
|
|
80
|
-
.addPackage(new FileUploadPackage())
|
|
81
|
-
|
|
82
|
-
.setUseDeveloperSupport(BuildConfig.DEBUG)
|
|
83
|
-
.setInitialLifecycleState(LifecycleState.RESUMED)
|
|
84
|
-
.build();
|
|
85
|
-
|
|
86
|
-
mReactRootView.startReactApplication(mReactInstanceManager, "MyApp", null);
|
|
87
|
-
|
|
88
|
-
setContentView(mReactRootView);
|
|
89
|
-
}
|
|
90
|
-
...
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## Usage
|
|
95
|
-
|
|
96
|
-
All you need is to export module `var FileUpload = require('NativeModules').FileUpload;` and direct invoke `FileUpload.upload`.
|
|
97
|
-
|
|
98
|
-
```javascript
|
|
99
|
-
'use strict';
|
|
100
|
-
|
|
101
|
-
var React = require('react-native');
|
|
102
|
-
var FileUpload = require('NativeModules').FileUpload;
|
|
103
|
-
|
|
104
|
-
var {
|
|
105
|
-
AppRegistry,
|
|
106
|
-
StyleSheet,
|
|
107
|
-
Text,
|
|
108
|
-
View,
|
|
109
|
-
} = React;
|
|
110
|
-
|
|
111
|
-
var FileUploadDemo = React.createClass({
|
|
112
|
-
componentDidMount: function() {
|
|
113
|
-
var obj = {
|
|
114
|
-
uploadUrl: 'http://127.0.0.1:3000',
|
|
115
|
-
method: 'POST', // default 'POST',support 'POST' and 'PUT'
|
|
116
|
-
headers: {
|
|
117
|
-
'Accept': 'application/json',
|
|
118
|
-
},
|
|
119
|
-
fields: {
|
|
120
|
-
'hello': 'world',
|
|
121
|
-
},
|
|
122
|
-
files: [
|
|
123
|
-
{
|
|
124
|
-
name: 'one', // optional, if none then `filename` is used instead
|
|
125
|
-
filename: 'one.w4a', // require, file name
|
|
126
|
-
filepath: '/xxx/one.w4a', // require, file absoluete path
|
|
127
|
-
filetype: 'audio/x-m4a', // options, if none, will get mimetype from `filepath` extension
|
|
128
|
-
},
|
|
129
|
-
]
|
|
130
|
-
};
|
|
131
|
-
FileUpload.upload(obj, function(err, result) {
|
|
132
|
-
console.log('upload:', err, result);
|
|
133
|
-
})
|
|
134
|
-
},
|
|
135
|
-
render: function() {
|
|
136
|
-
return (
|
|
137
|
-
<View style={styles.container}>
|
|
138
|
-
<Text style={styles.welcome}>
|
|
139
|
-
Welcome to React Native!
|
|
140
|
-
</Text>
|
|
141
|
-
</View>
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
var styles = StyleSheet.create({
|
|
147
|
-
container: {
|
|
148
|
-
flex: 1,
|
|
149
|
-
justifyContent: 'center',
|
|
150
|
-
alignItems: 'center',
|
|
151
|
-
backgroundColor: '#F5FCFF',
|
|
152
|
-
},
|
|
153
|
-
welcome: {
|
|
154
|
-
fontSize: 20,
|
|
155
|
-
textAlign: 'center',
|
|
156
|
-
margin: 10,
|
|
157
|
-
},
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
AppRegistry.registerComponent('FileUploadDemo', () => FileUploadDemo);
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
## License
|
|
164
|
-
|
|
1
|
+
# react-native-fileupload [](https://www.npmjs.com/package/react-native-fileupload)
|
|
2
|
+
|
|
3
|
+
**Important**: iOS version created by booxood (react-native-file-upload). This repository is the continuation of https://github.com/booxood/react-native-file-upload.
|
|
4
|
+
|
|
5
|
+
* Support to upload multiple files at a time
|
|
6
|
+
* Support to files and fields
|
|
7
|
+
|
|
8
|
+
## Getting started
|
|
9
|
+
|
|
10
|
+
`npm install react-native-fileupload --save`
|
|
11
|
+
|
|
12
|
+
### iOS
|
|
13
|
+
1. In XCode, in the project navigator, right click `your project` ➜ `Add Files to [your project's name]`
|
|
14
|
+
2. Go to `node_modules` ➜ `react-native-fileupload` and add `FileUpload.m`
|
|
15
|
+
3. Run your project (`Cmd+R`)
|
|
16
|
+
|
|
17
|
+
### Android
|
|
18
|
+
|
|
19
|
+
*Note: Android support requires React Native 0.12 or later*
|
|
20
|
+
|
|
21
|
+
* Edit `android/settings.gradle` to look like this:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
rootProject.name = 'MyApp'
|
|
25
|
+
|
|
26
|
+
include ':app'
|
|
27
|
+
|
|
28
|
+
//Add the following two lines:
|
|
29
|
+
include ':react-native-fileupload'
|
|
30
|
+
project(':react-native-fileupload').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fileupload/android')
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
* Edit `android/app/build.gradle` (note: **app** folder) to look like this:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
apply plugin: 'com.android.application'
|
|
37
|
+
|
|
38
|
+
android {
|
|
39
|
+
...
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
dependencies {
|
|
43
|
+
compile fileTree(dir: 'libs', include: ['*.jar'])
|
|
44
|
+
compile 'com.android.support:appcompat-v7:23.0.0'
|
|
45
|
+
compile 'com.facebook.react:react-native:0.12.+'
|
|
46
|
+
|
|
47
|
+
// Add this line:
|
|
48
|
+
compile project(':react-native-fileupload')
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
* Edit your `MainActivity.java` (deep in `android/app/src/main/java/...`) to look like this:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
package com.myapp;
|
|
56
|
+
|
|
57
|
+
// Add this line:
|
|
58
|
+
import com.yoloci.fileupload.FileUploadPackage;
|
|
59
|
+
|
|
60
|
+
import android.app.Activity;
|
|
61
|
+
....
|
|
62
|
+
|
|
63
|
+
public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
|
|
64
|
+
|
|
65
|
+
private ReactInstanceManager mReactInstanceManager;
|
|
66
|
+
private ReactRootView mReactRootView;
|
|
67
|
+
|
|
68
|
+
@Override
|
|
69
|
+
protected void onCreate(Bundle savedInstanceState) {
|
|
70
|
+
super.onCreate(savedInstanceState);
|
|
71
|
+
mReactRootView = new ReactRootView(this);
|
|
72
|
+
|
|
73
|
+
mReactInstanceManager = ReactInstanceManager.builder()
|
|
74
|
+
.setApplication(getApplication())
|
|
75
|
+
.setBundleAssetName("index.android.bundle")
|
|
76
|
+
.setJSMainModuleName("index.android")
|
|
77
|
+
.addPackage(new MainReactPackage())
|
|
78
|
+
|
|
79
|
+
// and this line:
|
|
80
|
+
.addPackage(new FileUploadPackage())
|
|
81
|
+
|
|
82
|
+
.setUseDeveloperSupport(BuildConfig.DEBUG)
|
|
83
|
+
.setInitialLifecycleState(LifecycleState.RESUMED)
|
|
84
|
+
.build();
|
|
85
|
+
|
|
86
|
+
mReactRootView.startReactApplication(mReactInstanceManager, "MyApp", null);
|
|
87
|
+
|
|
88
|
+
setContentView(mReactRootView);
|
|
89
|
+
}
|
|
90
|
+
...
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Usage
|
|
95
|
+
|
|
96
|
+
All you need is to export module `var FileUpload = require('NativeModules').FileUpload;` and direct invoke `FileUpload.upload`.
|
|
97
|
+
|
|
98
|
+
```javascript
|
|
99
|
+
'use strict';
|
|
100
|
+
|
|
101
|
+
var React = require('react-native');
|
|
102
|
+
var FileUpload = require('NativeModules').FileUpload;
|
|
103
|
+
|
|
104
|
+
var {
|
|
105
|
+
AppRegistry,
|
|
106
|
+
StyleSheet,
|
|
107
|
+
Text,
|
|
108
|
+
View,
|
|
109
|
+
} = React;
|
|
110
|
+
|
|
111
|
+
var FileUploadDemo = React.createClass({
|
|
112
|
+
componentDidMount: function() {
|
|
113
|
+
var obj = {
|
|
114
|
+
uploadUrl: 'http://127.0.0.1:3000',
|
|
115
|
+
method: 'POST', // default 'POST',support 'POST' and 'PUT'
|
|
116
|
+
headers: {
|
|
117
|
+
'Accept': 'application/json',
|
|
118
|
+
},
|
|
119
|
+
fields: {
|
|
120
|
+
'hello': 'world',
|
|
121
|
+
},
|
|
122
|
+
files: [
|
|
123
|
+
{
|
|
124
|
+
name: 'one', // optional, if none then `filename` is used instead
|
|
125
|
+
filename: 'one.w4a', // require, file name
|
|
126
|
+
filepath: '/xxx/one.w4a', // require, file absoluete path
|
|
127
|
+
filetype: 'audio/x-m4a', // options, if none, will get mimetype from `filepath` extension
|
|
128
|
+
},
|
|
129
|
+
]
|
|
130
|
+
};
|
|
131
|
+
FileUpload.upload(obj, function(err, result) {
|
|
132
|
+
console.log('upload:', err, result);
|
|
133
|
+
})
|
|
134
|
+
},
|
|
135
|
+
render: function() {
|
|
136
|
+
return (
|
|
137
|
+
<View style={styles.container}>
|
|
138
|
+
<Text style={styles.welcome}>
|
|
139
|
+
Welcome to React Native!
|
|
140
|
+
</Text>
|
|
141
|
+
</View>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
var styles = StyleSheet.create({
|
|
147
|
+
container: {
|
|
148
|
+
flex: 1,
|
|
149
|
+
justifyContent: 'center',
|
|
150
|
+
alignItems: 'center',
|
|
151
|
+
backgroundColor: '#F5FCFF',
|
|
152
|
+
},
|
|
153
|
+
welcome: {
|
|
154
|
+
fontSize: 20,
|
|
155
|
+
textAlign: 'center',
|
|
156
|
+
margin: 10,
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
AppRegistry.registerComponent('FileUploadDemo', () => FileUploadDemo);
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
165
|
MIT
|