New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Very slow in android #158
Comments
|
Android is slower when not build in release mode. |
|
@mmazzarolo Yes it is fast in release apk. |
|
still facing slow issue |
|
After release Apk the performance still slow |
|
after release the lag when opening modal still exists. |
|
Still feel lag in android :/ |
|
same here |
|
lag still exists on Android with RN > .61 |
|
Same here |
1 similar comment
|
Same here |
|
If you are referring to this slowness being as long as 2-3 seconds, it's most likely related to async content keeping the modal from showing up. It might get a bit confusing because even if your content loading code is placed within ComponentDidMount it can still block the Modal from showing smoothly. I would suggest using an ActivityIndicator along with an isLoading prop and not showing anything at the initial state other than the Modal wrapper itself.
P.S You also need to wrap the Modal itself with the |
|
In my case, it works correctly after stopping debug js remotely. |
|
@HelKyle Wow, ok. Same for me, but it's still a bit slow. Here some versions I'm using: I tried this on a physical device (one plus). |
|
Here you have a code example that totally screw with the animations on android when debugging (with React Native Debugger) if you want to test it: import React, { useState } from "react";
import { Button, Text, View, StyleSheet } from "react-native";
import Modal from "react-native-modal";
function MyModal(props) {
return (
<Modal
backdropOpacity={1}
swipeDirection={"down"}
onSwipeComplete={props.onRequestClose}
isVisible={props.isVisible}
>
<View style={styles.modalView}>
<View style={styles.formView}>{props.children}</View>
</View>
</Modal>
);
}
function ModalTester() {
const [isModalVisible, setModalVisible] = useState(false);
const toggleModal = () => {
setModalVisible(!isModalVisible);
};
return (
<View style={{ flex: 1 }}>
<Button title="Show modal" onPress={toggleModal} />
<MyModal isVisible={isModalVisible} onRequestClose={toggleModal}>
<View style={{ flex: 1 }}>
<Text>Hello!</Text>
<Button title="Hide modal" onPress={toggleModal} />
</View>
</MyModal>
</View>
);
}
const styles = StyleSheet.create({
modalView: {
flex: 1,
},
modalBackground: {
flex: 1
},
modalBackgroundContent: {
flex: 1
},
formView: {
flex: 1,
width: "100%",
backgroundColor: "white"
}
});
export default class App extends React.Component {
render() {
return <ModalTester />;
}
}For those who can't experience the problem, here is how it looks like. When showing the modal :
When closing it:
On the other hand, while swiping (before releasing) all animations are very smooth (sliding and opacity decreasing for the "backdrop"). With more complex examples (for example including a calendar) even without the debugger the modal is stuttering on close (freezes for a few frames in half way through the animation). This second issue doesn't seems to appear with the native driver option. |
|
i solved it by adding the following prop https://stackoverflow.com/questions/61127422/react-native-modal-time-delay-and-jerky-animation |
|
still looking for solutions +1 |
|
I have the same issue. |
|
I'm currently using modals in 2 different projects. In my another newer app I'm using : In my old app the modal opens very quickly and smoothly. I can't understand the reason for this, since in the newest app I'm using more efficient versions and approaches PS: I tested the same code in both apps, and the old app is much faster to open the modal |
|
I think this topic should be reopened. Because there really seems to be a slowness problem on the android platform. "react": "17.0.2",
"react-native": "0.66.4",
"react-native-modal": "^13.0.1",
|
|
If this is a problem linked to RN itself, then the issue should be opened there. |
Me too. |
|
DId you guys manage to fixed this? i have the same issue its super delay and no animation. when closing the background is going out first then the content after 1 sec i think. |
Nope, but found out that it was faster on real device than on emulator so it worked out well for me |
|
faster, but still laggy |
modal taking 2 or 3 seconds to open in Android, while in ios it is very fast.
<Modal isVisible={this.state.showModal} animationIn='slideInUp' backdropColor='black' backdropOpacity='0.20' animationInTiming={0} style={styles.bottomModal} onSwipe={() => this.setState({showModal: false})} onBackdropPress={() => this.setState({showModal: false})} > <View style={styles.modalContent}> <List itemDivider={false}> <ListItem icon noBorder style={{borderBottomWidth: 0}}> <Left> <Icon name="ios-camera"/> </Left> <Body> <Text>Upload from camera</Text> </Body> </ListItem> </List> </View> </Modal> </View>The text was updated successfully, but these errors were encountered: