How to touch and hold to select text in React Native - android

I'm new to Android and trying to implement a rich editor using Text component of React Native.
However when I touch the text and hold for a moment, the text was not highlighted and the top bar with selection actions was not shown like what behaves in a webview or other applications.
What am I missing or do I need to implement this feature by myself? If so could you point a direction?

As of now it is supported by react-native as well by adding props selectable={true}. Also on Android you can change the selected text color with selectionColor='orange'.
Example:
<Text selectable={true} selectionColor='orange'>You can select me</Text>

If you want click-and-hold-to-select-text using a Text component, this feature does not currently exist in React Native for iOS. You probably want to upvote https://react-native.canny.io/feature-requests/p/support-selecting-text-within-text-elements-for-copypaste-etc to suggest Facebook add support for this.
However, I've submitted support for on Android, as of React 0.30. But React iOS is drawing characters directly to the screen (and not using the native UITextView that supports a selectable property), so it is not supported there, and likely won't be for a long time.
RN 0.39 adds support to copy the entire text field, but does not yet include support for selecting a subset of the text field for copying.

Be careful if the text is nested you should add selectable attribute to the top `
<Text selectable>
<Text>
some selectable text
</Text>
</Text>

use onPress={this.onPressTitle()} inside Text
and Declare
onPressTitle:function(){
/* Your Actions on OnPress */
}

Related

React Native Android Clipping Children

I am creating a react native app using expo, and I am creating a dropdown in the header. On iOS the dropdown works as desired, and goes 'above' the main content, while on Android it is clipped or goes 'under'. I am not sure if in reality iOS is acting strange, or Android is.
The header is a custom headerTitle component, which holds the custom dropdown component (a view, which holds the dropdown items (Views with text and icons)
I am looking to get around this issue, and I have tried zIndex and absolute positioning (which I have read does not even work on android, but thought I would try), and that did not fix it (and caused other issues).
Any tips, tricks, and better understanding of why this happens on iOS and Android would be greatly appreciated. I can post code if necessary as well.
React Native does not support overflow: 'visible' on Android.
A good example to look at for this is here: https://github.com/brentvatne/growler-prowler/blob/0eebfaae641a088b1a1fd7ffe552deeac914bffe/screens/BreweryListScreen.js#L70-L76
The key here is to render the menu component inside of a modal (in this case I'm using react-native-root-modal) in order to have it appear on top of the header.

How to change font of textbox drop-down menu in HTML using Alpha Anywhere

I am writing a mobile app for Android and iOS using the Alpha Anywhere framework. I have a dropdown textbox which currently displays two options "King Kong" and "Peter Jackson". How do I change the font size of these names in Alpha Anywhere?
If you know of a solution using JavaScript or Xbasic in the software suite that would also useful, and appreciated.
Are you using a ControlBar control? If so, that is where you would style it. On the other hand, if it is simply a drop-down control in a header, you could click on the object in the UX editor, and edit it's style in the Properties column on the right.

Custom memo or text selection in Delphi Firemonkey for mobile?

Is it possible to create a custom memo in firemonkey to implement things like syntax highlighting?
I wrote my own component on a Frame but it doesnt support mobile text selecting on android... Is there any way to create a custom memo or implement the native text selection into my own component on a TFrame?
What i mean is this:
Hold touch to select text, selected text gets hovered with blue background and on top the toolbar comes down.
There is one full native android TMemo with the design you post available for Delphi. You can find the source code here: https://svn.code.sf.net/p/alcinoe/code/ (i gave the link because the code is too big to be post on SO)
You can also download the demo apk to see it in action:
https://svn.code.sf.net/p/alcinoe/code/demos/ALFmxControls/Android/Release/ALFmxControls/bin/ALFmxControls.apk

How can I change the colour of the toolbar in a FireMonkey mobile application

I'm using Delphi XE7 for developing mobile application. And how can I change the colour of the TToolbar component in Firemonkey mobile application? I can not find the option in the Object Inspector. Is there any other option to change the colour of this component. And I'm targeting Android platform.
Method #1: In Firemonkey most components can be contained within most other components. Place a TRectangle inside of your TToolBar component. Align it to Contents. Change the Fill color to the color you want. Change the Stroke.Kind property to None. Done.
Method #2: You can also do this by modifying the style. Drop the TToolBar on the form. Right click it and select Edit Custom Style.... You should see a toolbar1style1: TStyleObject in the Struction window. Find TRectangle in the Tool Palette. Drag and drop the TRectangle onto the toolbar1style1 line in the Structure window. It should add a TRectangle to your style. Set the Align to Contents. Set the Fill color to what you want. Set the Stroke.Kind to None. Apply and Close. Done.
It will create a custom TStyleBook on your form and your Toolbar should be the Fill color. This may be a less cluttered way than the first method. But could conflict with loading Premium styles into the TStyleBook. Therefor I think the first method is more forward compatible and more maintainable.
TintColor is the property that you are looking for
If your target is the Android platform, I think you can use the TintColor property.
I have tested the behaviour in Delphi 10.1 Berlin, and it does work correctly.
Please note that the TintColor property is currently only available for mobile platforms (iOS and Android).

Titanium - Developing a Dictionary

i'm using Titanium to develop a dictionary. I have a Tableview and the values of the rows are loaded from SQLite local database. I used the "SearchBar" component of Titanium and linked it to the tableview using the native property in Titanium. But the problem is: the filter is not anchored to the beginning of the string. So typing "ha" in the text box will include rows titled 'Harold' and 'Harvard', but also 'Sharon' and 'Jonathan'. And this was mentioned in the API docs of Appcelerator (http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.TableView.filterAttribute-property.html)
Any ideas to resolve that?
You need to implement custom search code for quick solution. So, do not use TableView's "search" and "filterAttribute" property. You can create a SearchBar on TableView's headerView and make custom search function with using SearchBar "return" and "change" events.

Categories

Resources