TextInput
To add a text input to your game, use the @replay/text-input
package.
#
Examplemy-sprite.js
src/index.js
#
Propsid
: (Required) Identifier, must be unique within a single render function.fontName
: (Required) Name of the font to use.fontSize
: (Required) Size of the font in game coordinates.text
: (Required) The text to show in the input. Users typing will triggeronChangeText
but will not automatically change the text shown in the input.onChangeText
: (Required) A callback with the updated text value when the player types.width
: (Required) Width of the text input in game coordinates.numberOfLines
: Number of lines text input shows. You should not switch between single and multi-line for the same text input. Default1
.align
: Alignment of text in input field, can be"left"
,"right"
or"center"
. Default"center"
.x
: x coordinate of input. Default0
.y
: y coordinate of input. Default0
.color
: An RGB hex value (e.g."#ff0000"
) or CSS Level 1 keyword (e.g."green"
). Default"black"
.