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