-
Notifications
You must be signed in to change notification settings - Fork 2
ui components
This page describes all built-in components for building you modules interface.
/app/ui/avatars/Avatar.tsx
Generic avatar displayer. You shall not directly use it. The image is fetched from the distant server with the userId. Use this generic component to create custom avatar displayers (see below).
Props :
-
count(number): total avatar displayed this way, one by one. Default1. -
decorate(boolean): Add a slight decorative white border. Defaulttrue. Works only withsizeprop toSize.verylarge. -
id(string): usedId used to get the avatar picture -
index(number): index of avatar displayed in the total (count). -
large(boolean): Deprecated. Doesn't do anything. -
size(Size): Can beSize.aligned,Size.large,Size.small, orSize.verylarge. -
width(number): width of the avatar container
/app/ui/avatars/SingleAvatar.tsx
Display a single circle avatar.
Props :
-
userID(string) -
size(number): Size in px. Default 45.
/app/ui/avatars/RowAvatars.tsx
Display a scrollable single row of avatars.
Props :
-
images(string[]): userIds to get avatars. -
size(Size) Can beSize.aligned,Size.large,Size.small, orSize.verylarge. Size of every avatar. -
onSlideIndex((index: number) => void): event called when the users ends a scroll. Passes the index of the avatar touched as an event argument.
/app/ui/avatars/GridAvatars.tsx
Display up to 4 little avatars in a grid.
Props :
-
users(String[]): userIds to get avatars.
/app/ui/forms/Checkbox.tsx
Displays a round checkbox.
Props :
-
checked(boolean): Is checked or not. -
onCheck(() => void): Event prop triggered when checkbox is checked. -
onUncheck(() => void): Event prop triggered when checkbox is unchecked.
/app/ui/forms/Toggle.tsx
Displays a toggle. Same the same way as Checkbox.
Props :
-
checked(boolean): Is active or not. -
onCheck(() => void): Event prop triggered when toggle is activated. -
onUncheck(() => void): Event prop triggered when toggle is deactivated.
/app/ui/forms/TextInputLine.tsx
Display an input to enter text, like the <input type="text"> Html element.
Props :
-
hasError(boolean): If true, the Text input is red. Default false. -
placeholder(String): Text placeholder. -
secureTextEntry(boolean): If true, characters typed in the input field are hidden, like password inputs. Default false. -
onFocus(() => void): Event prop triggered when the user focuses the input field. -
onBlur(() => void): Event prop triggered when the user exits the input field. -
inputRef((ref: TextInput) => void): Event prop triggered when input field is mounted and gets a ref.
/app/ui/forms/PasswordInputLine.tsx
Display an input to enter a password, like the <input type="password">. Also provides a button to show/hide character entered by the user.
Props :
All TextInputLine plus :
-
iconShowandiconHide(string): name of the icons used for the show/hide toggle. (See "Icons" section of this page)
/app/ui/headers/Header.tsx
Displays the header of your page.
Props :
- onLayout (() => void) Called on the
onLayoutevent of the header.
/app/ui/headers/Back.tsx
Displays the back button of the header.
/app/ui/headers/ResourceTitle.tsx
Display titles in the header.
Props : title (string) and subTitle (string).
/app/ui/headers/Header.tsx
Display an header icon.
Props :
-
name(string): name of the icon -
hidden(boolean): If true, icon is not visible. Default false -
iconSize(number): Size in px. Default20(Exceptions present iniconsDeltaSizesobject). -
onPress(() => void): Event prop triggered when icon is touched.
/app/ui/headers/Header.tsx
Just stylized touchable views.
/app/ui/headers/Header.tsx
Stylized text elements.
Title as smallSize (boolean) that make text littler.
HeaderActioncan be disable with its disabled (boolean) prop.
The icon font is built with Icomoon.
Use /assets/selection.json as the font backup. When you export the font with Icomoon, replace the selection.json file by the new one, and the font file at /assets/fonts/icomoon.ttf and /android/app/src/main/assets/fonts/icomoon.ttf.
/app/ui/icons/Icon.tsx
Displays an icon from icon font.
Props :
-
color(string): Icon color -
name(string): Name of the icon -
paddingHorizontal: (number) Corresponds to the style property "paddingHorizontal" -
size(number): Size of the icon -
focused(boolean): Don't know what is it for
/app/ui/icons/IconOnOff.tsx
An icon that changes whenever it is considered as "on" or as "off".
Props :
-
name(string): Name on the icon set. Icon names will be<name>-onand<name>-offans must exist in the icon font. -
focused(boolean): Controls whenever the icon is considered as "on" or "off". - ... All other
Iconprops.
/app/ui/icons/SearchIcon.tsx
exports a certain number of icon components that are just Icon with a predefined name, size (22) and color (white). Used for common header icons. Available icons are <SearchIcon> and <CloseIcon>.
/app/ui/AudioPlayer.tsx
Generates an audio media player. The media is entirely loaded before being able to play the sound. Loading is started when component is mounted.
Props :
-
source(string): url to fetch the sound media. The fetch request will be signed if necessary. -
style(ViewStyle): Style applied to the container<View>.
/app/ui/BottomSwitcher.tsx
This component is an indicator that displays the current choice of a menu at the bottom of the screen.
Props :
-
onPress(() => void): Behaves like a<TouchableOpacity> -
children(any): You can display anything you want in the bottomSwitcher. However, it has be designed to contain<Text>elements, or small content.
/app/ui/ButtonLine.tsx
This module contains some buttons styles that takes the full screen width, as we are used to see "Settings" app of our device.
This creates a button with a white background an a slight border. It has an arrow at the right (that can be hidden) that means the button is a menu.
Props :
-
onPress(() => void): Triggered on press event -
title(string): Text printed in the button -
color(string): Text color -
hideIcon(boolean): hides the arrow at the right.
This is just a stylized <View> that make look like a ButtonLine.
This is just a stylized <View> that make look like a ButtonLine, without the background neither the border.
This is a component to make some spaces between the containers and ButtonLine (20px).
/app/ui/ButtonsOkCancel.tsx
These components are used to generate two touchable texts. They are designed to work in a modal box.
One button to valid, another to cancel.
Props :
-
onValid,onCancel(() => void): Event props that are triggered in an evident way -
title(string): Text used for the valid button -
cancelText(string): Text used for the cancel button
Just the OK button
Props :
-
onValid(() => void): Event prop that are triggered in an evident way -
title(string): Text used for the valid button
Same as ButtonsOkCancel, but reversed.
/app/ui/ButtonTextIcon.tsx
Text buttons with optionally an icon at the left and at the right.
Props :
-
onPress(() => void): Event prop that are triggered in an evident way -
disabled(boolean): Is the button disabled ? -
leftNameandrightName(booleans): Name of the icons used at the left and at the right. -
title(string): Text used for the button -
whiteSpace(string): Separator betwwen text and icons. Default" ". -
style(TouchableOpacityProps): Additional styles applied to the button.