callstack / callstack/react-native-paper
Modal Animation
- Langage dominant
- TypeScript
- Étoiles
- 14.5k
- Forks
- 2.2k
- Merge moyen
- 5 j 23 h
- PR mergées (30 j)
- 12
Description
**How can we customize modal animation?**
I'm trying to customize animation of modal while showing up. Instead of default fadeIn fadeOut animation, I want to insert custom animation, is there any way to change defualt modal animation in react-native-paper ? I tried Animated from react native but it did not work.
```
import { useFocusEffect } from '@react-navigation/native';
import { Animated } from 'react-native';
import { Modal, Portal, Text, Button, PaperProvider } from 'react-native-paper';
const DefaultModal = () => {
const [visible, setVisible] = React.useState(false);
const fadeAnim = React.useRef(new Animated.Value(0)).current; // Initial value for opacity: 0
const showModal = () => setVisible(true);
const hideModal = () => setVisible(false);
const containerStyle = { backgroundColor: 'white', padding: 3 };
useFocusEffect(() => {
Animated.timing(fadeAnim, {
toValue: 1,
duration: 1000,
useNativeDriver: true,
}).start();
return () => {
Animated.timing(fadeAnim, {
toValue: 0,
duration: 250,
useNativeDriver: true,
}).start();
};
});
return (
<>
Example Modal. Click outside this area to dismiss.
Show
);
};
export default DefaultModal;
```
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par examiner la documentation de react-native-paper Modal et Portal ainsi que le comportement actuel des animations de Modal ; l’issue ne nomme aucun fichier source, test ou point d’entrée. L’API demandée et les critères d’acceptation ne sont pas définis ; il faudrait donc d’abord préciser comment l’animation personnalisée doit être configurée et comment ce comportement sera validé pour pouvoir terminer le travail.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- react-native
- Domaine
- mobile-dev
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100