我们正在使用 Apollo Client 构建一个离线的第一个 React Native 应用程序。目前我正在尝试在离线时直接更新 Apollo Cache 以乐观地更新 UI。由于我们离线,我们不会尝试在连接为“在线”之前触发突变,但希望 UI 在仍处于离线状态时触发突变之前反映这些更改。我们正在使用来自http://dev.apollodata.com/core/read-and-write.html#writequery-and-writefragment的 readQuery / writeQuery API 函数。并且能够通过 Reacotron 查看正在更新的缓存,但是,UI 不会更新此缓存更新的结果。
const newItemQuantity = existingItemQty + 1;
const data = this.props.client.readQuery({ query: getCart, variables: { referenceNumber: this.props.activeCartId } });
data.cart.items[itemIndex].quantity = newItemQuantity;
this.props.client.writeQuery({ query: getCart, data });
Run Code Online (Sandbox Code Playgroud) 我希望能够在用户单击按钮时使用本机Windows Reader应用程序打开PDF.到目前为止,我能够使用以下代码成功打开以(.PNG)扩展名结尾的文件.但是,当我让链接打开(.PDF)文件时,我收到以下错误.
The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
Run Code Online (Sandbox Code Playgroud)
文件目的地是正确的.
这是我的代码:
private async void btnLoad_Click(object sender, RoutedEventArgs e)
{
// Path to the file in the app package to launch
string imageFile = @"Data\Healthcare-Flyer.pdf";
var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(imageFile);
if (file != null)
{
// Set the option to show the picker
var options = new Windows.System.LauncherOptions();
options.DisplayApplicationPicker = true;
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(file, options);
if (success)
{
// File …
Run Code Online (Sandbox Code Playgroud) apollo ×1
c# ×1
javascript ×1
pdf ×1
react-apollo ×1
react-native ×1
reactjs ×1
windows-8 ×1
winrt-xaml ×1