When we have an input field on the bottom of the screen and we focus it, the keyboard covers the field and we will not know what we are typing inside.
My solution is a mix of two StackOverflow answers, which I will reference at the bottom. Also, apparently the React Native team tackled this issue in the 0.30.0 release. I tried it and it didn’t work the way I wanted, but maybe it was me doing something wrong.
Oh and of course this might not be the best way to do it at all, but it works for me and doesn’t look awful.
The whole code of the two components I am using is below or in this gist.
Let’s start with a basic <Drawer> with a <ScrollView> with a <ListView> inside. Since we don’t know the width of the drawer (because of devices with different resolutions) we can’t just set a fixed width to the images (or whatever) inside the grid. Also with flexbox, I didn’t manage to get the desired result, because I needed squares.
So, to create a grid that has let’s say images that have a 50% width, you have to hack a bit.
The simplest proxy wouldn’t need the proxy_set_header part but in my case I needed it because there was HTTP authentication in place. “ZGV2OmRldg==” is “username:password” Base64 encoded (without quotes).
Now, accessing localhost/api/ would be the same as accessing url.to.the.api/api/, which means that if you issue a GET request to localhost you are going to get one back from localhost instead of from across the internet – bye bye CORS!
Had to add an attachment functionality to the project I am currently working on at work.
The snippets below use a simple web service (which I didn’t include) that saves the files uploaded to a database and returns the columns read.
You need at least three columns in the table: ID (PK, int), FILENAME (varchar) and CONTENT (BLOB).
// Attach this method to an upload button.
private void UploadFile(object sender, RoutedEventArgs e)
OpenFileDialog fileDialog = new OpenFileDialog();
// In case you want filtering.
fileDialog.DefaultExt = ".txt";
fileDialog.Filter = "Text documents (.txt)|*.txt";
bool? result = fileDialog.ShowDialog();
if (result == true)
using (FileStream fs = new FileStream(fileDialog.FileName, FileMode.Open, FileAccess.Read))
Byte b = new Byte[fs.Length];
fs.Read(b, 0, b.Length);
// Save the byte array (b) to the BLOB column in the database.
// I am using a web service.
catch (Exception ex)
This presumes you want to create a transparent overlay layer over all of your elements and center a loading text to the middle of the application.
In my case I had a grid with three rows, hence the Grid.RowSpan="3".
If you change the Canvas name be sure to modify the ElementName in the DockPanel attributes.
To display a custom page template you usually rewrite the default WordPress query that is used to read the post / page content and display it: $wp_query.
By doing so, you end up somehow breaking it’s flow and don’t let it finish correctly (this is not what happens, you really break it though).
This, for instance, prevents the query to correctly set the current-menu-item and other css classes to the menu items that should be marked as selected when visiting a page with a custom template inside.