How can I send files ( pdf, text, jpg) through react-native-gifted-chat? - react-native-gifted-chat

Can any one help me through react native gifted chat? I want to share files like (.pdf, docs, .txt, .jpg.) How to do that?

You have to use renderCustomView (Function) - Custom view inside the bubble prop.
And add some meta information into your message data like this is a SPECIAL message and finally test in renderCustomView if you are in the case of a special message.
https://github.com/FaridSafi/react-native-gifted-chat/blob/master/App.tsx#L128
https://github.com/FaridSafi/react-native-gifted-chat/blob/master/example-expo/CustomView.tsx

react-native-gifted-chat already includes support for images and videos, using the properties video and image of IMessage, just past pass the the link of the resource
{
_id: 1,
text: 'My message',
createdAt: new Date(Date.UTC(2016, 5, 11, 17, 20, 0)),
user: {
_id: 2,
name: 'React Native',
avatar: 'https://facebook.github.io/react/img/logo_og.png',
},
image: 'https://facebook.github.io/react/img/logo_og.png',
// You can also add a video prop:
video: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4',
// Mark the message as sent, using one tick
sent: true,
// Mark the message as received, using two tick
received: true,
// Mark the message as pending with a clock loader
pending: true,
// Any additional custom parameters are passed through
}
For the rest of types you have to implement your own logic, using one of the render functions, i think you could renderMessageImage with a link to the icon of the resources and add a description, also you should handle the click event to start download

Related

Tabulator breaks after setData is being called first time

I have a weird bug in my application using Tabulator by #Oli Folkerd:
After refreshing the table I always end up with having 20 rows instead of my preset 25 rows:
I checked the response from my django ViewSet and the answer always contains the right amount of objects.
js Code:
var table = new Tabulator("#ptable",
{height:"100%",
layout: "fitData",
pagination: "local",
paginationSize: 25,
paginationSizeSelector: [50, 100],
ajaxURL: "api/products",
columns: cols,});
setInterval( function () {
table.setData();
}, 10000);
becomes:
I am happy to post code on the django part as well, but I do not think thats the problem here. Also interesting: When I click on a random page number in the footer I always get to see 20 items per page - except if I choose the last one.

Attachments moved away from Item after validation and before submit process in Apex

I have multiple File Browser Item fields on one page of Application in Oracle Apex.
What happens: When I miss any Item for which validation error fires, I want to hold that file to the browser but I usually loose it if I get that validation error. Is there a solution for the same like other Items fields hold previous value except File Browser Item field. Please see below ss:
Anshul,
APEX 4.2 is very old and no longer supported. A later (or preferably latest) version of APEX will behave differently as Dan explained above.
Can you import your application into apex.oracle.com (which is running APEX 20.1) and you will probably see better results. Based on this you can hopefully use it as justification to upgrade your environment.
Regards,
David
Go to your page-level attributes and a function like the following in the Function and Global Variable Declaration:
function validateItems(request) {
var $file1 = $('#P68_FILE_1');
var $file2 = $('#P68_FILE_2');
var errorsFound = false;
if ($file1.val() === '') {
errorsFound = true;
// Show item in error state
}
if ($file2.val() === '') {
errorsFound = true;
// Show item in error state
}
if (!errorsFound) {
// I think doSubmit was the name of the function back then. If not, try apex.submit
doSubmit(request);
} else {
// Show error message at top of page, I'll use a generic alert for now
alert('You must select a file for each file selector.');
}
}
Then, right-click the Create button and select Create a Dynamic Action. Set the name of the Dynamic Action to Create button clicked.
For the Action, set Type to Execute JavaScript Code. Enter the following JS in code:
validateItems('CREATE');
Finally, ensure that Fire on Initialization is disabled.
Repeat the process for the Save button, but change the request value passed to validateItems to SAVE.

Sticky notification in windows not working

Does node-notifier support allowing the notification stay on the action center until dismissed by user? Timeout and wait attribute is currently not working
it's on depends on os. for mac its provides timeout and wait but for windows, it's not supported by windows.
Here are all notification options :
const NotificationCenter = require('node-notifier').NotificationCenter;
var notifier = new NotificationCenter({
withFallback: false, // Use Growl Fallback if <= 10.8
customPath: undefined // Relative/Absolute path to binary if you want to use your own fork of terminal-notifier
});
notifier.notify(
{
title: title,
subtitle: subtitle,
message: message,
sound: false, // Case Sensitive string for location of sound file, or use one of macOS' native sounds (see below)
icon: 'Terminal Icon', // Absolute Path to Triggering Icon
contentImage: undefined, // Absolute Path to Attached Image (Content Image)
open: undefined, // URL to open on Click
wait: false, // Wait for User Action against Notification or times out. Same as timeout = 5 seconds
// New in latest version. See `example/macInput.js` for usage
timeout: 5, // Takes precedence over wait if both are defined.
closeLabel: undefined, // String. Label for cancel button
actions: undefined, // String | Array<String>. Action label or list of labels in case of dropdown
dropdownLabel: undefined, // String. Label to be used if multiple actions
reply: false // Boolean. If notification should take input. Value passed as third argument in callback and event emitter.
},
function (error, response, metadata) {
console.log(response, metadata);
}
);

List paging in Sencha

I have created a list in Sencha touch2. I need to add paging to it. Lets say i need 25 items to be displayed in a page and on tap of "next" button, the next 25 items has to be displayed.
I believe sencha touch 2 provides paging but am not gettin a handle on it.
My code is
cls:'inboxqueuecls',
xtype:'list',
id:'queuelist',
store:'QueueStore',
plugins: [{
xclass: 'Ext.plugin.ListPaging',
autoPaging: false,
clearOnPageLoad: true
}],
style:{
'border-right':'0.01px black',
'background-color':'rgba(0,140,153,0.2)'
},
itemTpl:'{queueName}'
and my store is
pageSize: 20,
autoload: false,
proxy:{
type:'memory',
reader:{
type:'xml',
record:'string',
rootProperty:'QueuesNames',
}
}
but the "page size" doesn seem to be working.
Anything am missing? Please help.
As TDEBailleul has said pageSize is an attribute of store not of the proxy.
Second, Memory proxy does not support paging. MemoryProxy has its own processing in the Store.js. Specify json or other proxy to get paged ajax call at the output. Another solution is MemoryProxy or ever from other ancestor subclassing.

Google Visualization API Geomap: How to handle marker click events?

I initially have the Google Visualization API Geomap on a world view (options['dataMode'] = 'regions') and I capture the 'regionClick' event when a country is clicked like so:
google.visualization.events.addListener(
geomap, 'regionClick', function (e) {
var rowindex = data.getFilteredRows([{column: 0, value: e['region']}]);
var location = data.getValue(rowindex[0], 3);
location.href = "?ISO=" + e['region'] + "&Location=" + location;
});
I then draw the map zoomed into the country in markers mode (options['dataMode'] = 'markers'). However, I can't seem to capture any events when the markers themselves are clicked.
The documentation ( http://code.google.com/apis/visualization/documentation/gallery/geomap.html#Events ) only refers to 'select' and 'regionClick' events neither of which are fired in this case. (Tested using Chrome 9, and IE 8.)
Has anybody had any success in doing this?
Many thanks.
According to http://groups.google.com/group/google-visualization-api/browse_thread/thread/2bcb89a1eb3c647d it's not currently supported.
I have it working on IE 8 and Chrome. First off, note the warning in the documentation if you are running this locally as file://
If that's not the case, make sure your google.visualization.GeoMap variable (the first argument to addListener) is indeed named geomap . If it is, add an alert() as the first line of code in the event handler and see if that fires. Lastly, note that unless the variable data is global, it will be out of scope if you try to access it from the event handler as you are doing.