File tree Expand file tree Collapse file tree
react-native-web-demo/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,16 +12,38 @@ export default class Search extends Component {
1212 onChangeText : PropTypes . func ,
1313 onEndText : PropTypes . func ,
1414 onCleanText : PropTypes . func ,
15- keyboardType : PropTypes . string
15+ keyboardType : PropTypes . string ,
16+ onMaybeFinish :PropTypes . func
1617 }
1718 static defaultProps = {
1819 keyboardType : 'ascii-capable'
1920 }
21+
22+ constructor ( ) {
23+ super ( ...arguments )
24+ this . state = {
25+ value : this . props . value
26+ }
27+ }
2028 _onClean = ( ) => {
2129 this . props . onCleanText && this . props . onCleanText ( '' )
30+ this . setState ( {
31+ value : ''
32+ } )
2233 }
2334 _onChangeText = ( text ) => {
2435 this . props . onChangeText && this . props . onChangeText ( text )
36+
37+ if ( this . props . onMaybeFinish ) {
38+ if ( this . textChangeTimer ) {
39+ clearTimeout ( this . textChangeTimer )
40+ this . textChangeTimer = false
41+ }
42+
43+ this . textChangeTimer = setTimeout ( ( ) => {
44+ this . props . onMaybeFinish ( text )
45+ } , 1000 )
46+ }
2547 }
2648 _onEndEditing = ( event ) => {
2749 this . props . onEndText && this . props . onEndText ( event . nativeEvent . text )
Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ export default class Console extends Plugin {
182182 const warnList = [ ]
183183 const errorList = [ ]
184184 Console . cachedLogList . forEach ( ( logItem ) => {
185- if ( ! searchText2 || logsToString ( logItem . msg ) . join ( '' ) . toLowerCase ( ) . indexOf ( searchText1 ) > - 1 ) {
185+ if ( ! searchText1 || logsToString ( logItem . msg ) . join ( '' ) . toLowerCase ( ) . indexOf ( searchText1 ) > - 1 ) {
186186 allList . push ( logItem )
187187 }
188188 if ( logItem . logType === Warn && ( ! searchText2 || logsToString ( logItem . msg ) . join ( '' ) . toLowerCase ( ) . indexOf ( searchText2 ) > - 1 ) ) {
@@ -251,7 +251,7 @@ export default class Console extends Plugin {
251251 return (
252252 < Search
253253 keyboardType = { 'default' }
254- onEndText = { this . _updateListBySearchText }
254+ onMaybeFinish = { this . _updateListBySearchText }
255255 onCleanText = { this . _updateListBySearchText }
256256 defaultValue = { this . state . searchTextMap [ this . tabName ] } />
257257 )
Original file line number Diff line number Diff line change @@ -24,13 +24,13 @@ export default class Network extends Plugin {
2424 Network . _proxyFetch = new ProxyFetch ( window )
2525 Network . _proxyFetch . onUpdate ( ( fetchList ) => {
2626 if ( Network . currentInstance && ! Network . currentInstance . _isRender ) {
27- Network . currentInstance . _updateList ( TABS . Request , fetchList )
27+ Network . currentInstance . _updateListBySearchText ( )
2828 }
2929 } )
3030 // 请求重发更新
3131 Network . _proxyFetch . onReUpdate ( ( fetchList ) => {
3232 if ( Network . currentInstance && ! Network . currentInstance . _isRender ) {
33- Network . currentInstance . _updateList ( TABS . ReRequest , fetchList )
33+ Network . currentInstance . _updateListBySearchText ( )
3434 }
3535 } )
3636 }
@@ -85,7 +85,7 @@ export default class Network extends Plugin {
8585 } )
8686 }
8787
88- _updateListBySearchText = ( searchText = '' ) => {
88+ _updateListBySearchText = ( searchText = this . state . searchTextMap [ this . tabName ] ) => {
8989 const list = Network . _getFetchList ( this . tabName )
9090 this . setState ( {
9191 searchTextMap : {
@@ -105,9 +105,9 @@ export default class Network extends Plugin {
105105 _renderHeader = ( ) => {
106106 return (
107107 < Search
108- onChangeText = { this . _updateListBySearchText }
108+ onMaybeFinish = { this . _updateListBySearchText }
109109 onCleanText = { this . _updateListBySearchText }
110- value = { this . state . searchTextMap [ this . tabName ] }
110+ defaultValue = { this . state . searchTextMap [ this . tabName ] }
111111 />
112112 )
113113 }
Original file line number Diff line number Diff line change @@ -25,6 +25,12 @@ class App extends React.Component {
2525 fetch ( 'https://static.geetest.com/static/js/fullpage.8.9.600.js' )
2626 fetch ( 'https://static.geetest.com/static/wind/sprite2x.1.5.8.png' )
2727 fetch ( 'https://static.geetest.com/static/js/fullpage.8.9.6.js' )
28+ setInterval ( ( ) => {
29+ fetch ( 'https://static.geetest.com/static/js/fullpage.8.9.6.js?ts=' + new Date ( ) . getTime ( ) )
30+ console . log ( 'some log ' + new Date ( ) . getTime ( ) )
31+ console . warn ( 'some warning ' + new Date ( ) . getTime ( ) )
32+ console . error ( 'some error ' + new Date ( ) . getTime ( ) )
33+ } , 5000 )
2834 }
2935
3036 render ( ) {
You can’t perform that action at this time.
0 commit comments