react-native-screens 3.10.0 → 3.10.1
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.
|
@@ -5,7 +5,7 @@ import androidx.activity.OnBackPressedCallback
|
|
|
5
5
|
import androidx.appcompat.widget.SearchView
|
|
6
6
|
import androidx.fragment.app.Fragment
|
|
7
7
|
|
|
8
|
-
class CustomSearchView(context: Context
|
|
8
|
+
class CustomSearchView(context: Context, fragment: Fragment) : SearchView(context) {
|
|
9
9
|
/*
|
|
10
10
|
CustomSearchView uses some variables from SearchView. They are listed below with links to documentation
|
|
11
11
|
isIconified - https://developer.android.com/reference/android/widget/SearchView#setIconified(boolean)
|
|
@@ -181,8 +181,9 @@ class ScreenStackFragment : ScreenFragment {
|
|
|
181
181
|
private fun updateToolbarMenu(menu: Menu) {
|
|
182
182
|
menu.clear()
|
|
183
183
|
if (shouldShowSearchBar()) {
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
val currentContext = context
|
|
185
|
+
if (searchView == null && currentContext != null) {
|
|
186
|
+
val newSearchView = CustomSearchView(currentContext, this)
|
|
186
187
|
searchView = newSearchView
|
|
187
188
|
onSearchViewCreate?.invoke(newSearchView)
|
|
188
189
|
}
|
|
@@ -360,10 +360,12 @@ Defaults to `auto`.
|
|
|
360
360
|
|
|
361
361
|
Sets the translucency of the status bar (similar to the `StatusBar` component). Defaults to `false`.
|
|
362
362
|
|
|
363
|
-
### Search bar
|
|
363
|
+
### Search bar (iOS only)
|
|
364
364
|
|
|
365
365
|
The search bar is just a `searchBar` property that can be specified in the navigator's `defaultNavigationOptions` prop or an individual screen's `navigationOptions`. Search bars are rarely static so normally it is controlled by passing an object to `searchBar` navigation option in the component's body.
|
|
366
366
|
|
|
367
|
+
Search bar is only supported on iOS.
|
|
368
|
+
|
|
367
369
|
Example:
|
|
368
370
|
|
|
369
371
|
```js
|
|
@@ -388,11 +390,7 @@ Possible values:
|
|
|
388
390
|
- `sentences`
|
|
389
391
|
- `characters`
|
|
390
392
|
|
|
391
|
-
Defaults to `sentences
|
|
392
|
-
|
|
393
|
-
#### `autoFocus` (Android only)
|
|
394
|
-
|
|
395
|
-
When set to `true` focuses search bar automatically when screen is appearing. Default value is `false`.
|
|
393
|
+
Defaults to `sentences`.
|
|
396
394
|
|
|
397
395
|
#### `barTintColor`
|
|
398
396
|
|
|
@@ -400,37 +398,23 @@ The search field background color.
|
|
|
400
398
|
|
|
401
399
|
By default bar tint color is translucent.
|
|
402
400
|
|
|
403
|
-
#### `cancelButtonText`
|
|
401
|
+
#### `cancelButtonText`
|
|
404
402
|
|
|
405
403
|
The text to be used instead of default `Cancel` button text.
|
|
406
404
|
|
|
407
|
-
#### `
|
|
408
|
-
|
|
409
|
-
Default behavior is to prevent screen from going back when search bar is open (`disableBackButtonOverride: false`). If you don't want this to happen set `disableBackButtonOverride` to `true`
|
|
410
|
-
|
|
411
|
-
#### `hideNavigationBar` (iOS only)
|
|
405
|
+
#### `hideNavigationBar`
|
|
412
406
|
|
|
413
407
|
Boolean indicating whether to hide the navigation bar during searching.
|
|
414
408
|
|
|
415
409
|
Defaults to `true`.
|
|
416
410
|
|
|
417
|
-
#### `hideWhenScrolling`
|
|
411
|
+
#### `hideWhenScrolling`
|
|
418
412
|
|
|
419
413
|
Boolean indicating whether to hide the search bar when scrolling.
|
|
420
414
|
|
|
421
415
|
Defaults to `true`.
|
|
422
416
|
|
|
423
|
-
####
|
|
424
|
-
|
|
425
|
-
This prop is used to change type of the input and keyboard. Default value is `'text'`.
|
|
426
|
-
|
|
427
|
-
All values:
|
|
428
|
-
- `'text'` - normal text input
|
|
429
|
-
- `'number'` - number input
|
|
430
|
-
- `'email'` - email input
|
|
431
|
-
- `'phone'` - phone input
|
|
432
|
-
|
|
433
|
-
#### `obscureBackground` (iOS only)
|
|
417
|
+
#### `obscureBackground`
|
|
434
418
|
|
|
435
419
|
Boolean indicating whether to obscure the underlying content with semi-transparent overlay.
|
|
436
420
|
|
|
@@ -440,7 +424,7 @@ Defaults to `true`.
|
|
|
440
424
|
|
|
441
425
|
A callback that gets called when search bar has lost focus.
|
|
442
426
|
|
|
443
|
-
#### `onCancelButtonPress`
|
|
427
|
+
#### `onCancelButtonPress`
|
|
444
428
|
|
|
445
429
|
A callback that gets called when the cancel button is pressed.
|
|
446
430
|
|
|
@@ -462,18 +446,10 @@ static navigationOptions = ({navigation}) => {
|
|
|
462
446
|
};
|
|
463
447
|
```
|
|
464
448
|
|
|
465
|
-
#### `onClose` (Android only)
|
|
466
|
-
|
|
467
|
-
A callback that gets called when search bar is closing
|
|
468
|
-
|
|
469
449
|
#### `onFocus`
|
|
470
450
|
|
|
471
451
|
A callback that gets called when search bar has received focus.
|
|
472
452
|
|
|
473
|
-
#### `onOpen` (Android only)
|
|
474
|
-
|
|
475
|
-
A callback that gets called when search bar is expanding
|
|
476
|
-
|
|
477
453
|
#### `onSearchButtonPress`
|
|
478
454
|
|
|
479
455
|
A callback that gets called when the search button is pressed. It receives the current text value of the search bar.
|