Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions packages/eslint-plugin-react-native/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@ const publicAPIMapping = {
'RefreshControlPropsIOS',
],
},
'Libraries/Components/SafeAreaView/SafeAreaView': {
default: 'SafeAreaView',
types: ['SafeAreaViewInstance'],
},
'Libraries/Components/ScrollView/ScrollView': {
default: 'ScrollView',
types: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ module.exports = new Set([
'Pressable',
'ProgressBarAndroid',
'ProgressViewIOS',
'SafeAreaView',
'ScrollView',
'SectionList',
'Slider',
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @format
*/

import SafeAreaView from '../../Components/SafeAreaView/SafeAreaView';
import SafeAreaView from '../../../src/private/components/safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE';
import StyleSheet, {
type ColorValue,
type ViewStyleProp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';

import type {HostInstance} from 'react-native';

import SafeAreaView from '../../../../src/private/components/safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE';
import * as Fantom from '@react-native/fantom';
import * as React from 'react';
import {createRef} from 'react';
Expand Down Expand Up @@ -116,3 +117,41 @@ describe('experimental_onSafeAreaInsetsChange', () => {
).toEqual(<rn-view experimental_onSafeAreaInsetsChange="true" />);
});
});

describe('<SafeAreaView>', () => {
it('applies the insets it receives as padding', () => {
const root = Fantom.createRoot();
const nodeRef = createRef<HostInstance>();

Fantom.runTask(() => {
root.render(<SafeAreaView collapsable={false} ref={nodeRef} />);
});

expect(
root
.getRenderedOutput({
props: ['paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'],
})
.toJSX(),
).toEqual(<rn-view />);

Fantom.dispatchNativeEvent(nodeRef, 'safeAreaInsetsChange', {
insets: INSETS,
});

expect(
root
.getRenderedOutput({
props: ['paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'],
})
.toJSX(),
).toEqual(
<rn-view
paddingBottom="34"
paddingLeft="0"
paddingRight="0"
paddingTop="44"
/>,
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @format
*/

import SafeAreaView from '../../Components/SafeAreaView/SafeAreaView';
import SafeAreaView from '../../../src/private/components/safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE';
import View from '../../Components/View/View';
import StyleSheet from '../../StyleSheet/StyleSheet';
import Text from '../../Text/Text';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
* @format
*/

import type {ViewProps} from '../../Components/View/ViewPropTypes';
import type {LogLevel} from '../Data/LogBoxLog';

import SafeAreaView from '../../Components/SafeAreaView/SafeAreaView';
import SafeAreaView from '../../../src/private/components/safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE';
import View from '../../Components/View/View';
import StyleSheet from '../../StyleSheet/StyleSheet';
import Text from '../../Text/Text';
Expand All @@ -27,13 +26,10 @@ type Props = Readonly<{
level: LogLevel,
}>;

const LogBoxInspectorHeaderSafeArea: React.ComponentType<ViewProps> =
Platform.OS === 'android' ? View : SafeAreaView;

export default function LogBoxInspectorHeader(props: Props): React.Node {
if (props.level === 'syntax') {
return (
<LogBoxInspectorHeaderSafeArea style={styles[props.level]}>
<SafeAreaView style={styles[props.level]}>
<View style={styles.header}>
<View style={styles.title}>
<Text
Expand All @@ -44,7 +40,7 @@ export default function LogBoxInspectorHeader(props: Props): React.Node {
</Text>
</View>
</View>
</LogBoxInspectorHeaderSafeArea>
</SafeAreaView>
);
}

Expand All @@ -56,7 +52,7 @@ export default function LogBoxInspectorHeader(props: Props): React.Node {
const titleText = `Log ${props.selectedIndex + 1} of ${props.total}`;

return (
<LogBoxInspectorHeaderSafeArea style={styles[props.level]}>
<SafeAreaView style={styles[props.level]}>
<View style={styles.header}>
<LogBoxInspectorHeaderButton
id="logbox_header_button_prev"
Expand All @@ -81,7 +77,7 @@ export default function LogBoxInspectorHeader(props: Props): React.Node {
onPress={() => props.onSelectIndex(nextIndex)}
/>
</View>
</LogBoxInspectorHeaderSafeArea>
</SafeAreaView>
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`LogBoxNotificationContainer should render both an error and warning notification 1`] = `
<SafeAreaView
<View
experimental_onSafeAreaInsetsChange={[Function]}
style={
Object {
"alignItems": "center",
"bottom": 20,
"left": 10,
"pointerEvents": "box-none",
"position": "absolute",
"right": 10,
}
Array [
Object {
"alignItems": "center",
"bottom": 20,
"left": 10,
"pointerEvents": "box-none",
"position": "absolute",
"right": 10,
},
null,
]
}
>
<View
Expand Down Expand Up @@ -107,7 +111,7 @@ exports[`LogBoxNotificationContainer should render both an error and warning not
totalLogCount={1}
/>
</View>
</SafeAreaView>
</View>
`;

exports[`LogBoxNotificationContainer should render null with no logs 1`] = `null`;
Expand All @@ -119,16 +123,20 @@ exports[`LogBoxNotificationContainer should render selected fatal error even whe
exports[`LogBoxNotificationContainer should render selected syntax error even when disabled 1`] = `null`;

exports[`LogBoxNotificationContainer should render the latest error notification 1`] = `
<SafeAreaView
<View
experimental_onSafeAreaInsetsChange={[Function]}
style={
Object {
"alignItems": "center",
"bottom": 20,
"left": 10,
"pointerEvents": "box-none",
"position": "absolute",
"right": 10,
}
Array [
Object {
"alignItems": "center",
"bottom": 20,
"left": 10,
"pointerEvents": "box-none",
"position": "absolute",
"right": 10,
},
null,
]
}
>
<View
Expand Down Expand Up @@ -178,20 +186,24 @@ exports[`LogBoxNotificationContainer should render the latest error notification
totalLogCount={2}
/>
</View>
</SafeAreaView>
</View>
`;

exports[`LogBoxNotificationContainer should render the latest warning notification 1`] = `
<SafeAreaView
<View
experimental_onSafeAreaInsetsChange={[Function]}
style={
Object {
"alignItems": "center",
"bottom": 20,
"left": 10,
"pointerEvents": "box-none",
"position": "absolute",
"right": 10,
}
Array [
Object {
"alignItems": "center",
"bottom": 20,
"left": 10,
"pointerEvents": "box-none",
"position": "absolute",
"right": 10,
},
null,
]
}
>
<View
Expand Down Expand Up @@ -241,5 +253,5 @@ exports[`LogBoxNotificationContainer should render the latest warning notificati
totalLogCount={2}
/>
</View>
</SafeAreaView>
</View>
`;
11 changes: 1 addition & 10 deletions packages/react-native/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ let reactFabric = RNTarget(
"components/inputaccessory",
"components/modal",
"components/rncore",
"components/safeareaview",
"components/switch",
"components/text",
"components/textinput",
Expand Down Expand Up @@ -528,12 +527,6 @@ let reactFabricSwitch = RNTarget(
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging]
)

let reactFabricSafeAreaView = RNTarget(
name: .reactFabricSafeAreaView,
path: "ReactCommon/react/renderer/components/safeareaview",
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging]
)

let reactFabricTextLayoutManager = RNTarget(
name: .reactFabricTextLayoutManager,
path: "ReactCommon/react/renderer/textlayoutmanager",
Expand Down Expand Up @@ -586,7 +579,7 @@ let reactRCTFabric = RNTarget(
name: .reactRCTFabric,
path: "React/Fabric",
searchPaths: [virtualViewPath],
dependencies: [.reactNativeDependencies, .reactCore, .reactRCTImage, .yoga, .reactRCTText, .jsi, .reactFabricInputAccessory, .reactFabricModal, .reactFabricSafeAreaView, .reactFabricSwitch, .reactFabricText, .reactFabricTextInput, .reactFabricUnimplementedView, .reactFabricTextLayoutManager, .reactGraphics, .reactImageManager, .reactDebug, .reactUtils, .reactPerformanceTimeline, .reactRendererDebug, .reactRendererConsistency, .reactRuntimeScheduler, .reactRCTAnimation, .reactJsInspector, .reactJsInspectorNetwork, .reactJsInspectorTracing, .reactFabric, .reactFabricImage, .rctSwiftUIWrapper]
dependencies: [.reactNativeDependencies, .reactCore, .reactRCTImage, .yoga, .reactRCTText, .jsi, .reactFabricInputAccessory, .reactFabricModal, .reactFabricSwitch, .reactFabricText, .reactFabricTextInput, .reactFabricUnimplementedView, .reactFabricTextLayoutManager, .reactGraphics, .reactImageManager, .reactDebug, .reactUtils, .reactPerformanceTimeline, .reactRendererDebug, .reactRendererConsistency, .reactRuntimeScheduler, .reactRCTAnimation, .reactJsInspector, .reactJsInspectorNetwork, .reactJsInspectorTracing, .reactFabric, .reactFabricImage, .rctSwiftUIWrapper]
)

/// React-ImageManagerApple.podspec
Expand Down Expand Up @@ -709,7 +702,6 @@ let targets = [
reactFabricImage,
reactFabricInputAccessory,
reactFabricModal,
reactFabricSafeAreaView,
reactFabricSwitch,
reactFabricTextLayoutManager,
reactFabricText,
Expand Down Expand Up @@ -896,7 +888,6 @@ extension String {
static let reactFabricImage = "React-FabricImage"
static let reactFabricInputAccessory = "React-FabricInputAccessory"
static let reactFabricModal = "React-FabricModal"
static let reactFabricSafeAreaView = "React-FabricSafeAreaView"
static let reactFabricSwitch = "React-FabricSwitch"
static let reactFabricTextLayoutManager = "React-FabricTextLayoutManager"
static let reactFabricText = "React-FabricText"
Expand Down
1 change: 0 additions & 1 deletion packages/react-native/React/Base/RCTBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
@"RCTDebuggingOverlayManager",
@"RCTModalHostViewManager",
@"RCTRefreshControlManager",
@"RCTSafeAreaViewManager",
@"RCTScrollContentViewManager",
@"RCTScrollViewManager",
@"RCTSwitchManager",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Class<RCTComponentViewProtocol> RCTDebuggingOverlayCls(void) __attribute__((used
Class<RCTComponentViewProtocol> RCTInputAccessoryCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTParagraphCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTPullToRefreshViewCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTSafeAreaViewCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTScrollViewCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTSwitchCls(void) __attribute__((used));
Class<RCTComponentViewProtocol> RCTTextInputCls(void) __attribute__((used));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
{"InputAccessoryView", RCTInputAccessoryCls},
{"Paragraph", RCTParagraphCls},
{"PullToRefreshView", RCTPullToRefreshViewCls},
{"SafeAreaView", RCTSafeAreaViewCls},
{"ScrollView", RCTScrollViewCls},
{"Switch", RCTSwitchCls},
{"TextInput", RCTTextInputCls},
Expand Down

This file was deleted.

Loading
Loading