File tree 3 files changed +33
-3
lines changed
HTMLEngineProvider/HTMLRenderers
PressableWithSecondaryInteraction 3 files changed +33
-3
lines changed Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import { ScrollView } from 'react-native-gesture-handler' ;
3
+ import { View } from 'react-native' ;
4
+ import _ from 'underscore' ;
5
+ import withLocalize from '../../withLocalize' ;
6
+ import htmlRendererPropTypes from './htmlRendererPropTypes' ;
7
+
8
+ const PreRenderer = ( props ) => {
9
+ const TDefaultRenderer = props . TDefaultRenderer ;
10
+ const defaultRendererProps = _ . omit ( props , [ 'TDefaultRenderer' ] ) ;
11
+
12
+ return (
13
+ < ScrollView horizontal >
14
+ < View onStartShouldSetResponder = { ( ) => true } >
15
+ < TDefaultRenderer
16
+ // eslint-disable-next-line react/jsx-props-no-spreading
17
+ { ...defaultRendererProps }
18
+ />
19
+ </ View >
20
+ </ ScrollView >
21
+ ) ;
22
+ } ;
23
+
24
+ PreRenderer . propTypes = htmlRendererPropTypes ;
25
+ PreRenderer . displayName = 'PreRenderer' ;
26
+
27
+ export default withLocalize ( PreRenderer ) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import AnchorRenderer from './AnchorRenderer';
2
2
import CodeRenderer from './CodeRenderer' ;
3
3
import EditedRenderer from './EditedRenderer' ;
4
4
import ImageRenderer from './ImageRenderer' ;
5
+ import PreRenderer from './PreRenderer' ;
5
6
6
7
/**
7
8
* This collection defines our custom renderers. It is a mapping from HTML tag type to the corresponding component.
@@ -14,4 +15,5 @@ export default {
14
15
15
16
// Custom tag renderers
16
17
edited : EditedRenderer ,
18
+ pre : PreRenderer ,
17
19
} ;
Original file line number Diff line number Diff line change 1
1
import _ from 'underscore' ;
2
2
import React , { Component } from 'react' ;
3
- import { Pressable } from 'react-native' ;
3
+ import { Platform , Pressable } from 'react-native' ;
4
4
import { LongPressGestureHandler , State } from 'react-native-gesture-handler' ;
5
5
import SelectionScraper from '../../libs/SelectionScraper' ;
6
6
import * as pressableWithSecondaryInteractionPropTypes from './pressableWithSecondaryInteractionPropTypes' ;
@@ -31,7 +31,8 @@ class PressableWithSecondaryInteraction extends Component {
31
31
* @param {Object } e
32
32
*/
33
33
callSecondaryInteractionWithMappedEvent ( e ) {
34
- if ( e . nativeEvent . state !== State . ACTIVE ) {
34
+ const isHoverableDevice = ( ( Platform . OS === 'web' ) || ( Platform . OS === 'windows' ) || ( Platform . OS === 'macos' ) ) ;
35
+ if ( ( e . nativeEvent . state !== State . ACTIVE ) || isHoverableDevice ) {
35
36
return ;
36
37
}
37
38
@@ -73,7 +74,7 @@ class PressableWithSecondaryInteraction extends Component {
73
74
onPressOut = { this . props . onPressOut }
74
75
onPress = { this . props . onPress }
75
76
ref = { el => this . pressableRef = el }
76
- // eslint-disable-next-line react/jsx-props-no-spreading
77
+ // eslint-disable-next-line react/jsx-props-no-spreading
77
78
{ ...defaultPressableProps }
78
79
>
79
80
{ this . props . children }
You can’t perform that action at this time.
0 commit comments