React-Native: The subject line of email is same as the message contents using Share.share - react-native

It's a pretty strange problem I have been facing. I am using Share.share which takes message, subject(ios) and title (for gmail) as an argument. In the android it works fine. i.e. The subject line is "I am the title" whereas the message body is "I am groot". But in iOS, the subject line is always same as the message, like the screenshot shown below: Any help would be highly appreciable. Thanks in advance.
onShare = async () => {
try {
await Share.share(
{
message: "I am groot",
title: "I am the title",
},
{
subject: "I am the subject line",
}
);
} catch (error) {
...
}
};

Instead of importing Share from react-native, when I imported it from react-native-share, it fixed my problem.

As per the documentation, Share title property is used only as a title for the message. To set the email subject you need to set the subject property in the options object (note: this only works on IOS)

Related

data:application/pdf;base64,undefined (pdf-generation problem)

I was creating a pdf generator following guidelines from this website "https://www.wix.com/velo/forum/coding-with-velo/pdf-generator-api-npm-demo"
code screenshot
I copy every code from the guideline, but when I click the submit button, error of [data:application/pdf;base64,undefined] occur, and no record is saved at the pdf generator.
Check the link of the website here: website link
I believe it should be something wrong with the code below
//code start
import { pdf } from 'backend/pdf.jsw';
$w.onReady(function () {
var base64;
$w('#btnSubmit').onClick(() => {
let name = $w('#inName').value;
let detail = $w('#inDetail').value;
pdf(name, detail).then( e => {
base64 = e;
base64 = 'data:application/pdf;base64,' + base64
let msg = {
"conv": true,
"dataUrl": base64
}
$w('#html1').postMessage(msg);
});
});
});
// Code end
I search through the internet and some mentioned open data URl directly function is not supported since 2020 (see website). I am new in programme or codes, it would be greatful if someone could provide me the adjusted code.
Sorry for the trouble

Discord API node.js hover for tooltip

I wanted to add a tooltip to my workinprogress bot, but I got this error.
/home/runner/simplebot/index.js:46
.setColor("#4287f5").setTitle("ToolTip Example").setDescription('Hover for tooltip': [(i)](${ message.url } 'Hey look! Its a tooltip!') ); message.channel.send(tooltipEmbed);
^^^^^^^^^^^^^^^^^^^
SyntaxError: missing ) after argument list
This is my code
{
const tooltipEmbed = new Discord.MessageEmbed()
.setColor("#4287f5").setTitle("ToolTip Example").setDescription('Hover for tooltip': [(i)](${ message.url } 'Hey look! Its a tooltip!') ); message.channel.send(tooltipEmbed);
}
Can someone help me with this?
Thanks!
-Sam
It's due to your .setDescription. If you want a description in your embed, you'll have to use .setDescription('Whatever you want') If you take a look to your description:
.setDescription('Hover for tooltip': [(i)](${ message.url } 'Hey look! Its a tooltip!')
You see that there isn't just one string, infact, there are two, with [(i)](${ message.url } in between.
You can take a look in the docs from discord.js.

React native share API - problems when both message and url used

We are implementing share functionality in our react native app and I'm having difficulty with the appearance of the resulting share text.
Using the share API, if i set just the URL param to our website and share via sms the result looks great. I have set the image and title meta tags and they render in the sms as expected (ie I get a nice picture). However, if I want to add a dynamic message to the share text, via the message param it looks awful. I get 2 sms, one with a text link to the site (no image, no title), then a second sms with the message text. For reference, I am aiming for something in appearance to what you get when you share an app in iOS, like this:
But sharing just a URL via share I get this:
which looks nice, with image etc but no dynamic text.
As soon as i add some text via the message param, the result looks like this:
which looks pretty crappy.
It kind of feels like this is a pretty vanilla use case and i can't see what I'm doing wrong. Anyone got any ideas?
Edit: A simplified version of the code I'm using is as follows:
import { Share } from 'react-native'
const content = {
message: 'This is a lovely message',
url: 'https://www.google.com/chrome/'
}
try {
const result = await Share.share(content)
console.log('Shared', result)
if (result.action === Share.sharedAction) {
// shared
} else if (result.action === Share.dismissedAction) {
// IOS ONLY
// dismissed
}
} catch (err) {
console.log('Failed to share', err)
}
}

Detect input text as ISBN EAN UPC

I want to build a input form in which a user inserts a code and depending on what is introduced, show a message like UPS (or EAN/ISBN/GTIN ) code found or This code is not valid.
Have been looked for a library that can detect something like this but had no luck?
First of all, can it be done, and if yes, any tips for such library?
$('input[type="text"]').each(function() {
$(this).rules('add', {
messages: {
required: "this is EAN code"
}
})
});
$('input[type="file"]').each(function() {
$(this).rules('add', {
messages: {
required: "this is ISBN code"
}
})
});
Yes this can be done.
There are different libarys that can validate if a String is a valid EAN/ISBN/GTIN.
And if the input is not a valid EAN/ISBN/GTIN than it is (by your definition) an undefined input and not valid.
You could use a combination of different libarys or check out how they work and adapt it to your specific problem.
Here are some example JavaScript libarys:
https://github.com/dominiklessel/node-barcoder
An EAN/GTIN validator
https://github.com/yieme/isbnjs
An ISBN JavaScript Library

React Native Show custom message after Capturing image

I am trying to show a message to the user after he captures an image and the image is saved in gallery. I have surfed through the net but can not find any solution. So far what I have tried the following code from here for capturing image-
takePicture = async function() {
if (this.camera) {
this.camera.takePicture().then(data => {
FileSystem.moveAsync({
from: data,
to: `${FileSystem.documentDirectory}photos/Photo_${this.state
.photoId}.jpg`,
}).then(() => {
this.setState({
photoId: this.state.photoId + 1,
});
Vibration.vibrate();
});
});
}
};
Now I want to know what should I do to get the completion event. Any help is highly appreciated.
I am not the best with what all to put in that code, but you can make a message show this way:
Toast.makeText(getApplicationContext(),"Picture taken!",Toast.LENGTH_SHORT).show();
Instead of Toast you can use a cross platform library : react-native-dropdown-alert