@@ -28,48 +28,35 @@ dependencies {
28
28
}
29
29
```
30
30
31
- * register module (in MainActivity .java)
31
+ * register module (in MainApplication .java)
32
32
33
33
``` java
34
- import com.remobile.filetransfer.* ; // <--- import
35
-
36
- public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
37
- ......
38
- @Override
39
- protected void onCreate (Bundle savedInstanceState ) {
40
- super . onCreate(savedInstanceState);
41
- mReactRootView = new ReactRootView (this );
42
-
43
- mReactInstanceManager = ReactInstanceManager . builder()
44
- .setApplication(getApplication())
45
- .setBundleAssetName(" index.android.bundle" )
46
- .setJSMainModuleName(" index.android" )
47
- .addPackage(new MainReactPackage ())
48
- .addPackage(new RCTFileTransferPackage ()) // <------ add here
49
- .setUseDeveloperSupport(BuildConfig . DEBUG )
50
- .setInitialLifecycleState(LifecycleState . RESUMED )
51
- .build();
52
-
53
- mReactRootView. startReactApplication(mReactInstanceManager, " ExampleRN" , null );
54
-
55
- setContentView(mReactRootView);
56
- }
57
-
58
- ......
34
+ ......
35
+ import com.remobile.filetransfer.RCTFileTransferPackage ; // <--- import
36
+
37
+ ......
38
+
39
+ @Override
40
+ protected List<ReactPackage > getPackages() {
41
+ ......
42
+ new RCTFileTransferPackage (), // <------ add here
43
+ ......
59
44
}
45
+
60
46
```
61
47
62
48
## Usage
63
49
64
50
### Example
65
51
``` js
66
- var React = require (' react-native' );
52
+ var React = require (' react' );
53
+ var ReactNative = require (' react-native' );
67
54
var {
68
55
StyleSheet ,
69
56
NativeAppEventEmitter,
70
57
View,
71
58
Text ,
72
- } = React ;
59
+ } = ReactNative ;
73
60
74
61
var FileTransfer = require (' @remobile/react-native-file-transfer' );
75
62
var Button = require (' @remobile/react-native-simple-button' );
@@ -145,3 +132,7 @@ var styles = StyleSheet.create({
145
132
146
133
### thanks
147
134
* this project come from https://github.com/apache/cordova-plugin-file-transfer
135
+
136
+
137
+ ### see detail use
138
+ * https://github.com/remobile/react-native-template
0 commit comments