Skip to content
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

IOS attachment image not displaying when app is closed #989

Closed
racic99 opened this issue Feb 13, 2024 · 9 comments
Closed

IOS attachment image not displaying when app is closed #989

racic99 opened this issue Feb 13, 2024 · 9 comments

Comments

@racic99
Copy link

racic99 commented Feb 13, 2024

Just reopening the issue mentioned in #901

I have the exact same problem

@fukemy
Copy link

fukemy commented Feb 16, 2024

bump

@mironemanueldanut
Copy link

same issue here! works in the right way when the app is opened but not displaying the image when the app is closed

@ChammounC
Copy link

+1

@mironemanueldanut
Copy link

any updates regarding this ?

@alexmartinezm
Copy link

Same issue here, any workarounds?

@toy0605
Copy link

toy0605 commented Apr 2, 2024

I found workaround I guess.
I've tested by physical device.

If you're using require(), It doesn't work.
It works only dev mode.
If app is deployed for release mode, attachment that using require() is not displayed.

You need to change to absolute path. The path is started assets.

This source file is located 'src/example.ts' for example.
and image file is located 'src/assets/example.png'.

// It works only dev mode.
{
  url: require("./assets/example.png"),
  typeHint: "public.png",
}

// You must change absolute path conditional.
{
  url: __DEV__ === true ? require("./assets/example.png") : "assets/src/assets/example.png",
  typeHint: "public.png",
}

I think it works. Maybe react-native's require() doesn't works properly in ios native code.

@mironemanueldanut
Copy link

mironemanueldanut commented Apr 2, 2024

but this example is not working when you send the image url from firebase and you take it like this :
const notificationImageIOS = remoteMessage?.data?.fcm_options.image and then you replace that image in
notificationConfig.ios.attachments = [
{
id: 'image',
options: {
thumbnailHidden: false,
},
url: notificationImageIOS,
},
];

this workaround works 
only when the app is opened, 
in case that is killed or in background don't work 


@toy0605 

@toy0605
Copy link

toy0605 commented Apr 2, 2024

I found workaround I guess.

I've tested by physical device.

If you're using require(), It doesn't work.

It works only dev mode.

If app is deployed for release mode, attachment that using require() is not displayed.

You need to change to absolute path. The path is started assets.

This source file is located 'src/example.ts' for example.

and image file is located 'src/assets/example.png'.

// It works only dev mode.

{

  url: require("./assets/example.png"),

  typeHint: "public.png",

}



// You must change absolute path conditional.

{

  url: __DEV__ === true ? require("./assets/example.png") : "assets/src/assets/example.png",

  typeHint: "public.png",

}

I think it works. Maybe react-native's require() doesn't works properly in ios native code.

Sorry. I've not read original issue's source code.

I'll post new issue my case for someone needs help

+)
#1022

Copy link

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants