https://github.com/rumax/react-native-saveview
💾 Library for saving React Native View/ScrollView elements
https://github.com/rumax/react-native-saveview
Last synced: about 1 year ago
JSON representation
💾 Library for saving React Native View/ScrollView elements
- Host: GitHub
- URL: https://github.com/rumax/react-native-saveview
- Owner: rumax
- License: mit
- Created: 2019-01-07T18:42:23.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-11-07T21:12:03.000Z (over 5 years ago)
- Last Synced: 2025-04-22T06:58:27.302Z (about 1 year ago)
- Language: Java
- Homepage:
- Size: 25.4 KB
- Stars: 18
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# react-native-save-view
[](https://www.codacy.com/app/rumax/react-native-SaveView?utm_source=github.com&utm_medium=referral&utm_content=rumax/react-native-SaveView&utm_campaign=Badge_Grade)
[](https://github.com/rumax/react-native-SaveView)
[](https://badge.fury.io/js/react-native-save-view)
[](http://makeapullrequest.com)
Library for saving React Native View/ScrollView elements
## Example
```js
export default class App extends Component {
componentDidMount() {
this._saveView();
}
render() {
return (
this._viewRef = ref} collapsable={false}>
Some content
);
}
async _saveView() {
await this._makeSnapshotPNG();
await this._makeSnapshotPNGBase64();
}
async _makeSnapshotPNG() {
await RNSaveView.saveToPNG(ref, '/sdcard/Download/view.png');
// Check /sdcard/Download/view.png using Device File Explorer
}
async _makeSnapshotPNGBase64() {
const base64 = await RNSaveView.saveToPNGBase64(ref);
console.log('base64:', base64);
}
}
```
## Methods
Name|Android|iOS|Description|
----|-------|---|-----------|
saveToPNG|✓|✓|Save View to PNG file. Before the function is called, check that android has [write to file permissions](https://developer.android.com/training/data-storage/files)|
saveToPNGBase64|✓|✓|Save View to PNG base64|
## License
[MIT](https://opensource.org/licenses/MIT)
## Author
- [rumax](https://github.com/rumax)
### Other information
- Generated with [react-native-create-library](https://github.com/frostney/react-native-create-library)
- Zero JavaScript dependency. Which means that you do not bring other dependencies to your project
- If you think that something is missing or would like to propose new feature, please, discuss it with author
- Please, feel free to ⭐️ the project. This gives the confidence that you like it and a great job was done by publishing and supporting it 🤩