mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-25 23:48:54 +00:00
[fix] SafeAreaView ref supports setNativeProps
https://github.com/facebook/react-native/pull/24589 Close #1407
This commit is contained in:
committed by
Nicolas Gallagher
parent
8f5e7d4e14
commit
a7ddd7b9ac
+15
-19
@@ -12,28 +12,24 @@ import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';
|
||||
import React from 'react';
|
||||
import StyleSheet from '../StyleSheet';
|
||||
import View from '../View';
|
||||
import ViewPropTypes, { type ViewProps } from '../ViewPropTypes';
|
||||
import { type ViewProps } from '../ViewPropTypes';
|
||||
|
||||
class SafeAreaView extends React.Component<ViewProps> {
|
||||
static displayName = 'SafeAreaView';
|
||||
const SafeAreaView = React.forwardRef<View, ViewProps>((props: ViewProps, ref) => {
|
||||
const { style, ...rest } = props;
|
||||
|
||||
static propTypes = {
|
||||
...ViewPropTypes
|
||||
};
|
||||
return (
|
||||
<View
|
||||
{...rest}
|
||||
ref={ref}
|
||||
style={StyleSheet.compose(
|
||||
styles.root,
|
||||
style
|
||||
)}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
render() {
|
||||
const { style, ...rest } = this.props;
|
||||
return (
|
||||
<View
|
||||
{...rest}
|
||||
style={StyleSheet.compose(
|
||||
styles.root,
|
||||
style
|
||||
)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
SafeAreaView.displayName = 'SafeAreaView';
|
||||
|
||||
const cssFunction: 'constant' | 'env' = (function() {
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user