react-native-tvos 0.85.3-2 → 0.85.3-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,7 +29,7 @@ export default class ReactNativeVersion {
29
29
  static major: number = 0;
30
30
  static minor: number = 85;
31
31
  static patch: number = 3;
32
- static prerelease: string | null = '2';
32
+ static prerelease: string | null = '3';
33
33
 
34
34
  static getVersionString(): string {
35
35
  return `${this.major}.${this.minor}.${this.patch}${this.prerelease != null ? `-${this.prerelease}` : ''}`;
@@ -12,11 +12,9 @@ import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType';
12
12
  import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
13
13
  import type {GestureResponderEvent} from '../../Types/CoreEventTypes';
14
14
 
15
- import TouchableHighlight from '../../Components/Touchable/TouchableHighlight';
16
- import TouchableWithoutFeedback from '../../Components/Touchable/TouchableWithoutFeedback';
15
+ import Pressable from '../../Components/Pressable/Pressable';
17
16
  import View from '../../Components/View/View';
18
17
  import StyleSheet from '../../StyleSheet/StyleSheet';
19
- import Platform from '../../Utilities/Platform';
20
18
  import * as LogBoxStyle from './LogBoxStyle';
21
19
  import * as React from 'react';
22
20
  import {useState} from 'react';
@@ -30,9 +28,10 @@ component LogBoxButton(
30
28
  children?: React.Node,
31
29
  hitSlop?: ?EdgeInsetsProp,
32
30
  onPress?: ?(event: GestureResponderEvent) => void,
31
+ onFocusChange?: ?(focused: boolean) => void,
33
32
  style?: ViewStyleProp,
34
33
  ) {
35
- const [pressed, setPressed] = useState(false);
34
+ const [focused, setFocused] = useState(false);
36
35
 
37
36
  let resolvedBackgroundColor = backgroundColor;
38
37
  if (!resolvedBackgroundColor) {
@@ -42,41 +41,54 @@ component LogBoxButton(
42
41
  };
43
42
  }
44
43
 
45
- const content = (
46
- <View
47
- id={id}
48
- style={StyleSheet.compose(
49
- {
50
- backgroundColor: pressed
51
- ? resolvedBackgroundColor.pressed
52
- : resolvedBackgroundColor.default,
53
- },
54
- style,
55
- )}>
56
- {children}
57
- </View>
58
- );
44
+ if (onPress == null) {
45
+ return (
46
+ <View
47
+ id={id}
48
+ style={StyleSheet.compose(
49
+ {backgroundColor: resolvedBackgroundColor.default},
50
+ style,
51
+ )}>
52
+ {children}
53
+ </View>
54
+ );
55
+ }
59
56
 
60
- return onPress == null ? (
61
- content
62
- ) : Platform.isTV ? (
63
- <TouchableHighlight
64
- tvParallaxProperties={{enabled: false}}
65
- hitSlop={hitSlop}
66
- onPress={onPress}
67
- onPressIn={() => setPressed(true)}
68
- onPressOut={() => setPressed(false)}>
69
- {content}
70
- </TouchableHighlight>
71
- ) : (
72
- <TouchableWithoutFeedback
57
+ return (
58
+ <Pressable
59
+ id={id}
60
+ focusable={true}
73
61
  hitSlop={hitSlop}
74
62
  onPress={onPress}
75
- onPressIn={() => setPressed(true)}
76
- onPressOut={() => setPressed(false)}>
77
- {content}
78
- </TouchableWithoutFeedback>
63
+ onFocus={() => {
64
+ setFocused(true);
65
+ onFocusChange?.(true);
66
+ }}
67
+ onBlur={() => {
68
+ setFocused(false);
69
+ onFocusChange?.(false);
70
+ }}
71
+ style={({pressed}) =>
72
+ StyleSheet.compose(
73
+ {
74
+ backgroundColor: pressed
75
+ ? resolvedBackgroundColor.pressed
76
+ : resolvedBackgroundColor.default,
77
+ },
78
+ focused ? StyleSheet.compose(style, styles.focusRing) : style,
79
+ )
80
+ }>
81
+ {children}
82
+ </Pressable>
79
83
  );
80
84
  }
81
85
 
86
+ const styles = StyleSheet.create({
87
+ focusRing: {
88
+ borderWidth: 2,
89
+ borderColor: LogBoxStyle.getTextColor(0.6),
90
+ borderRadius: 4,
91
+ },
92
+ });
93
+
82
94
  export default LogBoxButton;
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(85),
26
26
  RCTVersionPatch: @(3),
27
- RCTVersionPrerelease: @"2",
27
+ RCTVersionPrerelease: @"3",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -1274,8 +1274,20 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
1274
1274
  CGPoint targetContentOffset = isHorizontalSnap
1275
1275
  ? CGPointMake(targetOffset, scrollView.contentOffset.y)
1276
1276
  : CGPointMake(scrollView.contentOffset.x, targetOffset);
1277
+ // Where the focused item should snap to. We don't scroll to it here: this view's
1278
+ // scrollViewWillEndDragging:withVelocity:targetContentOffset: override sets
1279
+ // *targetContentOffset = preferredContentOffset. On tvOS the focus engine routes its
1280
+ // focus-driven scroll through that delegate, so the item snaps to this offset via the
1281
+ // engine's own scroll, even when it's already on screen. An explicit setContentOffset here
1282
+ // would just scroll a second time.
1283
+ // https://developer.apple.com/documentation/uikit/uiscrollviewdelegate/scrollviewwillenddragging(_:withvelocity:targetcontentoffset:)
1284
+ // https://developer.apple.com/forums/thread/22103?answerId=73300022#73300022
1277
1285
  self.preferredContentOffset = targetContentOffset;
1278
- [_scrollView setContentOffset:targetContentOffset animated:scrollProps.scrollAnimationEnabled];
1286
+ if (!scrollProps.scrollAnimationEnabled) {
1287
+ // Animations off: RCTEnhancedScrollView.didUpdateFocusInContext blocks the engine's
1288
+ // scroll, so the delegate never fires — set the offset directly.
1289
+ scrollView.contentOffset = targetContentOffset;
1290
+ }
1279
1291
  }
1280
1292
 
1281
1293
  - (void)didUpdateFocusInContext:(UIFocusUpdateContext *)context
@@ -771,12 +771,23 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
771
771
 
772
772
  - (void)_setAttributedString:(NSAttributedString *)attributedString
773
773
  {
774
+ #if TARGET_OS_TV
775
+ // Attribute-free string prevents the tvOS keyboard from inheriting the component's small font.
776
+ if ([attributedString.string isEqualToString:_backedTextInputView.attributedText.string]) {
777
+ return;
778
+ }
779
+ #else
774
780
  if ([self _textOf:attributedString equals:_backedTextInputView.attributedText]) {
775
781
  return;
776
782
  }
783
+ #endif
777
784
  UITextRange *selectedRange = _backedTextInputView.selectedTextRange;
778
785
  NSInteger oldTextLength = _backedTextInputView.attributedText.string.length;
786
+ #if TARGET_OS_TV
787
+ _backedTextInputView.attributedText = [[NSAttributedString alloc] initWithString:attributedString.string];
788
+ #else
779
789
  _backedTextInputView.attributedText = attributedString;
790
+ #endif
780
791
  // Updating the UITextView attributedText, for example changing the lineHeight, the color or adding
781
792
  // a new paragraph with \n, causes the cursor to move to the end of the Text and scroll.
782
793
  // This is fixed by restoring the cursor position and scrolling to that position (iOS issue 652653).
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.85.3-2
1
+ VERSION_NAME=0.85.3-3
2
2
  react.internal.publishingGroup=io.github.react-native-tvos
3
3
  react.internal.hermesPublishingGroup=com.facebook.hermes
4
4
 
@@ -63,6 +63,7 @@ public class ReactAndroidHWInputDeviceHelper {
63
63
  .put(KeyEvent.KEYCODE_9, "9")
64
64
  .put(KeyEvent.KEYCODE_CHANNEL_DOWN, "channelDown")
65
65
  .put(KeyEvent.KEYCODE_CHANNEL_UP, "channelUp")
66
+ .put(KeyEvent.KEYCODE_DEL, "delete")
66
67
  .put(KeyEvent.KEYCODE_BOOKMARK, "bookmark")
67
68
  .put(KeyEvent.KEYCODE_AVR_INPUT, "avrInput")
68
69
  .put(KeyEvent.KEYCODE_AVR_POWER, "avrPower")
@@ -15,6 +15,6 @@ public object ReactNativeVersion {
15
15
  "major" to 0,
16
16
  "minor" to 85,
17
17
  "patch" to 3,
18
- "prerelease" to "2"
18
+ "prerelease" to "3"
19
19
  )
20
20
  }
@@ -22,7 +22,7 @@ struct ReactNativeVersionType {
22
22
  int32_t Major = 0;
23
23
  int32_t Minor = 85;
24
24
  int32_t Patch = 3;
25
- std::string_view Prerelease = "2";
25
+ std::string_view Prerelease = "3";
26
26
  };
27
27
 
28
28
  constexpr ReactNativeVersionType ReactNativeVersion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-tvos",
3
- "version": "0.85.3-2",
3
+ "version": "0.85.3-3",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -198,7 +198,7 @@
198
198
  "whatwg-fetch": "^3.0.0",
199
199
  "ws": "^7.5.10",
200
200
  "yargs": "^17.6.2",
201
- "@react-native-tvos/virtualized-lists": "0.85.3-2"
201
+ "@react-native-tvos/virtualized-lists": "0.85.3-3"
202
202
  },
203
203
  "codegenConfig": {
204
204
  "libraries": [