-
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 withsize
prop 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 :
-
iconShow
andiconHide
(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
onLayout
event 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 iniconsDeltaSizes
object). -
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.
HeaderAction
can 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>-on
and<name>-off
ans must exist in the icon font. -
focused
(boolean): Controls whenever the icon is considered as "on" or "off". - ... All other
Icon
props.
/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 ? -
leftName
andrightName
(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.
/app/ui/Card.tsx
<Card>
is <View>
with some styles applied. There is also <TouchCard>
that is a witht he same styles.
/app/ui/Carousel.tsx
The Carousel is a modal view that print full-screen images that are swipeable from one to one.
Props:
-
images
(Array<{ src: ImageURISource; alt: string; linkTo?: string }>): Array of the images that will be displayed in the carousel. The src must be signed in needed. The optional linkTo allow to show a extarnal link button that opens the web browser. -
visible
(boolean): Is the carousel active or hidden -
startIndex
(number): which image have to be displayed first when the carousel opens. Default0
-
onClose
: (() => void): Event triggered when the user touches the close button in the corner
/app/ui/CircleNumber.tsx
This just show a tiny circle with a number inside, used for show unread messages.
Props :
- nb: (number | string)
/app/ui/ContainerContent.tsx
Custom view used to print Timeline previews.
View used to layout filters.
Props :
- borderBottomWidth (number): same a the equivalent style property.
- full (boolean): Render the ListItem as active
- nb (number): If not zero, the background color differs.
Custom views used for Timeline preview's top information
Custom view used for Conversation thread information
Custom view used a the page wrapper.
/app/ui/CustomTouchableOpacity.tsx
This version is exactly a TouchableOpacity
, with a particlar prop with a default value to better handle swipes. Every <TouchableOpacity>
component must be this component instead.
/app/ui/DateView.tsx
This component is outdated. Moment.js must be used instead. See "I18n" section of this documentation.
Prints a timestamp into a readable string.
Props :
-
date
(number): The timestamp to process -
strong
(boolean): is bold text or not. Default false. -
short
(boolean): Short times format, or long time format. Default true.
Renders a screen containing a big title, a small description and a centered picture. This component is used when a screen has empty data.
Props :
-
imageSrc
(ImageSource): source of the image. Userequire(...)
here. -
title
(string): Big title text -
text
(string): Description text -
imgWidth
andimgHeight
(numbers): put the actual image size in pixels. This is to maintain aspect ratio. -
scale
(number): Add a scale factor to the image size compared to the total width of the page. Default0.6
.
Display a blue rounded button to display a primary action.
Props :
-
disabled
(boolean) -
leftName
andrightName
(String): icon names for the left and the right -
title
(string): text displayed in the button -
whiteSpace
(string): Separator between icons and title. Default" "
. -
loading
(boolean): Is the button is in loading state -
onPress
(() => void): Event handler on press