1
1
2
2
import React , { useState , useEffect } from 'react' ;
3
+ import { Button } from 'react-native-elements' ;
3
4
import { ActivityIndicator , FlatList , Platform , TextInput , KeyboardAvoidingView , Text , View , StyleSheet } from 'react-native' ;
4
5
import { AnalyzerService } from './pyright/server/src/analyzer/service' ;
5
6
import { ArgumentCategory , ParseNodeType } from './pyright/server/src/parser/parseNodes' ;
@@ -46,19 +47,40 @@ function CodeInput(props) {
46
47
clearTimeout ( changeTimeout ) ;
47
48
setChangeTimeout ( 0 ) ;
48
49
}
50
+
49
51
if ( oldValue != newValue ) {
50
52
console . log ( "done" ) ;
53
+
51
54
if ( newValue . length > 0 ) {
52
55
patch ( props . offset , oldValue , newValue ) ;
53
56
}
54
57
}
55
58
}
59
+ function changeValue ( ) {
60
+ newValue = newValue == "True" ? onChange ( "False" ) : onChange ( "True" ) ;
61
+ }
62
+
63
+ if ( props . keyword == "yes" ) {
64
+
65
+ return (
66
+
67
+ < Button onPress = { changeValue }
68
+ title = { newValue }
69
+ type = "clear"
70
+ titleStyle = { [ props . style , { fontFamily : font } , debugStyle ] }
71
+ buttonStyle = { { padding : 0 } }
72
+ />
73
+
74
+ )
75
+ }
76
+
56
77
return ( < TextInput { ...props } style = { [ props . style , { fontFamily : font , paddingVertical : 0 , textAlignVertical : 'top' } , debugStyle ] } onChangeText = { onChange } onEndEditing = { onDone } > { newValue } </ TextInput > ) ;
57
78
}
58
79
59
80
const styles = StyleSheet . create ( {
60
81
keyword : {
61
- color : 'blue' ,
82
+ color : '#145C9E' ,
83
+ fontSize : 15 ,
62
84
} ,
63
85
} ) ;
64
86
@@ -76,7 +98,8 @@ function Indent(props) {
76
98
function renderKeyword ( token , changeCode , offset ) {
77
99
if ( token . keywordType == KeywordType . True || token . keywordType == KeywordType . False ) {
78
100
let value = token . keywordType == KeywordType . True ? "True" : "False" ;
79
- return ( < CodeInput placeholder = "bool"
101
+ return ( < CodeInput placeholder = "bool"
102
+ keyword = "yes"
80
103
style = { styles . keyword }
81
104
editable = { true }
82
105
multiline = { false }
@@ -155,7 +178,7 @@ function renderParseNode(node, changeCode) {
155
178
if ( node . items . length == 1 ) {
156
179
return renderParseNode ( node . items [ 0 ] , changeCode ) ;
157
180
}
158
- sbreak ;
181
+ break ;
159
182
case ParseNodeType . MemberAccess :
160
183
return ( < View style = { { flexDirection : 'row' , alignItems : 'flex-end' } } > { renderParseNode ( node . leftExpression , changeCode ) } < Code > .</ Code > { renderParseNode ( node . memberName , changeCode ) } </ View > ) ;
161
184
0 commit comments