React-Native Change Text With setNativeProps - text

Has anyone figured out a way to dynamically mutate text on the screen without triggering a render?
A large part of my screen utilizes setNativeProps for moving parts, meaning that the animations become lagged despite using shouldComponentUpdate. I would like to use the Text tag instead of the TextInput tag workaround suggested in this post for stylistic reasons.
Best case scenario is a workaround that involves setNaiveProps as it would follow the pattern of the rest of the screen; however, I currently plan to render all the numbers 0-9 on the screen an move them into place at the moment, so any help would be greatly appreciated!

As it turns out, you can actually format TextInputs the same exact way as Text elements (from what I have tested). For placing text horizontally, you have to set the width (something I had trouble with before). For those still interested in the original question however, you can nest TextInputs inside of a Text Element (one per text element because there is no justification and it automatically places them in a row). Styling applied to the Text Element will apply to the TextInput.

Related

Allign shapes and text in SVG for PDF generation

I would like to generate some diagram style graphics using SVG and use text in the diagrams. My problem is, how to know the size of the text in advance to be able to adjust the rest of the layout accordingly. To make this explicit: I'm not talking about SVG in a browser. I would like to work with fixed units and generate PDF for printing for example. So if I use a 12pt font, it should also be printed as 12pt font.
To have a more concrete example: Lets assume I have the three strings "bla", "blablub" and "blubblablub". I would like to print them in a given 12pt font, determine the string size and enclosing boxes and draw the biggest sized box around all of them. The idea is to have equally sized boxed around all, based on the longest text.
Could somebody give me a hint how to do that or why it is not possible? Searching for this topic, I only get some JavaScript tricks in the browser, which usually involves rendering the text and then re-rendering everything again.

Is it possible for text/font to overlap input field?

I am wondering if it is possible to make the font/text inside of an input field overlap the input field itself. I'd like to know if this is possible without doing something like creating two input fields with one overlapping the other and one having a hidden field box.
For instance, say you have a font that looks like handwriting and you want the descenders of lowercase letters (the bottom parts of "p" "y" "g" for instance) to hang below the field box rather than get cut off by it - similar to how handwriting extends below the baseline when writing on lined paper.
I've done extensive searching with little luck, so even if someone knows of a better search term than "text overlapping input-box" and similar such strings, that in iteself would be a tremendous help.
The thing is, I don't know of a CSS selector that just focuses on the text inside the input-box or I would try to increase the z-index of the text so that it would be on a layer above the box.
Have you tried setting a background image on the input element? Your background image could be the line.
i.e.
input {
background: url(path/to/image.png) repeat-x;
}
EDIT:
I've had a quick play with this and have got something up and running here: http://jsfiddle.net/qUc9Y/
I've wrapped the input in another element (fieldset.input-wrapper) and moved your CSS transitions to this new element. I've pushed the input down relatively 10px so it overhangs the shadow created by the container. I've set the background of the input to transparent so the box shadows on the .input-wrapper are visible through it.
Finally, I've added some quick jQuery so that when the input is hovered, the css transitions are applied to the new .input-wrapper container (i.e. the input's parent). You should be able to do the same for focus/blur.
I hope this helps.
EDIT 2:
The focus state should now work too, see http://jsfiddle.net/yZ3uw/14/ .

Advanced CSS Circles

I'm trying to make 3 different circles to my website. I don't want to insert it as a graphic/image file. So I've been trying to achieve it using CSS3, but I can't really work my fingers around it.
What will it look like?
I have uploaded a picture of what I'm trying to achieve at: www.sp34k.com/etc/circles.jpg
I can't really show the code I've been trying to use to achieve this, as it all looks totally weird and nothing floats currectly.
What I've tried
What I've tried is to make 3 circles with position absolute and then use % (percentage) to determine the width of the colored parts, but I can't twist my mind around how it should be set up.
Any suggestions is appreciated,
Mike
Here is a simple try of me to achieve the effect you want:
DEMO
edit: css-only solution
It can be easily animated with javascript or keyframes. Arbitrary content would go into the inner div. To change the percentage, simply adjust the angle of the pseudo-elements.
With a little more effort this could be easily refined I guess;)
Note: the transform has the webkit-prefix, so it works only in chrome/safari - to see it in firefox or other browsers, you need to change the prefix.
P.S. I will animate it when I'm home from work.
Good one by Christoph but he is using SASS/SCSS which are comparatively slow then normal CSS because they have to be converted to CSS before browser render it so I have have a different Solution for you
try this fiddle

Prevent figures/listings from being inserted into specific parts of a LaTeX document

I have a part A in a document with some text and listings/figures in between. The figures and listings are positioned using htb.
Following this part A, there is the bibliography. However a couple of figures do not fit and are therefore are offset to another page, which is fine. But: I do want to limit the offset space to part A and not have the figures be placed within the bibliography text. Also, I don't want to force page of float for all figures (hp positioning or something). A page of floats at the end of part A and before the bibliography would be fine.
So my questions is, is there a way to exclude some parts of a LaTex document from being used for positioning floats that did not fit someplace before?
Maybe I'm missing something, but couldn't you just put a \clearpage right before the bibliography? That forces out all floats that haven't found a place yet.

LaTeX: How to make a fullpage vertical rule on every page?

I'm using LaTeX and I would like to have vertical rule along left side of page, topmargin to bottommargin, 0.5in from the left edge of the page. I want this on every page, so I assume that means it must somehow be tied to the header or the footer?
I've made no progress at all, so I need help with (1) making the full-length rule itself and (2) making it happen automatically on every page of the document.
Can someone tell me how to do that?
I got a working answer to my question on the Latex Community forum: http://www.latex-community.org/forum/viewtopic.php?f=5&t=9072&p=34877#p34877
The answer I got uses the 'Background' package and this code:
\documentclass{article}
\usepackage{background}
\usepackage{lipsum}% just to generate filler text for the example
\SetBgScale{1}
\SetBgAngle{0}
\SetBgColor{black}
\SetBgContents{\rule{.4pt}{\paperheight}}
\SetBgHshift{-9cm}
\begin{document}
\lipsum[1-90]
\end{document}
Works great and was easy to adjust to put one vrule in left margin area and one in the right margin area.
There could be a LaTeX package to do this for you, but I'm more of a TeX person, so I tried to come up with a TeX solution (not always the best idea to mix plain TeX with LaTeX but I think I have it working).
Try this. Box 255 is the box register that TeX places the page contents into before the page is output. What I've done is taken the existing output routine, and changed it to insert into box 255: a 0-height, 0-width infinitely shrinkable-but-overflowing set of boxes containing a rule that is the height of the page, 0.4pt thick and with any luck, half an inch away into the left. The existing contents of box 255 is then added after this rule. Then I call the previous output routine which outputs the page (which now includes a rule), and also the headers and footers.
\newtoks\oldoutput
\oldoutput=\expandafter{\the\output}%
\output{%
\setbox255\vbox to 0pt{%
\hbox to 0pt{%
\vsize\ht255%
\vbox to \ht255{%
\vss
\hbox to -0.5in{%
\hss
\vrule height \ht255 width 0.4pt%
}%
}\hss
}\vss
\box255%
}%
\the\oldoutput
}%
Put it before your \begin{document} command. This might not solve your problem completely, but hopefully it should get you started. Here's a great page for learning about TeX primitives and built-in things.
Have a look at the eso-pic package. From memory, what you want would look like this:
\AddToShipoutPicture{%
\setlength\unitlength{1in}%
\AtPageUpperLeft{%
\put(0.5,\topmargin){\vrule width .5pt height \textheight}%
}%
}
It's not clear in your question if you want the line to span the text area or the whole paper height. Depending on the case, you have to replace \topmargin and \textheight by the correct values, either 0pt or whatever your top margin is, or by \paperheight. See the geometry package if you don't already use it for how to control those dimensions.

Resources