aliyun-oss-react-native

App.js 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import React, { Component } from 'react';
  2. import {
  3. StyleSheet,
  4. View,
  5. ScrollView,
  6. } from 'react-native';
  7. import { AuthManager } from './Component/AuthManager'
  8. import { UploadManager } from './Component/UploadManager'
  9. import { DownloadManager } from './Component/DownloadManager'
  10. import { ImageProcessManager } from './Component/ImageProcessManager'
  11. import { BucketManager } from './Component/BucketManager'
  12. import { ObjectManager } from './Component/ObjectManager'
  13. import AliyunOSS from 'aliyun-oss-react-native'
  14. //open log
  15. AliyunOSS.enableDevMode()
  16. // defalut configraiton
  17. const configuration = {
  18. maxRetryCount: 3,
  19. timeoutIntervalForRequest: 30,
  20. timeoutIntervalForResource: 24 * 60 * 60
  21. };
  22. const config = {
  23. AccessKey: 'XXX',
  24. SecretKey: 'XXX',
  25. };
  26. const endPoint = 'oss-cn-zhangjiakou.aliyuncs.com';
  27. const companyserver = "http://XXX:PORT";
  28. const familyserver = "http://XXX:PORT";
  29. // AliyunOSS.initWithPlainTextAccessKey(config.AccessKey, config.SecretKey, endPoint, configuration);
  30. AliyunOSS.initWithServerSTS(familyserver,endPoint, configuration)
  31. type Props = {};
  32. export default class App extends Component<Props> {
  33. render() {
  34. return (
  35. <ScrollView>
  36. <View style={styles.container}>
  37. <AuthManager/>
  38. <UploadManager/>
  39. <DownloadManager/>
  40. <ImageProcessManager/>
  41. <BucketManager/>
  42. <ObjectManager/>
  43. </View>
  44. </ScrollView>
  45. );
  46. }
  47. }
  48. const styles = StyleSheet.create({
  49. container: {
  50. flexDirection:'column',
  51. backgroundColor: '#F5FCFF',
  52. flexWrap:'wrap'
  53. }
  54. });