aliyun-oss-react-native

App.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 endPoint = 'oss-cn-XXX.aliyuncs.com';
  23. const authserver = "http://XXX:PORT";
  24. // initWithServerSTS to auth
  25. AliyunOSS.initWithServerSTS(authserver,endPoint, configuration)
  26. type Props = {};
  27. export default class App extends Component<Props> {
  28. render() {
  29. return (
  30. <ScrollView>
  31. <View style={styles.container}>
  32. <AuthManager/>
  33. <UploadManager/>
  34. <DownloadManager/>
  35. <ImageProcessManager/>
  36. <BucketManager/>
  37. <ObjectManager/>
  38. </View>
  39. </ScrollView>
  40. );
  41. }
  42. }
  43. const styles = StyleSheet.create({
  44. container: {
  45. flexDirection:'column',
  46. backgroundColor: '#F5FCFF',
  47. flexWrap:'wrap'
  48. }
  49. });