Skip to content

Commit c5401d1

Browse files
committed
fix: use isVision instead of isVisionOS (#76)
1 parent d439a8b commit c5401d1

File tree

9 files changed

+78
-66
lines changed

9 files changed

+78
-66
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
@@ -764,7 +764,7 @@ class ScrollView extends React.Component<Props, State> {
764764
this._keyboardMetrics = Keyboard.metrics();
765765
this._additionalScrollOffset = 0;
766766

767-
if (Platform.isVisionOS) {
767+
if (Platform.isVision) {
768768
this._subscriptionKeyboardWillShow = Keyboard.addListener(
769769
'keyboardWillShow',
770770
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: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@ const Platform: PlatformType = {
6565
return this.constants.isDisableAnimations ?? this.isTesting;
6666
},
6767
// $FlowFixMe[unsafe-getters-setters]
68-
get isVisionOS(): boolean {
69-
// $FlowFixMe[object-this-reference]
70-
return this.constants.interfaceIdiom === 'vision';
68+
get isVision(): boolean {
69+
return false;
7170
},
7271
// $FlowFixMe[unsafe-getters-setters]
7372
get isTV(): boolean {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ type AndroidPlatform = {
7878
Manufacturer: string,
7979
|},
8080
// $FlowFixMe[unsafe-getters-setters]
81-
get isVisionOS(): boolean,
82-
// $FlowFixMe[unsafe-getters-setters]
8381
get isTV(): boolean,
8482
// $FlowFixMe[unsafe-getters-setters]
8583
get isVision(): boolean,

packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,6 +1812,9 @@ exports[`public API should not change unintentionally Libraries/Components/Press
18121812
export type StateCallbackType = $ReadOnly<{|
18131813
pressed: boolean,
18141814
|}>;
1815+
type VisionOSProps = $ReadOnly<{|
1816+
visionos_hoverEffect?: ?HoverEffect,
1817+
|}>;
18151818
type Props = $ReadOnly<{|
18161819
accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
18171820
accessibilityElementsHidden?: ?boolean,
@@ -1862,6 +1865,7 @@ type Props = $ReadOnly<{|
18621865
testOnly_pressed?: ?boolean,
18631866
unstable_pressDelay?: ?number,
18641867
\\"aria-label\\"?: ?string,
1868+
...VisionOSProps,
18651869
|}>;
18661870
declare export default React.AbstractComponent<
18671871
Props,
@@ -3310,10 +3314,14 @@ exports[`public API should not change unintentionally Libraries/Components/Touch
33103314
type IOSProps = $ReadOnly<{|
33113315
hasTVPreferredFocus?: ?boolean,
33123316
|}>;
3317+
type VisionOSProps = $ReadOnly<{|
3318+
hoverEffect?: ?HoverEffect,
3319+
|}>;
33133320
type Props = $ReadOnly<{|
33143321
...React.ElementConfig<TouchableWithoutFeedback>,
33153322
...AndroidProps,
33163323
...IOSProps,
3324+
...VisionOSProps,
33173325
activeOpacity?: ?number,
33183326
underlayColor?: ?ColorValue,
33193327
style?: ?ViewStyleProp,
@@ -3339,9 +3347,13 @@ exports[`public API should not change unintentionally Libraries/Components/Touch
33393347
nextFocusRight?: ?number,
33403348
nextFocusUp?: ?number,
33413349
|}>;
3350+
type VisionOSProps = $ReadOnly<{|
3351+
visionos_hoverEffect?: ?HoverEffect,
3352+
|}>;
33423353
type Props = $ReadOnly<{|
33433354
...React.ElementConfig<TouchableWithoutFeedback>,
33443355
...TVProps,
3356+
...VisionOSProps,
33453357
activeOpacity?: ?number,
33463358
style?: ?ViewStyleProp,
33473359
hostRef?: ?React.Ref<typeof Animated.View>,
@@ -3640,6 +3652,7 @@ type AndroidDrawableRipple = $ReadOnly<{|
36403652
borderless?: ?boolean,
36413653
rippleRadius?: ?number,
36423654
|}>;
3655+
export type HoverEffect = \\"lift\\" | \\"highlight\\";
36433656
type AndroidDrawable = AndroidDrawableThemeAttr | AndroidDrawableRipple;
36443657
type AndroidViewProps = $ReadOnly<{|
36453658
accessibilityLabelledBy?: ?string | ?Array<string>,
@@ -3667,6 +3680,7 @@ type IOSViewProps = $ReadOnly<{|
36673680
accessibilityElementsHidden?: ?boolean,
36683681
accessibilityLanguage?: ?Stringish,
36693682
shouldRasterizeIOS?: ?boolean,
3683+
visionos_hoverEffect?: ?HoverEffect,
36703684
|}>;
36713685
export type ViewProps = $ReadOnly<{|
36723686
...DirectEventProps,

packages/rn-tester/Podfile.lock

Lines changed: 53 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,7 @@ PODS:
11901190
- RCT-Folly (= 2024.01.01.00)
11911191
- React-callinvoker (= 1000.0.0)
11921192
- React-cxxreact (= 1000.0.0)
1193+
- React-debug (= 1000.0.0)
11931194
- React-jsi (= 1000.0.0)
11941195
- React-logger (= 1000.0.0)
11951196
- React-perflogger (= 1000.0.0)
@@ -1415,65 +1416,65 @@ CHECKOUT OPTIONS:
14151416
SPEC CHECKSUMS:
14161417
boost: 8f1e9b214fa11f71081fc8ecd5fad3daf221cf7f
14171418
DoubleConversion: 71bf0761505a44e4dfddc0aa04afa049fdfb63b5
1418-
FBLazyVector: 5fdead7fff97d43aacf320bcccb748cf8527af07
1419+
FBLazyVector: bdac74ca2911225376312021896e15c79dbf9fcb
14191420
fmt: 5d9ffa7ccba126c08b730252123601d514652320
14201421
glog: 4f05d17aa39a829fee878689fc9a41af587fabba
14211422
hermes-engine: 3fed7e58e811ae8f795063cc6450714395c0276d
1422-
MyNativeView: 534e99e9c5dfd0bae242bdb06bb72e11d720c9a2
1423-
NativeCxxModuleExample: 107af3af8f5ce8802037937aabf1872ac891ad43
1423+
MyNativeView: f3d15118880cbd9b2a619c620b4709bf69fa61d7
1424+
NativeCxxModuleExample: c078c9bc1d22c81572c993ce2c1e9e8fbd8ae2a8
14241425
OCMock: 267d92c078398b7ce11d99e811e3a402744c06bc
1425-
RCT-Folly: d8c13e288297f63c0db8f083cfedebdd2649a299
1426+
RCT-Folly: 70c792c856324d6a518af75b3a307c14c226343a
14261427
RCTDeprecation: 3808e36294137f9ee5668f4df2e73dc079cd1dcf
1427-
RCTRequired: 6b32de28a5215a5990284d541bbdec8b5e3c78bf
1428-
RCTTypeSafety: 0e2bb3047d531a60b28b1d0d63e0c27a742a3019
1429-
React: a6f80cd5ba07887121f8b480991e17041a838f5c
1430-
React-callinvoker: d558dab7c4d987f1577838a50d59aeb069130d91
1428+
RCTRequired: 6aeca084db3de8b52fd8bb5cc836fe7d7b2b5751
1429+
RCTTypeSafety: 43fcd6846d491ddf9babbe4952c17f2ce6ea5666
1430+
React: b4e48c185ef18e24a9b037cfb9f4078dc6355d7c
1431+
React-callinvoker: 02d5475486a607fffcfd83b258731aa46bb06727
14311432
React-Codegen: 04a9ac6fd2f392534ed432102c6cbf117dcbf62b
1432-
React-Core: 6403b0d9390e408017e82dc7823e059c53186141
1433-
React-CoreModules: 6406001452f46e9234a2fac3861a60786285acc0
1434-
React-cxxreact: f917d87380150aaaf8053fb4280358aad33c9b71
1435-
React-debug: c12ba28faf2c0aace7cbc81d7ac7661075976460
1436-
React-Fabric: 1d2070e13efd26fa34bb67cf484794265402ac06
1437-
React-FabricImage: 238905c6db0cf533d562b52ae936bfd7ed5f00dc
1438-
React-graphics: c430227a30690a86be35a8fb8c4c36ff312ff4bc
1439-
React-hermes: f6b54c8b4553fc7a8926f3e46459923a834a99d4
1440-
React-ImageManager: 38795ba06968bbcb11343b9e1123557af34c6270
1441-
React-jserrorhandler: fba402f8090b05e29c57c7bb111413e12e89aebe
1442-
React-jsi: d5643763df3910249aac671c9b7d634e6e96af7b
1443-
React-jsiexecutor: 847a90333a8840846652833aa4e291e433277aec
1444-
React-jsinspector: c2abef5095276eeb09c4b871f3024851d2ac3e58
1445-
React-jsitracing: 3f24b1171cc7aa986555a84e1036d3a6ba98bc84
1446-
React-logger: 4b1ded6e5707b276ffd58505987aba8dd1c0c3e4
1447-
React-Mapbuffer: b562329b31a9a5e3f18a8b4632c4fa8945a504e8
1448-
React-nativeconfig: 86b0961752d6a00ccc30418bfb5bfb5ebda84149
1449-
React-NativeModulesApple: eb4d247f32f25df62d1e979721502203db3de17c
1450-
React-perflogger: 31792e118e9c4785739c1823a481d64ba3d512b9
1451-
React-RCTActionSheet: a79621f1907340e31a66a4ad5e89175ef13f4215
1452-
React-RCTAnimation: 1f6948befc38688ecd5e78b7afd7d356aafa79b3
1453-
React-RCTAppDelegate: 9b0ecae938c894f4678a5e4726c03a06e92b0d93
1454-
React-RCTBlob: afaf18b4618c4d71095dfae9fca7c548dbcf0da0
1455-
React-RCTFabric: 0e96635634399a9ccf6c3c7fb18d5bac8e2561d5
1456-
React-RCTImage: 280f6f62a88f13253013ab5709e7bc60259cc081
1457-
React-RCTLinking: 9757d922aaa9aea2baa6e6178a8b1f08c1a85add
1458-
React-RCTNetwork: 92e96ad358d83b5a809e6222987c77106f44691e
1459-
React-RCTPushNotification: 36ec0c6d3ab1195665c49c0cfd689864401cc111
1460-
React-RCTSettings: 758a24aefbee012d903ca4f80532e95edfe2b516
1461-
React-RCTTest: a30b88c8910a259ef769af7654b1812668019b22
1462-
React-RCTText: ff85a26056ca9a34198934774e0f75ac2305c2c0
1463-
React-RCTVibration: 5086b14f98c2255e71cc6a2213b6f67338dcdff4
1464-
React-rendererdebug: 6e0021971efb40a76f807b913fdba6ec3ecabbd0
1465-
React-rncore: 27b4d75d116e9ae44292dc26aecff5bbad9e6996
1466-
React-RuntimeApple: c18cc85bf03a322efd2a76fd48f4c693d6901e67
1467-
React-RuntimeCore: 631803674e2884b5d866aacac96850191a081e1a
1468-
React-runtimeexecutor: a6b1c771b522e49e6906c5354b0e8859a64e7b3e
1469-
React-RuntimeHermes: 1473abdead583d8ab788ebd31de9c8e81e19d0fc
1470-
React-runtimescheduler: 1b905cb65942a3bfdff3f003c9c778b6b46afca6
1471-
React-utils: a5c7207b3bd558fdbfc553ea7a7731fbfc7f3552
1472-
ReactCommon: 2c87b20987de3a37d3993e4c1cab34fb97c28899
1473-
ReactCommon-Samples: e95d8d284b23ed4eda37498eaa460b6468c24699
1474-
ScreenshotManager: a5f596498de38f3cf3377df636ca67355503f190
1433+
React-Core: f8004b0136f7decc8279532634b28938612d6f85
1434+
React-CoreModules: 9c3294cce3e00032144028032acf4da22d56b924
1435+
React-cxxreact: 73fd9a8dde65edd4a1c6cfad2d7431a57bf60f94
1436+
React-debug: 32dab6cb8b0d3432232c45dea7457ae5238c47cf
1437+
React-Fabric: bc8cbcd1404edb57493d52002fadb6bc1f417e8f
1438+
React-FabricImage: 48bc60132fb10a0eeae72d72dd81943c16872ede
1439+
React-graphics: c930135abad3098e4b82dad3f298feae52829f80
1440+
React-hermes: 0a8c4bfcbdc1ff61b9d1993363aeda6802c3815c
1441+
React-ImageManager: 88eac6de7cff39d2ba2cdb06bd98bd1c4629399d
1442+
React-jserrorhandler: c01a0b7135825b753fd5c729b2deb290f2480ea3
1443+
React-jsi: 9382a899fb5b5f84f4546b50cca64778635c4f82
1444+
React-jsiexecutor: cb27970e14d32627b627894e701a9ae5dae55054
1445+
React-jsinspector: 060e667e014a572852aadcc816550200942920ea
1446+
React-jsitracing: c4cbdb7c48c65729f3c4ba4dbc0d94135818d882
1447+
React-logger: b0a5a630737a8161629c1d29cc37249b03d7177d
1448+
React-Mapbuffer: bc62c7a8db875f429288640af4a75708a6631e77
1449+
React-nativeconfig: d70bae868914e174f305250afbaa9f17ece24ca2
1450+
React-NativeModulesApple: 17857f8e70713707dc6699e44a60604e340ca26a
1451+
React-perflogger: b4cf18ad5a647180372b0017976f0785dd58e37c
1452+
React-RCTActionSheet: 67e887502a6b109a840dc086caa365ef38b697ae
1453+
React-RCTAnimation: 55b4c85ef5508f395c981e5a5364579d1eb0e8ac
1454+
React-RCTAppDelegate: ad500d624c40190f44408a87ae850da050e83383
1455+
React-RCTBlob: 3cd3d166d9263c40b1f09423d595a72ee5f6ba03
1456+
React-RCTFabric: ef602234a80209e28f4a4b04cc42b81f286b4cf1
1457+
React-RCTImage: c8b1f97471711a64c54103aaf3abb06ffe4e9367
1458+
React-RCTLinking: 39f9a96c680014d7864e2a94328c9b5c16b1bc2f
1459+
React-RCTNetwork: c153dc34eb3b4243dafeb7732a7004794f2fcfc2
1460+
React-RCTPushNotification: 7e8b4717f9f49b15e30bf2440988f0c8dad34b9c
1461+
React-RCTSettings: 4389617d10fce8fa1e59623f07830ae4d16accb4
1462+
React-RCTTest: baa5056754918b7f42adfda1db81105ed05fa990
1463+
React-RCTText: 88d7180f8a88c29cb9c783f6c671375cc261923b
1464+
React-RCTVibration: 672865035f44075ae945c37ac0508930dd5979b4
1465+
React-rendererdebug: eaf5fe3f507afa26e683c9618fd717aea88065eb
1466+
React-rncore: 113f8658923af62e2306c5c52b591eee101625a6
1467+
React-RuntimeApple: a17be9669a016c7cda7889e9b5ee7489afcd627a
1468+
React-RuntimeCore: 615ab6fc54247e7243013530c8526121bbed70e8
1469+
React-runtimeexecutor: ebc5eec4b653cca71a8974f209a04e241f453e39
1470+
React-RuntimeHermes: 032fba7487b5949524489cd7ed218f3d1bd8de58
1471+
React-runtimescheduler: 763397cd4ded78ab6d5f0f563ce97622fdc108df
1472+
React-utils: 596fb6f15c61d94aab31500e2886e7b7d5b5c416
1473+
ReactCommon: 754052eef88f1ceb0b0b709cd0872d91c32bb270
1474+
ReactCommon-Samples: 37ea01aea69b7fa25eeaf37a77e644629fda4ea4
1475+
ScreenshotManager: abb77feb92964d59f57e0b112797fe24bd25aea6
14751476
SocketRocket: 0ba3e799f983d2dfa878777017659ef6c866e5c6
1476-
Yoga: e4691eb7881cae15f847654cf06b0f7962707af0
1477+
Yoga: 49f2e65de656c1814c5151e72723dd4f76ff8163
14771478

14781479
PODFILE CHECKSUM: 7e999b8158f1055609ef4491bc35f1ad658fdd6c
14791480

0 commit comments

Comments
 (0)