-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Render prop method on View does not work for Images #1369
Comments
|
Hi @diegomura. Below are some ideas on how we could overcome this limitation. If I understood the code correctly there's a processing step ahead of rendering that traverses de node tree and resolves image urls. Would it be possible to define a dependencies props so that this step can resolve those nodes? I'm thinking an API like the following <View
render={({pageNumber}, [logo]) => {
return pageNumber > 0 ? logo : <View/>;
}}
deps={[<Image key="logo" src="..."/>]}
/> Maybe we could even use the children prop <View
render={({pageNumber}, [logo]) => {
return pageNumber > 0 ? logo : <View/>;
}}
>{[
<Image key="logo" src="..."/>
]}</View> Another idea is to have some sort of AssetRegistry, similar to the Font and then we have the assets already loaded. Assets.register({
key: "logo",
source: "https://w....."
});
<View
render={({pageNumber, assets}) => {
return pageNumber > 0 ? <Image src={assets.logo}/> : <View/>;
}}
/> I would love to hear your opinion on these ideas. |
Hi @diegomura, I'm sorry to ping you on this again. I'm willing to try to work on a solution for this but I would like to hear your opinion before I start. I digged a little bit deeper on the deps alternative and I think it's a bit more tricky than I thought because of the ReactElement <-> node conversion. I think the Assets Registry option is more feasible. What do you think? |
fix: fetch assets inside dynamic content (diegomura#1369, diegomura#1587, diegomura#1630, diegomura#1936,…
The following throws an error: Error:
TypeError: Cannot read property 'width' of undefined
Ref: repl
It starts working fine when Image is not used in the render prop. What is a work around for this?
The text was updated successfully, but these errors were encountered: