Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ type: `Number` default: `0`
A value of 1 types text left to right until completion. A value of -1 erases
text from right to left. A value of 0 stops the animation.

### startTyped

type: `Boolean` default: `false`

A true value will make the value typed out when the component renders, this is useful when one wants to show a static value and change to a different value making the latter being typed out.

### fixed

type: `Boolean` default: `false`
Expand Down
7 changes: 7 additions & 0 deletions components/typewriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const MAX_DELAY = 100;

export default class TypeWriter extends Component {
static propTypes = {
startTyped: PropTypes.bool,
children: PropTypes.node.isRequired,
delayMap: PropTypes.arrayOf(
PropTypes.shape({
Expand All @@ -33,6 +34,7 @@ export default class TypeWriter extends Component {
};

static defaultProps = {
startTyped: false,
fixed: false,
initialDelay: MAX_DELAY * 2,
maxDelay: MAX_DELAY,
Expand Down Expand Up @@ -150,6 +152,7 @@ export default class TypeWriter extends Component {

render() {
const {
startTyped,
children,
delayMap,
fixed,
Expand All @@ -168,6 +171,10 @@ export default class TypeWriter extends Component {
</Text>
);

if(startTyped){
return component
}

return hideSubstring(component, fixed, visibleChars);
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-typewriter",
"version": "0.7.0",
"version": "0.8.0",
"description": "A React Native component for creating typing effects",
"main": "index.js",
"license": "MIT",
Expand Down