Merge pull request #164 from lbryio/navigation-tweaks
set the unique navigation keys for the file pages to the URIs.
This commit is contained in:
commit
51d86148e8
5 changed files with 10 additions and 8 deletions
|
@ -193,7 +193,7 @@ class AppWithNavigationState extends React.Component {
|
|||
if (evt.url) {
|
||||
const navigateAction = NavigationActions.navigate({
|
||||
routeName: 'File',
|
||||
key: 'filePage',
|
||||
key: evt.url,
|
||||
params: { uri: evt.url }
|
||||
});
|
||||
dispatch(navigateAction);
|
||||
|
|
|
@ -61,7 +61,7 @@ class FileItem extends React.PureComponent {
|
|||
if (NativeModules.Mixpanel) {
|
||||
NativeModules.Mixpanel.track('Discover Tap', { Uri: uri });
|
||||
}
|
||||
navigation.navigate({ routeName: 'File', key: 'filePage', params: { uri } });
|
||||
navigation.navigate({ routeName: 'File', key: uri, params: { uri } });
|
||||
}
|
||||
}>
|
||||
<FileItemMedia title={title} thumbnail={thumbnail} blurRadius={obscureNsfw ? 15 : 0} resizeMode="cover" />
|
||||
|
|
|
@ -25,7 +25,7 @@ class TransactionListItem extends React.PureComponent {
|
|||
style={transactionListStyle.link}
|
||||
onPress={() => navigation && navigation.navigate({
|
||||
routeName: 'File',
|
||||
key: 'filePage',
|
||||
key: evt.Url,
|
||||
params: { uri: buildURI({ claimName: name, claimId }) }})
|
||||
}
|
||||
text={name} />
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// @flow
|
||||
import React from 'react';
|
||||
import { SEARCH_TYPES, isNameValid, normalizeURI } from 'lbry-redux';
|
||||
import { SEARCH_TYPES, isNameValid, isURIValid, normalizeURI } from 'lbry-redux';
|
||||
import { FlatList, Keyboard, TextInput, View } from 'react-native';
|
||||
import UriBarItem from './internal/uri-bar-item';
|
||||
import uriBarStyle from '../../styles/uriBar';
|
||||
|
@ -52,7 +52,8 @@ class UriBar extends React.PureComponent {
|
|||
if (SEARCH_TYPES.SEARCH === type) {
|
||||
navigation.navigate({ routeName: 'Search', key: 'searchPage', params: { searchQuery: value }});
|
||||
} else {
|
||||
navigation.navigate({ routeName: 'File', key: 'filePage', params: { uri: normalizeURI(value) }});
|
||||
const uri = normalizeURI(value);
|
||||
navigation.navigate({ routeName: 'File', key: uri, params: { uri }});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,8 +105,9 @@ class UriBar extends React.PureComponent {
|
|||
onSubmitEditing={() => {
|
||||
if (this.state.inputText) {
|
||||
let inputText = this.state.inputText;
|
||||
if (isNameValid(inputText)) {
|
||||
navigation.navigate({ routeName: 'File', key: 'filePage', params: { uri: normalizeURI(inputText) }});
|
||||
if (isNameValid(inputText) || isURIValid(inputText)) {
|
||||
const uri = normalizeURI(inputText);
|
||||
navigation.navigate({ routeName: 'File', key: uri, params: { uri }});
|
||||
} else {
|
||||
// Open the search page with the query populated
|
||||
navigation.navigate({ routeName: 'Search', key: 'searchPage', params: { searchQuery: inputText }});
|
||||
|
|
|
@ -54,7 +54,7 @@ class SplashScreen extends React.PureComponent {
|
|||
navigation.dispatch(resetAction);
|
||||
|
||||
if (this.state.launchUrl) {
|
||||
navigation.navigate({ routeName: 'File', key: 'filePage', params: { uri: this.state.launchUrl } });
|
||||
navigation.navigate({ routeName: 'File', key: this.state.launchUrl, params: { uri: this.state.launchUrl } });
|
||||
}
|
||||
});
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue