实现类似React.createPortal的效果
@qnpm/q-portal 已经迁移至@qnpm/qportal ,使用方式不变,旧组件将不再维护更新,注意替换
npm install @qnpm/qportal --save --registry=http://npmrepo.corp.qunar.com
import React from 'react';
import { ScrollView, View, Text, StyleSheet } from 'react-native';
import { Provider } from '@qnpm/qportal';
export default class ExampleRender extends QView<any, any> {
render() {
return (
<Provider>
<View style={{ flex: 1, paddingBottom: 33 }}>
<Text></Text>
</View>
</Provider>
);
}
}
import React from 'react';
import { ScrollView, View, Text, StyleSheet } from 'react-native';
import { Portal } from '@qnpm/qportal';
export default class QPopupLayer extends React.component {
render() {
return (
<Portal>
<View>我是一个小弹层</View>
</Portal>
)
}
}