-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add documentation for typing animation
- Loading branch information
1 parent
862c88b
commit 56e58d4
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
## Native dependencies | ||
|
||
You will need to install `lottie-ios` and `lottie-react-native` in order to use default animation provided, otherwise it will fallback to text based typing animation. | ||
|
||
:::tip | ||
Install native dependencies only if you are going to use default typing animation. | ||
::: | ||
|
||
renderTypingBubble={() => <Text>Custom View (Typing...)</Text>} | ||
|
||
## Customize | ||
|
||
Pass `renderTypingBubble` at Chatty instance. | ||
|
||
```jsx | ||
import React, { useState } from 'react'; | ||
import { Chatty } from 'react-native-chatty'; | ||
|
||
export default function MyReactPage() { | ||
|
||
return ( | ||
<Chatty | ||
{...props} | ||
|
||
// If you want to render whole custom animation | ||
renderTypingBubble={() => <Text>Custom View (Typing...)</Text>} | ||
|
||
// Or if you want to use default animation but want's to change the container | ||
// You can grab default animation from the context, and use it that way too!. | ||
renderTypingBubble={({ typingAnimation }) => <View style={fancyStyles}>{typingAnimation}</View>} | ||
/> | ||
); | ||
} | ||
``` |