Skip to content

Commit

Permalink
chore: replace warn with warnOnce
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagobrez committed Nov 5, 2023
1 parent 1759b93 commit 3341d27
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import LayoutAnimation from '../../LayoutAnimation/LayoutAnimation';
import dismissKeyboard from '../../Utilities/dismissKeyboard';
import Platform from '../../Utilities/Platform';
import NativeKeyboardObserver from './NativeKeyboardObserver';
import warnOnce from '../../Utilities/warnOnce';

export type KeyboardEventName = $Keys<KeyboardEventDefinitions>;

Expand Down Expand Up @@ -115,8 +116,9 @@ class Keyboard {

constructor() {
if (Platform.isVisionOS) {
console.warn(
'Keyboard is not supported on VisionOS. The system displays the keyboard in a separate window, leaving the app’s window unaffected by the keyboard’s appearance and disappearance',
warnOnce(
'Keyboard-unavailable',
'Keyboard 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',
);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import AccessibilityInfo from '../AccessibilityInfo/AccessibilityInfo';
import View from '../View/View';
import Keyboard from './Keyboard';
import * as React from 'react';
import warnOnce from '../../Utilities/warnOnce';

type Props = $ReadOnly<{|
...ViewProps,
Expand Down Expand Up @@ -177,8 +178,9 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
componentDidMount(): void {
if (Platform.OS === 'ios') {
if (Platform.isVisionOS) {
console.warn(
'KeyboardAvoidingView is not supported on VisionOS. The system displays the keyboard in a separate window, leaving the app’s window unaffected by the keyboard’s appearance and disappearance',
warnOnce(
'KeyboardAvoidingView-unavailable',
'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',
);
return;
}
Expand Down

0 comments on commit 3341d27

Please sign in to comment.