React Native MantineMiscellaneous

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

PropTypeDefaultDescription
mounted (required)booleanIf true, component will be mounted
transitionTransitionType'fade'Transition type
durationnumber250Transition duration in ms
exitDurationnumberExit transition duration in ms
timingFunction'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out''ease'Transition timing function
children (required)React.ReactNodeChildren to transition
onExited() => voidCalled when exit transition ends
onEntered() => voidCalled when enter transition ends
styleanyAdditional styles
testIDstringTest identifier used by testing frameworks

Source on GitHub · npm