react-native-overlayer
react-native-overlayer copied to clipboard
设计上的不合理地方
1.没必要使用DeviceEventEmitter,会造成性能的极大损耗 没理解错的话,您的RRCTopView是单例的,RRCTopView中定义一个INSTANCE export default class RRCTopView extends Component { static INSTANCE = false;
constructor(props) { .... RRCTopView.INSTANCE = this; }
static addAlert(element) { let key = ++keyValue; //这里不再通过DeviceEventEmitter.emit触发 RRCTopView.INSTANCE.addAlertToTopView({ key, element }); return key; } }
2.这样就可以去除componentWillMount和componentWillUnmount 就能兼容新版本的react native的 componentWillMount改名的尴尬了