标签: react-native-ios

IOS模拟器:JavaScriptCoreWTF :: CrashOnOverflow :: crash:

在iPhone SE模拟器中按CMD + R进行测试时会在xCode中使用此错误冻结应用程序: 在此输入图像描述

React Native版本:0.34,平台:iOS.

将xCode升级到8.0版后启动

safari ios ios-simulator react-native react-native-ios

8
推荐指数
1
解决办法
427
查看次数

在本机中如何重用函数?

我需要从本地反应的另一个页面访问函数.

示例:

validateEmail = (email) => {
// ---- Code ----
}
Run Code Online (Sandbox Code Playgroud)

我需要在login.js和registration.js中访问该函数

react-native react-native-android react-native-ios

8
推荐指数
1
解决办法
7023
查看次数

React Native - NativeBase组件在iOS上不占用全宽

在使用NativeBase构建的iOS版本的本机应用程序中,除非给出特定的宽度,否则一切都太瘦了.见下图.我给页眉和页脚的宽度为100%,所以它很好,但我没有为输入做到这一点,他们太瘦了.当没有宽度时,页眉和页脚是瘦的.

在此输入图像描述

码:

import React from 'react'
import {
  Container,
  Header,
  Form,
  Item,
  Input,
  Label,
  Content,
  Footer,
  FooterTab,
  Button,
  Left,
  Right,
  Body
} from 'native-base'

import { Text, Image } from 'react-native'

export const Volcalc = () => {
  return (
    <Container style={styles.container}>
      <Header style={styles.header}>
        <Left>
          <Image resizeMode={Image.resizeMode.contain} style={styles.thumbnail} source={require('./img/logo_red_nowords.png')} />

        </Left>
        <Body>
        </Body>
        <Right />
      </Header>

      <Content>

        <Form>
          <Item stackedLabel bordered >
            <Label>height</Label>
            <Input />
          </Item>
          <Item stackedLabel >
            <Label>width</Label>
            <Input />
          </Item>
        </Form>

      </Content>

      <Footer >
        <FooterTab style={styles.footer}>
          <Button …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-android native-base react-native-ios

8
推荐指数
2
解决办法
7654
查看次数

反应原生ios构建需要很长时间

反应我在Xcode中构建的本机项目,始终坚持"运行2个4自定义shell脚本"并花费将近5分钟继续.之后,反应包装器中的捆绑过程也需要很长时间.

例如:捆绑index.ios.js [开发,非缩小,hmr禁用]▓▓░░░░░░░░░░░░░░18.3%(412/962),差不多一秒钟只增加一个.但上次我在Windows中构建反应原生Android版本并且捆绑过程非常快.

我已经搜索了一些像这样的解决方案尝试的结果是一样的,有人说是看守问题所以我用brew重新安装守望者,结果也一样,性能没有增加.

RN版本:

react-native-cli:2.0.1

反应原生:0.48.4

xcode ios watchman react-native react-native-ios

8
推荐指数
0
解决办法
1600
查看次数

在React Native视图上强制onLayout

我有一个View包含Text字段的React Native ,我正在使用onLayout prop进行一些依赖于它提供的数据的位置计算.

<View onLayout={this.calculateDimensions}>
  <Text>{this.props.content}</Text>
</View>
Run Code Online (Sandbox Code Playgroud)

这很好用,但有一种情况是content道具更新为具有相同字符大小的不同字符串.这导致布局不会改变而onLayout不会触发.

每次content支柱更新时都必须进行这些位置计算.

注意:我知道有很多方法可以使组件更新.更新是不一样的,布局,遗憾的是不会触发onLayout.

javascript ios reactjs react-native react-native-ios

8
推荐指数
1
解决办法
624
查看次数

React Native"interactive"keyboardDismissMode在拖动时抛出错误

错误是: RCTLayoutAnimationGroup expects timings to be in ms, not seconds

当我快速向下拖动键盘时会发生这种情况.有时候这种情况会发生; 有时它没有.

我在KeyboardAvoidingView中使用一个简单的TextInput组件

react-native react-native-ios react-native-flatlist

8
推荐指数
1
解决办法
531
查看次数

Flatlist 不在绝对视图内滚动?

平面列表不在绝对视图内滚动这是我的代码,但如果我删除绝对它工作正常

<View style={{ flex: 1, marginTop: 8 }}>
        <Input ref={input => {
          this.input = input;
        }}
          onFocus={() => {
            this.setState({ showPicker: true })
          }}
          onEndEditing={() => {
            this.setState({ showPicker: false })
          }}>
        </Input>
        <View style={{ position: "relative", zIndex: 9999, margin: 8 }}>
          {
            this.state.showPicker ?
              <View style={{position:"absolute",width:"100%", backgroundColor: "white" }}>

                  <FlatList

                    data={["A", "B", "C", "D", "E", "F", "G", "H", "A", "B", "C", "D", "E", "F", "G", "H"]}
                    showsVerticalScrollIndicator={false}
                    renderItem={({ item }) =>
                    <TouchableWithoutFeedback>
                      <View>
                        <View style={{ width: "100%", height: 50 …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-ios react-native-flatlist

8
推荐指数
1
解决办法
4658
查看次数

React Native Expo 音频播放器错误 - 播放器不存在

我在我的应用程序中使用 React Native expo 音频,我使用 createAsync 在播放器中加载音频,但有时我会收到 Player 不存在错误,有时它工作正常。我无法调试该错误。\n我还尝试过 expo loadAsync 创建和加载音频,它也会产生相同的错误。\n这是我的代码...

\n\n
    componentWillMount(){\n        const audioFileLocation = audioFile;\n        const source = audioFileLocation;\n        const { sound } = await Audio.Sound.createAsync(\n            source,\n            {\n                progressUpdateIntervalMillis: 1000,\n                shouldPlay: false,\n                isLooping: false,\n            },\n            onPlaybackStatusUpdate,\n        );\n        return sound;\xc3\x8f\n    }\n\nexport const playAndPauseSound = async (playbackStatus, playbackInstance) => {\n    if (playbackStatus.isPlaying) {\n        await playbackInstance.pauseAsync();\n    } else {\n        if (playbackStatus.positionMillis === playbackStatus.durationMillis) {\n            return playbackInstance.replayAsync();\n        } else {\n            return playbackInstance.playAsync();\n        }\n    }\n}\n
Run Code Online (Sandbox Code Playgroud)\n

javascript android reactjs react-native react-native-ios

8
推荐指数
1
解决办法
2023
查看次数

应用程序关闭时无法更新徽章计数 - 反应本机 iOS

我们正在使用React Native Firebase 版本 6消息传递来处理推送通知。从远程通知内容来看,我们无法在 ios 上增加/减少徽章计数。所以我们使用推送通知 ios来设置徽章计数。

当应用程序位于前台和后台时,它运行得很好。但是当应用程序关闭时,我们能够收到通知,但无法更新徽章计数。

messaging().onMessage(async remoteMessage => {
      Alert.alert('A new FCM message arrived!', JSON.stringify(remoteMessage));
});

messaging().setBackgroundMessageHandler(async remoteMessage => {
      PushNotificationIOS.getApplicationIconBadgeNumber(number => {
        PushNotificationIOS.setApplicationIconBadgeNumber(number + 1);
      });
      asyncstorage.saveItem("remoteMessage", "only one killed message received");
    });
Run Code Online (Sandbox Code Playgroud)

当应用程序处于后台状态时,这里setBackgroundMessageHandler正在工作。根据文档,即使应用程序关闭,此方法也应该调用。但事实并非如此。为了获得更多说明,当应用程序终止时,我在该方法中执行了异步存储操作。但它没有按预期工作。

我还添加了服务器端数据,这些数据是我从后端发送的通知,

{
"to":".................",
"notification":{
 "title":"Working Good",
 "body":"backgroudn noti",
 "badge":"1",
 "sound":"./app/assets/sound/alert.wav"
},
"priority":"high",
"badge":"1",
"content_available":true
}
Run Code Online (Sandbox Code Playgroud)

我想提一下这些键的一些要点,

通知对象内有一个徽章,每次关闭应用程序时都会将其设置为图标。但无法增加/减少徽章计数。它始终是 1。

添加“content_available”属性后,我能够更新徽章计数。这意味着仅添加 content_available 后,我在setBackgroundMessageHandler方法中获得了触发器,并使用推送通知 ios 属性更新了徽章计数。

现在,当应用程序关闭时,我在setBackgroundMessageHandler方法中没有收到任何触发器。

即使应用程序已关闭,我是否需要添加任何其他键才能在setBackgroundMessageHandler方法内获取触发器? …

push-notification badge react-native react-native-ios react-native-firebase

8
推荐指数
1
解决办法
3881
查看次数

React Native 构建失败 - xcodebuild:错误:名为“foo”的工作区不包含名为“foo”的方案

我有一个反应本机应用程序,当从 XCode 运行时,它按预期工作(在模拟器上构建和运行)。但是当我尝试从我的终端运行它时

\n
npx react-native run-ios\n
Run Code Online (Sandbox Code Playgroud)\n

我收到错误:

\n
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening foo.xcworkspace.\nCommand line invocation:\n    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace foo.xcworkspace -configuration Debug -scheme foo -destination id=FEB37\n\nUser defaults from command line:\n    IDEPackageSupportUseBuiltinSCM = YES\n\nxcodebuild: error: The workspace named "foo" does not contain a scheme named "foo". The "-list" option can be used to find the …
Run Code Online (Sandbox Code Playgroud)

xcode react-native-ios lottie

8
推荐指数
1
解决办法
1万
查看次数