React Native Mantine › Miscellaneous
Transition
Animated mount/unmount transitions
Import: import { Transition } from 'react-native-mantine';
Usage
import { useState } from 'react';
import { Transition, Button, Paper, Text } from 'react-native-mantine';
const MyComponent = () => {
const [visible, setVisible] = useState(false);
return (
<>
<Button onPress={() => setVisible(!visible)}>
Toggle
</Button>
<Transition
mounted={visible}
transition="scale"
duration={300}
>
<Paper p="md">
<Text>Animated content</Text>
</Paper>
</Transition>
</>
);
};
// Available transitions:
// - fade: Simple opacity
// - scale: Scale with fade
// - slide-down, slide-up, slide-left, slide-right
// - pop: Scale from 0
// - rotate: 180° rotation with fade
Props
| Prop | Type | Default | Description |
|---|---|---|---|
mounted (required) | boolean | If true, component will be mounted | |
transition | TransitionType | 'fade' | Transition type |
duration | number | 250 | Transition duration in ms |
exitDuration | number | Exit transition duration in ms | |
timingFunction | 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'ease' | Transition timing function |
children (required) | React.ReactNode | Children to transition | |
onExited | () => void | Called when exit transition ends | |
onEntered | () => void | Called when enter transition ends | |
style | any | Additional styles | |
testID | string | Test identifier used by testing frameworks |