Comments (5)
I'm not sure what you mean by "without passing a refer" ?
Can you tell me what would be the signature of such a function? Currently it's basically (ref: ReactRefObject) => Promise<string>
from react-native-view-shot.
For example passing the component it self like:
<View style={{flex:1, backgroundColor:'red'}} />
from react-native-view-shot.
so basically you want
(elementAkaJSX: React.Element) => Promise<string>
?
I don't think we can make it more optimized than rendering once, getting a ref, and rasterizing it, because <View />
is something that only exist on JS side and will have to be resolved on this side. It will trigger some 'native element' creation through bridge, and only when that is done, we can call the native code to snapshot that..
related to that question, see my answer here: #31 (comment)
maybe more thoughts need to be given into this to provide an elegant API, but I don't think we'll be able to do more efficient things. That said, if you need to render 60 different views, you might want to try to parallelize this work (render all in once, OR maybe 10 at a time. I guess you need to try and see what is the best perfs)
BTW, the react-native-view-shot implementation already should happen asynchronously and should not take time on the UI thread. if it does, it's probably a bug. However, this is probably not true for Android according so this PR: #28 . unfortunately I had to close this PR because the code was not working when I tested, PR is welcomed to fix that state
from react-native-view-shot.
Yes, my thought was to pass the "component" to native side, see what function react native use to create component in the native side and use it.
My problem is not the react-native-view-shot, it's the need to render the view to use it.
As you said above i will try with just one render create all the Views and take the snapshot's :)
(Fingers cross xD)
I believe we can close this now :)
from react-native-view-shot.
I don't think there is a difference between "passing component to native side, create component and use it" and "rendering the view".
you need to render the view to rasterize it. the only different might be to not actually "showing it to screen" but I don't think there are big perf issue with or without doing that. (maybe i'm wrong?)
thanks
from react-native-view-shot.
Related Issues (20)
- Crash error on android HOT 5
- not working on ios RN0.72.4
- newArchEnabled HOT 2
- Viewshot is not capture screen shot of absolute positioned Views/
- Is this package still maintained?, because it doesn't seem to work on android anymore HOT 2
- Run time crash due to use of depricated UI Image apis
- not working on android React-Native 0.7x HOT 1
- In scrollable content when i take a shot end of the content styles not applied example borderRadius and color and border
- Android: Image is coming partially black on Android when used in conjunction with ScrollView! HOT 3
- how to avoid black edges formed after capturing. HOT 3
- Regression in 4.0.0-alpha.2 HOT 1
- In android it does nothing and not showing any error logs. Works fine in iOS HOT 12
- Privacy Manifest file HOT 1
- captureRef webview ref error
- view-shot content will not update when webview changes
- One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts HOT 2
- Need support for android O and above
- The generated screenshot appears blurry on Android devices, as if the resolution is incorrect
- On Android, captured image cannot be shared (empty share dialog) HOT 1
- 4.0.0-alpha.3 ios snapshot wrong
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-view-shot.