小编Aka*_*kar的帖子

apollo 客户端在本机反应初始重新加载中返回未定义

我正在尝试从缓存中获取一些数据。在初始重新加载时,数据道具返回未定义,但如果我快速重新加载应用程序(反应本机快速重新加载)数据道具具有我想要的值。我不明白为什么它在初始重新加载中返回未定义。一种情况可能是我在初始化缓存之前调用查询。我已经控制台了本地缓存,它显示了值,但查询正在重新调整未定义。

我在 client.js 中的客户端设置

const dev = {
  base_url: BASE_URL
};

const httpLink = createHttpLink({
  uri: dev.base_url
});

const errorLink = onError(({ graphQLErrors, networkError, response }) => {
  if (graphQLErrors) {
    // do something with graphql error
    console.log(graphQLErrors);
  }
  if (networkError) {
    // do something with network error
    console.log(networkError);
    // console.log('network not available');
  }
  if (response) {
    console.log(response);
  }
});
const cache = new InMemoryCache();

const setupPersistedCache = async () => {
  const persistor = new CachePersistor({
    cache,
    storage: AsyncStorage …
Run Code Online (Sandbox Code Playgroud)

javascript graphql react-native react-apollo apollo-client

4
推荐指数
1
解决办法
2991
查看次数

https://github.com/electron/electron/releases/download/v9.4.4/electron-v9.4.4-darwin-arm64.zip 的响应代码 404(未找到)

我正在尝试在 M1 macbook pro 中安装用于反应本机项目的节点模块。在尝试运行时npm install或yarn install我遇到此错误。

error /Users/akash/Documents/Projects/business-hub/node_modules/electron: Command failed.
Exit code: 1
Command: node install.js
Arguments:
Directory: /Users/akash/Documents/Projects/business-hub/node_modules/electron
Output:
HTTPError: Response code 404 (Not Found) for https://github.com/electron/electron/releases/download/v9.4.4/electron-v9.4.4-darwin-arm64.zip
    at EventEmitter.<anonymous> (/Users/akash/Documents/Projects/business-hub/node_modules/got/source/as-stream.js:35:24)
    at EventEmitter.emit (node:events:369:20)
    at module.exports (/Users/akash/Documents/Projects/business-hub/node_modules/got/source/get-response.js:22:10)
    at ClientRequest.handleResponse (/Users/akash/Documents/Projects/business-hub/node_modules/got/source/request-as-event-emitter.js:155:5)
    at Object.onceWrapper (node:events:476:26)
    at ClientRequest.emit (node:events:381:22)
    at ClientRequest.origin.emit (/Users/akash/Documents/Projects/business-hub/node_modules/@szmarczak/http-timer/source/index.js:37:11)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:636:27)
Run Code Online (Sandbox Code Playgroud)

我无法找到我的哪些软件包正在使用电子,因为我无法升级电子版本。

react-native electron apple-m1

4
推荐指数
1
解决办法
1269
查看次数

在 React Native 中按下 TextInput 时,防止系统键盘显示

我想在按下输入字段时显示我的自定义键盘组件。我想完全防止系统默认键盘被触发。

我曾尝试关闭 onFocus 上的键盘,但这会触发键盘,然后关闭键盘。

 <TextInput
     placeholder="type here"
     onFocus={Keyboard.dismiss}
 />
Run Code Online (Sandbox Code Playgroud)

我已经厌倦了将 TextInput 包裹在 TouchableWithoutFeedback 中,但此解决方案不起作用。

<TouchableWithoutFeedback
    onPress={() => Keyboard.dismiss()}
    accessible={false}
>
    <View>
        <TextInput placeholder="type here" />
    </View>
</TouchableWithoutFeedback>
Run Code Online (Sandbox Code Playgroud)

任何想法我怎样才能达到预期的结果?

keyboard textinput react-native

3
推荐指数
2
解决办法
1135
查看次数