Native file documents sample project
Overview
Sample project for Native File Documents module.
Documentation
Description
Shows functionality of the Native File Documents module.
Access the file system of the native device. View file documents on the device, as temporary solution until the Mendix platform supports this.
Due to the nature of this module, it comes with a disclaimer and warning, by using this module you accept and agree to it:
This module provides a convenient way for viewing files and images. However, it is an advanced, highly technical module! You need to create a custom build to use it, it does not work in the Make It Native app!
The module is free to use, as is, and we will update it regularly for new Mendix releases.
Unfortunately, we cannot provide extended support on using this module.
Be advised that incorrect usage of the JavaScript actions in this module can cause issues in your app, like deleting files that you did not create yourself. We do not accept any liability or responsibility!
If you are interested we are of course willing to provide assistance, you may contact use here: https://developer.mendixcloud.com/link/partnerprofile/4808
Typical usage scenario
View file documents on the device. Access the file system of the native device.
Features and limitations
Examples of:
- Viewing files,
- Viewing PDFs in the app itself
- Selecting files from the device storage
- Resizing images
- Cropping images
- Writing content to files.
- Reading contents of files.
- Listing directory contents.
- Writing to text files.
- Capture Mendix log data using the listener API.
- (un)zipping files.
Dependencies
- 8.18.3+
- Mendix 9: Native dependencies are included automatically when you build the app
- Mendix 8: Node modules react-native-fs, react-native-file-viewer, react-native-share and react-native-document-picker
Manual installation steps required
Please read the documentation of the module itself for details on manual installation steps
Installation
Download the Mendix appstore module.
Create a custom native build which includes the configured node modules listed above.
To test your app, you will need to use a custom dev app because the Make It Native app does not have the required native modules.
Note that just using npm install is sufficient for the modules to work. React native link is no longer necessary.
Create a native build using the native builder UI. You need at least version 1.0.78 and allow it to update the native template if it prompts you for the update. The additional native module dependencies will be included automatically during the native build for Mx9.
When building for Mx8, use npm install to include the native dependencies react-native-fs, react-native-file-viewer, react-native-share and react-native-document-picker.
Also run pod install in the ios folder again for iOS builds.
Android specific
You need to add a query to the Android Manifest for Android 11 and up. Place it directly before the close tag, see screenshot. Note that recent versions of the native template add a similar intent by default so you no longer need to do this manually.