Skip to content

Commit f4b2ae5

Browse files
committed
fix: use isVision instead of isVisionOS (#76)
# Conflicts: # packages/react-native/Libraries/Utilities/Platform.android.js # packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap # packages/rn-tester/Podfile.lock
1 parent 3f9990e commit f4b2ae5

File tree

7 files changed

+556
-511
lines changed

7 files changed

+556
-511
lines changed

packages/react-native/Libraries/Components/Keyboard/Keyboard.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class Keyboard {
115115
);
116116

117117
constructor() {
118-
if (Platform.isVisionOS) {
118+
if (Platform.isVision) {
119119
return;
120120
}
121121

@@ -156,7 +156,7 @@ class Keyboard {
156156
listener: (...$ElementType<KeyboardEventDefinitions, K>) => mixed,
157157
context?: mixed,
158158
): EventSubscription {
159-
if (Platform.isVisionOS) {
159+
if (Platform.isVision) {
160160
warnOnce(
161161
'Keyboard-unavailable',
162162
'Keyboard API is not available on visionOS platform. The system displays the keyboard in a separate window, leaving the app’s window unaffected by the keyboard’s appearance and disappearance',
@@ -173,7 +173,7 @@ class Keyboard {
173173
* @param {string} eventType The native event string listeners are watching which will be removed.
174174
*/
175175
removeAllListeners<K: $Keys<KeyboardEventDefinitions>>(eventType: ?K): void {
176-
if (Platform.isVisionOS) {
176+
if (Platform.isVision) {
177177
return;
178178
}
179179

packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
177177

178178
componentDidMount(): void {
179179
if (Platform.OS === 'ios') {
180-
if (Platform.isVisionOS) {
180+
if (Platform.isVision) {
181181
warnOnce(
182182
'KeyboardAvoidingView-unavailable',
183183
'KeyboardAvoidingView is not available on visionOS platform. The system displays the keyboard in a separate window, leaving the app’s window unaffected by the keyboard’s appearance and disappearance',
@@ -214,7 +214,7 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
214214
...props
215215
} = this.props;
216216

217-
if (Platform.isVisionOS) {
217+
if (Platform.isVision) {
218218
// KeyboardAvoidingView is not supported on VisionOS, so we return a simple View without the onLayout handler
219219
return (
220220
<View ref={this.viewRef} style={style} {...props}>

packages/react-native/Libraries/Components/ScrollView/ScrollView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ class ScrollView extends React.Component<Props, State> {
776776
this._keyboardMetrics = Keyboard.metrics();
777777
this._additionalScrollOffset = 0;
778778

779-
if (Platform.isVisionOS) {
779+
if (Platform.isVision) {
780780
this._subscriptionKeyboardWillShow = Keyboard.addListener(
781781
'keyboardWillShow',
782782
this.scrollResponderKeyboardWillShow,

packages/react-native/Libraries/Components/StatusBar/StatusBar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ class StatusBar extends React.Component<Props> {
394394
_stackEntry = null;
395395

396396
componentDidMount() {
397-
if (Platform.isVisionOS) {
397+
if (Platform.isVision) {
398398
warnOnce(
399399
'StatusBar-unavailable',
400400
'StatusBar is not available on visionOS platform.',

packages/react-native/Libraries/Components/TextInput/InputAccessoryView.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ type Props = $ReadOnly<{|
8989
class InputAccessoryView extends React.Component<Props> {
9090
// TODO: once the 'visionos' is implemented as a platform, we can remove this
9191
componentDidMount() {
92-
if (Platform.isVisionOS) {
92+
if (Platform.isVision) {
9393
warnOnce(
9494
'component-unavailable',
9595
'InputAccessoryView is not available on visionOS platform.',
@@ -99,7 +99,7 @@ class InputAccessoryView extends React.Component<Props> {
9999

100100
render(): React.Node {
101101
// TODO: once the 'visionos' is implemented as a platform, we can remove this
102-
if (Platform.isVisionOS) {
102+
if (Platform.isVision) {
103103
return null;
104104
}
105105

packages/react-native/Libraries/Utilities/Platform.android.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ const Platform: PlatformType = {
6565
return this.constants.isDisableAnimations ?? this.isTesting;
6666
},
6767
// $FlowFixMe[unsafe-getters-setters]
68+
get isVision(): boolean {
69+
return false;
70+
},
71+
// $FlowFixMe[unsafe-getters-setters]
6872
get isTV(): boolean {
6973
// $FlowFixMe[object-this-reference]
7074
return this.constants.uiMode === 'tv';

0 commit comments

Comments
 (0)